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

Unified Diff: tests_lit/reader_tests/phi.ll

Issue 568473002: Add phi instruction to Subzero bitcode reader. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix issues raised in patch set 2. Created 6 years, 3 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
« no previous file with comments | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/reader_tests/phi.ll
diff --git a/tests_lit/reader_tests/phi.ll b/tests_lit/reader_tests/phi.ll
new file mode 100644
index 0000000000000000000000000000000000000000..0186d4c698f4661daab7bdd240fd82dc97a333c7
--- /dev/null
+++ b/tests_lit/reader_tests/phi.ll
@@ -0,0 +1,34 @@
+; Test reading phi instructions.
+
+; RUN: llvm-as < %s | pnacl-freeze -allow-local-symbol-tables \
+; RUN: | %llvm2ice -notranslate -verbose=inst -build-on-read \
+; RUN: -allow-pnacl-reader-error-recovery \
+; RUN: -allow-local-symbol-tables \
+; RUN: | FileCheck %s
+
+; TODO(kschimpf) Add forward reference examples.
+
+define internal i32 @testPhi1(i32 %arg) {
+entry:
+ %cmp1 = icmp sgt i32 %arg, 0
+ br i1 %cmp1, label %next, label %target
+next:
+ br label %target
+target:
+ %merge = phi i1 [ %cmp1, %entry ], [ false, %next ]
+ %result = zext i1 %merge to i32
+ ret i32 %result
+}
+
+; CHECK: define internal i32 @testPhi1(i32 %arg) {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: %cmp1 = icmp sgt i32 %arg, 0
+; CHECK-NEXT: br i1 %cmp1, label %next, label %target
+; CHECK-NEXT: next:
+; CHECK-NEXT: br label %target
+; CHECK-NEXT: target:
+; CHECK-NEXT: %merge = phi i1 [ %cmp1, %entry ], [ false, %next ]
+; CHECK-NEXT: %result = zext i1 %merge to i32
+; CHECK-NEXT: ret i32 %result
+; CHECK-NEXT: }
+
« no previous file with comments | « src/PNaClTranslator.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698