[PATCH] D22887: [LSV] Use Instruction*s rather than Value*s where possible.

Alina Sbirlea via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 15:33:57 PDT 2016


asbirlea added a comment.

I had mixed feeling about some of the changes, but considering the overall removal of casts, this looks worth doing.


================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:846
@@ -840,4 +845,3 @@
       Builder.CreateBitCast(S0->getPointerOperand(), VecTy->getPointerTo(AS));
-  StoreInst *SI = cast<StoreInst>(Builder.CreateStore(Vec, Bitcast));
-  propagateMetadata(SI, Chain);
-  SI->setAlignment(Alignment);
+  if (StoreInst *SI = dyn_cast<StoreInst>(Builder.CreateStore(Vec, Bitcast))) {
+    propagateMetadata(SI, Chain);
----------------
When is this not a store instruction? Does it affect in any way the decision to vectorize (it's kinda late in the flow..)?

================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:973
@@ +972,3 @@
+  Value *Load = Builder.CreateLoad(Bitcast);
+  if (LoadInst *LI = dyn_cast<LoadInst>(Load)) {
+    propagateMetadata(LI, Chain);
----------------
Same as for stores. When is this not a load and what does that mean? (consequences when used below? I honestly have no idea...)
Perhaps add a comment explaining this?


https://reviews.llvm.org/D22887





More information about the llvm-commits mailing list