diff options
author | Dan Gohman <gohman@apple.com> | 2012-02-13 22:57:02 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-02-13 22:57:02 +0000 |
commit | eb6e01533aeb86b5a2df6a373803350bb56ed555 (patch) | |
tree | fb8b57d991e1571dd4c4dd6122dd9812b3d8aebc /llvm/lib/Transforms | |
parent | e2a0e4163a7eab225de1a9b83434cddf6695012e (diff) | |
download | bcm5719-llvm-eb6e01533aeb86b5a2df6a373803350bb56ed555.tar.gz bcm5719-llvm-eb6e01533aeb86b5a2df6a373803350bb56ed555.zip |
Just like in regular escape analysis, loads and stores through
(but not of) a block pointer do not cause the block pointer to
escape. This fixes rdar://10803830.
llvm-svn: 150424
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/ObjCARC.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/ObjCARC.cpp b/llvm/lib/Transforms/Scalar/ObjCARC.cpp index 928440150c2..673e1a4bbb4 100644 --- a/llvm/lib/Transforms/Scalar/ObjCARC.cpp +++ b/llvm/lib/Transforms/Scalar/ObjCARC.cpp @@ -618,11 +618,21 @@ static bool DoesObjCBlockEscape(const Value *BlockPtr) { // to be an escape. if (isa<CallInst>(UUser) || isa<InvokeInst>(UUser)) continue; + // Use by an instruction which copies the value is an escape if the + // result is an escape. if (isa<BitCastInst>(UUser) || isa<GetElementPtrInst>(UUser) || isa<PHINode>(UUser) || isa<SelectInst>(UUser)) { Worklist.push_back(UUser); continue; } + // Use by a load is not an escape. + if (isa<LoadInst>(UUser)) + continue; + // Use by a store is not an escape if the use is the address. + if (const StoreInst *SI = dyn_cast<StoreInst>(UUser)) + if (V != SI->getValueOperand()) + continue; + // Otherwise, conservatively assume an escape. return true; } } while (!Worklist.empty()); |