Skip to content

Commit a1bfed5

Browse files
committed
[PATCH-AVR] avr-rust/rust-legacy-fork#101 (D53106): topological sorting
1 parent 4a1ad71 commit a1bfed5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

include/llvm/CodeGen/SelectionDAGNodes.h

+14
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,12 @@ class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
836836
SmallVectorImpl<const SDNode *> &Worklist,
837837
unsigned int MaxSteps = 0,
838838
bool TopologicalPrune = false) {
839+
// NOTE(TimNN): I'm not confident that the in-progress D53106 actually
840+
// handles the topological ordering correctly, so I'm disabling
841+
// this performance optimization until the upstream patch has
842+
// been accepted.
843+
TopologicalPrune = false;
844+
839845
SmallVector<const SDNode *, 8> DeferredNodes;
840846
if (Visited.count(N))
841847
return true;
@@ -867,6 +873,14 @@ class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
867873
}
868874
for (const SDValue &OpV : M->op_values()) {
869875
SDNode *Op = OpV.getNode();
876+
// If we are adding a glued node, its glued user should be considered a
877+
// predecessor as well to prevent a node merge causing a non-immediate
878+
// use of a glue operand. Walk down all unvisited glue users.
879+
while (auto *GN = Op->getGluedUser()) {
880+
if ((GN == M) || Visited.count(GN))
881+
break;
882+
Op = GN;
883+
}
870884
if (Visited.insert(Op).second)
871885
Worklist.push_back(Op);
872886
if (Op == N)

0 commit comments

Comments
 (0)