diff --git a/bolt/lib/Passes/BinaryPasses.cpp b/bolt/lib/Passes/BinaryPasses.cpp --- a/bolt/lib/Passes/BinaryPasses.cpp +++ b/bolt/lib/Passes/BinaryPasses.cpp @@ -336,7 +336,7 @@ if (Count) { Modified.insert(&Function); if (opts::Verbosity > 0) - outs() << "BOLT-INFO: Removed " << Count + outs() << "BOLT-INFO: removed " << Count << " dead basic block(s) accounting for " << Bytes << " bytes in function " << Function << '\n'; } @@ -350,8 +350,9 @@ runOnFunction(Function); } - outs() << "BOLT-INFO: UCE removed " << DeletedBlocks << " blocks and " - << DeletedBytes << " bytes of code.\n"; + if (DeletedBlocks) + outs() << "BOLT-INFO: UCE removed " << DeletedBlocks << " blocks and " + << DeletedBytes << " bytes of code\n"; } bool ReorderBasicBlocks::shouldPrint(const BinaryFunction &BF) const { @@ -999,16 +1000,17 @@ } } - outs() << "BOLT-INFO: SCTC: patched " << NumTailCallsPatched - << " tail calls (" << NumOrigForwardBranches << " forward)" - << " tail calls (" << NumOrigBackwardBranches << " backward)" - << " from a total of " << NumCandidateTailCalls << " while removing " - << NumDoubleJumps << " double jumps" - << " and removing " << DeletedBlocks << " basic blocks" - << " totalling " << DeletedBytes - << " bytes of code. CTCs total execution count is " << CTCExecCount - << " and the number of times CTCs are taken is " << CTCTakenCount - << ".\n"; + if (NumTailCallsPatched) + outs() << "BOLT-INFO: SCTC: patched " << NumTailCallsPatched + << " tail calls (" << NumOrigForwardBranches << " forward)" + << " tail calls (" << NumOrigBackwardBranches << " backward)" + << " from a total of " << NumCandidateTailCalls << " while removing " + << NumDoubleJumps << " double jumps" + << " and removing " << DeletedBlocks << " basic blocks" + << " totalling " << DeletedBytes + << " bytes of code. CTCs total execution count is " << CTCExecCount + << " and the number of times CTCs are taken is " << CTCTakenCount + << "\n"; } uint64_t ShortenInstructions::shortenInstructions(BinaryFunction &Function) { @@ -1048,7 +1050,8 @@ [&](BinaryFunction &BF) { NumShortened += shortenInstructions(BF); }, nullptr, "ShortenInstructions"); - outs() << "BOLT-INFO: " << NumShortened << " instructions were shortened\n"; + if (NumShortened) + outs() << "BOLT-INFO: " << NumShortened << " instructions were shortened\n"; } void Peepholes::addTailcallTraps(BinaryFunction &Function) { diff --git a/bolt/test/X86/issue20.s b/bolt/test/X86/issue20.s --- a/bolt/test/X86/issue20.s +++ b/bolt/test/X86/issue20.s @@ -10,7 +10,7 @@ # RUN: llvm-bolt %t.exe --relocs=0 --jump-tables=move --print-finalized \ # RUN: -o %t.out | FileCheck %s -# CHECK: BOLT-INFO: UCE removed 0 blocks and 0 bytes of code. +# CHECK-NOT: BOLT-INFO: UCE removed {{.*}} blocks and {{.*}} bytes of code # CHECK: Binary Function "main" # CHECK: .LFT{{.*}} (2 instructions, align : 1) # CHECK-NEXT: CFI State : 0 diff --git a/bolt/test/X86/issue20.test b/bolt/test/X86/issue20.test --- a/bolt/test/X86/issue20.test +++ b/bolt/test/X86/issue20.test @@ -6,7 +6,7 @@ # RUN: llvm-bolt %t.exe --relocs=0 --jump-tables=move --print-finalized \ # RUN: -o %t.out | FileCheck %s -CHECK: BOLT-INFO: UCE removed 0 blocks and 0 bytes of code. +CHECK-NOT: BOLT-INFO: UCE removed {{.*}} blocks and {{.*}}| bytes of code CHECK: Binary Function "main" CHECK: .LFT0 (2 instructions, align : 1) CHECK-NEXT: CFI State : 0 diff --git a/bolt/test/X86/unreachable.test b/bolt/test/X86/unreachable.test --- a/bolt/test/X86/unreachable.test +++ b/bolt/test/X86/unreachable.test @@ -12,7 +12,7 @@ RUN: --no-show-raw-insn | FileCheck %s BOLT: BB Layout : .LBB{{.*}}, .LFT{{.*}}, .Ltmp{{.*}}, .LFT{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .LLP{{.*}}, .LFT{{.*}}, .Ltmp{{.*}}, .LFT{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}} -BOLT: BOLT-INFO: UCE removed 4 blocks and 16 bytes of code. +BOLT: BOLT-INFO: UCE removed 4 blocks and 16 bytes of code BOLT: BB Layout : .LBB{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .LLP{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}}, .Ltmp{{.*}} CHECK: :