Index: llvm/lib/Analysis/InlineCost.cpp =================================================================== --- llvm/lib/Analysis/InlineCost.cpp +++ llvm/lib/Analysis/InlineCost.cpp @@ -726,6 +726,10 @@ void dump(); + // Prints the same analysis as dump(), but its definition is not dependent + // on the build. + void print(); + Optional getCostDetails(const Instruction *I) { if (InstructionCostDetailMap.find(I) != InstructionCostDetailMap.end()) return InstructionCostDetailMap[I]; @@ -2167,10 +2171,28 @@ return finalizeAnalysis(); } +void InlineCostCallAnalyzer::print() { +#define DEBUG_PRINT_STAT(x) dbgs() << " " #x ": " << x << "\n" + if (PrintInstructionComments) + F.print(dbgs(), &Writer); + DEBUG_PRINT_STAT(NumConstantArgs); + DEBUG_PRINT_STAT(NumConstantOffsetPtrArgs); + DEBUG_PRINT_STAT(NumAllocaArgs); + DEBUG_PRINT_STAT(NumConstantPtrCmps); + DEBUG_PRINT_STAT(NumConstantPtrDiffs); + DEBUG_PRINT_STAT(NumInstructionsSimplified); + DEBUG_PRINT_STAT(NumInstructions); + DEBUG_PRINT_STAT(SROACostSavings); + DEBUG_PRINT_STAT(SROACostSavingsLost); + DEBUG_PRINT_STAT(LoadEliminationCost); + DEBUG_PRINT_STAT(ContainsNoDuplicateCall); + DEBUG_PRINT_STAT(Cost); + DEBUG_PRINT_STAT(Threshold); +} + #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP) /// Dump stats about this call's analysis. LLVM_DUMP_METHOD void InlineCostCallAnalyzer::dump() { -#define DEBUG_PRINT_STAT(x) dbgs() << " " #x ": " << x << "\n" if (PrintInstructionComments) F.print(dbgs(), &Writer); DEBUG_PRINT_STAT(NumConstantArgs);