diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-08-30 08:52:20 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-08-30 08:52:20 -0700 |
commit | 2302e5d39e2302962d1a0e45d60e00ed47b9b061 (patch) | |
tree | 1a121361ee62714d76c916ac4e203a091a747601 /test | |
parent | 215d7de42d1ada5ca44bd6bc03789b2ea81ce865 (diff) |
Remove generating STRUCT_ANON records in PNaCl bitcode files.
Don't generate types for elided cast instructions, since they
are never put into the bitcode file. In addition, do not generate
a type id for the types of global variables, because they are never
needed. Don't allow and STRUCT records in bitcode files
when PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23431008
Diffstat (limited to 'test')
-rw-r--r-- | test/NaCl/Bitcode/no-structs.ll | 38 | ||||
-rw-r--r-- | test/NaCl/Bitcode/ptrtoint-elide.ll | 32 |
2 files changed, 54 insertions, 16 deletions
diff --git a/test/NaCl/Bitcode/no-structs.ll b/test/NaCl/Bitcode/no-structs.ll new file mode 100644 index 0000000000..1f9b1279fe --- /dev/null +++ b/test/NaCl/Bitcode/no-structs.ll @@ -0,0 +1,38 @@ +; Tests that even though global variables can define structured types, +; they types are not put into the bitcode file. + +; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=1 \ +; RUN: | pnacl-bcanalyzer -dump-records \ +; RUN: | FileCheck %s + +; RUN: llvm-as < %s | pnacl-freeze --pnacl-version=2 \ +; RUN: | pnacl-bcanalyzer -dump-records \ +; RUN: | FileCheck %s + +declare void @func() + +@compound = internal global <{ [4 x i8], i32 }> + <{ [4 x i8] c"home", i32 ptrtoint (void ()* @func to i32) }> + +define void @CheckBitcastGlobal() { + %1 = bitcast <{ [4 x i8], i32}>* @compound to i32* + %2 = load i32* %1, align 4 + ret void +} + +define void @CheckPtrToIntGlobal() { + %1 = ptrtoint <{ [4 x i8], i32 }>* @compound to i32 + %2 = add i32 %1, 0 + ret void +} + +; Note that neither pnacl-version defines a struct type. + +; CHECK: <TYPE_BLOCK_ID> +; CHECK-NEXT: <NUMENTRY op0=5/> +; CHECK-NEXT: <INTEGER op0=32/> +; CHECK-NEXT: <VOID/> +; CHECK-NEXT: <FUNCTION op0=0 op1=1/> +; CHECK-NEXT: <POINTER op0=2 op1=0/> +; CHECK-NEXT: <POINTER op0=0 op1=0/> +; CHECK-NEXT: </TYPE_BLOCK_ID> diff --git a/test/NaCl/Bitcode/ptrtoint-elide.ll b/test/NaCl/Bitcode/ptrtoint-elide.ll index eba451c289..3ef7909fe7 100644 --- a/test/NaCl/Bitcode/ptrtoint-elide.ll +++ b/test/NaCl/Bitcode/ptrtoint-elide.ll @@ -638,14 +638,14 @@ define void @TestCasts() { ; PF1-NEXT: <INST_CAST op0=1 op1=0 op2=9/> ; PF1-NEXT: <INST_CAST op0=6 op1=2 op2=0/> ; PF1-NEXT: <INST_CAST op0=2 op1=2 op2=0/> -; PF1-NEXT: <INST_CAST op0=8 op1=13 op2=1/> -; PF1-NEXT: <INST_CAST op0=4 op1=13 op2=1/> -; PF1-NEXT: <INST_CAST op0=9 op1=13 op2=2/> -; PF1-NEXT: <INST_CAST op0=6 op1=13 op2=2/> -; PF1-NEXT: <INST_CAST op0=9 op1=14 op2=5/> -; PF1-NEXT: <INST_CAST op0=8 op1=14 op2=5/> -; PF1-NEXT: <INST_CAST op0=13 op1=14 op2=6/> -; PF1-NEXT: <INST_CAST op0=10 op1=14 op2=6/> +; PF1-NEXT: <INST_CAST op0=8 op1=11 op2=1/> +; PF1-NEXT: <INST_CAST op0=4 op1=11 op2=1/> +; PF1-NEXT: <INST_CAST op0=9 op1=11 op2=2/> +; PF1-NEXT: <INST_CAST op0=6 op1=11 op2=2/> +; PF1-NEXT: <INST_CAST op0=9 op1=12 op2=5/> +; PF1-NEXT: <INST_CAST op0=8 op1=12 op2=5/> +; PF1-NEXT: <INST_CAST op0=13 op1=12 op2=6/> +; PF1-NEXT: <INST_CAST op0=10 op1=12 op2=6/> ; PF1-NEXT: <INST_RET/> ; PF1-NEXT: </FUNCTION_BLOCK> @@ -670,14 +670,14 @@ define void @TestCasts() { ; PF2-NEXT: <INST_ALLOCA op0=2 op1=4/> ; PF2-NEXT: <INST_CAST op0=5 op1=2 op2=0/> ; PF2-NEXT: <INST_CAST op0=2 op1=2 op2=0/> -; PF2-NEXT: <INST_CAST op0=7 op1=13 op2=1/> -; PF2-NEXT: <INST_CAST op0=4 op1=13 op2=1/> -; PF2-NEXT: <INST_CAST op0=8 op1=13 op2=2/> -; PF2-NEXT: <INST_CAST op0=6 op1=13 op2=2/> -; PF2-NEXT: <INST_CAST op0=8 op1=14 op2=5/> -; PF2-NEXT: <INST_CAST op0=8 op1=14 op2=5/> -; PF2-NEXT: <INST_CAST op0=12 op1=14 op2=6/> -; PF2-NEXT: <INST_CAST op0=10 op1=14 op2=6/> +; PF2-NEXT: <INST_CAST op0=7 op1=11 op2=1/> +; PF2-NEXT: <INST_CAST op0=4 op1=11 op2=1/> +; PF2-NEXT: <INST_CAST op0=8 op1=11 op2=2/> +; PF2-NEXT: <INST_CAST op0=6 op1=11 op2=2/> +; PF2-NEXT: <INST_CAST op0=8 op1=12 op2=5/> +; PF2-NEXT: <INST_CAST op0=8 op1=12 op2=5/> +; PF2-NEXT: <INST_CAST op0=12 op1=12 op2=6/> +; PF2-NEXT: <INST_CAST op0=10 op1=12 op2=6/> ; PF2-NEXT: <INST_RET/> ; PF2-NEXT: </FUNCTION_BLOCK> |