[PATCH] D104595: [NFC] [LoopIdiom] Let processLoopStridedStore take StoreSize as SCEV instead of unsigned

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 4 12:25:16 PDT 2021


lebedev.ri added a comment.

This does seem like a NFC refactor.
Thanks.



================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:984
+// let LIR deal with runtime-determined store size.
+static bool mayLoopAccessLocation(Value *Ptr, ModRefInfo Access, Loop *L,
+                                  const SCEV *BECount, unsigned StoreSize,
----------------
I think this should just be inlined into users.


================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1001-1002
   const SCEV *Index = SE->getTruncateOrZeroExtend(BECount, IntPtr);
-  if (StoreSize != 1)
-    Index = SE->getMulExpr(Index, SE->getConstant(IntPtr, StoreSize),
+  const SCEVConstant *ConstSize = dyn_cast<SCEVConstant>(StoreSizeSCEV);
+  if (!ConstSize || (ConstSize->getAPInt() != 1)) {
+    // index = back edge count * store size
----------------



================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1012
 
-/// Compute the number of bytes as a SCEV from the backedge taken count.
-///
-/// This also maps the SCEV into the provided type and tries to handle the
-/// computation in a way that will fold cleanly.
-static const SCEV *getNumBytes(const SCEV *BECount, Type *IntPtr,
-                               unsigned StoreSize, Loop *CurLoop,
-                               const DataLayout *DL, ScalarEvolution *SE) {
-  const SCEV *NumBytesS;
-  // The # stored bytes is (BECount+1)*Size.  Expand the trip count out to
+// Forwards StoreSize as SCEV, aim to replace usage of this prototype to
+// let LIR deal with runtime-determined store size.
----------------
Same, i think this should just be inlined into users.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104595



More information about the llvm-commits mailing list