[llvm] r295181 - [InlineFunction] use getCaller(); NFCI

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 07:08:38 PST 2017


Author: spatel
Date: Wed Feb 15 09:08:38 2017
New Revision: 295181

URL: http://llvm.org/viewvc/llvm-project?rev=295181&view=rev
Log:
[InlineFunction] use getCaller(); NFCI

Modified:
    llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp

Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=295181&r1=295180&r2=295181&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Wed Feb 15 09:08:38 2017
@@ -1112,8 +1112,7 @@ static void AddAlignmentAssumptions(Call
     unsigned Align = Arg.getType()->isPointerTy() ? Arg.getParamAlignment() : 0;
     if (Align && !Arg.hasByValOrInAllocaAttr() && !Arg.hasNUses(0)) {
       if (!DTCalculated) {
-        DT.recalculate(const_cast<Function&>(*CS.getInstruction()->getParent()
-                                               ->getParent()));
+        DT.recalculate(*CS.getCaller());
         DTCalculated = true;
       }
 
@@ -1139,7 +1138,7 @@ static void UpdateCallGraphAfterInlining
                                          ValueToValueMapTy &VMap,
                                          InlineFunctionInfo &IFI) {
   CallGraph &CG = *IFI.CG;
-  const Function *Caller = CS.getInstruction()->getParent()->getParent();
+  const Function *Caller = CS.getCaller();
   const Function *Callee = CS.getCalledFunction();
   CallGraphNode *CalleeNode = CG[Callee];
   CallGraphNode *CallerNode = CG[Caller];




More information about the llvm-commits mailing list