[PATCH] D67841: [SLP] avoid reduction transform on patterns that the backend can load-combine

Alexey Bataev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 10:06:28 PDT 2019


ABataev added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6497
+      if (ReductionData.getOpcode() == Instruction::Or)
+        LoadCombineCost = TTI->getLoadCombineCost(FirstReducedVal);
+      if (LoadCombineCost) {
----------------
spatel wrote:
> ABataev wrote:
> > Shall we move all this stuff to `TargetTransformInfo::getArithmeticInstrCost`?
> Do you have a specific suggestion about how to alter that API to make this fit? 
> 
> I'm not seeing how to do it without making this more confusing than having a dedicated function.
`getArithmeticInstrCost` function has optional parameter `Args`. We can use it when we call this function and try to make a pattern matching for the arguments of the instruction rather than the instruction itself as in your original patch. Also, you will need to change the way you estimate the cost of the instruction. You need to estimate it for the single instruction. It is going to be less precise than in your current implementation but this is the common problem of the cost model, which should be addressed separately.


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

https://reviews.llvm.org/D67841





More information about the llvm-commits mailing list