summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/Inliner.cpp
diff options
context:
space:
mode:
authorVivek Pandya <vivekvpandya@gmail.com>2017-10-11 17:12:59 +0000
committerVivek Pandya <vivekvpandya@gmail.com>2017-10-11 17:12:59 +0000
commit9590658fb88d40b88ad5bb34c66c946513579384 (patch)
tree7153e7514adc5b98d16cc7a026988c9644b7fa47 /llvm/lib/Transforms/IPO/Inliner.cpp
parent87867988f9a57bae14a1d14865cca926205685ba (diff)
downloadbcm5719-llvm-9590658fb88d40b88ad5bb34c66c946513579384.tar.gz
bcm5719-llvm-9590658fb88d40b88ad5bb34c66c946513579384.zip
[NFC] Convert OptimizationRemarkEmitter old emit() calls to new closure
parameterized emit() calls Summary: This is not functional change to adopt new emit() API added in r313691. Reviewed By: anemet Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38285 llvm-svn: 315476
Diffstat (limited to 'llvm/lib/Transforms/IPO/Inliner.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp84
1 files changed, 49 insertions, 35 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index 28558c87fa0..d8aa7e6eac0 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -384,11 +384,13 @@ shouldInline(CallSite CS, function_ref<InlineCost(CallSite CS)> GetInlineCost,
DEBUG(dbgs() << " NOT Inlining: " << *CS.getInstruction()
<< " Cost = " << IC.getCost()
<< ", outer Cost = " << TotalSecondaryCost << '\n');
- ORE.emit(OptimizationRemarkMissed(DEBUG_TYPE, "IncreaseCostInOtherContexts",
+ ORE.emit([&]() {
+ return OptimizationRemarkMissed(DEBUG_TYPE, "IncreaseCostInOtherContexts",
Call)
<< "Not inlining. Cost of inlining " << NV("Callee", Callee)
<< " increases the cost of inlining " << NV("Caller", Caller)
- << " in other contexts");
+ << " in other contexts";
+ });
// IC does not bool() to false, so get an InlineCost that will.
// This will not be inspected to make an error message.
@@ -476,11 +478,13 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
if (Function *Callee = CS.getCalledFunction())
if (Callee->isDeclaration()) {
using namespace ore;
- ORE.emit(OptimizationRemarkMissed(DEBUG_TYPE, "NoDefinition", &I)
+ ORE.emit([&]() {
+ return OptimizationRemarkMissed(DEBUG_TYPE, "NoDefinition", &I)
<< NV("Callee", Callee) << " will not be inlined into "
<< NV("Caller", CS.getCaller())
<< " because its definition is unavailable"
- << setIsVerbose());
+ << setIsVerbose();
+ });
continue;
}
@@ -572,27 +576,31 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
if (!InlineCallIfPossible(CS, InlineInfo, InlinedArrayAllocas,
InlineHistoryID, InsertLifetime, AARGetter,
ImportedFunctionsStats)) {
- ORE.emit(
- OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
- << NV("Callee", Callee) << " will not be inlined into "
- << NV("Caller", Caller));
+ ORE.emit([&]() {
+ return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc,
+ Block)
+ << NV("Callee", Callee) << " will not be inlined into "
+ << NV("Caller", Caller);
+ });
continue;
}
++NumInlined;
- if (OIC->isAlways())
- ORE.emit(OptimizationRemark(DEBUG_TYPE, "AlwaysInline", DLoc, Block)
- << NV("Callee", Callee) << " inlined into "
- << NV("Caller", Caller) << " with cost=always");
- else
- ORE.emit([&]() {
- return OptimizationRemark(DEBUG_TYPE, "Inlined", DLoc, Block)
- << NV("Callee", Callee) << " inlined into "
- << NV("Caller", Caller)
- << " with cost=" << NV("Cost", OIC->getCost())
- << " (threshold=" << NV("Threshold", OIC->getThreshold())
- << ")";
- });
+ ORE.emit([&]() {
+ bool AlwaysInline = OIC->isAlways();
+ StringRef RemarkName = AlwaysInline ? "AlwaysInline" : "Inlined";
+ OptimizationRemark R(DEBUG_TYPE, RemarkName, DLoc, Block);
+ R << NV("Callee", Callee) << " inlined into ";
+ R << NV("Caller", Caller);
+ if (AlwaysInline)
+ R << " with cost=always";
+ else {
+ R << " with cost=" << NV("Cost", OIC->getCost());
+ R << " (threshold=" << NV("Threshold", OIC->getThreshold());
+ R << ")";
+ }
+ return R;
+ });
// If inlining this function gave us any new call sites, throw them
// onto our worklist to process. They are useful inline candidates.
@@ -915,25 +923,31 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
using namespace ore;
if (!InlineFunction(CS, IFI)) {
- ORE.emit(
- OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
- << NV("Callee", &Callee) << " will not be inlined into "
- << NV("Caller", &F));
+ ORE.emit([&]() {
+ return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
+ << NV("Callee", &Callee) << " will not be inlined into "
+ << NV("Caller", &F);
+ });
continue;
}
DidInline = true;
InlinedCallees.insert(&Callee);
- if (OIC->isAlways())
- ORE.emit(OptimizationRemark(DEBUG_TYPE, "AlwaysInline", DLoc, Block)
- << NV("Callee", &Callee) << " inlined into "
- << NV("Caller", &F) << " with cost=always");
- else
- ORE.emit(
- OptimizationRemark(DEBUG_TYPE, "Inlined", DLoc, Block)
- << NV("Callee", &Callee) << " inlined into " << NV("Caller", &F)
- << " with cost=" << NV("Cost", OIC->getCost())
- << " (threshold=" << NV("Threshold", OIC->getThreshold()) << ")");
+ ORE.emit([&]() {
+ bool AlwaysInline = OIC->isAlways();
+ StringRef RemarkName = AlwaysInline ? "AlwaysInline" : "Inlined";
+ OptimizationRemark R(DEBUG_TYPE, RemarkName, DLoc, Block);
+ R << NV("Callee", &Callee) << " inlined into ";
+ R << NV("Caller", &F);
+ if (AlwaysInline)
+ R << " with cost=always";
+ else {
+ R << " with cost=" << NV("Cost", OIC->getCost());
+ R << " (threshold=" << NV("Threshold", OIC->getThreshold());
+ R << ")";
+ }
+ return R;
+ });
// Add any new callsites to defined functions to the worklist.
if (!IFI.InlinedCallSites.empty()) {
OpenPOWER on IntegriCloud