summaryrefslogtreecommitdiff
path: root/test/CodeGen/X86/jump_sign.ll
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2012-08-08 00:51:41 +0000
committerManman Ren <mren@apple.com>2012-08-08 00:51:41 +0000
commit39ad568c62f5120faec29f69d3d614303a1f992d (patch)
tree4512b094b076453ca2fe06fa3a8a17fbe32f275b /test/CodeGen/X86/jump_sign.ll
parent130e603115129ec1a6b94550a15f7caea0cbf068 (diff)
downloadllvm-39ad568c62f5120faec29f69d3d614303a1f992d.tar.gz
llvm-39ad568c62f5120faec29f69d3d614303a1f992d.tar.bz2
llvm-39ad568c62f5120faec29f69d3d614303a1f992d.tar.xz
X86: enable CSE between CMP and SUB
We perform the following: 1> Use SUB instead of CMP for i8,i16,i32 and i64 in ISel lowering. 2> Modify MachineCSE to correctly handle implicit defs. 3> Convert SUB back to CMP if possible at peephole. Removed pattern matching of (a>b) ? (a-b):0 and like, since they are handled by peephole now. rdar://11873276 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161462 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/jump_sign.ll')
-rw-r--r--test/CodeGen/X86/jump_sign.ll23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CodeGen/X86/jump_sign.ll b/test/CodeGen/X86/jump_sign.ll
index 61792d3253..48e21061d2 100644
--- a/test/CodeGen/X86/jump_sign.ll
+++ b/test/CodeGen/X86/jump_sign.ll
@@ -230,3 +230,26 @@ define i32 @q(i32 %j.4, i32 %w, i32 %el) {
%j.5 = select i1 %or.cond, i32 %tmp535, i32 %j.4
ret i32 %j.5
}
+; rdar://11873276
+define i8* @r(i8* %base, i32* nocapture %offset, i32 %size) nounwind {
+entry:
+; CHECK: r:
+; CHECK: sub
+; CHECK-NOT: cmp
+; CHECK: j
+; CHECK-NOT: sub
+; CHECK: ret
+ %0 = load i32* %offset, align 8
+ %cmp = icmp slt i32 %0, %size
+ br i1 %cmp, label %return, label %if.end
+
+if.end:
+ %sub = sub nsw i32 %0, %size
+ store i32 %sub, i32* %offset, align 8
+ %add.ptr = getelementptr inbounds i8* %base, i32 %sub
+ br label %return
+
+return:
+ %retval.0 = phi i8* [ %add.ptr, %if.end ], [ null, %entry ]
+ ret i8* %retval.0
+}