From: Davide Italiano Date: Thu, 30 Nov 2017 22:10:35 +0000 (+0000) Subject: [InlineCost] Prefer getFunction() to two calls to getParent(). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=156f91323f9db898256484d1bd503bed23a1a5e1;p=llvm [InlineCost] Prefer getFunction() to two calls to getParent(). Improves clarity, also slightly cheaper. NFCI. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319481 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp index b7fe884cc22..8fd74ccdc50 100644 --- a/lib/Analysis/InlineCost.cpp +++ b/lib/Analysis/InlineCost.cpp @@ -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; @@ -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; }