Skip to content

Commit 7fd2e46

Browse files
committed
[sil] Move mark_unresolved_move_addr in SILNodes.def so it is not classified as a SingleValueInstruction.
The specific problem here is that this causes MarkUnresolvedMoveAddr to be within the SINGLE_VALUE_INST_RANGE which defines the classify method used to determine if casting to a SingleValueInstruction is ok. This is of course not ok in this case since mark_unresolved_move_addr is actually a NonValueInst. I noticed this b/c I made the same mistake with a new instruction I am added and hit a crash in the tests as a result of it being classified as a single value instruction. After fixing that, I checked for any more instances of this issue and found that mark_unresolved_move_addr was similarly afflicted.
1 parent 110041b commit 7fd2e46

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

include/swift/SIL/SILNodes.def

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,6 @@ ABSTRACT_VALUE_AND_INST(SingleValueInstruction, ValueBase, SILInstruction)
518518
SINGLE_VALUE_INST(CopyableToMoveOnlyWrapperAddrInst,
519519
copyable_to_moveonlywrapper_addr, SingleValueInstruction,
520520
None, DoesNotRelease)
521-
// A move_addr is a Raw SIL only instruction that is equivalent to a copy_addr
522-
// [init]. It is lowered during the diagnostic passes to a copy_addr [init] if
523-
// the move checker found uses that prevented us from converting this to a
524-
// move or if we do not find such uses, a copy_addr [init] [take].
525-
NON_VALUE_INST(MarkUnresolvedMoveAddrInst, mark_unresolved_move_addr,
526-
SILInstruction, None, DoesNotRelease)
527521

528522
// IsUnique does not actually write to memory but should be modeled
529523
// as such. Its operand is a pointer to an object reference. The
@@ -893,6 +887,13 @@ NON_VALUE_INST(PackElementSetInst, pack_element_set,
893887
NON_VALUE_INST(CondFailInst, cond_fail,
894888
SILInstruction, MayHaveSideEffects, DoesNotRelease)
895889

890+
// A move_addr is a Raw SIL only instruction that is equivalent to a copy_addr
891+
// [init]. It is lowered during the diagnostic passes to a copy_addr [init] if
892+
// the move checker found uses that prevented us from converting this to a
893+
// move or if we do not find such uses, a copy_addr [init] [take].
894+
NON_VALUE_INST(MarkUnresolvedMoveAddrInst, mark_unresolved_move_addr,
895+
SILInstruction, None, DoesNotRelease)
896+
896897
NON_VALUE_INST(IncrementProfilerCounterInst, increment_profiler_counter,
897898
SILInstruction, MayReadWrite, DoesNotRelease)
898899

0 commit comments

Comments
 (0)