Skip to content

Commit 26551b1

Browse files
committed
[SIL] Fix egregious errors in extract_executor handling.
Make sure it is properly treated as a SingleValueInstruction, and don't blatantly read freed memory in the LowerHopToExecutor pass.
1 parent 8c9d402 commit 26551b1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

include/swift/SIL/SILNodes.def

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,9 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
725725
GetAsyncContinuationInstBase, MayHaveSideEffects, MayRelease)
726726
SINGLE_VALUE_INST_RANGE(GetAsyncContinuationInstBase, GetAsyncContinuationInst, GetAsyncContinuationAddrInst)
727727

728+
SINGLE_VALUE_INST(ExtractExecutorInst, extract_executor,
729+
SingleValueInstruction, MayRead, DoesNotRelease)
730+
728731
// Key paths
729732
// TODO: The only "side effect" is potentially retaining the returned key path
730733
// object; is there a more specific effect?
@@ -835,8 +838,6 @@ NON_VALUE_INST(FixLifetimeInst, fix_lifetime,
835838

836839
NON_VALUE_INST(HopToExecutorInst, hop_to_executor,
837840
SILInstruction, MayHaveSideEffects, DoesNotRelease)
838-
SINGLE_VALUE_INST(ExtractExecutorInst, extract_executor,
839-
SILInstruction, MayRead, DoesNotRelease)
840841

841842
NON_VALUE_INST(DestroyValueInst, destroy_value,
842843
SILInstruction, MayHaveSideEffects, MayRelease)

lib/SILOptimizer/Mandatory/LowerHopToActor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ bool LowerHopToActor::run() {
7575
SILInstruction *inst = &*ii++;
7676
if (auto *hop = dyn_cast<HopToExecutorInst>(inst)) {
7777
changed |= processHop(hop);
78-
}
79-
if (auto *extract = dyn_cast<ExtractExecutorInst>(inst)) {
78+
} else if (auto *extract = dyn_cast<ExtractExecutorInst>(inst)) {
8079
changed |= processExtract(extract);
8180
}
8281
}

lib/Serialization/ModuleFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5656
/// describe what change you made. The content of this comment isn't important;
5757
/// it just ensures a conflict if two people change the module format.
5858
/// Don't worry about adhering to the 80-column limit for this line.
59-
const uint16_t SWIFTMODULE_VERSION_MINOR = 608; // internal parameter labels
59+
const uint16_t SWIFTMODULE_VERSION_MINOR = 609; // extract_executor SIL inst
6060

6161
/// A standard hash seed used for all string hashes in a serialized module.
6262
///

0 commit comments

Comments
 (0)