Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ bool MayAutorelease(const CallBase &CB, unsigned Depth = 0) {
if (const Function *Callee = CB.getCalledFunction()) {
if (!Callee->hasExactDefinition())
return true;
// This recursion depth limit is arbitrary. It's just great
// enough to cover known interesting testcases.
if (Depth > 16)
return false;
for (const BasicBlock &BB : *Callee) {
for (const Instruction &I : BB)
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 && !JCB->onlyReadsMemory() &&
MayAutorelease(*JCB, Depth + 1))
if (!JCB->onlyReadsMemory() && MayAutorelease(*JCB, Depth + 1))
return true;
}
return false;
Expand Down
Loading