aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorKarl Schimpf <kschimpf@google.com>2013-09-06 13:27:38 -0700
committerKarl Schimpf <kschimpf@google.com>2013-09-06 13:27:38 -0700
commit9b86d1e242fec1dce22eda36b8f2eb3d6f1cc380 (patch)
treea732249a07bdb6aacd4d783152d8032674a89768 /test
parent38a5426a06d06aa18de1cc332411c04c348b01e4 (diff)
Clean up vestigial code for constants in PNaCl bitcode files.
* Removes code that is no longer used because global variables are handled separately. * Removes CST_CODE_NULL. * Adds special abbreviations for constant integer 0, replacing most of what was lost when CST_CODE_NULL is removed. * Adds abbreviation for floating point constants. * Removes CST_CODE_AGGREGATE and CST_CODE_DATA, except for reading old PNaCl version 1 bitcode files. * Removes call to ParseConstants() in ParseModule() since the module block no longer contains a constants block (globals are handled separately). * Removes getConstantFwdRef() method, since it is no longer needed. * Remove ConstantPlaceHolder class, since it is no longer needed. * Remove ResolvedConstants and ResolveConstantForwardRefs() from the bitcode reader, since it is no longer needed. BUG= https://code.google.com/p/nativeclient/issues/detail?id=3668 R=mseaborn@chromium.org Review URL: https://codereview.chromium.org/23522024
Diffstat (limited to 'test')
-rw-r--r--test/NaCl/Bitcode/null.ll89
1 files changed, 89 insertions, 0 deletions
diff --git a/test/NaCl/Bitcode/null.ll b/test/NaCl/Bitcode/null.ll
new file mode 100644
index 0000000000..9e5de493b3
--- /dev/null
+++ b/test/NaCl/Bitcode/null.ll
@@ -0,0 +1,89 @@
+; Test that we no longer generate NULL for numeric constants.
+
+; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=1 \
+; RUN: | pnacl-bcanalyzer -dump-records \
+; RUN: | FileCheck %s -check-prefix=PF
+
+; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=1 | pnacl-thaw \
+; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD
+
+; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=2 \
+; RUN: | pnacl-bcanalyzer -dump-records \
+; RUN: | FileCheck %s -check-prefix=PF
+
+; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=2 | pnacl-thaw \
+; RUN: | llvm-dis - | FileCheck %s -check-prefix=TD
+
+; ------------------------------------------------------
+
+define void @TestIntegers() {
+ %1 = and i1 true, false
+ %2 = add i8 1, 0
+ %3 = add i16 1, 0
+ %4 = add i32 1, 0
+ %5 = add i64 1, 0
+ ret void
+}
+
+; TD: define void @TestIntegers() {
+; TD-NEXT: %1 = and i1 true, false
+; TD-NEXT: %2 = add i8 1, 0
+; TD-NEXT: %3 = add i16 1, 0
+; TD-NEXT: %4 = add i32 1, 0
+; TD-NEXT: %5 = add i64 1, 0
+; TD-NEXT: ret void
+; TD-NEXT: }
+
+; PF: <FUNCTION_BLOCK>
+; PF-NEXT: <DECLAREBLOCKS op0=1/>
+; PF-NEXT: <CONSTANTS_BLOCK>
+; PF-NEXT: <SETTYPE op0=1/>
+; PF-NEXT: <INTEGER op0=3/>
+; PF-NEXT: <INTEGER op0=0/>
+; PF-NEXT: <SETTYPE op0=2/>
+; PF-NEXT: <INTEGER op0=2/>
+; PF-NEXT: <INTEGER op0=0/>
+; PF-NEXT: <SETTYPE op0=3/>
+; PF-NEXT: <INTEGER op0=2/>
+; PF-NEXT: <INTEGER op0=0/>
+; PF-NEXT: <SETTYPE op0=4/>
+; PF-NEXT: <INTEGER op0=2/>
+; PF-NEXT: <INTEGER op0=0/>
+; PF-NEXT: <SETTYPE op0=5/>
+; PF-NEXT: <INTEGER op0=2/>
+; PF-NEXT: <INTEGER op0=0/>
+; PF-NEXT: </CONSTANTS_BLOCK>
+; PF-NEXT: <INST_BINOP op0=10 op1=9 op2=10/>
+; PF-NEXT: <INST_BINOP op0=9 op1=8 op2=0/>
+; PF-NEXT: <INST_BINOP op0=8 op1=7 op2=0/>
+; PF-NEXT: <INST_BINOP op0=7 op1=6 op2=0/>
+; PF-NEXT: <INST_BINOP op0=6 op1=5 op2=0/>
+; PF-NEXT: <INST_RET/>
+; PF-NEXT: </FUNCTION_BLOCK>
+
+define void @TestFloats() {
+ %1 = fadd float 1.0, 0.0
+ %2 = fadd double 1.0, 0.0
+ ret void
+}
+
+; TD: define void @TestFloats() {
+; TD-NEXT: %1 = fadd float 1.000000e+00, 0.000000e+00
+; TD-NEXT: %2 = fadd double 1.000000e+00, 0.000000e+00
+; TD-NEXT: ret void
+; TD-NEXT: }
+
+; PF: <FUNCTION_BLOCK>
+; PF-NEXT: <DECLAREBLOCKS op0=1/>
+; PF-NEXT: <CONSTANTS_BLOCK>
+; PF-NEXT: <SETTYPE op0=6/>
+; PF-NEXT: <FLOAT op0=1065353216/>
+; PF-NEXT: <FLOAT op0=0/>
+; PF-NEXT: <SETTYPE op0=7/>
+; PF-NEXT: <FLOAT op0=4607182418800017408/>
+; PF-NEXT: <FLOAT op0=0/>
+; PF-NEXT: </CONSTANTS_BLOCK>
+; PF-NEXT: <INST_BINOP op0=4 op1=3 op2=0/>
+; PF-NEXT: <INST_BINOP op0=3 op1=2 op2=0/>
+; PF-NEXT: <INST_RET/>
+; PF-NEXT: </FUNCTION_BLOCK>