aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.cpp31
-rw-r--r--lib/CodeGen/SelectionDAG/LegalizeTypes.h1
-rw-r--r--lib/CodeGen/SelectionDAG/SDNodeOrdering.h4
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp2
4 files changed, 15 insertions, 23 deletions
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
index 1d6a981..b6436bf 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
@@ -619,17 +619,6 @@ void DAGTypeLegalizer::RemapValue(SDValue &N) {
}
}
-/// PropagateOrdering - Propagate SDNode ordering information from \p Old to
-/// \p New. Generally, this just means copying the ordering value, but if the
-/// new node is actually a recycled node with a lower ordering already, then
-/// we do not want to propagate the new (higher) ordering.
-void DAGTypeLegalizer::PropagateOrdering(SDNode *Old, SDNode *New) {
- unsigned OldOrder = DAG.GetOrdering(Old);
- unsigned NewOrder = DAG.GetOrdering(New);
- if (NewOrder == 0 || (NewOrder > 0 && OldOrder < NewOrder))
- DAG.AssignOrdering(New, OldOrder);
-}
-
namespace {
/// NodeUpdateListener - This class is a DAGUpdateListener that listens for
/// updates to nodes and recomputes their ready state.
@@ -748,7 +737,7 @@ void DAGTypeLegalizer::SetPromotedInteger(SDValue Op, SDValue Result) {
OpEntry = Result;
// Propagate node ordering
- PropagateOrdering(Op.getNode(), Result.getNode());
+ DAG.AssignOrdering(Result.getNode(), DAG.GetOrdering(Op.getNode()));
}
void DAGTypeLegalizer::SetSoftenedFloat(SDValue Op, SDValue Result) {
@@ -762,7 +751,7 @@ void DAGTypeLegalizer::SetSoftenedFloat(SDValue Op, SDValue Result) {
OpEntry = Result;
// Propagate node ordering
- PropagateOrdering(Op.getNode(), Result.getNode());
+ DAG.AssignOrdering(Result.getNode(), DAG.GetOrdering(Op.getNode()));
}
void DAGTypeLegalizer::SetScalarizedVector(SDValue Op, SDValue Result) {
@@ -779,7 +768,7 @@ void DAGTypeLegalizer::SetScalarizedVector(SDValue Op, SDValue Result) {
OpEntry = Result;
// Propagate node ordering
- PropagateOrdering(Op.getNode(), Result.getNode());
+ DAG.AssignOrdering(Result.getNode(), DAG.GetOrdering(Op.getNode()));
}
void DAGTypeLegalizer::GetExpandedInteger(SDValue Op, SDValue &Lo,
@@ -809,8 +798,8 @@ void DAGTypeLegalizer::SetExpandedInteger(SDValue Op, SDValue Lo,
Entry.second = Hi;
// Propagate ordering
- PropagateOrdering(Op.getNode(), Lo.getNode());
- PropagateOrdering(Op.getNode(), Hi.getNode());
+ DAG.AssignOrdering(Lo.getNode(), DAG.GetOrdering(Op.getNode()));
+ DAG.AssignOrdering(Hi.getNode(), DAG.GetOrdering(Op.getNode()));
}
void DAGTypeLegalizer::GetExpandedFloat(SDValue Op, SDValue &Lo,
@@ -840,8 +829,8 @@ void DAGTypeLegalizer::SetExpandedFloat(SDValue Op, SDValue Lo,
Entry.second = Hi;
// Propagate ordering
- PropagateOrdering(Op.getNode(), Lo.getNode());
- PropagateOrdering(Op.getNode(), Hi.getNode());
+ DAG.AssignOrdering(Lo.getNode(), DAG.GetOrdering(Op.getNode()));
+ DAG.AssignOrdering(Hi.getNode(), DAG.GetOrdering(Op.getNode()));
}
void DAGTypeLegalizer::GetSplitVector(SDValue Op, SDValue &Lo,
@@ -873,8 +862,8 @@ void DAGTypeLegalizer::SetSplitVector(SDValue Op, SDValue Lo,
Entry.second = Hi;
// Propagate ordering
- PropagateOrdering(Op.getNode(), Lo.getNode());
- PropagateOrdering(Op.getNode(), Hi.getNode());
+ DAG.AssignOrdering(Lo.getNode(), DAG.GetOrdering(Op.getNode()));
+ DAG.AssignOrdering(Hi.getNode(), DAG.GetOrdering(Op.getNode()));
}
void DAGTypeLegalizer::SetWidenedVector(SDValue Op, SDValue Result) {
@@ -888,7 +877,7 @@ void DAGTypeLegalizer::SetWidenedVector(SDValue Op, SDValue Result) {
OpEntry = Result;
// Propagate node ordering
- PropagateOrdering(Op.getNode(), Result.getNode());
+ DAG.AssignOrdering(Result.getNode(), DAG.GetOrdering(Op.getNode()));
}
diff --git a/lib/CodeGen/SelectionDAG/LegalizeTypes.h b/lib/CodeGen/SelectionDAG/LegalizeTypes.h
index b8b5ba8..27b3cf2 100644
--- a/lib/CodeGen/SelectionDAG/LegalizeTypes.h
+++ b/lib/CodeGen/SelectionDAG/LegalizeTypes.h
@@ -143,7 +143,6 @@ private:
void ExpungeNode(SDNode *N);
void PerformExpensiveChecks();
void RemapValue(SDValue &N);
- void PropagateOrdering(SDNode *Old, SDNode *New);
// Common routines.
SDValue BitConvertToInteger(SDValue Op);
diff --git a/lib/CodeGen/SelectionDAG/SDNodeOrdering.h b/lib/CodeGen/SelectionDAG/SDNodeOrdering.h
index d2269f8..74010a8 100644
--- a/lib/CodeGen/SelectionDAG/SDNodeOrdering.h
+++ b/lib/CodeGen/SelectionDAG/SDNodeOrdering.h
@@ -34,7 +34,9 @@ public:
SDNodeOrdering() {}
void add(const SDNode *Node, unsigned O) {
- OrderMap[Node] = O;
+ unsigned OldOrder = getOrder(Node);
+ if (OldOrder == 0 || (OldOrder > 0 && O < OldOrder))
+ OrderMap[Node] = O;
}
void remove(const SDNode *Node) {
DenseMap<const SDNode*, unsigned>::iterator Itr = OrderMap.find(Node);
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 15001f5..eeea9e4 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -786,7 +786,9 @@ void SelectionDAGISel::DoInstructionSelection() {
continue;
// Replace node.
if (ResNode) {
+ // Propagate ordering
CurDAG->AssignOrdering(ResNode, CurDAG->GetOrdering(Node));
+
ReplaceUses(Node, ResNode);
}