// Prints the same analysis as dump(), but its definition is not dependent
// on the build.
- void print();
+ void print(raw_ostream &OS);
Optional<InstructionCostDetail> getCostDetails(const Instruction *I) {
if (InstructionCostDetailMap.find(I) != InstructionCostDetailMap.end())
return finalizeAnalysis();
}
-void InlineCostCallAnalyzer::print() {
-#define DEBUG_PRINT_STAT(x) dbgs() << " " #x ": " << x << "\n"
+void InlineCostCallAnalyzer::print(raw_ostream &OS) {
+#define DEBUG_PRINT_STAT(x) OS << " " #x ": " << x << "\n"
if (PrintInstructionComments)
- F.print(dbgs(), &Writer);
+ F.print(OS, &Writer);
DEBUG_PRINT_STAT(NumConstantArgs);
DEBUG_PRINT_STAT(NumConstantOffsetPtrArgs);
DEBUG_PRINT_STAT(NumAllocaArgs);
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
/// Dump stats about this call's analysis.
-LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() { print(); }
+LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() { print(dbgs()); }
#endif
/// Test that there are no attribute conflicts between Caller and Callee
ICCA.analyze();
OS << " Analyzing call of " << CalledFunction->getName()
<< "... (caller:" << CI->getCaller()->getName() << ")\n";
- ICCA.print();
+ ICCA.print(OS);
+ OS << "\n";
}
}
}
; CHECK: ContainsNoDuplicateCall: {{.*}}
; CHECK: Cost: {{.*}}
; CHECK: Threshold: {{.*}}
+; CHECK-EMPTY:
+; CHECK: Analyzing call of foo... (caller:main)
define i8 addrspace(1)** @foo() {
%1 = inttoptr i64 754974720 to i8 addrspace(1)**
define i8 addrspace(1)** @main() {
%1 = call i8 addrspace(1)** @foo()
+ %2 = call i8 addrspace(1)** @foo()
ret i8 addrspace(1)** %1
}