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

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 09:28:52 PDT 2016


mkuper 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);
----------------
gilr wrote:
> 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?
We're not even consistent about it in our different cost models - CostModelAnalysis::getInstructionCost() calls getCFInstrCost(), while (the admittedly, old) BBVectorizer cost model just reutrns 0.
But I get what you're saying. If you prefer to leave it, leave it, but I think it'd be nice to document the fact you don't currently expect a real cost here.


https://reviews.llvm.org/D22918





More information about the llvm-commits mailing list