X86: replace SUB with CMP if possible
authorManman Ren <mren@apple.com>
Thu, 31 May 2012 17:20:29 +0000 (17:20 +0000)
committerManman Ren <mren@apple.com>
Thu, 31 May 2012 17:20:29 +0000 (17:20 +0000)
commit91c5346d91973a1d3458a20f8c6b0e899b732e38
treeeb29d9f46d2f9184cb248413cc98369f6179c089
parent5ddc04caf25a649963c99be02646c3a9fc88d514
X86: replace SUB with CMP if possible

This patch will optimize the following
        movq    %rdi, %rax
        subq    %rsi, %rax
        cmovsq  %rsi, %rdi
        movq    %rdi, %rax
to
        cmpq    %rsi, %rdi
        cmovsq  %rsi, %rdi
        movq    %rdi, %rax

Perform this optimization if the actual result of SUB is not used.

rdar: 11540023

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157755 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetInstrInfo.h
lib/CodeGen/PeepholeOptimizer.cpp
lib/Target/X86/X86InstrInfo.cpp
lib/Target/X86/X86InstrInfo.h
test/CodeGen/X86/jump_sign.ll