[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed May 11 21:49:25 PDT 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.107 -> 1.108
---
Log message:

Fix a problem where early legalization can cause token chain problems.


---
Diffs of the changes:  (+8 -7)

 LegalizeDAG.cpp |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.107 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.108
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.107	Wed May 11 19:17:04 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Wed May 11 23:49:08 2005
@@ -130,6 +130,8 @@
   void ExpandByParts(unsigned NodeOp, SDOperand LHS, SDOperand RHS,
                      SDOperand &Lo, SDOperand &Hi);
 
+  void SpliceCallInto(const SDOperand &CallResult, SDNode *OutChain);
+
   SDOperand getIntPtrConstant(uint64_t Val) {
     return DAG.getConstant(Val, TLI.getPointerTy());
   }
@@ -1271,7 +1273,6 @@
           Node->getOpcode() == ISD::UINT_TO_FP) {
         Result = ExpandIntToFP(Node->getOpcode() == ISD::SINT_TO_FP,
                                Node->getValueType(0), Node->getOperand(0));
-        Result = LegalizeOp(Result);
         break;
       } else if (Node->getOpcode() == ISD::TRUNCATE) {
         // In the expand case, we must be dealing with a truncate, because
@@ -1530,8 +1531,6 @@
     case Expand:
       Result = ExpandIntToFP(Node->getOpcode() == ISD::SINT_TO_FP, NVT,
                              Node->getOperand(0));
-      Result = LegalizeOp(Result);
-
       // Round if we cannot tolerate excess precision.
       if (NoExcessFPPrecision)
         Result = DAG.getNode(ISD::FP_ROUND_INREG, NVT, Result, VT);
@@ -2047,8 +2046,8 @@
 }
 
 /// SpliceCallInto - Given the result chain of a libcall (CallResult), and a 
-static void SpliceCallInto(const SDOperand &CallResult, SDNode *OutChain,
-                           SelectionDAG &DAG) {
+void SelectionDAGLegalize::SpliceCallInto(const SDOperand &CallResult,
+                                          SDNode *OutChain) {
   // Nothing to splice it into?
   if (OutChain == 0) return;
 
@@ -2087,7 +2086,9 @@
   const Type *RetTy = MVT::getTypeForValueType(Node->getValueType(0));
   std::pair<SDOperand,SDOperand> CallInfo =
     TLI.LowerCallTo(InChain, RetTy, false, Callee, Args, DAG);
-  SpliceCallInto(CallInfo.second, OutChain, DAG);
+  SpliceCallInto(CallInfo.second, OutChain);
+
+  NeedsAnotherIteration = true;
 
   switch (getTypeAction(CallInfo.first.getValueType())) {
   default: assert(0 && "Unknown thing");
@@ -2176,7 +2177,7 @@
   std::pair<SDOperand,SDOperand> CallResult =
     TLI.LowerCallTo(InChain, RetTy, false, Callee, Args, DAG);
 
-  SpliceCallInto(CallResult.second, OutChain, DAG);
+  SpliceCallInto(CallResult.second, OutChain);
   return CallResult.first;
 }
 






More information about the llvm-commits mailing list