[PATCH] D35292: [SLPVectorizer] Add propagateIRFlagsWithOp() function to propagate IRFlags for specific Operation

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 12 01:54:23 PDT 2017


RKSimon added a reviewer: filcab.
RKSimon added a comment.

A few minor comments



================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:225
+/// only in case of scalar sub-operation from (VL) is equal to (OpValue). Flag set:
+/// NSW, NUW, exact, and all of fast-math.
+static void propagateIRFlagsWithOp(Value *I, ArrayRef<Value *> VL, Value *OpValue) {
----------------
Put the Flag set: on the last line to make it clearer.


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:228
+  if (auto *VecOp = dyn_cast<Instruction>(I)) {
+    auto *Intersection = cast<Instruction>(OpValue);
+    const unsigned Opcode = Intersection->getOpcode();
----------------
Should we assume this (the cast will assert on failure) or check for it?
```
if (auto *Intersection = dyn_cast<Instruction>(OpValue)) {
}
```


================
Comment at: lib/Transforms/Vectorize/SLPVectorizer.cpp:4585
                                                Pair.first, "bin.extra");
-          propagateIRFlags(VectorizedTree, I);
+          propagateIRFlagsWithOp(VectorizedTree, I, I);
         }
----------------
Should the last argument be I[0]?


https://reviews.llvm.org/D35292





More information about the llvm-commits mailing list