[PATCH] D22918: [Loop Vectorizer] Support predication of div/rem

Gil Rapaport via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 03:56:56 PDT 2016


gilr added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3331
@@ -3321,1 +3330,3 @@
+      if (Predicate)
+        Cost += TTI.getCFInstrCost(Instruction::PHI);
       Cost += TTI.getVectorInstrCost(Instruction::InsertElement, Ty, I);
----------------
I actually wasn't trying to model any specific cost in the generated code, just trying to be consistent about accounting for every generated instruction at IR level (and letting TTI decide their cost).
So if PHIs have zero cost by definition/convention and should not be taken into account in cost models then I should just remove this. Otherwise, placing the call now makes sure we don't miss that cost if targets start modelling it. What say you?

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3860-3861
@@ +3859,4 @@
+
+    I->getParent()->setName(Twine("pred.") + Twine(I->getOpcodeName()) +
+                            Twine(".if"));
+    BB->setName(Twine("pred.") + Twine(I->getOpcodeName()) +
----------------
anemet wrote:
> I think that Twine knows how to concatenate string-like things.  You only need the explicit ctor on the first one.
Right, will fix.


https://reviews.llvm.org/D22918





More information about the llvm-commits mailing list