[all-commits] [llvm/llvm-project] ec2e21: [LangRef] No target-specific size limit for atomic...
Michael Kruse via All-commits
all-commits at lists.llvm.org
Mon Jul 14 11:36:31 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ec2e21a14d3685cdfa953ede3627aaa23f26f5ec
https://github.com/llvm/llvm-project/commit/ec2e21a14d3685cdfa953ede3627aaa23f26f5ec
Author: Michael Kruse <llvm-project at meinersbur.de>
Date: 2025-07-14 (Mon, 14 Jul 2025)
Changed paths:
M llvm/docs/LangRef.rst
Log Message:
-----------
[LangRef] No target-specific size limit for atomics (#136864)
According to the current LangRef, atomics of sizes larger than a
target-dependent limit are non-conformant IR. Presumably, that size
limit is `TargetLoweringBase::getMaxAtomicSizeInBitsSupported()`. As a
consequence, one would not even know whether IR is valid without
instantiating the Target backend.
To get around this, Clang's CGAtomic uses a constant "16 bytes" for the
maximally supported atomic. The verifier only checks the power-of-two
requirement.
In a discussion with jyknight, the intention is rather that the
AtomicExpandPass will just lower everything larger than the
target-supported atomic sizes to libcall (such as `__atomic_load`).
According to this interpretation, the size limit needs only be known by
the lowering and does not affect the IR specification.
The original "target-specific size limit" had been added in
59b66883eacbc62a09c09f08bcbfdce7af46cf31. The LangRef change is needed
for #134455 because otherwise frontends need to pass a TargetLowering
object to the helper functions just to know what the target-specific
limit is.
This also changes the LangRef for atomicrmw. Are there libatomic
fallbacks for these? If not, LLVM-IR validity still depends on
instantiating the actual backend. There are also some intrinsics such as
`llvm.memcpy.element.unordered.atomic` that have this constraint but do
not change in this PR.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list