Skip to content

Commit 6e89dbe

Browse files
authored
Merge pull request #6987 from bob-wilson/mem2reg-testcase
Add a testcase for my mem2reg fix in f22f05f.
2 parents 839221a + cc886e1 commit 6e89dbe

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/SILOptimizer/mem2reg.sil

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,18 @@ bb0(%0 : $AnyObject):
327327
return %7 : $()
328328
}
329329

330+
// Test cases where there are dead address instructions.
331+
// CHECK-LABEL: sil @dead_use
332+
// CHECK-NOT: alloc_stack
333+
sil @dead_use : $@convention(thin) () -> () {
334+
%0 = alloc_stack $Int64
335+
%1 = struct_element_addr %0 : $*Int64, #Int64._value
336+
dealloc_stack %0 : $*Int64
337+
%2 = alloc_stack $(Int64, Int64)
338+
%3 = tuple_element_addr %2 : $*(Int64, Int64), 0
339+
dealloc_stack %2 : $*(Int64, Int64)
340+
// CHECK: [[VAL:%.*]] = tuple ()
341+
%4 = tuple ()
342+
// CHECK: return [[VAL]]
343+
return %4 : $()
344+
}

0 commit comments

Comments
 (0)