diff options
author | Karl Schimpf <kschimpf@google.com> | 2013-09-04 13:34:52 -0700 |
---|---|---|
committer | Karl Schimpf <kschimpf@google.com> | 2013-09-04 13:34:52 -0700 |
commit | d8f9bfbc093e7e0c1fab719bc014ba7c6f94ad6d (patch) | |
tree | f97b1b11573bba4db6a158514f83ee4e3ef77cb3 /test | |
parent | f8ea6b0a1ed535c10089d53c93f32cfe0117c812 (diff) |
Remove ARRAY/VECTOR types from PNaCl bitcode files.
The value selector list for switch statements are represented using
ARRAY/VECTOR constants, but this information is not put into the bitcode file.
This CL changes the value enumerator to not emit these constants.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3649
R=mseaborn@chromium.org
Review URL: https://codereview.chromium.org/23653013
Diffstat (limited to 'test')
-rw-r--r-- | test/NaCl/Bitcode/switch.ll | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/test/NaCl/Bitcode/switch.ll b/test/NaCl/Bitcode/switch.ll new file mode 100644 index 0000000000..9da6667bed --- /dev/null +++ b/test/NaCl/Bitcode/switch.ll @@ -0,0 +1,58 @@ +; Test that we no longer put VECTOR/ARRAY type entries, associated with +; switch instructions, 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 + +; Test case where we switch on a variable. +define void @SwitchVariable(i32) { + switch i32 %0, label %l1 [ + i32 1, label %l2 + i32 2, label %l2 + i32 4, label %l3 + i32 5, label %l3 + ] + br label %end +l1: + br label %end +l2: + br label %end +l3: + br label %end +end: + ret void +} + +; Test case where we switch on a constant. +define void @SwitchConstant(i32) { + switch i32 3, label %l1 [ + i32 1, label %l2 + i32 2, label %l2 + i32 4, label %l3 + i32 5, label %l3 + ] + br label %end +l1: + br label %end +l2: + br label %end +l3: + br label %end +end: + ret void +} + +; CHECK: <TYPE_BLOCK_ID> +; CHECK-NEXT: <NUMENTRY op0=5/> +; CHECK-NEXT: <VOID/> +; CHECK-NEXT: <LABEL/> +; CHECK-NEXT: <INTEGER op0=32/> +; CHECK-NEXT: <FUNCTION op0=0 op1=0 op2=2/> +; CHECK-NEXT: <POINTER op0=3 op1=0/> +; CHECK-NEXT: </TYPE_BLOCK_ID> + |