[LSR] Tweak debug output to always print initial cost

This commit is contained in:
Philip Reames 2024-05-14 13:33:31 -07:00 committed by Philip Reames
parent fb8f492a1c
commit baca93fc83
2 changed files with 3 additions and 3 deletions

View File

@ -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.

View File

@ -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.