[llvm] baca93f - [LSR] Tweak debug output to always print initial cost
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue May 14 13:34:41 PDT 2024
Author: Philip Reames
Date: 2024-05-14T13:34:20-07:00
New Revision: baca93fc83ee3b9ef32cd328dc4275a06177c8c7
URL: https://github.com/llvm/llvm-project/commit/baca93fc83ee3b9ef32cd328dc4275a06177c8c7
DIFF: https://github.com/llvm/llvm-project/commit/baca93fc83ee3b9ef32cd328dc4275a06177c8c7.diff
LOG: [LSR] Tweak debug output to always print initial cost
Added:
Modified:
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-drop-solution-dbg-msg.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index eb1904ccaff35..35a17d6060c94 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -5251,8 +5251,6 @@ void LSRInstance::Solve(SmallVectorImpl<const Formula *> &Solution) const {
assert(Solution.size() == Uses.size() && "Malformed solution!");
if (BaselineCost.isLess(SolutionCost)) {
- LLVM_DEBUG(dbgs() << "The baseline solution requires ";
- BaselineCost.print(dbgs()); dbgs() << "\n");
if (!AllowDropSolutionIfLessProfitable)
LLVM_DEBUG(
dbgs() << "Baseline is more profitable than chosen solution, "
@@ -5931,6 +5929,8 @@ LSRInstance::LSRInstance(Loop *L, IVUsers &IU, ScalarEvolution &SE,
LLVM_DEBUG(dbgs() << "LSR found " << Uses.size() << " uses:\n";
print_uses(dbgs()));
+ LLVM_DEBUG(dbgs() << "The baseline solution requires ";
+ BaselineCost.print(dbgs()); dbgs() << "\n");
// Now use the reuse data to generate a bunch of interesting ways
// to formulate the values needed for the uses.
diff --git a/llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-drop-solution-dbg-msg.ll b/llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-drop-solution-dbg-msg.ll
index 37876a9071240..8d9d43202f0d9 100644
--- a/llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-drop-solution-dbg-msg.ll
+++ b/llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-drop-solution-dbg-msg.ll
@@ -6,8 +6,8 @@ target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
target triple = "riscv64-unknown-linux-gnu"
define ptr @foo(ptr %a0, ptr %a1, i64 %a2) {
-;DEBUG: The chosen solution requires 3 instructions 6 regs, with addrec cost 1, plus 2 base adds, plus 5 setup cost
;DEBUG: The baseline solution requires 2 instructions 4 regs, with addrec cost 2, plus 3 setup cost
+;DEBUG: The chosen solution requires 3 instructions 6 regs, with addrec cost 1, plus 2 base adds, plus 5 setup cost
;DEBUG: Baseline is more profitable than chosen solution, dropping LSR solution.
;DEBUG2: Baseline is more profitable than chosen solution, add option 'lsr-drop-solution' to drop LSR solution.
More information about the llvm-commits
mailing list