diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp --- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp +++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp @@ -10,7 +10,6 @@ #include "llvm/Analysis/StackSafetyAnalysis.h" #include "llvm/Analysis/ScalarEvolutionExpressions.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/InstIterator.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/InitializePasses.h" @@ -340,7 +339,7 @@ case Instruction::Call: case Instruction::Invoke: { - ImmutableCallSite CS(I); + const auto &CB = cast(*I); if (I->isLifetimeStartOrEnd()) break; @@ -354,7 +353,7 @@ // Do not follow aliases, otherwise we could inadvertently follow // dso_preemptable aliases or aliases with interposable linkage. const GlobalValue *Callee = - dyn_cast(CS.getCalledValue()->stripPointerCasts()); + dyn_cast(CB.getCalledValue()->stripPointerCasts()); if (!Callee) { US.updateRange(UnknownRange); return false; @@ -362,8 +361,8 @@ assert(isa(Callee) || isa(Callee)); - ImmutableCallSite::arg_iterator B = CS.arg_begin(), E = CS.arg_end(); - for (ImmutableCallSite::arg_iterator A = B; A != E; ++A) { + auto B = CB.arg_begin(), E = CB.arg_end(); + for (auto A = B; A != E; ++A) { if (A->get() == V) { ConstantRange Offset = offsetFromAlloca(UI, Ptr); US.Calls.emplace_back(Callee, A - B, Offset); diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -31,7 +31,6 @@ #include "llvm/Config/llvm-config.h" #include "llvm/IR/Attributes.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/CallSite.h" #include "llvm/IR/Comdat.h" #include "llvm/IR/Constant.h" #include "llvm/IR/Constants.h" @@ -374,7 +373,7 @@ void writeModuleConstants(); bool pushValueAndType(const Value *V, unsigned InstID, SmallVectorImpl &Vals); - void writeOperandBundles(ImmutableCallSite CS, unsigned InstID); + void writeOperandBundles(const CallBase &CB, unsigned InstID); void pushValue(const Value *V, unsigned InstID, SmallVectorImpl &Vals); void pushValueSigned(const Value *V, unsigned InstID, @@ -2583,10 +2582,10 @@ return false; } -void ModuleBitcodeWriter::writeOperandBundles(ImmutableCallSite CS, +void ModuleBitcodeWriter::writeOperandBundles(const CallBase &CS, unsigned InstID) { SmallVector Record; - LLVMContext &C = CS.getInstruction()->getContext(); + LLVMContext &C = CS.getContext(); for (unsigned i = 0, e = CS.getNumOperandBundles(); i != e; ++i) { const auto &Bundle = CS.getOperandBundleAt(i); @@ -2778,7 +2777,7 @@ FunctionType *FTy = II->getFunctionType(); if (II->hasOperandBundles()) - writeOperandBundles(II, InstID); + writeOperandBundles(*II, InstID); Code = bitc::FUNC_CODE_INST_INVOKE; @@ -2854,7 +2853,7 @@ FunctionType *FTy = CBI->getFunctionType(); if (CBI->hasOperandBundles()) - writeOperandBundles(CBI, InstID); + writeOperandBundles(*CBI, InstID); Code = bitc::FUNC_CODE_INST_CALLBR; @@ -3011,7 +3010,7 @@ FunctionType *FTy = CI.getFunctionType(); if (CI.hasOperandBundles()) - writeOperandBundles(&CI, InstID); + writeOperandBundles(CI, InstID); Code = bitc::FUNC_CODE_INST_CALL; diff --git a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp --- a/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp +++ b/llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp @@ -95,10 +95,9 @@ // of any other dynamic reference-counted pointers. if (!IsPotentialRetainableObjPtr(ICI->getOperand(1), *PA.getAA())) return false; - } else if (auto CS = ImmutableCallSite(Inst)) { + } else if (const auto *CS = dyn_cast(Inst)) { // For calls, just check the arguments (and not the callee operand). - for (ImmutableCallSite::arg_iterator OI = CS.arg_begin(), - OE = CS.arg_end(); OI != OE; ++OI) { + for (auto OI = CS->arg_begin(), OE = CS->arg_end(); OI != OE; ++OI) { const Value *Op = *OI; if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) && PA.related(Ptr, Op, DL)) diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -115,8 +115,7 @@ /// return value. We do this late so we do not disrupt the dataflow analysis in /// ObjCARCOpt. bool ObjCARCContract::optimizeRetainCall(Function &F, Instruction *Retain) { - ImmutableCallSite CS(GetArgRCIdentityRoot(Retain)); - const Instruction *Call = CS.getInstruction(); + const auto *Call = dyn_cast(GetArgRCIdentityRoot(Retain)); if (!Call) return false; if (Call->getParent() != Retain->getParent())