1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-31 16:02:52 +01:00
llvm-mirror/test/CodeGen/X86/cmp-redundant.ll
Eli Friedman 5b78092546 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
2011-05-04 22:10:36 +00:00

23 lines
623 B
LLVM

; 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
}