[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
Thu Jul 6 12:33:25 PDT 2017


haicheng added a comment.

Just a few more comments.  Please use clang format on your code.

Haicheng



================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:984
+
+      // The stride of both loads should be equal
+      if (FirstLoadEv->getOperand(1) != SecondLoadEv->getOperand(1))
----------------
I think you can remove this one or change it to an assert.  

At this point, I think we know the stores have the same strides and loads have the same strides as their users (stores), so the strides of the loads should be the same.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1151
   //  by previous checks.
-  if (!SI->isAtomic() && !LI->isAtomic())
+  if (!TheStore->isAtomic() && !TheLoad->isAtomic())
     NewCall = Builder.CreateMemCpy(StoreBasePtr, LoadBasePtr, NumBytes, Align);
----------------
What if some Loads/Stores are atomic and some are not?


https://reviews.llvm.org/D34566





More information about the llvm-commits mailing list