[llvm] [FunctionAttrs] Switch readonly etc inference to use CaptureTracking (PR #201136)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 06:27:15 PDT 2026


================
@@ -480,7 +480,7 @@ define void @memcpy(ptr %p, ptr %p2) {
 define void @memcpy_volatile(ptr %p, ptr %p2) {
 ; CHECK: Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite, inaccessiblemem: readwrite)
 ; CHECK-LABEL: define void @memcpy_volatile(
-; CHECK-SAME: ptr writeonly [[P:%.*]], ptr readonly [[P2:%.*]]) #[[ATTR2]] {
----------------
antoniofrighetto wrote:

> But I'm also not sure if inferring writeonly/readonly here is actually correct, even if the fix is accidental. Note that we don't infer them for plain volatile ops: https://llvm.godbolt.org/z/sbbvhKbon

Right, I agree there should be consistency across volatile memory ops, though I feel like I haven't fully interiorized why readonly shouldn't hold for a volatile load as well (also, perhaps worth to add a test for volatile load here in initializes.ll too, together with the store).

https://github.com/llvm/llvm-project/pull/201136


More information about the llvm-commits mailing list