]> granicus.if.org Git - llvm/commitdiff
[InlineFunction] use getCaller(); NFCI
authorSanjay Patel <spatel@rotateright.com>
Wed, 15 Feb 2017 15:08:38 +0000 (15:08 +0000)
committerSanjay Patel <spatel@rotateright.com>
Wed, 15 Feb 2017 15:08:38 +0000 (15:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295181 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/InlineFunction.cpp

index cc83ee7bafce6b83add6d28d24fce60422416fc1..f6f155691dd12a7a52cd20c49acf0b9e15dc07ee 100644 (file)
@@ -1112,8 +1112,7 @@ static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI) {
     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(CallSite CS,
                                          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];