summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Bolvansky <david.bolvansky@gmail.com>2018-07-31 14:47:22 +0000
committerDavid Bolvansky <david.bolvansky@gmail.com>2018-07-31 14:47:22 +0000
commitab79414f7b29c8a82eebcc6daf055c8251641558 (patch)
treeffee3b4e78e04af808ee38fef62d6566b51dce95 /llvm/lib
parent57d617d6767d480a179423132b78e1726e876474 (diff)
downloadbcm5719-llvm-ab79414f7b29c8a82eebcc6daf055c8251641558.tar.gz
bcm5719-llvm-ab79414f7b29c8a82eebcc6daf055c8251641558.zip
Revert Enrich inline messages
llvm-svn: 338389
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/InlineCost.cpp93
-rw-r--r--llvm/lib/Target/AMDGPU/AMDGPUInline.cpp17
-rw-r--r--llvm/lib/Transforms/IPO/AlwaysInliner.cpp4
-rw-r--r--llvm/lib/Transforms/IPO/Inliner.cpp120
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp29
5 files changed, 111 insertions, 152 deletions
diff --git a/llvm/lib/Analysis/InlineCost.cpp b/llvm/lib/Analysis/InlineCost.cpp
index 1d879f8aee9..a6cccc3b591 100644
--- a/llvm/lib/Analysis/InlineCost.cpp
+++ b/llvm/lib/Analysis/InlineCost.cpp
@@ -227,8 +227,7 @@ class CallAnalyzer : public InstVisitor<CallAnalyzer, bool> {
BlockFrequencyInfo *CallerBFI);
// Custom analysis routines.
- InlineResult analyzeBlock(BasicBlock *BB,
- SmallPtrSetImpl<const Value *> &EphValues);
+ bool analyzeBlock(BasicBlock *BB, SmallPtrSetImpl<const Value *> &EphValues);
// Disable several entry points to the visitor so we don't accidentally use
// them by declaring but not defining them here.
@@ -291,7 +290,7 @@ public:
NumInstructionsSimplified(0), SROACostSavings(0),
SROACostSavingsLost(0) {}
- InlineResult analyzeCall(CallSite CS);
+ bool analyzeCall(CallSite CS);
int getThreshold() { return Threshold; }
int getCost() { return Cost; }
@@ -1542,9 +1541,8 @@ bool CallAnalyzer::visitInstruction(Instruction &I) {
/// aborts early if the threshold has been exceeded or an impossible to inline
/// construct has been detected. It returns false if inlining is no longer
/// viable, and true if inlining remains viable.
-InlineResult
-CallAnalyzer::analyzeBlock(BasicBlock *BB,
- SmallPtrSetImpl<const Value *> &EphValues) {
+bool CallAnalyzer::analyzeBlock(BasicBlock *BB,
+ SmallPtrSetImpl<const Value *> &EphValues) {
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) {
// FIXME: Currently, the number of instructions in a function regardless of
// our ability to simplify them during inline to constants or dead code,
@@ -1576,29 +1574,16 @@ CallAnalyzer::analyzeBlock(BasicBlock *BB,
using namespace ore;
// If the visit this instruction detected an uninlinable pattern, abort.
- InlineResult IR;
- if (IsRecursiveCall)
- IR = "recursive";
- else if (ExposesReturnsTwice)
- IR = "exposes returns twice";
- else if (HasDynamicAlloca)
- IR = "dynamic alloca";
- else if (HasIndirectBr)
- IR = "indirect branch";
- else if (HasUninlineableIntrinsic)
- IR = "uninlinable intrinsic";
- else if (UsesVarArgs)
- IR = "varargs";
- if (!IR) {
+ if (IsRecursiveCall || ExposesReturnsTwice || HasDynamicAlloca ||
+ HasIndirectBr || HasUninlineableIntrinsic || UsesVarArgs) {
if (ORE)
ORE->emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "NeverInline",
CandidateCS.getInstruction())
- << NV("Callee", &F) << " has uninlinable pattern ("
- << NV("InlineResult", IR.message)
- << ") and cost is not fully computed";
+ << NV("Callee", &F)
+ << " has uninlinable pattern and cost is not fully computed";
});
- return IR;
+ return false;
}
// If the caller is a recursive function then we don't want to inline
@@ -1606,15 +1591,15 @@ CallAnalyzer::analyzeBlock(BasicBlock *BB,
// the caller stack usage dramatically.
if (IsCallerRecursive &&
AllocatedSize > InlineConstants::TotalAllocaSizeRecursiveCaller) {
- InlineResult IR = "recursive and allocates too much stack space";
if (ORE)
ORE->emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "NeverInline",
CandidateCS.getInstruction())
- << NV("Callee", &F) << " is " << NV("InlineResult", IR.message)
- << ". Cost is not fully computed";
+ << NV("Callee", &F)
+ << " is recursive and allocates too much stack space. Cost is "
+ "not fully computed";
});
- return IR;
+ return false;
}
// Check if we've past the maximum possible threshold so we don't spin in
@@ -1710,7 +1695,7 @@ void CallAnalyzer::findDeadBlocks(BasicBlock *CurrBB, BasicBlock *NextBB) {
/// factors and heuristics. If this method returns false but the computed cost
/// is below the computed threshold, then inlining was forcibly disabled by
/// some artifact of the routine.
-InlineResult CallAnalyzer::analyzeCall(CallSite CS) {
+bool CallAnalyzer::analyzeCall(CallSite CS) {
++NumCallsAnalyzed;
// Perform some tweaks to the cost and threshold based on the direct
@@ -1745,7 +1730,7 @@ InlineResult CallAnalyzer::analyzeCall(CallSite CS) {
// Check if we're done. This can happen due to bonuses and penalties.
if (Cost >= Threshold && !ComputeFullInlineCost)
- return "high cost";
+ return false;
if (F.empty())
return true;
@@ -1824,13 +1809,12 @@ InlineResult CallAnalyzer::analyzeCall(CallSite CS) {
// site. If the blockaddress escapes the function, e.g., via a global
// variable, inlining may lead to an invalid cross-function reference.
if (BB->hasAddressTaken())
- return "blockaddress";
+ return false;
// Analyze the cost of this block. If we blow through the threshold, this
// returns false, and we can bail on out.
- InlineResult IR = analyzeBlock(BB, EphValues);
- if (!IR)
- return IR;
+ if (!analyzeBlock(BB, EphValues))
+ return false;
TerminatorInst *TI = BB->getTerminator();
@@ -1883,7 +1867,7 @@ InlineResult CallAnalyzer::analyzeCall(CallSite CS) {
// inlining this would cause the removal of the caller (so the instruction
// is not actually duplicated, just moved).
if (!OnlyOneCallAndLocalLinkage && ContainsNoDuplicateCall)
- return "noduplicate";
+ return false;
// We applied the maximum possible vector bonus at the beginning. Now,
// subtract the excess bonus, if any, from the Threshold before
@@ -1977,7 +1961,7 @@ InlineCost llvm::getInlineCost(
// Cannot inline indirect calls.
if (!Callee)
- return llvm::InlineCost::getNever("indirect call");
+ return llvm::InlineCost::getNever();
// Never inline calls with byval arguments that does not have the alloca
// address space. Since byval arguments can be replaced with a copy to an
@@ -1989,59 +1973,54 @@ InlineCost llvm::getInlineCost(
if (CS.isByValArgument(I)) {
PointerType *PTy = cast<PointerType>(CS.getArgument(I)->getType());
if (PTy->getAddressSpace() != AllocaAS)
- return llvm::InlineCost::getNever("byval arguments without alloca"
- " address space");
+ return llvm::InlineCost::getNever();
}
// Calls to functions with always-inline attributes should be inlined
// whenever possible.
if (CS.hasFnAttr(Attribute::AlwaysInline)) {
if (isInlineViable(*Callee))
- return llvm::InlineCost::getAlways("always inline attribute");
- return llvm::InlineCost::getNever("inapplicable always inline attribute");
+ return llvm::InlineCost::getAlways();
+ return llvm::InlineCost::getNever();
}
// Never inline functions with conflicting attributes (unless callee has
// always-inline attribute).
Function *Caller = CS.getCaller();
if (!functionsHaveCompatibleAttributes(Caller, Callee, CalleeTTI))
- return llvm::InlineCost::getNever("conflicting attributes");
+ return llvm::InlineCost::getNever();
// Don't inline this call if the caller has the optnone attribute.
if (Caller->hasFnAttribute(Attribute::OptimizeNone))
- return llvm::InlineCost::getNever("optnone attribute");
+ return llvm::InlineCost::getNever();
// Don't inline a function that treats null pointer as valid into a caller
// that does not have this attribute.
if (!Caller->nullPointerIsDefined() && Callee->nullPointerIsDefined())
- return llvm::InlineCost::getNever("nullptr definitions incompatible");
-
- // Don't inline functions which can be interposed at link-time.
- if (Callee->isInterposable())
- return llvm::InlineCost::getNever("interposable");
-
- // Don't inline functions marked noinline.
- if (Callee->hasFnAttribute(Attribute::NoInline))
- return llvm::InlineCost::getNever("noinline function attribute");
+ return llvm::InlineCost::getNever();
- // Don't inline call sites marked noinline.
- if (CS.isNoInline())
- return llvm::InlineCost::getNever("noinline call site attribute");
+ // Don't inline functions which can be interposed at link-time. Don't inline
+ // functions marked noinline or call sites marked noinline.
+ // Note: inlining non-exact non-interposable functions is fine, since we know
+ // we have *a* correct implementation of the source level function.
+ if (Callee->isInterposable() || Callee->hasFnAttribute(Attribute::NoInline) ||
+ CS.isNoInline())
+ return llvm::InlineCost::getNever();
LLVM_DEBUG(llvm::dbgs() << " Analyzing call of " << Callee->getName()
<< "... (caller:" << Caller->getName() << ")\n");
CallAnalyzer CA(CalleeTTI, GetAssumptionCache, GetBFI, PSI, ORE, *Callee, CS,
Params);
- InlineResult ShouldInline = CA.analyzeCall(CS);
+ bool ShouldInline = CA.analyzeCall(CS);
LLVM_DEBUG(CA.dump());
// Check if there was a reason to force inlining or no inlining.
if (!ShouldInline && CA.getCost() < CA.getThreshold())
- return InlineCost::getNever(ShouldInline.message);
+ return InlineCost::getNever();
if (ShouldInline && CA.getCost() >= CA.getThreshold())
- return InlineCost::getAlways("empty function");
+ return InlineCost::getAlways();
return llvm::InlineCost::get(CA.getCost(), CA.getThreshold());
}
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
index 7060ff353f4..35dd9eb0a47 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUInline.cpp
@@ -174,23 +174,18 @@ InlineCost AMDGPUInliner::getInlineCost(CallSite CS) {
Function *Caller = CS.getCaller();
TargetTransformInfo &TTI = TTIWP->getTTI(*Callee);
- if (!Callee || Callee->isDeclaration())
- return llvm::InlineCost::getNever("undefined callee");
-
- if (CS.isNoInline())
- return llvm::InlineCost::getNever("noinline");
-
- if (!TTI.areInlineCompatible(Caller, Callee))
- return llvm::InlineCost::getNever("incompatible");
+ if (!Callee || Callee->isDeclaration() || CS.isNoInline() ||
+ !TTI.areInlineCompatible(Caller, Callee))
+ return llvm::InlineCost::getNever();
if (CS.hasFnAttr(Attribute::AlwaysInline)) {
if (isInlineViable(*Callee))
- return llvm::InlineCost::getAlways("alwaysinline viable");
- return llvm::InlineCost::getNever("alwaysinline unviable");
+ return llvm::InlineCost::getAlways();
+ return llvm::InlineCost::getNever();
}
if (isWrapperOnlyCall(CS))
- return llvm::InlineCost::getAlways("wrapper-only call");
+ return llvm::InlineCost::getAlways();
InlineParams LocalParams = Params;
LocalParams.DefaultThreshold = (int)getInlineThreshold(CS);
diff --git a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
index 07138718ce2..3b735ddd192 100644
--- a/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
+++ b/llvm/lib/Transforms/IPO/AlwaysInliner.cpp
@@ -150,7 +150,7 @@ InlineCost AlwaysInlinerLegacyPass::getInlineCost(CallSite CS) {
// declarations.
if (Callee && !Callee->isDeclaration() &&
CS.hasFnAttr(Attribute::AlwaysInline) && isInlineViable(*Callee))
- return InlineCost::getAlways("always inliner");
+ return InlineCost::getAlways();
- return InlineCost::getNever("always inliner");
+ return InlineCost::getNever();
}
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp
index ef55aca306f..3da0c2e83eb 100644
--- a/llvm/lib/Transforms/IPO/Inliner.cpp
+++ b/llvm/lib/Transforms/IPO/Inliner.cpp
@@ -64,7 +64,6 @@
#include <algorithm>
#include <cassert>
#include <functional>
-#include <sstream>
#include <tuple>
#include <utility>
#include <vector>
@@ -276,9 +275,8 @@ static bool InlineCallIfPossible(
// Try to inline the function. Get the list of static allocas that were
// inlined.
- InlineResult IR = InlineFunction(CS, IFI, &AAR, InsertLifetime);
- if (!IR)
- return IR;
+ if (!InlineFunction(CS, IFI, &AAR, InsertLifetime))
+ return false;
if (InlinerFunctionImportStats != InlinerFunctionImportStatsOpts::No)
ImportedFunctionsStats.recordInline(*Caller, *Callee);
@@ -288,7 +286,7 @@ static bool InlineCallIfPossible(
if (!DisableInlinedAllocaMerging)
mergeInlinedArrayAllocas(Caller, IFI, InlinedArrayAllocas, InlineHistory);
- return IR; // success
+ return true;
}
/// Return true if inlining of CS can block the caller from being
@@ -367,33 +365,6 @@ shouldBeDeferred(Function *Caller, CallSite CS, InlineCost IC,
return false;
}
-template <class RemarkT>
-RemarkT &operator<<(RemarkT &&R, const InlineCost &IC) {
- using namespace ore;
- if (IC.isAlways()) {
- R << "(cost=always)";
- } else if (IC.isNever()) {
- R << "(cost=never)";
- } else {
- R << "(cost=" << ore::NV("Cost", IC.getCost())
- << ", threshold=" << ore::NV("Threshold", IC.getThreshold()) << ")";
- }
- if (const char *Reason = IC.getReason())
- R << ": " << ore::NV("Reason", Reason);
- return R;
-}
-
-static std::basic_ostream<char> &operator<<(std::basic_ostream<char> &R,
- const ore::NV &Arg) {
- return R << Arg.Val;
-}
-
-static std::string inlineCostStr(const InlineCost &IC) {
- std::stringstream Remark;
- Remark << IC;
- return Remark.str();
-}
-
/// Return the cost only if the inliner should attempt to inline at the given
/// CallSite. If we return the cost, we will emit an optimisation remark later
/// using that cost, so we won't do so from this function.
@@ -408,32 +379,35 @@ shouldInline(CallSite CS, function_ref<InlineCost(CallSite CS)> GetInlineCost,
Function *Caller = CS.getCaller();
if (IC.isAlways()) {
- LLVM_DEBUG(dbgs() << " Inlining " << inlineCostStr(IC)
+ LLVM_DEBUG(dbgs() << " Inlining: cost=always"
<< ", Call: " << *CS.getInstruction() << "\n");
return IC;
}
if (IC.isNever()) {
- LLVM_DEBUG(dbgs() << " NOT Inlining " << inlineCostStr(IC)
+ LLVM_DEBUG(dbgs() << " NOT Inlining: cost=never"
<< ", Call: " << *CS.getInstruction() << "\n");
ORE.emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "NeverInline", Call)
<< NV("Callee", Callee) << " not inlined into "
- << NV("Caller", Caller) << " because it should never be inlined "
- << IC;
+ << NV("Caller", Caller)
+ << " because it should never be inlined (cost=never)";
});
- return IC;
+ return None;
}
if (!IC) {
- LLVM_DEBUG(dbgs() << " NOT Inlining " << inlineCostStr(IC)
+ LLVM_DEBUG(dbgs() << " NOT Inlining: cost=" << IC.getCost()
+ << ", thres=" << IC.getThreshold()
<< ", Call: " << *CS.getInstruction() << "\n");
ORE.emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "TooCostly", Call)
<< NV("Callee", Callee) << " not inlined into "
- << NV("Caller", Caller) << " because too costly to inline " << IC;
+ << NV("Caller", Caller) << " because too costly to inline (cost="
+ << NV("Cost", IC.getCost())
+ << ", threshold=" << NV("Threshold", IC.getThreshold()) << ")";
});
- return IC;
+ return None;
}
int TotalSecondaryCost = 0;
@@ -454,7 +428,8 @@ shouldInline(CallSite CS, function_ref<InlineCost(CallSite CS)> GetInlineCost,
return None;
}
- LLVM_DEBUG(dbgs() << " Inlining " << inlineCostStr(IC)
+ LLVM_DEBUG(dbgs() << " Inlining: cost=" << IC.getCost()
+ << ", thres=" << IC.getThreshold()
<< ", Call: " << *CS.getInstruction() << '\n');
return IC;
}
@@ -486,18 +461,6 @@ bool LegacyInlinerBase::runOnSCC(CallGraphSCC &SCC) {
return inlineCalls(SCC);
}
-static void emit_inlined_into(OptimizationRemarkEmitter &ORE, DebugLoc &DLoc,
- const BasicBlock *Block, const Function &Callee,
- const Function &Caller, const InlineCost &IC) {
- ORE.emit([&]() {
- bool AlwaysInline = IC.isAlways();
- StringRef RemarkName = AlwaysInline ? "AlwaysInline" : "Inlined";
- return OptimizationRemark(DEBUG_TYPE, RemarkName, DLoc, Block)
- << ore::NV("Callee", &Callee) << " inlined into "
- << ore::NV("Caller", &Caller) << " with " << IC;
- });
-}
-
static bool
inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
std::function<AssumptionCache &(Function &)> GetAssumptionCache,
@@ -622,9 +585,8 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
Optional<InlineCost> OIC = shouldInline(CS, GetInlineCost, ORE);
// If the policy determines that we should inline this function,
// delete the call instead.
- if (!OIC || !*OIC) {
+ if (!OIC)
continue;
- }
// If this call site is dead and it is to a readonly function, we should
// just delete the call instead of trying to inline it, regardless of
@@ -644,21 +606,34 @@ inlineCallsImpl(CallGraphSCC &SCC, CallGraph &CG,
// Attempt to inline the function.
using namespace ore;
- InlineResult IR = InlineCallIfPossible(
- CS, InlineInfo, InlinedArrayAllocas, InlineHistoryID,
- InsertLifetime, AARGetter, ImportedFunctionsStats);
- if (!IR) {
+ if (!InlineCallIfPossible(CS, InlineInfo, InlinedArrayAllocas,
+ InlineHistoryID, InsertLifetime, AARGetter,
+ ImportedFunctionsStats)) {
ORE.emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc,
Block)
<< NV("Callee", Callee) << " will not be inlined into "
- << NV("Caller", Caller) << ": " << NV("Reason", IR.message);
+ << NV("Caller", Caller);
});
continue;
}
++NumInlined;
- emit_inlined_into(ORE, DLoc, Block, *Callee, *Caller, *OIC);
+ 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.
@@ -996,7 +971,7 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
Optional<InlineCost> OIC = shouldInline(CS, GetInlineCost, ORE);
// Check whether we want to inline this callsite.
- if (!OIC || !*OIC)
+ if (!OIC)
continue;
// Setup the data structure used to plumb customization into the
@@ -1012,19 +987,32 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,
using namespace ore;
- InlineResult IR = InlineFunction(CS, IFI);
- if (!IR) {
+ if (!InlineFunction(CS, IFI)) {
ORE.emit([&]() {
return OptimizationRemarkMissed(DEBUG_TYPE, "NotInlined", DLoc, Block)
<< NV("Callee", &Callee) << " will not be inlined into "
- << NV("Caller", &F) << ": " << NV("Reason", IR.message);
+ << NV("Caller", &F);
});
continue;
}
DidInline = true;
InlinedCallees.insert(&Callee);
- emit_inlined_into(ORE, DLoc, Block, Callee, F, *OIC);
+ 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()) {
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index f8226f529ee..ddc6e07e2f5 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -84,15 +84,13 @@ PreserveAlignmentAssumptions("preserve-alignment-assumptions-during-inlining",
cl::init(true), cl::Hidden,
cl::desc("Convert align attributes to assumptions during inlining."));
-llvm::InlineResult llvm::InlineFunction(CallInst *CI, InlineFunctionInfo &IFI,
- AAResults *CalleeAAR,
- bool InsertLifetime) {
+bool llvm::InlineFunction(CallInst *CI, InlineFunctionInfo &IFI,
+ AAResults *CalleeAAR, bool InsertLifetime) {
return InlineFunction(CallSite(CI), IFI, CalleeAAR, InsertLifetime);
}
-llvm::InlineResult llvm::InlineFunction(InvokeInst *II, InlineFunctionInfo &IFI,
- AAResults *CalleeAAR,
- bool InsertLifetime) {
+bool llvm::InlineFunction(InvokeInst *II, InlineFunctionInfo &IFI,
+ AAResults *CalleeAAR, bool InsertLifetime) {
return InlineFunction(CallSite(II), IFI, CalleeAAR, InsertLifetime);
}
@@ -1493,10 +1491,9 @@ static void updateCalleeCount(BlockFrequencyInfo *CallerBFI, BasicBlock *CallBB,
/// instruction 'call B' is inlined, and 'B' calls 'C', then the call to 'C' now
/// exists in the instruction stream. Similarly this will inline a recursive
/// function by one level.
-llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
- AAResults *CalleeAAR,
- bool InsertLifetime,
- Function *ForwardVarArgsTo) {
+bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
+ AAResults *CalleeAAR, bool InsertLifetime,
+ Function *ForwardVarArgsTo) {
Instruction *TheCall = CS.getInstruction();
assert(TheCall->getParent() && TheCall->getFunction()
&& "Instruction not in function!");
@@ -1507,7 +1504,7 @@ llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
Function *CalledFunc = CS.getCalledFunction();
if (!CalledFunc || // Can't inline external function or indirect
CalledFunc->isDeclaration()) // call!
- return "external or indirect";
+ return false;
// The inliner does not know how to inline through calls with operand bundles
// in general ...
@@ -1521,7 +1518,7 @@ llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
if (Tag == LLVMContext::OB_funclet)
continue;
- return "unsupported operand bundle";
+ return false;
}
}
@@ -1540,7 +1537,7 @@ llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
if (!Caller->hasGC())
Caller->setGC(CalledFunc->getGC());
else if (CalledFunc->getGC() != Caller->getGC())
- return "incompatible GC";
+ return false;
}
// Get the personality function from the callee if it contains a landing pad.
@@ -1564,7 +1561,7 @@ llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// TODO: This isn't 100% true. Some personality functions are proper
// supersets of others and can be used in place of the other.
else if (CalledPersonality != CallerPersonality)
- return "incompatible personality";
+ return false;
}
// We need to figure out which funclet the callsite was in so that we may
@@ -1589,7 +1586,7 @@ llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// for catchpads.
for (const BasicBlock &CalledBB : *CalledFunc) {
if (isa<CatchSwitchInst>(CalledBB.getFirstNonPHI()))
- return "catch in cleanup funclet";
+ return false;
}
}
} else if (isAsynchronousEHPersonality(Personality)) {
@@ -1597,7 +1594,7 @@ llvm::InlineResult llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI,
// funclet in the callee.
for (const BasicBlock &CalledBB : *CalledFunc) {
if (CalledBB.isEHPad())
- return "SEH in cleanup funclet";
+ return false;
}
}
}
OpenPOWER on IntegriCloud