summaryrefslogtreecommitdiff
path: root/test/Bitcode
diff options
context:
space:
mode:
authorStepan Dyatkovskiy <stpworld@narod.ru>2012-05-12 10:48:17 +0000
committerStepan Dyatkovskiy <stpworld@narod.ru>2012-05-12 10:48:17 +0000
commit1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9 (patch)
tree378e29cf4f36c588be5cd059a60e6752c3338ae3 /test/Bitcode
parentb7454fd9df0b477e3daf2fce6e1d5e1b241562df (diff)
downloadllvm-1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9.tar.gz
llvm-1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9.tar.bz2
llvm-1cce5bf8ef9ee3dc157ae5d8778f84a7a0d1d8b9.tar.xz
Recommited r156374 with critical fixes in BitcodeReader/Writer:
Ordinary patch for PR1255. Added new case-ranges orientated methods for adding/removing cases in SwitchInst. After this patch cases will internally representated as ConstantArray-s instead of ConstantInt, externally cases wrapped within the ConstantRangesSet object. Old methods of SwitchInst are also works well, but marked as deprecated. So on this stage we have no side effects except that I added support for case ranges in BitcodeReader/Writer, of course test for Bitcode is also added. Old "switch" format is also supported. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156704 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bitcode')
-rw-r--r--test/Bitcode/2012-05-07-SwitchInstRangesSupport.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Bitcode/2012-05-07-SwitchInstRangesSupport.ll b/test/Bitcode/2012-05-07-SwitchInstRangesSupport.ll
new file mode 100644
index 0000000000..4f51ba83b9
--- /dev/null
+++ b/test/Bitcode/2012-05-07-SwitchInstRangesSupport.ll
@@ -0,0 +1,33 @@
+; RUN: rm -f %t.bc
+; RUN: rm -f %t.ll
+; RUN: rm -f %t2.bc
+; RUN: rm -f %t2.ll
+; RUN: llvm-as %s -o %t.bc
+; RUN: llvm-dis %t.bc -o - | tail -n +2 > %t.ll
+; RUN: llvm-as %t.ll -o %t2.bc
+; RUN: llvm-dis %t2.bc -o - | tail -n +2 > %t2.ll
+; RUN: diff %t.ll %t2.ll | not grep .*
+
+define void @test() {
+ %mem = alloca i32
+ store i32 2, i32* %mem
+ %c = load i32* %mem
+ switch i32 %c, label %exit [
+ i32 1, label %exit
+ i32 2, label %exit
+ ]
+exit:
+ ret void
+}
+define void @test_wide() {
+ %mem = alloca i256
+ store i256 2, i256* %mem
+ %c = load i256* %mem
+ switch i256 %c, label %exit [
+ i256 123456789012345678901234567890, label %exit
+ i256 2, label %exit
+ ]
+exit:
+ ret void
+}
+