aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/InlineCost.cpp
diff options
context:
space:
mode:
authorKirill Naumov <knaumov@azul.com>2020-06-19 14:57:34 +0000
committerKirill Naumov <knaumov@azul.com>2020-06-24 20:07:27 +0000
commitca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b (patch)
tree96b9b5a18bd90bcdb1566f0490cf17f977581660 /llvm/lib/Analysis/InlineCost.cpp
parent26fd3ffa78360e4b4581e2165efa18bf67c59d86 (diff)
downloadllvm-ca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b.zip
llvm-ca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b.tar.gz
llvm-ca899bf90aca0709d0bbe221ec6ee1d59ee9ec0b.tar.bz2
[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
Diffstat (limited to 'llvm/lib/Analysis/InlineCost.cpp')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 66e8184..cb57011 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -726,6 +726,10 @@ public:
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