Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit ecd25ed

Browse files
committed
[InlineCost] Add empty line between call sites when printing inline costs
1 parent 9d1db3d commit ecd25ed

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

llvm/lib/Analysis/InlineCost.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
10131013

10141014
// Prints the same analysis as dump(), but its definition is not dependent
10151015
// on the build.
1016-
void print();
1016+
void print(raw_ostream &OS);
10171017

10181018
Optional<InstructionCostDetail> getCostDetails(const Instruction *I) {
10191019
if (InstructionCostDetailMap.find(I) != InstructionCostDetailMap.end())
@@ -2711,10 +2711,10 @@ InlineResult CallAnalyzer::analyze() {
27112711
return finalizeAnalysis();
27122712
}
27132713

2714-
void InlineCostCallAnalyzer::print() {
2715-
#define DEBUG_PRINT_STAT(x) dbgs() << " " #x ": " << x << "\n"
2714+
void InlineCostCallAnalyzer::print(raw_ostream &OS) {
2715+
#define DEBUG_PRINT_STAT(x) OS << " " #x ": " << x << "\n"
27162716
if (PrintInstructionComments)
2717-
F.print(dbgs(), &Writer);
2717+
F.print(OS, &Writer);
27182718
DEBUG_PRINT_STAT(NumConstantArgs);
27192719
DEBUG_PRINT_STAT(NumConstantOffsetPtrArgs);
27202720
DEBUG_PRINT_STAT(NumAllocaArgs);
@@ -2733,7 +2733,7 @@ void InlineCostCallAnalyzer::print() {
27332733

27342734
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
27352735
/// Dump stats about this call's analysis.
2736-
LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() { print(); }
2736+
LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() { print(dbgs()); }
27372737
#endif
27382738

27392739
/// Test that there are no attribute conflicts between Caller and Callee
@@ -3127,7 +3127,8 @@ InlineCostAnnotationPrinterPass::run(Function &F,
31273127
ICCA.analyze();
31283128
OS << " Analyzing call of " << CalledFunction->getName()
31293129
<< "... (caller:" << CI->getCaller()->getName() << ")\n";
3130-
ICCA.print();
3130+
ICCA.print(OS);
3131+
OS << "\n";
31313132
}
31323133
}
31333134
}

llvm/test/Transforms/Inline/inline-cost-annotation-pass.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
; CHECK: ContainsNoDuplicateCall: {{.*}}
2121
; CHECK: Cost: {{.*}}
2222
; CHECK: Threshold: {{.*}}
23+
; CHECK-EMPTY:
24+
; CHECK: Analyzing call of foo... (caller:main)
2325

2426
define i8 addrspace(1)** @foo() {
2527
%1 = inttoptr i64 754974720 to i8 addrspace(1)**
@@ -28,5 +30,6 @@ define i8 addrspace(1)** @foo() {
2830

2931
define i8 addrspace(1)** @main() {
3032
%1 = call i8 addrspace(1)** @foo()
33+
%2 = call i8 addrspace(1)** @foo()
3134
ret i8 addrspace(1)** %1
3235
}

0 commit comments

Comments
 (0)