[PATCH] D133567: [AA] Improve the BasicAA analysis capability

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 12 01:34:09 PDT 2022


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/BasicAliasAnalysis.cpp:597
       const Value *Index = *I;
+      TypeSize AllocaTypeSize = DL.getTypeAllocSize(GTI.getIndexedType());
       // Compute the (potentially symbolic) offset in bytes for this index.
----------------
Please move this below the StructType check, this call is expensive.


================
Comment at: llvm/lib/Analysis/BasicAliasAnalysis.cpp:626
 
+      if (isa<ScalableVectorType>(GEPOp->getSourceElementType())) {
+        Decomposed.Base = V;
----------------
Allen wrote:
> nikic wrote:
> > Here again we should be checking the alloc size, not the source element type. It should be possible to support something like `getelementptr <vscale x 4 x i32>, ptr %p, i64 0, i64 %i`, where the variable is on a non-scalable index.
> Yes, good catch, thanks very much
Can you please also add a test for this case? Something like using `%i` and `%j = add %i, 1` as indices. should probably work.


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

https://reviews.llvm.org/D133567



More information about the llvm-commits mailing list