[PATCH] D34566: [loop idiom Recognition] support memcpy for multiple consecutive loads and stores

Haicheng Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 5 18:56:11 PDT 2017


haicheng added a comment.

Please check the inlined comment.

Is it possible to reuse the code of processLoopStridedStore()?

Haicheng



================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:527
 
   // Optimize the store into a memcpy, if it feeds an similarly strided load.
   for (auto &SI : StoreRefsForMemcpy)
----------------
I think this comment should be changed.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:900
 
-/// If the stored value is a strided load in the same loop with the same stride
-/// this may be transformable into a memcpy.  This kicks in for stuff like
+/// If there are one or multiple stored values , which are strided loads
+/// in the same loop with the same stride , then this amy be transformed into
----------------
I think we need to emphasize that loads and stores are consecutive.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:930
+
+    LoadInst *FirstStoreLoad = dyn_cast<LoadInst>(SL[i]->getValueOperand());
+    assert(FirstStoreLoad->isUnordered() && 
----------------
What if FirstStoreLoad is nullptr?


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:968
+
+      LoadInst *SecondStoreLoad = dyn_cast<LoadInst>(SL[k]->getValueOperand());
+      assert(SecondStoreLoad->isUnordered() && 
----------------
Same thing here.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1070
+  const SCEV *StrStart = Ev->getStart();
+  unsigned StrAS =  DestPtr->getType()->getPointerAddressSpace();
   Type *IntPtrTy = Builder.getIntPtrTy(*DL, StrAS);
----------------
Please check the format.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1077
 
+  // TODO: ideally we should still be able to generate memset if SCEV expander
+  // is taught to generate the dependencies at the latest point.
----------------
memset?


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1105
 
+  // TODO: ideally we should still be able to generate memset if SCEV expander
+  // is taught to generate the dependencies at the latest point.
----------------
memset?


https://reviews.llvm.org/D34566





More information about the llvm-commits mailing list