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 | 415e13afea66fb0fea6a13c9988a96185e064dd8 (patch) | |
tree | 0ce6f47a7471f58f537749c16168b76f2dfb2731 | |
parent | 7015ef8395c2588c76a59467b295558b9de7c62d (diff) | |
download | external_llvm-415e13afea66fb0fea6a13c9988a96185e064dd8.zip external_llvm-415e13afea66fb0fea6a13c9988a96185e064dd8.tar.gz external_llvm-415e13afea66fb0fea6a13c9988a96185e064dd8.tar.bz2 |
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
-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 6ac549b..dc59006 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(); } |