mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update escape helpers with a few more cases.
No observable difference yet, but upcoming changes in the box-to-stack promotion will require this change. Swift SVN r15516
This commit is contained in:
@@ -215,7 +215,9 @@ static bool useCaptured(Operand *UI) {
|
||||
// These instructions do not cause the address to escape.
|
||||
if (isa<CopyAddrInst>(User) ||
|
||||
isa<LoadInst>(User) ||
|
||||
isa<ProtocolMethodInst>(User))
|
||||
isa<ProtocolMethodInst>(User) ||
|
||||
isa<DebugValueInst>(User) ||
|
||||
isa<DebugValueAddrInst>(User))
|
||||
return false;
|
||||
|
||||
if (auto *Store = dyn_cast<StoreInst>(User)) {
|
||||
@@ -253,6 +255,10 @@ swift::canValueEscape(SILValue V) {
|
||||
// apply instructions do not capture the pointer when it is passed
|
||||
// indirectly
|
||||
if (auto apply = dyn_cast<ApplyInst>(User)) {
|
||||
// Applying a function does not cause the function to escape.
|
||||
if (UI->getOperandNumber() == 0)
|
||||
continue;
|
||||
|
||||
if (apply->getSubstCalleeType()
|
||||
->getInterfaceParameters()[UI->getOperandNumber()-1].isIndirect()) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user