Commit ec2e21a
authored
[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
59b6688. 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.1 parent 7615503 commit ec2e21a
1 file changed
+6
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11281 | 11281 | | |
11282 | 11282 | | |
11283 | 11283 | | |
11284 | | - | |
| 11284 | + | |
11285 | 11285 | | |
11286 | 11286 | | |
11287 | 11287 | | |
| |||
11422 | 11422 | | |
11423 | 11423 | | |
11424 | 11424 | | |
11425 | | - | |
| 11425 | + | |
11426 | 11426 | | |
11427 | 11427 | | |
11428 | 11428 | | |
| |||
11567 | 11567 | | |
11568 | 11568 | | |
11569 | 11569 | | |
11570 | | - | |
11571 | | - | |
| 11570 | + | |
| 11571 | + | |
11572 | 11572 | | |
11573 | 11573 | | |
11574 | 11574 | | |
| |||
11681 | 11681 | | |
11682 | 11682 | | |
11683 | 11683 | | |
11684 | | - | |
11685 | | - | |
| 11684 | + | |
| 11685 | + | |
11686 | 11686 | | |
11687 | 11687 | | |
11688 | 11688 | | |
| |||
0 commit comments