[PATCH] D38961: [PowerPC] Increase the user cost of vector instructions by their legalization cost

Brad Nemanich via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 08:55:54 PDT 2017


bnemanich added inline comments.


================
Comment at: lib/Target/PowerPC/PPCTargetTransformInfo.cpp:194-197
+  if (U->getType()->isVectorTy()) {
+    // Instructions that need to be split should cost more.
+    std::pair<int, MVT> LT = TLI->getTypeLegalizationCost(DL, U->getType());
+    return LT.first * BaseT::getUserCost(U, Operands);
----------------
echristo wrote:
> I have concerns about this being Power only. And to what costs we're applying this to, etc.
> 
> Thoughts?
It could be done for all platforms, but I was worried that it would hurt some tuning that I wasn't able to test. This should only affect cases where there are vector instructions in the IR that are larger than the machine can handle. In those cases, getUserCost will not give a more accurate description of the cost. For example, if there is a 16 wide add of i32s, getUserCost will now return a value of 4 instead of 1, since it will eventually be split into 4 instructions on a machine that only has 128bit wide vector instructions.


https://reviews.llvm.org/D38961





More information about the llvm-commits mailing list