[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 Aug 9 15:40:07 PDT 2017


haicheng added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:737
+    } else {
+        if (processLoopStoreOfLoopLoad(StorePtr, StoreSize, HeadStore,
+                                     StoreLoadInst, AdjacentStores, StoreEv,
----------------
DIVYA wrote:
> haicheng wrote:
> > I think processLoopStoreOfLoopLoad() can refactor with processLoopStridedStore(), then you don't need if...else... here.
> processLoopStoreOfLoopLoad() function was already present,so I haven't refactored it with  processLoopStridedStore()  in this patch.I can do that in the next patch
I think you can go ahead.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:646
+
+      } else {
+        SecondStoreLoad = cast<LoadInst>(SL[k]->getValueOperand());
----------------
Please add a comment to make it clear it is for memcpy.  

or add if (memcpy) 

or write this part as a switch.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:669-674
+          else if(MemIdiom == LegalStoreKind::Memcpy)
+          {
+            if (!isConsecutiveAccess(FirstStoreLoad, SecondStoreLoad, *DL,
+                                     *SE, false))
+              continue;
+          }
----------------
clang-format here


https://reviews.llvm.org/D34566





More information about the llvm-commits mailing list