summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorHans Wennborg <hans@hanshq.net>2016-04-15 21:45:30 +0000
committerHans Wennborg <hans@hanshq.net>2016-04-15 21:45:30 +0000
commit07f6d3a89379d615f266df16d0b076e457fa05ae (patch)
tree46cf1cf3049024d4b5dd785b07e41ff69c7a4a2f /llvm/test
parentc944c13dc186b57cc4e16e73c9dc5413d7b7402a (diff)
downloadbcm5719-llvm-07f6d3a89379d615f266df16d0b076e457fa05ae.tar.gz
bcm5719-llvm-07f6d3a89379d615f266df16d0b076e457fa05ae.zip
Switch lowering: don't add incoming PHI values from skipped bit test MBB's (PR27135)
After r245976, LLVM will skip the last bit test case if knows it will always be true. However, we would still erroneously update PHI nodes with incoming values from the MBB that would perform the final bit test, causing -verify-machineinstrs to fail. llvm-svn: 266479
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/X86/switch.ll34
1 files changed, 32 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/switch.ll b/llvm/test/CodeGen/X86/switch.ll
index 5bba78d4490..2506a075106 100644
--- a/llvm/test/CodeGen/X86/switch.ll
+++ b/llvm/test/CodeGen/X86/switch.ll
@@ -1,5 +1,5 @@
-; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -jump-table-density=40 | FileCheck %s
-; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -O0 -jump-table-density=40 | FileCheck --check-prefix=NOOPT %s
+; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -jump-table-density=40 -verify-machineinstrs | FileCheck %s
+; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -O0 -jump-table-density=40 -verify-machineinstrs | FileCheck --check-prefix=NOOPT %s
declare void @g(i32)
@@ -748,3 +748,33 @@ return: ret void
; Don't assert due to truncating the bitwidth (64) to i4 when checking
; that the bit-test range fits in a word.
}
+
+
+define i32 @pr27132(i32 %i) {
+entry:
+ br i1 undef, label %sw, label %end
+sw:
+ switch i32 %i, label %end [
+ i32 99, label %sw.bb
+ i32 98, label %sw.bb
+ i32 101, label %sw.bb
+ i32 97, label %sw.bb2
+ i32 96, label %sw.bb2
+ i32 100, label %sw.bb2
+ ]
+sw.bb:
+ unreachable
+sw.bb2:
+ unreachable
+end:
+ %p = phi i32 [ 1, %sw ], [ 0, %entry ]
+ ret i32 %p
+
+; CHECK-LABEL: pr27132:
+; The switch is lowered with bit tests. Since the case range is contiguous, the
+; second bit test is redundant and can be skipped. Check that we don't update
+; the phi node with an incoming value from the MBB of the skipped bit test
+; (-verify-machine-instrs cathces this).
+; CHECK: btl
+; CHECK-NOT: btl
+}
OpenPOWER on IntegriCloud