Skip to content

Commit 626f49c

Browse files
TimNNdylanmckay
authored andcommitted
avr-rust/rust-legacy-fork#101 (D53106): topological sorting
1 parent f1630e5 commit 626f49c

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

+14
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,12 @@ class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
842842
SmallVectorImpl<const SDNode *> &Worklist,
843843
unsigned int MaxSteps = 0,
844844
bool TopologicalPrune = false) {
845+
// NOTE(TimNN): I'm not confident that the in-progress D53106 actually
846+
// handles the topological ordering correctly, so I'm disabling
847+
// this performance optimization until the upstream patch has
848+
// been accepted.
849+
TopologicalPrune = false;
850+
845851
SmallVector<const SDNode *, 8> DeferredNodes;
846852
if (Visited.count(N))
847853
return true;
@@ -873,6 +879,14 @@ class SDNode : public FoldingSetNode, public ilist_node<SDNode> {
873879
}
874880
for (const SDValue &OpV : M->op_values()) {
875881
SDNode *Op = OpV.getNode();
882+
// If we are adding a glued node, its glued user should be considered a
883+
// predecessor as well to prevent a node merge causing a non-immediate
884+
// use of a glue operand. Walk down all unvisited glue users.
885+
while (auto *GN = Op->getGluedUser()) {
886+
if ((GN == M) || Visited.count(GN))
887+
break;
888+
Op = GN;
889+
}
876890
if (Visited.insert(Op).second)
877891
Worklist.push_back(Op);
878892
if (Op == N)

0 commit comments

Comments
 (0)