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

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 13 16:55:14 PST 2006



Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.302 -> 1.303
---
Log message:

Fix a latent bug in the call sequence handling stuff.  Some targets (e.g. x86)
create these nodes with flag results.  Remember that we legalized them.


---
Diffs of the changes:  (+11 -4)

 LegalizeDAG.cpp |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.302 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.303
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.302	Mon Feb 13 03:18:02 2006
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp	Mon Feb 13 18:55:02 2006
@@ -729,8 +729,10 @@
     }
     
     // Remember that the CALLSEQ_START is legalized.
-    AddLegalizedOperand(Op, Result);
-
+    AddLegalizedOperand(Op.getValue(0), Result);
+    if (Node->getNumValues() == 2)    // If this has a flag result, remember it.
+      AddLegalizedOperand(Op.getValue(1), Result.getValue(1));
+    
     // Now that the callseq_start and all of the non-call nodes above this call
     // sequence have been legalized, legalize the call itself.  During this 
     // process, no libcalls can/will be inserted, guaranteeing that no calls
@@ -778,10 +780,15 @@
         Result = DAG.UpdateNodeOperands(Result, Ops);
       }
     }
-    assert(IsLegalizingCall && "imbalance between START/END?");
+    assert(IsLegalizingCall && "Call sequence imbalance between start/end?");
     // This finishes up call legalization.
     IsLegalizingCall = false;
-    break;
+    
+    // If the CALLSEQ_END node has a flag, remember that we legalized it.
+    AddLegalizedOperand(SDOperand(Node, 0), Result.getValue(0));
+    if (Node->getNumValues() == 2)
+      AddLegalizedOperand(SDOperand(Node, 1), Result.getValue(1));
+    return Result.getValue(Op.ResNo);
   case ISD::DYNAMIC_STACKALLOC: {
     Tmp1 = LegalizeOp(Node->getOperand(0));  // Legalize the chain.
     Tmp2 = LegalizeOp(Node->getOperand(1));  // Legalize the size.






More information about the llvm-commits mailing list