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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 06:46:37 PDT 2023


nikic 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;
+
----------------
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...


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

https://reviews.llvm.org/D146622



More information about the llvm-commits mailing list