summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86
diff options
context:
space:
mode:
authorKyle Butt <kyle+llvm@iteratee.net>2016-06-24 18:16:36 +0000
committerKyle Butt <kyle+llvm@iteratee.net>2016-06-24 18:16:36 +0000
commit267164df0ab6d1e61f1420feddee96b1938cb577 (patch)
tree8fc5bca691b34fe7336825bab0e84e174f06da75 /llvm/test/CodeGen/X86
parent955d3569e7599840a1ea3692339709f98551a6ac (diff)
downloadbcm5719-llvm-267164df0ab6d1e61f1420feddee96b1938cb577.tar.gz
bcm5719-llvm-267164df0ab6d1e61f1420feddee96b1938cb577.zip
Codegen: Fix broken assumption in Tail Merge.
Tail merge was making the assumption that a layout successor or predecessor was always a cfg successor/predecessor. Remove that assumption. Changes to tests are necessary because the errant cfg edges were preventing optimizations. llvm-svn: 273700
Diffstat (limited to 'llvm/test/CodeGen/X86')
-rw-r--r--llvm/test/CodeGen/X86/br-fold.ll2
-rw-r--r--llvm/test/CodeGen/X86/tail-merge-unreachable.ll34
2 files changed, 36 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/br-fold.ll b/llvm/test/CodeGen/X86/br-fold.ll
index 5e5f860ffc7..d3aedbb17e7 100644
--- a/llvm/test/CodeGen/X86/br-fold.ll
+++ b/llvm/test/CodeGen/X86/br-fold.ll
@@ -5,9 +5,11 @@
; RUN: llc -mtriple=x86_64-scei-ps4 < %s | FileCheck -check-prefix=PS4 %s
; X64_DARWIN: orq
+; X64_DARWIN-NEXT: jne
; X64_DARWIN-NEXT: %bb8.i329
; X64_LINUX: orq %rax, %rcx
+; X64_LINUX-NEXT: jne
; X64_LINUX-NEXT: %bb8.i329
; X64_WINDOWS: orq %rax, %rcx
diff --git a/llvm/test/CodeGen/X86/tail-merge-unreachable.ll b/llvm/test/CodeGen/X86/tail-merge-unreachable.ll
new file mode 100644
index 00000000000..7b2c0f72721
--- /dev/null
+++ b/llvm/test/CodeGen/X86/tail-merge-unreachable.ll
@@ -0,0 +1,34 @@
+; RUN: llc -mtriple=x86_64-linux-gnu %s -o - -verify-machineinstrs | FileCheck %s
+
+define i32 @tail_merge_unreachable(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: tail_merge_unreachable:
+; Range Check
+; CHECK: addl $-96
+; CHECK: cmpl $5
+; CHECK: jbe [[JUMP_TABLE_BLOCK:[.][A-Za-z0-9_]+]]
+; CHECK: retq
+; CHECK: [[JUMP_TABLE_BLOCK]]:
+; CHECK: btl
+; CHECK: jae [[UNREACHABLE_BLOCK:[.][A-Za-z0-9_]+]]
+; CHECK [[UNREACHABLE_BLOCK]]:
+; CHECK: .Lfunc_end0
+}
OpenPOWER on IntegriCloud