[PATCH] D115615: [MemCpyOpt] Make capture check during call slot optimization more precise
Philip Reames via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 3 07:57:27 PST 2022
reames added a comment.
In D115615#3205364 <https://reviews.llvm.org/D115615#3205364>, @nikic wrote:
> Yeah, that sounds about right. However, I don't think that this would allow us to place a nocapture attribute: After all, the pointer may indeed be captured, it's just that the capture ends up not being used before the object goes out of scope. The capture in the call may be relevant independently of effects it may allow after the call.
I'm not sure this is true. Or at least, we seem inconsistent about how we model this today. I won't push for this now, but I do think we need to clarify the meaning of nocapture on this point.
However, I think I found a counter example to this transform.
Consider the following case:
%dest = &g
%src = alloca
foo(%src)
memcpy src to dest
foo(i8* %a) {
if (%a == &g) throw();
}
That is, if we allow foo to capture it's argument, one of the things it's allowed to do is to check the address of address of that argument against an already captured address (such as a global). In the original program, that comparison will always be false, but if dest is the global, we've changed program behavior.
Do you see something I'm missing which disallows this case?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115615/new/
https://reviews.llvm.org/D115615
More information about the llvm-commits
mailing list