[llvm] ca899bf - [InlineCost] Added InlineCostCallAnalyzer::print()
Kirill Naumov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 24 13:07:50 PDT 2020
Author: Kirill Naumov
Date: 2020-06-24T20:07:27Z
New Revision: ca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b
URL: https://github.com/llvm/llvm-project/commit/ca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b
DIFF: https://github.com/llvm/llvm-project/commit/ca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b.diff
LOG: [InlineCost] Added InlineCostCallAnalyzer::print()
For the upcoming changes, we need to have an ability to dump
InlineCostCallAnalyzer info in non-debug builds as well.
Reviewed-By: mtrofin
Differential Revision: https://reviews.llvm.org/D82205
Added:
Modified:
llvm/lib/Analysis/InlineCost.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 66e8184e7ec2..cb5701110aa0 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -726,6 +726,10 @@ class InlineCostCallAnalyzer final : public CallAnalyzer {
void dump();
+ // Prints the same analysis as dump(), but its definition is not dependent
+ // on the build.
+ void print();
+
Optional<InstructionCostDetail> getCostDetails(const Instruction *I) {
if (InstructionCostDetailMap.find(I) != InstructionCostDetailMap.end())
return InstructionCostDetailMap[I];
@@ -2168,9 +2172,7 @@ InlineResult CallAnalyzer::analyze() {
return finalizeAnalysis();
}
-#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
-/// Dump stats about this call's analysis.
-LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() {
+void InlineCostCallAnalyzer::print() {
#define DEBUG_PRINT_STAT(x) dbgs() << " " #x ": " << x << "\n"
if (PrintInstructionComments)
F.print(dbgs(), &Writer);
@@ -2189,6 +2191,12 @@ LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() {
DEBUG_PRINT_STAT(Threshold);
#undef DEBUG_PRINT_STAT
}
+
+#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
+/// Dump stats about this call's analysis.
+LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() {
+ print();
+}
#endif
/// Test that there are no attribute conflicts between Caller and Callee
More information about the llvm-commits
mailing list