[PATCH] D26277: [SLP] Fixed cost model for horizontal reduction.

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 13 11:56:24 PST 2016


mkuper added inline comments.


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:966
+    unsigned ShuffleCost = 0;
+    auto *ThisT = static_cast<T *>(this);
+    std::pair<unsigned, MVT> LT =
----------------
ThisT -> ConcreteTTI, or something conveying the same information?
(That's what this actually is, right?)


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:983
+    // operations performed on the current platform. That's why several final
+    // reduction opertions are perfomed ont eh vectors with the same
+    // architecture-dependent length.
----------------
ont eh -> on the


================
Comment at: include/llvm/CodeGen/BasicTTIImpl.h:988
+        ThisT->getShuffleCost(TTI::SK_ExtractSubvector, Ty, NumVecElts, Ty);
+    ArithCost += (NumReduxLevels - LongVectorCount + 1) *
+                 ThisT->getArithmeticInstrCost(Opcode, Ty);
----------------
Why the +1?
If the type is legal, LongVectorsCount is 0, Ty doesn't change, so this changes the behavior from multiplying by NumReduxLevel to NumReduxLevel + 1. Was the previous version wrong in that respect?


https://reviews.llvm.org/D26277





More information about the llvm-commits mailing list