[PATCH] D16197: [LV] Vectorize pre-load recurrences

Geoff Berry via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 14 10:25:33 PST 2016


gberry added a subscriber: gberry.
gberry added a comment.

Matt, I've added a few comments below.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4573
@@ +4572,3 @@
+  for (auto I = Iter(PreLoad), E = PreHeader->end(); I != E; ++I)
+    if (isa<StoreInst>(&*I))
+      return false;
----------------
I don't think checking for store instructions is enough here.  Isn't I->mayWriteToMemory() more appropriate to catch e.g. calls?

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:4579
@@ +4578,3 @@
+  for (auto I = Header->begin(), E = Iter(User); I != E; ++I)
+    if (isa<StoreInst>(&*I))
+      return false;
----------------
Same as above.  Plus, I'm not sure this is a sufficient check.  What if there is a store after the sink point in iteration 'i' that may alias the load from iteration 'i+1'?  Perhaps you can piggy back on the check for vectorizability of the original load in the loop?  That may not be enough either since the load in question might be known to only write the 0th element (i.e. the value loaded by the sunk load).


http://reviews.llvm.org/D16197





More information about the llvm-commits mailing list