summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/Inliner.cpp
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@google.com>2014-04-08 16:42:34 +0000
committerDiego Novillo <dnovillo@google.com>2014-04-08 16:42:34 +0000
commita9298b22976513857f7c8ded491e67c6a95a04c9 (patch)
tree0056e02220998ef3308d2892cf14773fb8df5980 /llvm/lib/Transforms/IPO/Inliner.cpp
parent1e25822f4d8fb8300e9292ef3d670e9d9803c83a (diff)
downloadbcm5719-llvm-a9298b22976513857f7c8ded491e67c6a95a04c9.tar.gz
bcm5719-llvm-a9298b22976513857f7c8ded491e67c6a95a04c9.zip
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 "<unknown>: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
Diffstat (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp8
1 files changed, 7 insertions, 1 deletions
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()) {
OpenPOWER on IntegriCloud