aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/X86
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-05-04 22:10:36 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-05-04 22:10:36 +0000
commitbaf717a08a0bc8cb0a7931ea3ce51d063a8fe6f0 (patch)
treea783b0a34d6af1c5765489ade3449320ebbec85f /test/CodeGen/X86
parentb90584ae78a7acc4ac92e3ad52121a10c520b980 (diff)
Re-commit r130862 with a minor change to avoid an iterator running off the edge in some cases.
Original message: Teach MachineCSE how to do simple cross-block CSE involving physregs. This allows, for example, eliminating duplicate cmpl's on x86. Part of rdar://problem/8259436 . git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130877 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86')
-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
+}