[PATCH] D95826: [SROA] Propagate correct TBAA/TBAA Struct offsets

William Moses via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 2 09:17:15 PST 2021


wsmoses added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:3388
+      APInt Offset(
+          DL.getIndexSizeInBits(GEPToCompute->getPointerAddressSpace()), 0);
+      if (AATags && GEPToCompute->accumulateConstantOffset(DL, Offset))
----------------
jdoerfert wrote:
> wsmoses wrote:
> > jdoerfert wrote:
> > > No temporary GEPs please. What is wrong with GEP ?
> > The problem is that the GEP instruction itself may be constant folded by the IRBuilder (and thus why it only returns a value and not a gep instruction). 
> Hm, do we need this for anything other than struct types?
When you say struct types do you mean tbaa.struct (used in memcpy), tbaa struct path information, or something else?

We definitely need this in tbaa.struct per the memcpy test case. I think we also want it for regular tbaa (e.g. you have a load which uses regular tbaa info and it should have its tbaa with the correct offset).

Likewise I can imagine optimization passes other than SROA needing to do this sort of offset procedure (hence my inclination to make the API public for the shifting). 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95826



More information about the llvm-commits mailing list