OLD | NEW |
1 ; RUN: opt %s -expand-struct-regs -S | FileCheck %s | 1 ; RUN: opt %s -expand-struct-regs -S | FileCheck %s |
2 ; RUN: opt %s -expand-struct-regs -S | FileCheck %s -check-prefix=CLEANUP | 2 ; RUN: opt %s -expand-struct-regs -S | FileCheck %s -check-prefix=CLEANUP |
3 | 3 |
4 ; These two instructions should not appear in the output: | 4 ; These two instructions should not appear in the output: |
5 ; CLEANUP-NOT: extractvalue | 5 ; CLEANUP-NOT: extractvalue |
6 ; CLEANUP-NOT: insertvalue | 6 ; CLEANUP-NOT: insertvalue |
7 | 7 |
8 %struct = type { i8, i32 } | 8 %struct = type { i8, i32 } |
9 | 9 |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 ; CHECK-NEXT: store i32 200, i32* %out1 | 117 ; CHECK-NEXT: store i32 200, i32* %out1 |
118 ; CHECK-NEXT: ret void | 118 ; CHECK-NEXT: ret void |
119 | 119 |
120 | 120 |
121 define i32 @extract_from_constant() { | 121 define i32 @extract_from_constant() { |
122 %ev = extractvalue %struct { i8 99, i32 888 }, 1 | 122 %ev = extractvalue %struct { i8 99, i32 888 }, 1 |
123 ret i32 %ev | 123 ret i32 %ev |
124 } | 124 } |
125 ; CHECK: define i32 @extract_from_constant() { | 125 ; CHECK: define i32 @extract_from_constant() { |
126 ; CHECK-NEXT: ret i32 888 | 126 ; CHECK-NEXT: ret i32 888 |
| 127 |
| 128 define void @nested_structs() { |
| 129 %a1 = alloca i64 |
| 130 %a2 = alloca i32 |
| 131 %a3 = alloca { { i32, i64 } } |
| 132 %a = insertvalue { i32, i64 } undef, i32 5, 0 |
| 133 %b = insertvalue { i32, i64 } %a, i64 6, 1 |
| 134 %c = insertvalue { { i32, i64 } } undef, { i32, i64 } %b, 0 |
| 135 %d = insertvalue { { { i32, i64 } }, i64 } undef, { { i32, i64 } } %c, 0 |
| 136 %e = insertvalue { { { i32, i64 } }, i64 } undef, { i32, i64 } %b, 0, 0 |
| 137 |
| 138 %f = extractvalue { { { i32, i64 } }, i64 } %d, 0, 0, 1 |
| 139 %g = extractvalue { { { i32, i64 } }, i64 } %e, 0, 0, 0 |
| 140 %h = extractvalue { { { i32, i64 } }, i64 } %e, 0 |
| 141 store i64 %f, i64* %a1 |
| 142 store i32 %g, i32* %a2 |
| 143 store { { i32, i64 } } %h, { { i32, i64 } }* %a3 |
| 144 ret void |
| 145 } |
| 146 ; CHECK-LABEL: define void @nested_structs() |
| 147 ; CHECK-NEXT: %a1 = alloca i64 |
| 148 ; CHECK-NEXT: %a2 = alloca i32 |
| 149 ; CHECK-NEXT: %a3 = alloca { { i32, i64 } } |
| 150 ; CHECK-NEXT: store i64 6, i64* %a1 |
| 151 ; CHECK-NEXT: store i32 5, i32* %a2 |
| 152 ; CHECK-NEXT: %a3.index = getelementptr { { i32, i64 } }* %a3, i32 0, i32 0 |
| 153 ; CHECK-NEXT: %a3.index.index = getelementptr { i32, i64 }* %a3.index, i32 0,
i32 0 |
| 154 ; CHECK-NEXT: store i32 5, i32* %a3.index.index, align 1 |
| 155 ; CHECK-NEXT: %a3.index.index1 = getelementptr { i32, i64 }* %a3.index, i32 0
, i32 1 |
| 156 ; CHECK-NEXT: store i64 6, i64* %a3.index.index1, align 1 |
OLD | NEW |