Skip to content

Commit

Permalink
[InlineCost] Prefer getFunction() to two calls to getParent().
Browse files Browse the repository at this point in the history
Improves clarity, also slightly cheaper. NFCI.

llvm-svn: 319481
  • Loading branch information
dcci committed Nov 30, 2017
1 parent a7ac2cb commit 9d939c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Analysis/InlineCost.cpp
Expand Up @@ -1103,7 +1103,7 @@ bool CallAnalyzer::visitCallSite(CallSite CS) {
}
}

if (F == CS.getInstruction()->getParent()->getParent()) {
if (F == CS.getInstruction()->getFunction()) {
// This flag will fully abort the analysis, so don't bother with anything
// else.
IsRecursiveCall = true;
Expand Down Expand Up @@ -1559,14 +1559,14 @@ bool CallAnalyzer::analyzeCall(CallSite CS) {
if (F.empty())
return true;

Function *Caller = CS.getInstruction()->getParent()->getParent();
Function *Caller = CS.getInstruction()->getFunction();
// Check if the caller function is recursive itself.
for (User *U : Caller->users()) {
CallSite Site(U);
if (!Site)
continue;
Instruction *I = Site.getInstruction();
if (I->getParent()->getParent() == Caller) {
if (I->getFunction() == Caller) {
IsCallerRecursive = true;
break;
}
Expand Down

0 comments on commit 9d939c8

Please sign in to comment.