[PATCH] D28458: [CostModel] Improve detection of uniform operands

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 10 08:07:20 PST 2017


RKSimon added inline comments.


================
Comment at: lib/Analysis/CostModel.cpp:163
 
+  // Check for a broadcast shuffle of an argument or globalvalue source.
+  if (auto *Shuf = dyn_cast<ShuffleVectorInst>(V))
----------------
mkuper wrote:
> Is this code actually used anywhere, except for the cost-model printer pass?
> 
> It looks like the only (in-tree) caller of getOperandInfo() is CostModelAnalysis::getInstructionCost(), but actual cost model consumers don't use getInstructionCost(). Rather, they call getArithmeticInstrCost() directly, and provide their own opinion on the operands' uniformity.
> 
> If that's really the case, I'm not entirely sure there's a point in trying to make this more precise.
OK - so do you think we should have a standard helper to determine the ValueKind in all the vectorizers?


================
Comment at: test/Analysis/CostModel/X86/vshift-ashr-cost.ll:189
+; AVX: Found an estimated cost of 8 for instruction:   %shift
+; AVX2: Found an estimated cost of 8 for instruction:   %shift
+; AVX512: Found an estimated cost of 8 for instruction:   %shift
----------------
mkuper wrote:
> This is really curious. How do we end up with a higher cost for a uniform operand than for a nun-uniform one?
Because trying to straighten out the cost model to match all the special cases in lowering is making my hair grey......


Repository:
  rL LLVM

https://reviews.llvm.org/D28458





More information about the llvm-commits mailing list