mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150424 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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());
|
||||
|
Reference in New Issue
Block a user