[llvm] [SLP]Improve reordering for consts, splats and ops from same nodes + improved analysis. (PR #87091)

Elvina Yakubova via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 16:14:28 PDT 2024


================
@@ -1847,23 +1856,44 @@ class BoUpSLP {
         // Look for an operand that matches the current mode.
         switch (RMode) {
         case ReorderingMode::Load:
-        case ReorderingMode::Constant:
         case ReorderingMode::Opcode: {
           bool LeftToRight = Lane > LastLane;
           Value *OpLeft = (LeftToRight) ? OpLastLane : Op;
           Value *OpRight = (LeftToRight) ? Op : OpLastLane;
           int Score = getLookAheadScore(OpLeft, OpRight, MainAltOps, Lane,
                                         OpIdx, Idx, IsUsed);
-          if (Score > static_cast<int>(BestOp.Score)) {
+          if (Score > static_cast<int>(BestOp.Score) ||
+              (Score > 0 && Score == static_cast<int>(BestOp.Score) &&
----------------
ElvinaYakubova wrote:

I'm trying to understand this change. Could you please explain the idea behind this check?

https://github.com/llvm/llvm-project/pull/87091


More information about the llvm-commits mailing list