Changes in directory llvm/lib/CodeGen/SelectionDAG:

LegalizeDAG.cpp updated: 1.212 -> 1.213
---
Log message:

Legalize MERGE_VALUES, expand READCYCLECOUNTER correctly, so it doesn't 
break control dependence.


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

 LegalizeDAG.cpp |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)


Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.212 
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.213
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.212 Sun Nov 20 15:32:07 2005
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp       Sun Nov 20 16:56:56 2005
@@ -561,6 +561,8 @@
       Result = DAG.getNode(Node->getOpcode(), Node->getValueType(0), Tmp1,
                            Node->getOperand(1));
     break;
+  case ISD::MERGE_VALUES:
+    return LegalizeOp(Node->getOperand(Op.ResNo));
   case ISD::CopyFromReg:
     Tmp1 = LegalizeOp(Node->getOperand(0));
     if (Tmp1 != Node->getOperand(0))
@@ -3338,15 +3340,18 @@
     break;
   }
 
-  case ISD::READCYCLECOUNTER:
-    if (TLI.getOperationAction(ISD::READCYCLECOUNTER, VT) == 
TargetLowering::Custom) {
-      SDOperand Chain = LegalizeOp(Node->getOperand(0));
-      AddLegalizedOperand(SDOperand(Node, 1), Chain);
-      SDOperand t = TLI.LowerOperation(Op, DAG);
-      ExpandOp(t, Lo, Hi);
-    } else
-      assert(0 && "Must custom expand ReadCycleCounter");
+  case ISD::READCYCLECOUNTER: {
+    assert(TLI.getOperationAction(ISD::READCYCLECOUNTER, VT) == 
+                 TargetLowering::Custom &&
+           "Must custom expand ReadCycleCounter");
+    SDOperand T = TLI.LowerOperation(Op, DAG);
+    assert(T.Val && "Node must be custom expanded!");
+    Lo = LegalizeOp(T.getValue(0));
+    Hi = LegalizeOp(T.getValue(1));
+    AddLegalizedOperand(SDOperand(Node, 1), // Remember we legalized the chain.
+                        LegalizeOp(T.getValue(2)));
     break;
+  }
 
     // These operators cannot be expanded directly, emit them as calls to
     // library functions.



_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to