diff options
Diffstat (limited to 'llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp')
-rw-r--r-- | llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp index 7a01ec967fb5..ac1db27f5e64 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp @@ -41,7 +41,7 @@ namespace { void getAnalysisUsage(AnalysisUsage &AU) const override; bool runOnModule(Module &M) override; - static bool MayAutorelease(ImmutableCallSite CS, unsigned Depth = 0); + static bool MayAutorelease(const CallBase &CB, unsigned Depth = 0); static bool OptimizeBB(BasicBlock *BB); public: @@ -68,18 +68,17 @@ void ObjCARCAPElim::getAnalysisUsage(AnalysisUsage &AU) const { /// Interprocedurally determine if calls made by the given call site can /// possibly produce autoreleases. -bool ObjCARCAPElim::MayAutorelease(ImmutableCallSite CS, unsigned Depth) { - if (const Function *Callee = CS.getCalledFunction()) { +bool ObjCARCAPElim::MayAutorelease(const CallBase &CB, unsigned Depth) { + if (const Function *Callee = CB.getCalledFunction()) { if (!Callee->hasExactDefinition()) return true; for (const BasicBlock &BB : *Callee) { for (const Instruction &I : BB) - if (ImmutableCallSite JCS = ImmutableCallSite(&I)) + if (const CallBase *JCB = dyn_cast<CallBase>(&I)) // This recursion depth limit is arbitrary. It's just great // enough to cover known interesting testcases. - if (Depth < 3 && - !JCS.onlyReadsMemory() && - MayAutorelease(JCS, Depth + 1)) + if (Depth < 3 && !JCB->onlyReadsMemory() && + MayAutorelease(*JCB, Depth + 1)) return true; } return false; @@ -115,7 +114,7 @@ bool ObjCARCAPElim::OptimizeBB(BasicBlock *BB) { Push = nullptr; break; case ARCInstKind::CallOrUser: - if (MayAutorelease(ImmutableCallSite(Inst))) + if (MayAutorelease(cast<CallBase>(*Inst))) Push = nullptr; break; default: |