Fix the (zext (zextload)) case to trigger, similarly for sign extends.
authorChris Lattner <sabre@nondot.org>
Wed, 14 Dec 2005 19:05:06 +0000 (19:05 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 14 Dec 2005 19:05:06 +0000 (19:05 +0000)
commitad25d4e2df3fe01541d62ab0fd22c7de22ce3a42
treeae4728bc982f18beb5105dd31e0478c3f894b5f1
parent6860f6a01ccc71d7cad61de506e0cf8ecb8ca146
Fix the (zext (zextload)) case to trigger, similarly for sign extends.
Allow (zext (truncate)) to apply after legalize if the target supports
AND (which all do).

This compiles
short %foo() {
        %tmp.0 = load ubyte* %X         ; <ubyte> [#uses=1]
        %tmp.3 = cast ubyte %tmp.0 to short             ; <short> [#uses=1]
        ret short %tmp.3
}

to:
_foo:
        movzbl _X, %eax
        ret

instead of:

_foo:
        movzbl _X, %eax
        movzbl %al, %eax
        ret

thanks to Evan for pointing this out.

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