Skip to content

Commit 440ce05

Browse files
committed
[FunctionAttrs] Handle potential access of captured argument
We have to account for accesses to argument memory via captures. I don't think there's any way to make this produce incorrect results right now (because as soon as "other" is set, we lose the ability to infer argmemonly), but this avoids incorrect results once we have more precise representation.
1 parent 7ac10e5 commit 440ce05

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/Transforms/IPO/FunctionAttrs.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@ checkFunctionMemoryAccess(Function &F, bool ThisBody, AAResults &AAR,
171171

172172
MRB |= CallMRB.getWithoutLoc(FunctionModRefBehavior::ArgMem);
173173

174+
// If the call accesses captured memory (currently part of "other") and
175+
// an argument is captured (currently not tracked), then it may also
176+
// access argument memory.
177+
ModRefInfo OtherMR = CallMRB.getModRef(FunctionModRefBehavior::Other);
178+
MRB |= FunctionModRefBehavior::argMemOnly(OtherMR);
179+
174180
// Check whether all pointer arguments point to local memory, and
175181
// ignore calls that only access local memory.
176182
ModRefInfo ArgMR = CallMRB.getModRef(FunctionModRefBehavior::ArgMem);

0 commit comments

Comments
 (0)