[llvm] r177525 - Move SDNode order propagation to SDNodeOrdering, which also fixes a missed
Justin Holewinski
jholewinski at nvidia.com
Wed Mar 20 07:51:01 PDT 2013
Author: jholewinski
Date: Wed Mar 20 09:51:01 2013
New Revision: 177525
URL: http://llvm.org/viewvc/llvm-project?rev=177525&view=rev
Log:
Move SDNode order propagation to SDNodeOrdering, which also fixes a missed
case of order propagation during isel.
Thanks Owen for the suggestion!
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp?rev=177525&r1=177524&r2=177525&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp Wed Mar 20 09:51:01 2013
@@ -619,17 +619,6 @@ void DAGTypeLegalizer::RemapValue(SDValu
}
}
-/// 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::SetPromotedIntege
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(
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::SetScalarizedVect
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::SetExpandedIntege
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(
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(SD
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(
OpEntry = Result;
// Propagate node ordering
- PropagateOrdering(Op.getNode(), Result.getNode());
+ DAG.AssignOrdering(Result.getNode(), DAG.GetOrdering(Op.getNode()));
}
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h?rev=177525&r1=177524&r2=177525&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeTypes.h Wed Mar 20 09:51:01 2013
@@ -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);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h?rev=177525&r1=177524&r2=177525&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SDNodeOrdering.h Wed Mar 20 09:51:01 2013
@@ -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);
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp?rev=177525&r1=177524&r2=177525&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Mar 20 09:51:01 2013
@@ -786,7 +786,9 @@ void SelectionDAGISel::DoInstructionSele
continue;
// Replace node.
if (ResNode) {
+ // Propagate ordering
CurDAG->AssignOrdering(ResNode, CurDAG->GetOrdering(Node));
+
ReplaceUses(Node, ResNode);
}
More information about the llvm-commits
mailing list