Forgot to update the chain result when softening
authorDuncan Sands <baldrick@free.fr>
Wed, 9 Jul 2008 11:15:31 +0000 (11:15 +0000)
committerDuncan Sands <baldrick@free.fr>
Wed, 9 Jul 2008 11:15:31 +0000 (11:15 +0000)
loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53287 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

index b0809fd8cca93b2991e6406d79c82da2e8a8c7b1..7dcffa21583914e1a401878e3b46259bf8f16412 100644 (file)
@@ -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) {