diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2011-05-04 22:10:36 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2011-05-04 22:10:36 +0000 |
| commit | 0fe4608af2edb537e725f83225a0c9d960b45c78 (patch) | |
| tree | 2ef3e3b1717459534818270c817b7470edb6c759 /llvm/test/CodeGen/X86 | |
| parent | c7e4fa7c191d4de743c60d3deb879cf9eb1cefb5 (diff) | |
| download | bcm5719-llvm-0fe4608af2edb537e725f83225a0c9d960b45c78.tar.gz bcm5719-llvm-0fe4608af2edb537e725f83225a0c9d960b45c78.zip | |
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 .
llvm-svn: 130877
Diffstat (limited to 'llvm/test/CodeGen/X86')
| -rw-r--r-- | llvm/test/CodeGen/X86/cmp-redundant.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/cmp-redundant.ll b/llvm/test/CodeGen/X86/cmp-redundant.ll new file mode 100644 index 00000000000..d30ea3edd68 --- /dev/null +++ b/llvm/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 +} |

