Don't bother sign/zext_inreg'ing the result of an and operation if we know
authorChris Lattner <sabre@nondot.org>
Sun, 10 Apr 2005 23:37:16 +0000 (23:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 10 Apr 2005 23:37:16 +0000 (23:37 +0000)
commit2bb6f412820cad829e1dd3ea4bd8a1b26c8c23b6
treee14b9dd8e4cfccef8dc0deb3b2c20b0fda3546c1
parent01ff7216dd7829d4094754086baf28aa2d7149ac
Don't bother sign/zext_inreg'ing the result of an and operation if we know
the result does change as a result of the extend.

This improves codegen for Alpha on this testcase:

int %a(ushort* %i) {
        %tmp.1 = load ushort* %i
        %tmp.2 = cast ushort %tmp.1 to int
        %tmp.4 = and int %tmp.2, 1
        ret int %tmp.4
}

Generating:

a:
        ldgp $29, 0($27)
        ldwu $0,0($16)
        and $0,1,$0
        ret $31,($26),1

instead of:

a:
        ldgp $29, 0($27)
        ldwu $0,0($16)
        and $0,1,$0
        addl $0,0,$0
        ret $31,($26),1

btw, alpha really should switch to livein/outs for args :)

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