diff options
author | Dan Gohman <gohman@apple.com> | 2008-04-28 16:58:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-04-28 16:58:24 +0000 |
commit | 8f0ad582e81e24f2ab35f9e9d2308339c8e8cbeb (patch) | |
tree | 0ce6f47a7471f58f537749c16168b76f2dfb2731 /lib/CodeGen/SelectionDAG | |
parent | beb4d8293d5311c4581fd3d914f865e358af53a5 (diff) |
Teach DAGCombine to convert (sext x) to (zext x) when the
sign-bit of x is known to be zero.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50357 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 6ac549b9cf..dc59006fcf 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2887,6 +2887,10 @@ SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) { 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(); } |