Turn any_extend nodes into zero_extend nodes when it allows us to remove an
authorChris Lattner <sabre@nondot.org>
Thu, 2 Feb 2006 07:17:31 +0000 (07:17 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 2 Feb 2006 07:17:31 +0000 (07:17 +0000)
commit3603cd62aed5cc54ec626848d0195eed2958312a
tree1d795d853b1426f4b3154a1a110204ff77b0d3a6
parent9a06cce0f2088a298f357b933fb7d8e268f6ca52
Turn any_extend nodes into zero_extend nodes when it allows us to remove an
and instruction.  This allows us to compile stuff like this:

bool %X(int %X) {
        %Y = add int %X, 14
        %Z = setne int %Y, 12345
        ret bool %Z
}

to this:

_X:
        cmpl $12331, 4(%esp)
        setne %al
        movzbl %al, %eax
        ret

instead of this:

_X:
        cmpl $12331, 4(%esp)
        setne %al
        movzbl %al, %eax
        andl $1, %eax
        ret

This occurs quite a bit with the X86 backend.  For example, 25 times in
lambda, 30 times in 177.mesa, 14 times in galgel,  70 times in fma3d,
25 times in vpr, several hundred times in gcc, ~45 times in crafty,
~60 times in parser, ~140 times in eon, 110 times in perlbmk, 55 on gap,
16 times on bzip2, 14 times on twolf, and 1-2 times in many other SPEC2K
programs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25901 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp