diff options
author | Dan Gohman <gohman@apple.com> | 2012-05-09 23:08:33 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-05-09 23:08:33 +0000 |
commit | 95b8cf1f11fa2582d05f87a83a580e92afd5500d (patch) | |
tree | 1417fbd27d85f8937d80ba0faceca702ca09a31f /lib | |
parent | ca313e1efa98910a7a5e7f4bf2ac1a70adb6e4fe (diff) |
Fix the objc_storeStrong recognizer to stop before walking off the
end of a basic block if there's no store.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156520 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/ObjCARC.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/ObjCARC.cpp b/lib/Transforms/Scalar/ObjCARC.cpp index 5d6e1a7d9f..ce4a195d95 100644 --- a/lib/Transforms/Scalar/ObjCARC.cpp +++ b/lib/Transforms/Scalar/ObjCARC.cpp @@ -3902,12 +3902,15 @@ void ObjCARCContract::ContractRelease(Instruction *Release, if (Load->getParent() != BB) return; // Walk down to find the store and the release, which may be in either order. - BasicBlock::iterator I = Load; + BasicBlock::iterator I = Load, End = BB->end(); ++I; AliasAnalysis::Location Loc = AA->getLocation(Load); StoreInst *Store = 0; bool SawRelease = false; for (; !Store || !SawRelease; ++I) { + if (I == End) + return; + Instruction *Inst = I; if (Inst == Release) { SawRelease = true; |