aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-08-10 23:15:10 +0000
committerDan Gohman <gohman@apple.com>2009-08-10 23:15:10 +0000
commit3f20cb6d9679205620a4fd51d3ec9aa73bf3a508 (patch)
tree9a1bdadf495f4ae9e697fdebf93295cc39c842e5 /lib/CodeGen
parent201b82226fff75b7087698c00037e1d4e8d08b78 (diff)
downloadexternal_llvm-3f20cb6d9679205620a4fd51d3ec9aa73bf3a508.zip
external_llvm-3f20cb6d9679205620a4fd51d3ec9aa73bf3a508.tar.gz
external_llvm-3f20cb6d9679205620a4fd51d3ec9aa73bf3a508.tar.bz2
Fix a bug where DAGCombine was producing an illegal ConstantFP
node after legalize, and remove the workaround code from the ARM backend. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78615 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/DAGCombiner.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 6119411..42d163f 100644
--- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -3721,7 +3721,18 @@ SDValue DAGCombiner::visitBIT_CONVERT(SDNode *N) {
// If the input is a constant, let getNode fold it.
if (isa<ConstantSDNode>(N0) || isa<ConstantFPSDNode>(N0)) {
SDValue Res = DAG.getNode(ISD::BIT_CONVERT, N->getDebugLoc(), VT, N0);
- if (Res.getNode() != N) return Res;
+ if (Res.getNode() != N) {
+ if (!LegalOperations ||
+ TLI.isOperationLegal(Res.getNode()->getOpcode(), VT))
+ return Res;
+
+ // Folding it resulted in an illegal node, and it's too late to
+ // do that. Clean up the old node and forego the transformation.
+ // Ideally this won't happen very often, because instcombine
+ // and the earlier dagcombine runs (where illegal nodes are
+ // permitted) should have folded most of them already.
+ DAG.DeleteNode(Res.getNode());
+ }
}
// (conv (conv x, t1), t2) -> (conv x, t2)