[llvm-commits] [llvm] r78615 - in /llvm/trunk/lib: CodeGen/SelectionDAG/DAGCombiner.cpp Target/ARM/ARMISelDAGToDAG.cpp
Dan Gohman
gohman at apple.com
Mon Aug 10 16:15:11 PDT 2009
Author: djg
Date: Mon Aug 10 18:15:10 2009
New Revision: 78615
URL: http://llvm.org/viewvc/llvm-project?rev=78615&view=rev
Log:
Fix a bug where DAGCombine was producing an illegal ConstantFP
node after legalize, and remove the workaround code from the
ARM backend.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=78615&r1=78614&r2=78615&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Mon Aug 10 18:15:10 2009
@@ -3721,7 +3721,18 @@
// 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)
Modified: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp?rev=78615&r1=78614&r2=78615&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp Mon Aug 10 18:15:10 2009
@@ -988,24 +988,6 @@
// Other cases are autogenerated.
break;
}
- case ISD::ConstantFP: {
- ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(N);
- EVT VT = CFP->getValueType(0);
- ConstantFP *LLVMC = const_cast<ConstantFP*>(CFP->getConstantFPValue());
- SDValue CPIdx = CurDAG->getTargetConstantPool(LLVMC, TLI.getPointerTy());
- SDNode *ResNode;
- SDValue Ops[] = {
- CPIdx,
- CurDAG->getTargetConstant(0, EVT::i32),
- getAL(CurDAG),
- CurDAG->getRegister(0, EVT::i32),
- CurDAG->getEntryNode()
- };
- unsigned Opc = (VT == EVT::f32) ? ARM::FLDS : ARM::FLDD;
- ResNode=CurDAG->getTargetNode(Opc, dl, VT, EVT::Other, Ops, 5);
- ReplaceUses(Op, SDValue(ResNode, 0));
- return NULL;
- }
case ISD::FrameIndex: {
// Selects to ADDri FI, 0 which in turn will become ADDri SP, imm.
int FI = cast<FrameIndexSDNode>(N)->getIndex();
More information about the llvm-commits
mailing list