[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 10:05:43 PDT 2017


haicheng added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:134
   bool processLoopStores(SmallVectorImpl<StoreInst *> &SL, const SCEV *BECount,
-                         bool ForMemset);
+                         bool ForMemset,bool ForMemcpy);
   bool processLoopMemSet(MemSetInst *MSI, const SCEV *BECount);
----------------
I think you can pass in an enum which has value ForMemset, ForMemsetPattern, ForMemcpy like LegalStoreKind above or just use LegalStoreKind if possible.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:651-675
+      } else {
+        LoadInst *SecondStoreLoad = cast<LoadInst>(SL[k]->getValueOperand());
+        assert(SecondStoreLoad->isUnordered() &&
+               "Expected only non-volatile non-ordered loads.");
+        Value *SecondLoadPtr =
+            GetUnderlyingObject(SecondStoreLoad->getPointerOperand(), *DL);
+
----------------
I think code here can refactor with code above


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:737
+    } else {
+        if (processLoopStoreOfLoopLoad(StorePtr, StoreSize, HeadStore,
+                                     StoreLoadInst, AdjacentStores, StoreEv,
----------------
I think processLoopStoreOfLoopLoad() can refactor with processLoopStridedStore(), then you don't need if...else... here.


https://reviews.llvm.org/D34566





More information about the llvm-commits mailing list