summaryrefslogtreecommitdiff
path: root/test/CodeGen/SystemZ
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-25 09:34:38 +0000
committerRichard Sandiford <rsandifo@linux.vnet.ibm.com>2013-07-25 09:34:38 +0000
commitea14085be54540be2f5cb4b1444d972972d22c5f (patch)
tree9a7c5e041ac7ee53f9a4ccc6e6732470af378a84 /test/CodeGen/SystemZ
parentbf99364f819465536a6b230b95735b239e3fc7a5 (diff)
downloadllvm-ea14085be54540be2f5cb4b1444d972972d22c5f.tar.gz
llvm-ea14085be54540be2f5cb4b1444d972972d22c5f.tar.bz2
llvm-ea14085be54540be2f5cb4b1444d972972d22c5f.tar.xz
[SystemZ] Rework compare and branch support
Before the patch we took advantage of the fact that the compare and branch are glued together in the selection DAG and fused them together (where possible) while emitting them. This seemed to work well in practice. However, fusing the compare so early makes it harder to remove redundant compares in cases where CC already has a suitable value. This patch therefore uses the peephole analyzeCompare/optimizeCompareInstr pair of functions instead. No behavioral change intended, but it paves the way for a later patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187116 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/SystemZ')
-rw-r--r--test/CodeGen/SystemZ/int-cmp-02.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/SystemZ/int-cmp-02.ll b/test/CodeGen/SystemZ/int-cmp-02.ll
index 455350b974..a77711931a 100644
--- a/test/CodeGen/SystemZ/int-cmp-02.ll
+++ b/test/CodeGen/SystemZ/int-cmp-02.ll
@@ -2,6 +2,8 @@
;
; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
+declare i32 @foo()
+
; Check register comparison.
define double @f1(double %a, double %b, i32 %i1, i32 %i2) {
; CHECK-LABEL: f1:
@@ -159,3 +161,23 @@ define double @f11(double %a, double %b, i32 %i1, i64 %base, i64 %index) {
%res = select i1 %cond, double %a, double %b
ret double %res
}
+
+; The first branch here got recreated by InsertBranch while splitting the
+; critical edge %entry->%while.body, which lost the kills information for CC.
+define void @f12(i32 %a, i32 %b) {
+; CHECK-LABEL: f12:
+; CHECK: crje %r2,
+; CHECK: crjlh %r2,
+; CHECK: br %r14
+entry:
+ %cmp11 = icmp eq i32 %a, %b
+ br i1 %cmp11, label %while.end, label %while.body
+
+while.body:
+ %c = call i32 @foo()
+ %cmp12 = icmp eq i32 %c, %b
+ br i1 %cmp12, label %while.end, label %while.body
+
+while.end:
+ ret void
+}