|
74 | 74 | return %index : $Builtin.PackIndex
|
75 | 75 | }
|
76 | 76 |
|
77 |
| -// CHECK-LABEL: define{{.*}} @test_pack_element_get_1( |
78 |
| -// CHECK: [[INDEX:%.*]] = add [[INT]] %1, 1 |
79 |
| -// CHECK: [[ELT_STORAGE:%.*]] = getelementptr inbounds %swift.opaque*, %swift.opaque** %0, [[INT]] [[INDEX]] |
80 |
| -// CHECK: [[BITCAST_STORAGE:%.*]] = bitcast %swift.opaque** [[ELT_STORAGE]] to %TSi** |
81 |
| -// CHECK: [[ELT_ADDR:%.*]] = load %TSi*, %TSi** [[BITCAST_STORAGE]], align |
82 |
| -// CHECK: [[VALUE_ADDR:%.*]] = getelementptr inbounds %TSi, %TSi* [[ELT_ADDR]], i32 0, i32 0 |
83 |
| -// CHECK: [[RET:%.*]] = load [[INT]], [[INT]]* [[VALUE_ADDR]], align |
84 |
| -// CHECK: ret [[INT]] [[RET]] |
85 |
| -sil @test_pack_element_get_1 : $<T...> (@pack_owned Pack{Int, repeat each T, Int}) -> Int { |
86 |
| -bb0(%pack : $*Pack{Int, repeat each T, Int}): |
87 |
| - %index = scalar_pack_index 2 of $Pack{Int, repeat each T, Int} |
88 |
| - %elementAddr = pack_element_get %index of %pack : $*Pack{Int, repeat each T, Int} as $*Int |
89 |
| - %value = load %elementAddr : $*Int |
90 |
| - return %value : $Int |
| 77 | +// CHECK-LABEL: define {{.*}}@test_pack_alloc_1_dynamic( |
| 78 | +// CHECK-SAME: i{{(32|64)}} [[PACK_SIZE:%[^,]+]] |
| 79 | +// CHECK: [[SIZE:%[^,]+]] = add i64 [[PACK_SIZE]], [[PACK_SIZE]] |
| 80 | +// CHECK: [[SP_SAVE:%[^,]+]] = call i8* @llvm.stacksave() |
| 81 | +// CHECK: alloca %swift.opaque*, i{{(32|64)}} [[SIZE]] |
| 82 | +// CHECK: call void @llvm.stackrestore(i8* [[SP_SAVE]]) |
| 83 | +sil @test_pack_alloc_1_dynamic : $<T...> () -> () { |
| 84 | +// Control flow so that stack saving/restoring is emitted |
| 85 | +entry: |
| 86 | + cond_br undef, left, right |
| 87 | +left: |
| 88 | + br exit |
| 89 | +right: |
| 90 | + br exit |
| 91 | +exit: |
| 92 | + %addr = alloc_pack $Pack{repeat each T, repeat each T} |
| 93 | + dealloc_pack %addr : $*Pack{repeat each T, repeat each T} |
| 94 | + %ret = tuple () |
| 95 | + return %ret : $() |
91 | 96 | }
|
92 | 97 |
|
93 |
| -// CHECK-LABEL: define{{.*}} @test_pack_element_set_1( |
94 |
| -// CHECK: [[INDEX:%.*]] = add [[INT]] %2, 1 |
95 |
| -// CHECK: [[ELT_STORAGE:%.*]] = getelementptr inbounds %swift.opaque*, %swift.opaque** %0, [[INT]] [[INDEX]] |
96 |
| -// CHECK: [[BITCAST_STORAGE:%.*]] = bitcast %swift.opaque** [[ELT_STORAGE]] to %TSi** |
97 |
| -// CHECK: [[ELT_ADDR:%.*]] = load %TSi*, %TSi** [[BITCAST_STORAGE]], align |
98 |
| -// CHECK: [[VALUE_ADDR:%.*]] = getelementptr inbounds %TSi, %TSi* [[ELT_ADDR]], i32 0, i32 0 |
99 |
| -// CHECK: store [[INT]] %1, [[INT]]* [[VALUE_ADDR]], align |
100 |
| -// CHECK: ret void |
101 |
| -sil @test_pack_element_set_1 : $<T...> (@pack_owned Pack{Int, repeat each T, Int}, Int) -> () { |
102 |
| -bb0(%pack : $*Pack{Int, repeat each T, Int}, %value : $Int): |
103 |
| - %index = scalar_pack_index 2 of $Pack{Int, repeat each T, Int} |
104 |
| - %elementAddr = pack_element_get %index of %pack : $*Pack{Int, repeat each T, Int} as $*Int |
105 |
| - store %value to %elementAddr : $*Int |
| 98 | +// CHECK-LABEL: define {{.*}}@test_pack_alloc_2_static |
| 99 | +// CHECK: [[STACK:%[^,]+]] = alloca [2 x %swift.opaque*] |
| 100 | +// CHECK: call void @llvm.lifetime.start.p0i8 |
| 101 | +// CHECK: call void @llvm.lifetime.end.p0i8 |
| 102 | +sil @test_pack_alloc_2_static : $<T...> () -> () { |
| 103 | + %addr = alloc_pack $Pack{Int, Int} |
| 104 | + dealloc_pack %addr : $*Pack{Int, Int} |
106 | 105 | %ret = tuple ()
|
107 | 106 | return %ret : $()
|
108 | 107 | }
|
0 commit comments