[PATCH] D144445: [AggressiveInstCombine] folding load for constant global patterened arrays and structs by alignment

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 09:12:17 PDT 2023


khei4 added inline comments.


================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:855-880
+  std::optional<APInt> Stride;
+  APInt ConstOffset = APInt(BW, 0);
+  if (isa<GlobalVariable>(PtrOp)) {
+    Stride = APInt(BW, 1);
+  }
+
+  // Any possible offset could be multiple of GEP stride. And any valid
----------------
nikic wrote:
> Some simplifications.
> 
> I think as far as foldPatternedLoads is concerned, we don't need the std::optional around Stride, because a Stride of 1 is always conservatively correct. It's only relevant internally while calculating GEP stride in the next patch.
Thanks! Yeah, simplicity for this patch matters!


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

https://reviews.llvm.org/D144445



More information about the llvm-commits mailing list