[PATCH] D39973: Fix CaptureTracking for llvm.invariant.group.barrier

Yaxun Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 08:36:35 PST 2017


yaxunl added a comment.

In https://reviews.llvm.org/D39973#924419, @Prazek wrote:

> Firstly, are you sure that the invariant.group.barrier is the problem here? I didn't hear that it is used anywhere besides devirtualization, that is not turned on by default.
>  Here is my old path that was never reviewed:
>  https://reviews.llvm.org/D32673
>
> As you can see, in order to check if the pointer passed to the barrier is captured, we need to check if all uses of the pointer returned by the barrier is not captured.




In https://reviews.llvm.org/D39973#924419, @Prazek wrote:

> Firstly, are you sure that the invariant.group.barrier is the problem here? I didn't hear that it is used anywhere besides devirtualization, that is not turned on by default.
>  Here is my old path that was never reviewed:
>  https://reviews.llvm.org/D32673
>
> As you can see, in order to check if the pointer passed to the barrier is captured, we need to check if all uses of the pointer returned by the barrier is not captured.


I am trying to fix a lit test failure related to invariant.group.barrier. There are two issues:

1. as Matt pointed out, invariant.group.barrier should accept pointer to any address space as parameter, since alloca address space may not be 0, e.g. for amdgcn---amdgiz triple, the pointer argument of invariant.group.barrier is in addr space 5.

2. CaptureTracking does not handle invariant.group.barrier correctly, which is what your patch and this patch tries to fix. Since you already have a patch for that, I would drop my fix and focus on the first issue. However as Stas suggested, it may be better to make the fix more generic instead of do special handling for invariant.group.barrier, e.g. is it OK to make it a generic checking for all functions?

if the func does not read mem
if the func does not throw
if the func returns nothing, or the returned pointer is not captured

then pointer argument is not captured


https://reviews.llvm.org/D39973





More information about the llvm-commits mailing list