OSDN Git Service

Fold subtracts into integer compares vs. zero. This improves generate code for this...
authorChristopher Lamb <christopher.lamb@gmail.com>
Tue, 18 Dec 2007 21:32:20 +0000 (21:32 +0000)
committerChristopher Lamb <christopher.lamb@gmail.com>
Tue, 18 Dec 2007 21:32:20 +0000 (21:32 +0000)
commit7a0678cae6c549a1e11ac0767e04c273c298c0b7
treeab9fedb8e4176350b31a3713954215b415645cf1
parentfeb8893d1757cc4f9400a5969df7f926606e246e
Fold subtracts into integer compares vs. zero. This improves generate code for this case on X86
from
_foo:
        movl    $99, %ecx
        movl    4(%esp), %eax
        subl    %eax, %ecx
        xorl    %edx, %edx
        testl   %ecx, %ecx
        cmovs   %edx, %eax
        ret

to
_foo:
        xorl    %ecx, %ecx
        movl    4(%esp), %eax
        cmpl    $99, %eax
        cmovg   %ecx, %eax
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45173 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/InstructionCombining.cpp