@@ -41,7 +41,7 @@ namespace {
4141 void getAnalysisUsage (AnalysisUsage &AU) const override ;
4242 bool runOnModule (Module &M) override ;
4343
44- static bool MayAutorelease (ImmutableCallSite CS , unsigned Depth = 0 );
44+ static bool MayAutorelease (const CallBase &CB , unsigned Depth = 0 );
4545 static bool OptimizeBB (BasicBlock *BB);
4646
4747 public:
@@ -68,18 +68,17 @@ void ObjCARCAPElim::getAnalysisUsage(AnalysisUsage &AU) const {
6868
6969// / Interprocedurally determine if calls made by the given call site can
7070// / possibly produce autoreleases.
71- bool ObjCARCAPElim::MayAutorelease (ImmutableCallSite CS , unsigned Depth) {
72- if (const Function *Callee = CS .getCalledFunction ()) {
71+ bool ObjCARCAPElim::MayAutorelease (const CallBase &CB , unsigned Depth) {
72+ if (const Function *Callee = CB .getCalledFunction ()) {
7373 if (!Callee->hasExactDefinition ())
7474 return true ;
7575 for (const BasicBlock &BB : *Callee) {
7676 for (const Instruction &I : BB)
77- if (ImmutableCallSite JCS = ImmutableCallSite (&I))
77+ if (const CallBase *JCB = dyn_cast<CallBase> (&I))
7878 // This recursion depth limit is arbitrary. It's just great
7979 // enough to cover known interesting testcases.
80- if (Depth < 3 &&
81- !JCS.onlyReadsMemory () &&
82- MayAutorelease (JCS, Depth + 1 ))
80+ if (Depth < 3 && !JCB->onlyReadsMemory () &&
81+ MayAutorelease (*JCB, Depth + 1 ))
8382 return true ;
8483 }
8584 return false ;
@@ -115,7 +114,7 @@ bool ObjCARCAPElim::OptimizeBB(BasicBlock *BB) {
115114 Push = nullptr ;
116115 break ;
117116 case ARCInstKind::CallOrUser:
118- if (MayAutorelease (ImmutableCallSite ( Inst)))
117+ if (MayAutorelease (cast<CallBase>(* Inst)))
119118 Push = nullptr ;
120119 break ;
121120 default :
0 commit comments