From 452911c468a8d3b7571a3eb9aeff37c3880adb94 Mon Sep 17 00:00:00 2001 From: Duncan Sands Date: Wed, 9 Jul 2008 11:15:31 +0000 Subject: [PATCH] Forgot to update the chain result when softening loads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53287 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../SelectionDAG/LegalizeFloatTypes.cpp | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp index b0809fd8cca..7dcffa21583 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp @@ -230,20 +230,29 @@ SDOperand DAGTypeLegalizer::SoftenFloatRes_LOAD(SDNode *N) { MVT VT = N->getValueType(0); MVT NVT = TLI.getTypeToTransformTo(VT); - if (L->getExtensionType() == ISD::NON_EXTLOAD) - return DAG.getLoad(L->getAddressingMode(), L->getExtensionType(), - NVT, L->getChain(), L->getBasePtr(), L->getOffset(), - L->getSrcValue(), L->getSrcValueOffset(), NVT, - L->isVolatile(), L->getAlignment()); + SDOperand NewL; + if (L->getExtensionType() == ISD::NON_EXTLOAD) { + NewL = DAG.getLoad(L->getAddressingMode(), L->getExtensionType(), + NVT, L->getChain(), L->getBasePtr(), L->getOffset(), + L->getSrcValue(), L->getSrcValueOffset(), NVT, + L->isVolatile(), L->getAlignment()); + // Legalized the chain result - switch anything that used the old chain to + // use the new one. + ReplaceValueWith(SDOperand(N, 1), NewL.getValue(1)); + return NewL; + } // Do a non-extending load followed by FP_EXTEND. - SDOperand NL = DAG.getLoad(L->getAddressingMode(), ISD::NON_EXTLOAD, - L->getMemoryVT(), L->getChain(), - L->getBasePtr(), L->getOffset(), - L->getSrcValue(), L->getSrcValueOffset(), - L->getMemoryVT(), - L->isVolatile(), L->getAlignment()); - return BitConvertToInteger(DAG.getNode(ISD::FP_EXTEND, VT, NL)); + NewL = DAG.getLoad(L->getAddressingMode(), ISD::NON_EXTLOAD, + L->getMemoryVT(), L->getChain(), + L->getBasePtr(), L->getOffset(), + L->getSrcValue(), L->getSrcValueOffset(), + L->getMemoryVT(), + L->isVolatile(), L->getAlignment()); + // Legalized the chain result - switch anything that used the old chain to + // use the new one. + ReplaceValueWith(SDOperand(N, 1), NewL.getValue(1)); + return BitConvertToInteger(DAG.getNode(ISD::FP_EXTEND, VT, NewL)); } SDOperand DAGTypeLegalizer::SoftenFloatRes_SELECT(SDNode *N) {