[llvm-commits] [llvm] r50357 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Evan Cheng evan.cheng at apple.com
Mon Apr 28 11:35:41 PDT 2008


Is this always safe? What if zext of the type is not legal?

Evan

On Apr 28, 2008, at 9:58 AM, Dan Gohman wrote:

> Author: djg
> Date: Mon Apr 28 11:58:24 2008
> New Revision: 50357
>
> URL: http://llvm.org/viewvc/llvm-project?rev=50357&view=rev
> Log:
> Teach DAGCombine to convert (sext x) to (zext x) when the
> sign-bit of x is known to be zero.
>
> Modified:
>    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=50357&r1=50356&r2=50357&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Apr 28  
> 11:58:24 2008
> @@ -2887,6 +2887,10 @@
>     if (SCC.Val) return SCC;
>   }
>
> +  // fold (sext x) -> (zext x) if the sign bit is known zero.
> +  if (DAG.SignBitIsZero(N0))
> +    return DAG.getNode(ISD::ZERO_EXTEND, VT, N0);
> +
>   return SDOperand();
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list