File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -3631,6 +3631,14 @@ class AssignAddressToDef : SILInstructionVisitor<AssignAddressToDef> {
36313631 singleValueInstructionFallback (kp);
36323632 }
36333633
3634+ void visitMarkDependenceInst (MarkDependenceInst *mark) {
3635+ // This instruction is purely for semantic tracking in SIL.
3636+ // Simply forward the value and delete the instruction.
3637+ auto valAddr = assignment.getAddressForValue (mark->getValue ());
3638+ assignment.mapValueToAddress (mark, valAddr);
3639+ assignment.markForDeletion (mark);
3640+ }
3641+
36343642 void visitBeginApplyInst (BeginApplyInst *apply) {
36353643 auto builder = assignment.getBuilder (++apply->getIterator ());
36363644 auto addr = assignment.createAllocStack (origValue->getType ());
Original file line number Diff line number Diff line change @@ -296,3 +296,21 @@ bb0(%0 : $*union_t):
296296 dealloc_stack %1 : $*union_t
297297 return %13 : $()
298298}
299+
300+ // This test case used to crash because we did not handle `mark_dependence`.
301+ sil @test12 : $@convention(thin) () -> () {
302+ bb0:
303+ %0 = alloc_stack $X
304+ %1 = alloc_stack $Y
305+ %2 = alloc_stack $X
306+ %3 = load %0 : $*X
307+ %4 = load %2 : $*X
308+ %5 = mark_dependence %3 : $X on %4 : $X
309+ %6 = struct $Y (%5 : $X , %5 : $X)
310+ store %6 to %1 : $*Y
311+ dealloc_stack %2 : $*X
312+ dealloc_stack %1 : $*Y
313+ dealloc_stack %0 : $*X
314+ %t = tuple ()
315+ return %t : $()
316+ }
You can’t perform that action at this time.
0 commit comments