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

Unified Diff: test/NaCl/Bitcode/forward-ref-decl.ll

Issue 939073008: Rebased PNaCl localmods in LLVM to 223109 (Closed)
Patch Set: undo localmod Created 5 years, 10 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 | « test/NaCl/Bitcode/flags.ll ('k') | test/NaCl/Bitcode/forward-ref-pointer-intrinsic.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/NaCl/Bitcode/forward-ref-decl.ll
diff --git a/test/NaCl/Bitcode/forward-ref-decl.ll b/test/NaCl/Bitcode/forward-ref-decl.ll
new file mode 100644
index 0000000000000000000000000000000000000000..ac02c850d72e335945e7ae462ca60e6d0921f5d4
--- /dev/null
+++ b/test/NaCl/Bitcode/forward-ref-decl.ll
@@ -0,0 +1,59 @@
+; RUN: llvm-as < %s | pnacl-freeze | pnacl-bcanalyzer -dump-records \
+; RUN: | FileCheck %s
+
+; Test that FORWARDTYPEREF declarations are emitted in the correct
+; places. These are emitted for forward value references inside
+; functions.
+
+define external void @_start(i32 %arg) {
+; CHECK: <FUNCTION_BLOCK
+
+ br label %bb1
+; CHECK: <INST_BR
+
+bb2:
+ ; This instruction contains two forward references, because %x and
+ ; %y are defined later in the function.
+ add i32 %forward1, %forward2
+; CHECK-NEXT: <FORWARDTYPEREF
+; CHECK-NEXT: <FORWARDTYPEREF
+; CHECK-NEXT: <INST_BINOP
+
+ ; The FORWARDTYPEREF declaration should only be emitted once per
+ ; value, so the following references will not emit more of them.
+ add i32 %forward1, %forward2
+; CHECK-NEXT: <INST_BINOP
+
+ ; Test another case of a forward reference.
+ call void @_start(i32 %forward3)
+; CHECK-NEXT: <FORWARDTYPEREF
+; CHECK-NEXT: <INST_CALL
+
+ ; Test that FORWARDTYPEREF is generated for phi nodes (since phi
+ ; node operands are a special case in the writer).
+ br label %bb3
+bb3:
+ phi i32 [ %forward4, %bb2 ]
+; CHECK-NEXT: <INST_BR
+; CHECK-NEXT: <FORWARDTYPEREF
+; CHECK-NEXT: <INST_PHI
+
+ ; Test that FORWARDTYPEREF is generated for switch instructions
+ ; (since switch condition operands are a special case in the
+ ; writer).
+ switch i32 %forward5, label %bb4 [i32 0, label %bb4]
+bb4:
+; CHECK-NEXT: <FORWARDTYPEREF
+; CHECK-NEXT: <INST_SWITCH
+
+ ret void
+; CHECK-NEXT: <INST_RET/>
+
+bb1:
+ %forward1 = add i32 %arg, 100
+ %forward2 = add i32 %arg, 200
+ %forward3 = add i32 %arg, 300
+ %forward4 = add i32 %arg, 400
+ %forward5 = add i32 %arg, 500
+ br label %bb2
+}
« no previous file with comments | « test/NaCl/Bitcode/flags.ll ('k') | test/NaCl/Bitcode/forward-ref-pointer-intrinsic.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698