[PATCH] D99424: [BasicAA] Be more careful with modulo ops on VariableGEPIndex.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 8 01:54:26 PDT 2021


fhahn added a comment.





================
Comment at: llvm/test/Analysis/BasicAA/gep-modulo.ll:133
 ; CHECK-NEXT:    PartialAlias: [16 x i8]* %ptr, i8* %gep.3
-; CHECK-NEXT:    NoAlias:  i8* %gep.3, i8* %gep.idx
+; CHECK-NEXT:    MayAlias:  i8* %gep.3, i8* %gep.idx
 ;
----------------
nikic wrote:
> nikic wrote:
> > This is an example of the case I have in mind: This can be NoAlias (https://alive2.llvm.org/ce/z/yYFAAz) even though the mul+sub can wrap. Despite the wrapping, we are still guaranteed that the power-of-2 part of the GCD still holds.
> Eh, maybe I'm wrong here regarding the general case. I'll have to think about it more carefully.
I think it may hold for cases where we compute `% power-of-2`, but not if the operand is not a power-of-2? I'm not too familiar with the code that actually uses the modulo, but if that's the case we may be able to use this? If so, we should be able to do so by adjusting the check to 
`if (!DecompGEP1.VarIndices[i].PreservesModulo && !Scale.isPowerOf2())`



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99424



More information about the llvm-commits mailing list