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

Justin Lebar via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 27 16:05:17 PDT 2016


jlebar added inline comments.

================
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);
----------------
asbirlea wrote:
> When is this not a store instruction? Does it affect in any way the decision to vectorize (it's kinda late in the flow..)?
Looking at the Builder code I don't think it can do that today, for a load or a store.

Normally I'd say I don't want to rely on the existing behavior -- having a load of a constant return a constant doesn't seem unreasonable -- but I'm sure that any attempt to change the behavior of Builder would break tons of other people too.  So, we might as well depend on it too.

Changed.


https://reviews.llvm.org/D22887





More information about the llvm-commits mailing list