Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Side by Side Diff: test/Transforms/NaCl/expand-struct-regs.ll

Issue 460053003: PNaCl: Handle nested structure types in -expand-struct-regs. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-llvm.git@master
Patch Set: Forgot a small change. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
157
158 define void @nested_structs_phi_load() {
Mark Seaborn 2014/12/09 20:39:46 I'm not sure what this test case is intended to te
Richard Diamond 2014/12/10 00:58:06 It's not. JF asked for a test with phi and load in
159 entry:
160 %a3 = alloca { { i32, i64 }* }
161 %a = insertvalue { i32, i64 } undef, i32 5, 0
162 %b = insertvalue { i32, i64 } %a, i64 6, 1
163 %a4 = getelementptr { { i32, i64 }* }* %a3, i32 0, i32 0
164 br label %next
165
166 next:
167 %n1 = phi { i32, i64 } [ %b, %entry ]
168 %n2 = phi { i32, i64 }** [ %a4, %entry ]
169 %n3 = load { i32, i64 }** %n2
170 store { i32, i64 } %n1, { i32, i64 }* %n3
171 %n4 = load { i32, i64 }* %n3
172 %n5 = extractvalue { i32, i64 } %n4, 0
173 %n6 = extractvalue { i32, i64 } %n4, 1
174 ret void
175 }
176 ; CHECK-LABEL: define void @nested_structs_phi_load()
177 ; CHECK-NEXT: entry:
178 ; CHECK-NEXT: %a3 = alloca { { i32, i64 }* }
179 ; CHECK-NEXT: %a4 = getelementptr { { i32, i64 }* }* %a3, i32 0, i32 0
180 ; CHECK-NEXT: br label %next
181 ; CHECK: next:
182 ; CHECK-NEXT: %n1.index = phi i32 [ 5, %entry ]
183 ; CHECK-NEXT: %n1.index1 = phi i64 [ 6, %entry ]
184 ; CHECK-NEXT: %n2 = phi { i32, i64 }** [ %a4, %entry ]
185 ; CHECK-NEXT: %n3 = load { i32, i64 }** %n2
186 ; CHECK-NEXT: %n3.index = getelementptr { i32, i64 }* %n3, i32 0, i32 0
187 ; CHECK-NEXT: store i32 %n1.index, i32* %n3.index, align 1
188 ; CHECK-NEXT: %n3.index4 = getelementptr { i32, i64 }* %n3, i32 0, i32 1
189 ; CHECK-NEXT: store i64 %n1.index1, i64* %n3.index4, align 1
190 ; CHECK-NEXT: %n4.index = getelementptr { i32, i64 }* %n3, i32 0, i32 0
191 ; CHECK-NEXT: %n4.field = load i32* %n4.index, align 1
192 ; CHECK-NEXT: %n4.index5 = getelementptr { i32, i64 }* %n3, i32 0, i32 1
193 ; CHECK-NEXT: %n4.field6 = load i64* %n4.index5, align 1
194 ; CHECK-NEXT: ret void
OLDNEW
« lib/Transforms/NaCl/ExpandStructRegs.cpp ('K') | « lib/Transforms/NaCl/ExpandStructRegs.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698