From 8f4d2e02bea6933d7f4c35f577bf5780bad93beb Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 1 Mar 2025 09:57:08 +0000 Subject: [PATCH] [VectorCombine] scalarizeLoadExtract - add debug message for match + cost-comparison Helps with debugging to show to that the fold found the match, and shows the old + new costs to indicate whether the fold was/wasn't profitable. --- llvm/lib/Transforms/Vectorize/VectorCombine.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 2e20961b4c912..bb4e1c0f67e79 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -1612,6 +1612,10 @@ bool VectorCombine::scalarizeLoadExtract(Instruction &I) { ScalarizedCost += TTI.getAddressComputationCost(VecTy->getElementType()); } + LLVM_DEBUG(dbgs() << "Found all extractions of a vector load: " << I + << "\n LoadExtractCost: " << OriginalCost + << " vs ScalarizedCost: " << ScalarizedCost << "\n"); + if (ScalarizedCost >= OriginalCost) return false;