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

Michael Kuperstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 18:07:53 PST 2017


mkuper 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))
----------------
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.


================
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
----------------
This is really curious. How do we end up with a higher cost for a uniform operand than for a nun-uniform one?


Repository:
  rL LLVM

https://reviews.llvm.org/D28458





More information about the llvm-commits mailing list