aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/cmp-redundant.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGen/X86/cmp-redundant.ll')
-rw-r--r--test/CodeGen/X86/cmp-redundant.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/X86/cmp-redundant.ll b/test/CodeGen/X86/cmp-redundant.ll
new file mode 100644
index 0000000000..d30ea3edd6
--- /dev/null
+++ b/test/CodeGen/X86/cmp-redundant.ll
@@ -0,0 +1,22 @@
+; RUN: llc < %s -mtriple=x86_64-apple-darwin10 | FileCheck %s
+
+define i32 @cmp(i32* %aa, i32* %bb) nounwind readnone ssp {
+entry:
+ %a = load i32* %aa
+ %b = load i32* %bb
+ %cmp = icmp sgt i32 %a, %b
+ br i1 %cmp, label %return, label %if.end
+; CHECK: cmp:
+; CHECK: cmpl
+; CHECK: jg
+if.end: ; preds = %entry
+; CHECK-NOT: cmpl
+; CHECK: cmov
+ %cmp4 = icmp slt i32 %a, %b
+ %. = select i1 %cmp4, i32 2, i32 111
+ br label %return
+
+return: ; preds = %if.end, %entry
+ %retval.0 = phi i32 [ 1, %entry ], [ %., %if.end ]
+ ret i32 %retval.0
+}