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

Unified 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: Created 6 years, 4 months 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 side-by-side diff with in-line comments
Download patch
Index: test/Transforms/NaCl/expand-struct-regs.ll
diff --git a/test/Transforms/NaCl/expand-struct-regs.ll b/test/Transforms/NaCl/expand-struct-regs.ll
index 0cc2c6db855f230118730efbdde5da067b873bdb..2ece105d398167534ced89c391f4189120b37be1 100644
--- a/test/Transforms/NaCl/expand-struct-regs.ll
+++ b/test/Transforms/NaCl/expand-struct-regs.ll
@@ -124,3 +124,33 @@ define i32 @extract_from_constant() {
}
; CHECK: define i32 @extract_from_constant() {
; CHECK-NEXT: ret i32 888
+
+define void @nested_structs() {
+ %a1 = alloca i64
+ %a2 = alloca i32
+ %a3 = alloca { { i32, i64 } }
+ %a = insertvalue { i32, i64 } undef, i32 5, 0
+ %b = insertvalue { i32, i64 } %a, i64 6, 1
+ %c = insertvalue { { i32, i64 } } undef, { i32, i64 } %b, 0
+ %d = insertvalue { { { i32, i64 } }, i64 } undef, { { i32, i64 } } %c, 0
+ %e = insertvalue { { { i32, i64 } }, i64 } undef, { i32, i64 } %b, 0, 0
+
+ %f = extractvalue { { { i32, i64 } }, i64 } %d, 0, 0, 1
+ %g = extractvalue { { { i32, i64 } }, i64 } %e, 0, 0, 0
+ %h = extractvalue { { { i32, i64 } }, i64 } %e, 0
+ store i64 %f, i64* %a1
+ store i32 %g, i32* %a2
+ store { { i32, i64 } } %h, { { i32, i64 } }* %a3
JF 2014/12/06 23:52:13 Could you also add tests for phi and load?
Richard Diamond 2014/12/09 04:33:19 Done.
+ unreachable
JF 2014/12/06 23:52:14 Why end with unreachable?
Richard Diamond 2014/12/09 04:33:20 No reason. Fixed.
+}
+; CHECK-LABEL: define void @nested_structs()
+; CHECK-NEXT: %a1 = alloca i64
+; CHECK-NEXT: %a2 = alloca i32
+; CHECK-NEXT: %a3 = alloca { { i32, i64 } }
+; CHECK-NEXT: store i64 6, i64* %a1
+; CHECK-NEXT: store i32 5, i32* %a2
+; CHECK-NEXT: %a3.index = getelementptr { { i32, i64 } }* %a3, i32 0, i32 0
+; CHECK-NEXT: %a3.index.index = getelementptr { i32, i64 }* %a3.index, i32 0, i32 0
+; CHECK-NEXT: store i32 5, i32* %a3.index.index, align 1
+; CHECK-NEXT: %a3.index.index1 = getelementptr { i32, i64 }* %a3.index, i32 0, i32 1
+; CHECK-NEXT: store i64 6, i64* %a3.index.index1, align 1
« 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