diff options
author | Evan Cheng <evan.cheng@apple.com> | 2012-11-30 02:02:42 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2012-11-30 02:02:42 +0000 |
commit | 40eef5fe361d8c528f764f66e311359d0da4d5b2 (patch) | |
tree | ec224ede67f35b9d89d8d87c5a73cd12cea6d19f /test | |
parent | a4eff77e37a59665b604cb8a644d66796b5622d4 (diff) |
Fix logic to determine whether to turn a switch into a lookup table. When
the tables cannot fit in registers (i.e. bitmap), do not emit the table
if it's using an illegal type.
rdar://12779436
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168970 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll b/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll index 8a59992f5e..5f70465c64 100644 --- a/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll +++ b/test/Transforms/SimplifyCFG/X86/switch_to_lookup_table.ll @@ -777,3 +777,29 @@ return: ; CHECK: switch.lookup: ; CHECK: getelementptr inbounds [5 x i32]* @switch.table6, i32 0, i32 %switch.tableidx } + +; Don't create a table with illegal type +; rdar://12779436 +define i96 @illegaltype(i32 %c) { +entry: + switch i32 %c, label %sw.default [ + i32 42, label %return + i32 43, label %sw.bb1 + i32 44, label %sw.bb2 + i32 45, label %sw.bb3 + i32 46, label %sw.bb4 + ] + +sw.bb1: br label %return +sw.bb2: br label %return +sw.bb3: br label %return +sw.bb4: br label %return +sw.default: br label %return +return: + %retval.0 = phi i96 [ 15, %sw.default ], [ 27, %sw.bb4 ], [ -1, %sw.bb3 ], [ 0, %sw.bb2 ], [ 123, %sw.bb1 ], [ 55, %entry ] + ret i96 %retval.0 + +; CHECK: @illegaltype +; CHECK-NOT: @switch.table +; CHECK: switch i32 %c +} |