diff options
author | Chris Lattner <sabre@nondot.org> | 2003-08-17 20:19:31 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-08-17 20:19:31 +0000 |
commit | 09864a1ef0f71c2ded71fe56ec6ee9f75ab6f7a6 (patch) | |
tree | a23711557657c39c4993af4b23137df4604532aa /test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll | |
parent | 694e37f08a7c09ccc24642532106295cf7b3a1e3 (diff) | |
download | external_llvm-09864a1ef0f71c2ded71fe56ec6ee9f75ab6f7a6.zip external_llvm-09864a1ef0f71c2ded71fe56ec6ee9f75ab6f7a6.tar.gz external_llvm-09864a1ef0f71c2ded71fe56ec6ee9f75ab6f7a6.tar.bz2 |
New testcase to ensure that switch folding happens correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll')
-rw-r--r-- | test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll b/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll new file mode 100644 index 0000000..79b55a4 --- /dev/null +++ b/test/Transforms/SimplifyCFG/2003-08-17-FoldSwitch.ll @@ -0,0 +1,49 @@ +; RUN: as < %s | opt -simplifycfg | dis | not grep switch + +int %test1() { ; Test normal folding + switch uint 5, label %Default [ + uint 0, label %Foo + uint 1, label %Bar + uint 2, label %Baz + uint 5, label %TheDest + ] +Default:ret int -1 +Foo: ret int -2 +Bar: ret int -3 +Baz: ret int -4 +TheDest:ret int 1234 +} + +int %test2() { ; Test folding to default dest + switch uint 3, label %Default [ + uint 0, label %Foo + uint 1, label %Bar + uint 2, label %Baz + uint 5, label %TheDest + ] +Default:ret int 1234 +Foo: ret int -2 +Bar: ret int -5 +Baz: ret int -6 +TheDest:ret int -8 +} + +int %test3(bool %C) { ; Test folding all to same dest + br bool %C, label %Start, label %TheDest +Start: + switch uint 3, label %TheDest [ + uint 0, label %TheDest + uint 1, label %TheDest + uint 2, label %TheDest + uint 5, label %TheDest + ] +TheDest: ret int 1234 +} + +int %test4(uint %C) { ; Test folding switch -> branch + switch uint %C, label %L1 [ + uint 0, label %L2 + ] +L1: ret int 0 +L2: ret int 1 +} |