[PATCH] Propagate instruction metadata during SLP vectorization.

Raul Silvera rsilvera at google.com
Fri Nov 15 14:51:36 PST 2013


  Thanks


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:168
@@ +167,3 @@
+static Instruction *propagateMetadata(Instruction *I, ArrayRef<Value *> VL) {
+  Instruction *I0 = dyn_cast<Instruction>(VL[0]);
+  SmallVector<std::pair<unsigned, MDNode*>, 4> Metadata;
----------------
hfinkel at anl.gov wrote:
> Just make this cast instead of dyn_cast (this way, if there is a problem, we'll get a nice assert here instead of a segfault later).
OK

================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1517
@@ -1482,1 +1516,3 @@
+
+      return propagateMetadata(dyn_cast<Instruction>(V), E->Scalars);
     }
----------------
hfinkel at anl.gov wrote:
> Can the cast above fail? Also, don't cast twice (unnecessary overhead; casts are not exactly free).
Removed the redundant cast.

Yes, this cast can fail; V could be a constant.


http://llvm-reviews.chandlerc.com/D2191



More information about the llvm-commits mailing list