[PATCH] D20639: SLPVectorizer: Move propagateMetadata to VectorUtils

Michael Zolotukhin via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 17:18:56 PDT 2016


mzolotukhin added a comment.

Hi,

Thanks for doing this! Please find some comments inline.

Michael


================
Comment at: lib/Analysis/VectorUtils.cpp:452
@@ +451,3 @@
+/// \returns \p I after propagating metadata from \p VL.
+Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
+  Instruction *I0 = cast<Instruction>(VL[0]);
----------------
Maybe make `VL` `ArrayRef<Instruction *>` - we always cast its elements to `Instruction` anyway.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:475
@@ -474,3 +474,3 @@
   /// loop.
-  void addMetadata(Instruction *To, const Instruction *From);
+  void addMetadata(Instruction *To, Instruction *From);
 
----------------
Why drop `const`?

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:479
@@ -478,3 +478,3 @@
   /// vector of instructions.
-  void addMetadata(SmallVectorImpl<Value *> &To, const Instruction *From);
+  void addMetadata(ArrayRef<Value *> To, Instruction *From);
 
----------------
Ditto.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:676
@@ -698,2 +675,3 @@
+                                      Instruction *From) {
   propagateMetadata(To, From);
   addNewMetadata(To, From);
----------------
Hmm.. `propagateMetadata` expects `ArrayRef<Value *> VL` now instead of `Instruction *From`, doesn't it? Am I missing something?


http://reviews.llvm.org/D20639





More information about the llvm-commits mailing list