llvm-project
ec2e21a1 - [LangRef] No target-specific size limit for atomics (#136864)

Commit
156 days ago
[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.
Author
Parents
Loading