[llvm] [VectorCombine] foldShuffleChainsToReduce - add dbg cost comparison message (PR #199233)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri May 22 09:40:55 PDT 2026


https://github.com/RKSimon created https://github.com/llvm/llvm-project/pull/199233

Help track whether a fold was attempted or not

>From c6e93c486ef482935767ffc1d76b24040b2a6540 Mon Sep 17 00:00:00 2001
From: Simon Pilgrim <llvm-dev at redking.me.uk>
Date: Fri, 22 May 2026 17:39:31 +0100
Subject: [PATCH] [VectorCombine] foldShuffleChainsToReduce - add dbg cost
 comparison message

Help track whether a fold was attempted or not
---
 llvm/lib/Transforms/Vectorize/VectorCombine.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
index d6a6f18c6209d..0c97016665ca3 100644
--- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -4179,6 +4179,9 @@ bool VectorCombine::foldShuffleChainsToReduce(Instruction &I) {
   IntrinsicCostAttributes ICA(ReducedOp, ReduceVecTy, {ReduceVecTy});
   NewCost += TTI.getIntrinsicInstrCost(ICA, CostKind);
 
+  LLVM_DEBUG(dbgs() << "Found reduction shuffle chain: " << I << "\n OldCost : "
+                    << OrigCost << " vs NewCost: " << NewCost << "\n");
+
   if (NewCost >= OrigCost)
     return false;
 



More information about the llvm-commits mailing list