mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 05:25:47 +00:00
[objc-arc] Refactored OptimizeReturns so that it uses continue instead of a large multi-level nested if statement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179964 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -2965,21 +2965,32 @@ void ObjCARCOpt::OptimizeReturns(Function &F) {
|
|||||||
FindPredecessorAutoreleaseWithSafePath(Arg, BB, Ret,
|
FindPredecessorAutoreleaseWithSafePath(Arg, BB, Ret,
|
||||||
DependingInstructions, Visited,
|
DependingInstructions, Visited,
|
||||||
PA);
|
PA);
|
||||||
if (Autorelease) {
|
|
||||||
DependingInstructions.clear();
|
DependingInstructions.clear();
|
||||||
Visited.clear();
|
Visited.clear();
|
||||||
|
|
||||||
|
if (!Autorelease)
|
||||||
|
continue;
|
||||||
|
|
||||||
CallInst *Retain =
|
CallInst *Retain =
|
||||||
FindPredecessorRetainWithSafePath(Arg, BB, Autorelease,
|
FindPredecessorRetainWithSafePath(Arg, BB, Autorelease,
|
||||||
DependingInstructions, Visited, PA);
|
DependingInstructions, Visited, PA);
|
||||||
if (Retain) {
|
|
||||||
DependingInstructions.clear();
|
DependingInstructions.clear();
|
||||||
Visited.clear();
|
Visited.clear();
|
||||||
|
|
||||||
|
if (!Retain)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Check that there is nothing that can affect the reference count
|
// Check that there is nothing that can affect the reference count
|
||||||
// between the retain and the call. Note that Retain need not be in BB.
|
// between the retain and the call. Note that Retain need not be in BB.
|
||||||
if (HasSafePathToPredecessorCall(Arg, Retain, DependingInstructions,
|
bool HasSafePathToCall = HasSafePathToPredecessorCall(Arg, Retain,
|
||||||
Visited, PA)) {
|
DependingInstructions,
|
||||||
|
Visited, PA);
|
||||||
|
DependingInstructions.clear();
|
||||||
|
Visited.clear();
|
||||||
|
|
||||||
|
if (!HasSafePathToCall)
|
||||||
|
continue;
|
||||||
|
|
||||||
// If so, we can zap the retain and autorelease.
|
// If so, we can zap the retain and autorelease.
|
||||||
Changed = true;
|
Changed = true;
|
||||||
++NumRets;
|
++NumRets;
|
||||||
@@ -2988,12 +2999,6 @@ void ObjCARCOpt::OptimizeReturns(Function &F) {
|
|||||||
EraseInstruction(Retain);
|
EraseInstruction(Retain);
|
||||||
EraseInstruction(Autorelease);
|
EraseInstruction(Autorelease);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DependingInstructions.clear();
|
|
||||||
Visited.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjCARCOpt::doInitialization(Module &M) {
|
bool ObjCARCOpt::doInitialization(Module &M) {
|
||||||
|
Reference in New Issue
Block a user