commit | 415e13afea66fb0fea6a13c9988a96185e064dd8 | [log] [tgz] |
---|---|---|
author | Dan Gohman <gohman@apple.com> | Mon Apr 28 16:58:24 2008 +0000 |
committer | Dan Gohman <gohman@apple.com> | Mon Apr 28 16:58:24 2008 +0000 |
tree | 0ce6f47a7471f58f537749c16168b76f2dfb2731 | |
parent | 7015ef8395c2588c76a59467b295558b9de7c62d [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
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 @@ 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(); }