[PATCH] D146622: [AggressiveInstCombine] folding load for constant global patterened arrays and structs by GEP indices

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 08:07:00 PDT 2023


khei4 added inline comments.


================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:834-835
+    MapVector<Value *, APInt> VarOffsets;
+    if (!GEP->collectOffset(DL, BW, VarOffsets, ModOffset))
+      return false;
+
----------------
nikic wrote:
> khei4 wrote:
> > I noticed this failure become uncapturable. I'm not sure the cases GEPOperator::collectOffset return false, but as we confirm, we can decide by Stride 1 whatever:) 
> I think you can replace it with `break;` so it falls through to the `!isa<GlobalVariable>(PtrOp)` handling. collectOffset() only fails for scalable vectors, so it's a very rare case...
I noticed it now! it sounds shorter than I did!


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

https://reviews.llvm.org/D146622



More information about the llvm-commits mailing list