[PATCH] D96287: [TTI] Change getOperandsScalarizationOverhead to take Type args

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 9 14:53:57 PST 2021


sdesmalen added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:647
+    if (!Args.empty()) {
+      SmallVector<Type *> Tys(Args.size(), Ty);
+      Cost += getOperandsScalarizationOverhead(Args, Tys);
----------------
dmgreen wrote:
> sdesmalen wrote:
> > Is this not doing something different than it did before, i.e. it now always uses `InTy` for each of the arguments to get the cost, where it previously used the types from each of the arguments?
> > I expected something similar to what you did in LoopVectorize with `MaybeVectorizeType`.
> Yeah. This version of getScalarizationOverhead is only called from getArithmeticInstrCost (or ARMTTIImpl::getArithmeticInstrCost etc). So the arguments/return value are all likely to all be the same value, and this is making that assumption.  It is probably at least good enough as a heuristic, when compared to the else below. I've added a comment too.
If this code assumes all arguments are of the same type, can you add an `assert` which checks this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96287/new/

https://reviews.llvm.org/D96287



More information about the llvm-commits mailing list