diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-09-03 14:04:17 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-09-03 14:04:17 -0700 |
commit | eb10318143cc0045a053a1973e4aeaf246e53984 (patch) | |
tree | cc1b6e097abc12a5532e61a14429f04ece95e37a /test | |
parent | 30aa17affbfa35a9d32895ff6f4b5f5fbfc9575a (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 STRUCT_ANON in bitcode files PNaClVersion==2.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3648
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23455023
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> |