diff options
author | Dan Gohman <gohman@apple.com> | 2008-04-28 18:47:17 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2008-04-28 18:47:17 +0000 |
commit | 5b37f9d6ad40098a7b3cf8308092cc64919ac9e4 (patch) | |
tree | 0b398091f5d11a6465ea8db71d647a7d6896b182 /lib | |
parent | 4457edb33078af6468ccb030629416e20d1a6cf7 (diff) | |
download | external_llvm-5b37f9d6ad40098a7b3cf8308092cc64919ac9e4.zip external_llvm-5b37f9d6ad40098a7b3cf8308092cc64919ac9e4.tar.gz external_llvm-5b37f9d6ad40098a7b3cf8308092cc64919ac9e4.tar.bz2 |
Evan pointed out that folding sext to zext may not be correct
if the zext is not legal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50368 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index dc59006..28f32d3 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -2888,7 +2888,8 @@ SDOperand DAGCombiner::visitSIGN_EXTEND(SDNode *N) { } // fold (sext x) -> (zext x) if the sign bit is known zero. - if (DAG.SignBitIsZero(N0)) + if ((!AfterLegalize || TLI.isOperationLegal(ISD::ZERO_EXTEND, VT)) && + DAG.SignBitIsZero(N0)) return DAG.getNode(ISD::ZERO_EXTEND, VT, N0); return SDOperand(); |