[PATCH] Propagate instruction metadata during SLP vectorization.
hfinkel at anl.gov
hfinkel at anl.gov
Fri Nov 15 14:09:23 PST 2013
================
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;
----------------
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).
================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:1517
@@ -1482,1 +1516,3 @@
+
+ return propagateMetadata(dyn_cast<Instruction>(V), E->Scalars);
}
----------------
Can the cast above fail? Also, don't cast twice (unnecessary overhead; casts are not exactly free).
http://llvm-reviews.chandlerc.com/D2191
More information about the llvm-commits
mailing list