Skip to content

Commit baca93f

Browse files
committed
[LSR] Tweak debug output to always print initial cost
1 parent fb8f492 commit baca93f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5251,8 +5251,6 @@ void LSRInstance::Solve(SmallVectorImpl<const Formula *> &Solution) const {
52515251
assert(Solution.size() == Uses.size() && "Malformed solution!");
52525252

52535253
if (BaselineCost.isLess(SolutionCost)) {
5254-
LLVM_DEBUG(dbgs() << "The baseline solution requires ";
5255-
BaselineCost.print(dbgs()); dbgs() << "\n");
52565254
if (!AllowDropSolutionIfLessProfitable)
52575255
LLVM_DEBUG(
52585256
dbgs() << "Baseline is more profitable than chosen solution, "
@@ -5931,6 +5929,8 @@ LSRInstance::LSRInstance(Loop *L, IVUsers &IU, ScalarEvolution &SE,
59315929

59325930
LLVM_DEBUG(dbgs() << "LSR found " << Uses.size() << " uses:\n";
59335931
print_uses(dbgs()));
5932+
LLVM_DEBUG(dbgs() << "The baseline solution requires ";
5933+
BaselineCost.print(dbgs()); dbgs() << "\n");
59345934

59355935
// Now use the reuse data to generate a bunch of interesting ways
59365936
// to formulate the values needed for the uses.

llvm/test/Transforms/LoopStrengthReduce/RISCV/lsr-drop-solution-dbg-msg.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128"
66
target triple = "riscv64-unknown-linux-gnu"
77

88
define ptr @foo(ptr %a0, ptr %a1, i64 %a2) {
9-
;DEBUG: The chosen solution requires 3 instructions 6 regs, with addrec cost 1, plus 2 base adds, plus 5 setup cost
109
;DEBUG: The baseline solution requires 2 instructions 4 regs, with addrec cost 2, plus 3 setup cost
10+
;DEBUG: The chosen solution requires 3 instructions 6 regs, with addrec cost 1, plus 2 base adds, plus 5 setup cost
1111
;DEBUG: Baseline is more profitable than chosen solution, dropping LSR solution.
1212

1313
;DEBUG2: Baseline is more profitable than chosen solution, add option 'lsr-drop-solution' to drop LSR solution.

0 commit comments

Comments
 (0)