From a9298b22976513857f7c8ded491e67c6a95a04c9 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Tue, 8 Apr 2014 16:42:34 +0000 Subject: Add support for optimization reports. Summary: This patch adds backend support for -Rpass=, which indicates the name of the optimization pass that should emit remarks stating when it made a transformation to the code. Pass names are taken from their DEBUG_NAME definitions. When emitting an optimization report diagnostic, the lack of debug information causes the diagnostic to use ":0:0" as the location string. This is the back end counterpart for http://llvm-reviews.chandlerc.com/D3226 Reviewers: qcolombet CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D3227 llvm-svn: 205774 --- llvm/lib/Transforms/IPO/Inliner.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp') diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index e97fb834f8d..17be3b2b447 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -21,6 +21,7 @@ #include "llvm/Analysis/InlineCost.h" #include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" +#include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/Module.h" @@ -522,7 +523,12 @@ bool Inliner::runOnSCC(CallGraphSCC &SCC) { InlineHistoryID, InsertLifetime, DL)) continue; ++NumInlined; - + + // Report the inline decision. + Caller->getContext().emitOptimizationRemark( + DEBUG_TYPE, *Caller, CS.getInstruction()->getDebugLoc(), + Twine(Callee->getName() + " inlined into " + Caller->getName())); + // If inlining this function gave us any new call sites, throw them // onto our worklist to process. They are useful inline candidates. if (!InlineInfo.InlinedCalls.empty()) { -- cgit v1.2.3