diff --git a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h --- a/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h +++ b/llvm/include/llvm/Transforms/Utils/CallPromotionUtils.h @@ -14,9 +14,11 @@ #ifndef LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H #define LLVM_TRANSFORMS_UTILS_CALLPROMOTIONUTILS_H -#include "llvm/IR/CallSite.h" - namespace llvm { +class CallBase; +class CastInst; +class Function; +class MDNode; /// Return true if the given indirect call site can be made to call \p Callee. /// @@ -25,7 +27,7 @@ /// match exactly, they must at least be bitcast compatible. If \p FailureReason /// is non-null and the indirect call cannot be promoted, the failure reason /// will be stored in it. -bool isLegalToPromote(CallSite CS, Function *Callee, +bool isLegalToPromote(CallBase &CB, Function *Callee, const char **FailureReason = nullptr); /// Promote the given indirect call site to unconditionally call \p Callee. @@ -35,8 +37,8 @@ /// of the callee, bitcast instructions are inserted where appropriate. If \p /// RetBitCast is non-null, it will be used to store the return value bitcast, /// if created. -Instruction *promoteCall(CallSite CS, Function *Callee, - CastInst **RetBitCast = nullptr); +CallBase &promoteCall(CallBase &CB, Function *Callee, + CastInst **RetBitCast = nullptr); /// Promote the given indirect call site to conditionally call \p Callee. /// @@ -45,8 +47,8 @@ /// indirect call site is promoted, placed in the "then" block, and returned. If /// \p BranchWeights is non-null, it will be used to set !prof metadata on the /// new conditional branch. -Instruction *promoteCallWithIfThenElse(CallSite CS, Function *Callee, - MDNode *BranchWeights = nullptr); +CallBase &promoteCallWithIfThenElse(CallBase &CB, Function *Callee, + MDNode *BranchWeights = nullptr); /// Try to promote (devirtualize) a virtual call on an Alloca. Return true on /// success. @@ -69,7 +71,7 @@ /// [i8* null, i8* bitcast ({ i8*, i8*, i8* }* @_ZTI4Impl to i8*), /// i8* bitcast (void (%class.Impl*)* @_ZN4Impl3RunEv to i8*)] } /// -bool tryPromoteCall(CallSite &CS); +bool tryPromoteCall(CallBase &CB); } // end namespace llvm diff --git a/llvm/include/llvm/Transforms/Utils/Cloning.h b/llvm/include/llvm/Transforms/Utils/Cloning.h --- a/llvm/include/llvm/Transforms/Utils/Cloning.h +++ b/llvm/include/llvm/Transforms/Utils/Cloning.h @@ -22,7 +22,6 @@ #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/AssumptionCache.h" #include "llvm/Analysis/InlineCost.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/ValueHandle.h" #include "llvm/Transforms/Utils/ValueMapper.h" #include @@ -201,7 +200,7 @@ /// 'InlineFunction' fills this in by scanning the inlined instructions, and /// only if CG is null. If CG is non-null, instead the value handle /// `InlinedCalls` above is used. - SmallVector InlinedCallSites; + SmallVector InlinedCallSites; void reset() { StaticAllocas.clear(); diff --git a/llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp b/llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUFixFunctionBitcasts.cpp @@ -35,8 +35,9 @@ if (CS.getCalledFunction()) return; auto Callee = dyn_cast(CS.getCalledValue()->stripPointerCasts()); - if (Callee && isLegalToPromote(CS, Callee)) { - promoteCall(CS, Callee); + if (Callee && + isLegalToPromote(*cast(CS.getInstruction()), Callee)) { + promoteCall(*cast(CS.getInstruction()), Callee); Modified = true; } } diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -38,7 +38,6 @@ #include "llvm/Transforms/Utils/CallPromotionUtils.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/DataLayout.h" #include "llvm/IR/DebugLoc.h" #include "llvm/IR/DerivedTypes.h" @@ -1113,20 +1112,19 @@ InlineHistory.push_back({&Callee, InlineHistoryID}); // FIXME(mtrofin): refactor IFI.InlinedCallSites to be CallBase-based - for (CallSite &CS : reverse(IFI.InlinedCallSites)) { - Function *NewCallee = CS.getCalledFunction(); + for (CallBase *CS : reverse(IFI.InlinedCallSites)) { + Function *NewCallee = CS->getCalledFunction(); if (!NewCallee) { // Try to promote an indirect (virtual) call without waiting for the // post-inline cleanup and the next DevirtSCCRepeatedPass iteration // because the next iteration may not happen and we may miss // inlining it. - if (tryPromoteCall(CS)) - NewCallee = CS.getCalledFunction(); + if (tryPromoteCall(*CS)) + NewCallee = CS->getCalledFunction(); } if (NewCallee) if (!NewCallee->isDeclaration()) - Calls.push_back( - {cast(CS.getInstruction()), NewHistoryID}); + Calls.push_back({CS, NewHistoryID}); } } diff --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp --- a/llvm/lib/Transforms/IPO/SampleProfile.cpp +++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp @@ -46,7 +46,6 @@ #include "llvm/Analysis/TargetTransformInfo.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DebugLoc.h" #include "llvm/IR/DiagnosticInfo.h" @@ -984,6 +983,8 @@ "ProfAccForSymsInList should be false when profile-sample-accurate " "is enabled"); + // FIXME(CallSite): refactor the vectors here, as they operate with CallBase + // values DenseMap localNotInlinedCallSites; bool Changed = false; while (true) { @@ -1047,7 +1048,7 @@ if (R != SymbolMap.end() && R->getValue() && !R->getValue()->isDeclaration() && R->getValue()->getSubprogram() && - isLegalToPromote(CallSite(I), R->getValue(), &Reason)) { + isLegalToPromote(*cast(I), R->getValue(), &Reason)) { uint64_t C = FS->getEntrySamples(); Instruction *DI = pgo::promoteIndirectCall(I, R->getValue(), C, Sum, false, ORE); diff --git a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp --- a/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp +++ b/llvm/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp @@ -23,7 +23,6 @@ #include "llvm/Analysis/ProfileSummaryInfo.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Function.h" @@ -217,6 +216,7 @@ // Indirect-call promotion heuristic. The direct targets are sorted based on // the count. Stop at the first target that is not promoted. +// FIXME(callsite): the Instruction* parameter can be changed to CallBase std::vector ICallPromotionFunc::getPromotionCandidatesForCallSite( Instruction *Inst, const ArrayRef &ValueDataRef, @@ -276,7 +276,7 @@ } const char *Reason = nullptr; - if (!isLegalToPromote(CallSite(Inst), TargetFunction, &Reason)) { + if (!isLegalToPromote(*cast(Inst), TargetFunction, &Reason)) { using namespace ore; ORE.emit([&]() { @@ -294,6 +294,8 @@ return Ret; } +// FIXME(callsite): the Instruction* parameter and return can be changed to +// CallBase Instruction *llvm::pgo::promoteIndirectCall(Instruction *Inst, Function *DirectCallee, uint64_t Count, uint64_t TotalCount, @@ -307,12 +309,12 @@ MDNode *BranchWeights = MDB.createBranchWeights( scaleBranchCount(Count, Scale), scaleBranchCount(ElseCount, Scale)); - Instruction *NewInst = - promoteCallWithIfThenElse(CallSite(Inst), DirectCallee, BranchWeights); + CallBase &NewInst = promoteCallWithIfThenElse(*cast(Inst), + DirectCallee, BranchWeights); if (AttachProfToDirectCall) { - MDBuilder MDB(NewInst->getContext()); - NewInst->setMetadata( + MDBuilder MDB(NewInst.getContext()); + NewInst.setMetadata( LLVMContext::MD_prof, MDB.createBranchWeights({static_cast(Count)})); } @@ -326,7 +328,7 @@ << " with count " << NV("Count", Count) << " out of " << NV("TotalCount", TotalCount); }); - return NewInst; + return &NewInst; } // Promote indirect-call to conditional direct-call for one callsite. diff --git a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp --- a/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp +++ b/llvm/lib/Transforms/Utils/CallPromotionUtils.cpp @@ -15,6 +15,7 @@ #include "llvm/Analysis/Loads.h" #include "llvm/Analysis/TypeMetadataUtils.h" #include "llvm/IR/IRBuilder.h" +#include "llvm/IR/Instructions.h" #include "llvm/Transforms/Utils/BasicBlockUtils.h" using namespace llvm; @@ -160,32 +161,31 @@ /// %t1 = bitcast i32 %t0 to ... /// br label %normal_dst /// -static void createRetBitCast(CallSite CS, Type *RetTy, CastInst **RetBitCast) { +static void createRetBitCast(CallBase &CB, Type *RetTy, CastInst **RetBitCast) { // Save the users of the calling instruction. These uses will be changed to // use the bitcast after we create it. SmallVector UsersToUpdate; - for (User *U : CS.getInstruction()->users()) + for (User *U : CB.users()) UsersToUpdate.push_back(U); // Determine an appropriate location to create the bitcast for the return // value. The location depends on if we have a call or invoke instruction. Instruction *InsertBefore = nullptr; - if (auto *Invoke = dyn_cast(CS.getInstruction())) + if (auto *Invoke = dyn_cast(&CB)) InsertBefore = &SplitEdge(Invoke->getParent(), Invoke->getNormalDest())->front(); else - InsertBefore = &*std::next(CS.getInstruction()->getIterator()); + InsertBefore = &*std::next(CB.getIterator()); // Bitcast the return value to the correct type. - auto *Cast = CastInst::CreateBitOrPointerCast(CS.getInstruction(), RetTy, "", - InsertBefore); + auto *Cast = CastInst::CreateBitOrPointerCast(&CB, RetTy, "", InsertBefore); if (RetBitCast) *RetBitCast = Cast; // Replace all the original uses of the calling instruction with the bitcast. for (User *U : UsersToUpdate) - U->replaceUsesOfWith(CS.getInstruction(), Cast); + U->replaceUsesOfWith(&CB, Cast); } /// Predicate and clone the given call site. @@ -255,26 +255,25 @@ /// %t2 = phi i32 [ %t0, %else_bb ], [ %t1, %then_bb ] /// br %normal_dst /// -static Instruction *versionCallSite(CallSite CS, Value *Callee, - MDNode *BranchWeights) { +static CallBase &versionCallSite(CallBase &CB, Value *Callee, + MDNode *BranchWeights) { - IRBuilder<> Builder(CS.getInstruction()); - Instruction *OrigInst = CS.getInstruction(); + IRBuilder<> Builder(&CB); + CallBase *OrigInst = &CB; BasicBlock *OrigBlock = OrigInst->getParent(); // Create the compare. The called value and callee must have the same type to // be compared. - if (CS.getCalledValue()->getType() != Callee->getType()) - Callee = Builder.CreateBitCast(Callee, CS.getCalledValue()->getType()); - auto *Cond = Builder.CreateICmpEQ(CS.getCalledValue(), Callee); + if (CB.getCalledValue()->getType() != Callee->getType()) + Callee = Builder.CreateBitCast(Callee, CB.getCalledValue()->getType()); + auto *Cond = Builder.CreateICmpEQ(CB.getCalledValue(), Callee); // Create an if-then-else structure. The original instruction is moved into // the "else" block, and a clone of the original instruction is placed in the // "then" block. Instruction *ThenTerm = nullptr; Instruction *ElseTerm = nullptr; - SplitBlockAndInsertIfThenElse(Cond, CS.getInstruction(), &ThenTerm, &ElseTerm, - BranchWeights); + SplitBlockAndInsertIfThenElse(Cond, &CB, &ThenTerm, &ElseTerm, BranchWeights); BasicBlock *ThenBlock = ThenTerm->getParent(); BasicBlock *ElseBlock = ElseTerm->getParent(); BasicBlock *MergeBlock = OrigInst->getParent(); @@ -283,7 +282,7 @@ ElseBlock->setName("if.false.orig_indirect"); MergeBlock->setName("if.end.icp"); - Instruction *NewInst = OrigInst->clone(); + CallBase *NewInst = cast(OrigInst->clone()); OrigInst->moveBefore(ElseTerm); NewInst->insertBefore(ThenTerm); @@ -315,18 +314,18 @@ // Create a phi node for the returned value of the call site. createRetPHINode(OrigInst, NewInst, MergeBlock, Builder); - return NewInst; + return *NewInst; } -bool llvm::isLegalToPromote(CallSite CS, Function *Callee, +bool llvm::isLegalToPromote(CallBase &CB, Function *Callee, const char **FailureReason) { - assert(!CS.getCalledFunction() && "Only indirect call sites can be promoted"); + assert(!CB.getCalledFunction() && "Only indirect call sites can be promoted"); auto &DL = Callee->getParent()->getDataLayout(); // Check the return type. The callee's return value type must be bitcast // compatible with the call site's type. - Type *CallRetTy = CS.getInstruction()->getType(); + Type *CallRetTy = CB.getType(); Type *FuncRetTy = Callee->getReturnType(); if (CallRetTy != FuncRetTy) if (!CastInst::isBitOrNoopPointerCastable(FuncRetTy, CallRetTy, DL)) { @@ -340,7 +339,7 @@ // Check the number of arguments. The callee and call site must agree on the // number of arguments. - if (CS.arg_size() != NumParams && !Callee->isVarArg()) { + if (CB.arg_size() != NumParams && !Callee->isVarArg()) { if (FailureReason) *FailureReason = "The number of arguments mismatch"; return false; @@ -351,7 +350,7 @@ // site. for (unsigned I = 0; I < NumParams; ++I) { Type *FormalTy = Callee->getFunctionType()->getFunctionParamType(I); - Type *ActualTy = CS.getArgument(I)->getType(); + Type *ActualTy = CB.getArgOperand(I)->getType(); if (FormalTy == ActualTy) continue; if (!CastInst::isBitOrNoopPointerCastable(ActualTy, FormalTy, DL)) { @@ -364,31 +363,31 @@ return true; } -Instruction *llvm::promoteCall(CallSite CS, Function *Callee, - CastInst **RetBitCast) { - assert(!CS.getCalledFunction() && "Only indirect call sites can be promoted"); +CallBase &llvm::promoteCall(CallBase &CB, Function *Callee, + CastInst **RetBitCast) { + assert(!CB.getCalledFunction() && "Only indirect call sites can be promoted"); // Set the called function of the call site to be the given callee (but don't // change the type). - cast(CS.getInstruction())->setCalledOperand(Callee); + CB.setCalledOperand(Callee); // Since the call site will no longer be direct, we must clear metadata that // is only appropriate for indirect calls. This includes !prof and !callees // metadata. - CS.getInstruction()->setMetadata(LLVMContext::MD_prof, nullptr); - CS.getInstruction()->setMetadata(LLVMContext::MD_callees, nullptr); + CB.setMetadata(LLVMContext::MD_prof, nullptr); + CB.setMetadata(LLVMContext::MD_callees, nullptr); // If the function type of the call site matches that of the callee, no // additional work is required. - if (CS.getFunctionType() == Callee->getFunctionType()) - return CS.getInstruction(); + if (CB.getFunctionType() == Callee->getFunctionType()) + return CB; // Save the return types of the call site and callee. - Type *CallSiteRetTy = CS.getInstruction()->getType(); + Type *CallSiteRetTy = CB.getType(); Type *CalleeRetTy = Callee->getReturnType(); // Change the function type of the call site the match that of the callee. - CS.mutateFunctionType(Callee->getFunctionType()); + CB.mutateFunctionType(Callee->getFunctionType()); // Inspect the arguments of the call site. If an argument's type doesn't // match the corresponding formal argument's type in the callee, bitcast it @@ -397,19 +396,18 @@ auto CalleeParamNum = CalleeType->getNumParams(); LLVMContext &Ctx = Callee->getContext(); - const AttributeList &CallerPAL = CS.getAttributes(); + const AttributeList &CallerPAL = CB.getAttributes(); // The new list of argument attributes. SmallVector NewArgAttrs; bool AttributeChanged = false; for (unsigned ArgNo = 0; ArgNo < CalleeParamNum; ++ArgNo) { - auto *Arg = CS.getArgument(ArgNo); + auto *Arg = CB.getArgOperand(ArgNo); Type *FormalTy = CalleeType->getParamType(ArgNo); Type *ActualTy = Arg->getType(); if (FormalTy != ActualTy) { - auto *Cast = CastInst::CreateBitOrPointerCast(Arg, FormalTy, "", - CS.getInstruction()); - CS.setArgument(ArgNo, Cast); + auto *Cast = CastInst::CreateBitOrPointerCast(Arg, FormalTy, "", &CB); + CB.setArgOperand(ArgNo, Cast); // Remove any incompatible attributes for the argument. AttrBuilder ArgAttrs(CallerPAL.getParamAttributes(ArgNo)); @@ -434,37 +432,37 @@ // Remove any incompatible return value attribute. AttrBuilder RAttrs(CallerPAL, AttributeList::ReturnIndex); if (!CallSiteRetTy->isVoidTy() && CallSiteRetTy != CalleeRetTy) { - createRetBitCast(CS, CallSiteRetTy, RetBitCast); + createRetBitCast(CB, CallSiteRetTy, RetBitCast); RAttrs.remove(AttributeFuncs::typeIncompatible(CalleeRetTy)); AttributeChanged = true; } // Set the new callsite attribute. if (AttributeChanged) - CS.setAttributes(AttributeList::get(Ctx, CallerPAL.getFnAttributes(), + CB.setAttributes(AttributeList::get(Ctx, CallerPAL.getFnAttributes(), AttributeSet::get(Ctx, RAttrs), NewArgAttrs)); - return CS.getInstruction(); + return CB; } -Instruction *llvm::promoteCallWithIfThenElse(CallSite CS, Function *Callee, - MDNode *BranchWeights) { +CallBase &llvm::promoteCallWithIfThenElse(CallBase &CB, Function *Callee, + MDNode *BranchWeights) { // Version the indirect call site. If the called value is equal to the given // callee, 'NewInst' will be executed, otherwise the original call site will // be executed. - Instruction *NewInst = versionCallSite(CS, Callee, BranchWeights); + CallBase &NewInst = versionCallSite(CB, Callee, BranchWeights); // Promote 'NewInst' so that it directly calls the desired function. - return promoteCall(CallSite(NewInst), Callee); + return promoteCall(NewInst, Callee); } -bool llvm::tryPromoteCall(CallSite &CS) { - assert(!CS.getCalledFunction()); - Module *M = CS.getCaller()->getParent(); +bool llvm::tryPromoteCall(CallBase &CB) { + assert(!CB.getCalledFunction()); + Module *M = CB.getCaller()->getParent(); const DataLayout &DL = M->getDataLayout(); - Value *Callee = CS.getCalledValue(); + Value *Callee = CB.getCalledValue(); LoadInst *VTableEntryLoad = dyn_cast(Callee); if (!VTableEntryLoad) @@ -511,11 +509,11 @@ if (!DirectCallee) return false; // No function pointer found. - if (!isLegalToPromote(CS, DirectCallee)) + if (!isLegalToPromote(CB, DirectCallee)) return false; // Success. - promoteCall(CS, DirectCallee); + promoteCall(CB, DirectCallee); return true; } diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -34,7 +34,6 @@ #include "llvm/IR/Argument.h" #include "llvm/IR/BasicBlock.h" #include "llvm/IR/CFG.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" #include "llvm/IR/DIBuilder.h" @@ -2350,8 +2349,8 @@ for (BasicBlock &NewBB : make_range(FirstNewBlock->getIterator(), Caller->end())) for (Instruction &I : NewBB) - if (auto CS = CallSite(&I)) - IFI.InlinedCallSites.push_back(CS); + if (auto *CB = dyn_cast(&I)) + IFI.InlinedCallSites.push_back(CB); } // If we cloned in _exactly one_ basic block, and if that block ends in a diff --git a/llvm/unittests/Transforms/Utils/CallPromotionUtilsTest.cpp b/llvm/unittests/Transforms/Utils/CallPromotionUtilsTest.cpp --- a/llvm/unittests/Transforms/Utils/CallPromotionUtilsTest.cpp +++ b/llvm/unittests/Transforms/Utils/CallPromotionUtilsTest.cpp @@ -61,14 +61,14 @@ Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_TRUE(IsPromoted); GV = M->getNamedValue("_ZN4Impl3RunEv"); ASSERT_TRUE(GV); auto *F1 = dyn_cast(GV); - EXPECT_EQ(F1, CS.getCalledFunction()); + EXPECT_EQ(F1, CB.getCalledFunction()); } TEST(CallPromotionUtilsTest, TryPromoteCall_NoFPLoad) { @@ -92,9 +92,9 @@ Instruction *Inst = &F->front().front(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_FALSE(IsPromoted); } @@ -120,9 +120,9 @@ Instruction *Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_FALSE(IsPromoted); } @@ -156,9 +156,9 @@ Instruction *Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_FALSE(IsPromoted); } @@ -199,9 +199,9 @@ Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_FALSE(IsPromoted); } @@ -242,9 +242,9 @@ Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_FALSE(IsPromoted); } @@ -302,7 +302,7 @@ Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS1(CI); + CallBase &CS1 = *CI; ASSERT_FALSE(CS1.getCalledFunction()); bool IsPromoted1 = tryPromoteCall(CS1); EXPECT_TRUE(IsPromoted1); @@ -321,7 +321,7 @@ Inst = &*++F->front().rbegin(); CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS2(CI); + CallBase &CS2 = *CI; ASSERT_FALSE(CS2.getCalledFunction()); bool IsPromoted2 = tryPromoteCall(CS2); EXPECT_TRUE(IsPromoted2); @@ -372,8 +372,8 @@ Inst = &*++F->front().rbegin(); auto *CI = dyn_cast(Inst); ASSERT_TRUE(CI); - CallSite CS(CI); - ASSERT_FALSE(CS.getCalledFunction()); - bool IsPromoted = tryPromoteCall(CS); + CallBase &CB = *CI; + ASSERT_FALSE(CB.getCalledFunction()); + bool IsPromoted = tryPromoteCall(CB); EXPECT_FALSE(IsPromoted); }