[PATCH] D151644: [InstCombine] Propegating `nocapture` flag to callsites
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 29 12:28:14 PDT 2023
nikic added a comment.
In D151644#4378838 <https://reviews.llvm.org/D151644#4378838>, @goldstein.w.n wrote:
> It should still work then in the case that the function doesn't interact with the global state after
> the call?
> So we could reverse iterate and while the sequence remains `pure`, it should be appliable?
I don't think it's quite as simple as that. Here's another example:
define void @test(ptr nocapture %p) {
%a = alloca ptr
call void @store_into_alloca(ptr %a, ptr %p)
ret void
}
The call-site is not no-capture, even though there are no memory accesses after it.
> My motivation is something like: https://godbolt.org/z/b1Pjf4bjP
>
> where AFAICT there is no way to write a syscall wrapper like that and actually preserve nocapture. Maybe a better approach?
So yeah, the case where we're literally calling another function with the exact same arguments is clearly safe -- it's just not entirely obvious to me what the right way to generalize that would be.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D151644/new/
https://reviews.llvm.org/D151644
More information about the llvm-commits
mailing list