[PATCH] D110751: [DomTree] Assert that blocks in queries aren't from another function

Daniil Suchkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 1 16:10:13 PDT 2021


DaniilSuchkov added a comment.

In D110751#3037655 <https://reviews.llvm.org/D110751#3037655>, @aeubanks wrote:

> nice find, looks like `Addr` might be a global with type `i8*`, might need a similar fix to the unswitch one like
>
>   --- a/llvm/lib/Transforms/Scalar/LICM.cpp
>   +++ b/llvm/lib/Transforms/Scalar/LICM.cpp
>   @@ -1068,6 +1068,8 @@ static bool isLoadInvariantInLoop(LoadInst *LI, DominatorTree *DT,
>          return false;
>        Addr = BC->getOperand(0);
>      }
>   +  if (isa<Constant>(Addr))
>   +    return false;
>    
>      unsigned UsesVisited = 0;
>      // Traverse all uses of the load operand value, to see if invariant.start is
>
> I managed to repro the stage2 failure and this fix does fix the crash, just need to come up with a reduced test case

I think it's better to just skip the users from other functions within the `for (auto *U : Addr->users()) {` loop. Because on its own, trying to prove that within current loop/function a load of a global value is invariant, seems reasonable. We just shouldn't take into account the users from other functions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110751/new/

https://reviews.llvm.org/D110751



More information about the llvm-commits mailing list