Skip to content

Commit ba813f7

Browse files
TimNNLazarus535
authored andcommitted
avr-rust/rust-legacy-fork#101 (D53106): topological sorting
(cherry picked from commit 626f49c)
1 parent 8adf9bd commit ba813f7

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
@@ -870,6 +870,12 @@ END_TWO_BYTE_PACK()
870870
SmallVectorImpl<const SDNode *> &Worklist,
871871
unsigned int MaxSteps = 0,
872872
bool TopologicalPrune = false) {
873+
// NOTE(TimNN): I'm not confident that the in-progress D53106 actually
874+
// handles the topological ordering correctly, so I'm disabling
875+
// this performance optimization until the upstream patch has
876+
// been accepted.
877+
TopologicalPrune = false;
878+
873879
SmallVector<const SDNode *, 8> DeferredNodes;
874880
if (Visited.count(N))
875881
return true;
@@ -901,6 +907,14 @@ END_TWO_BYTE_PACK()
901907
}
902908
for (const SDValue &OpV : M->op_values()) {
903909
SDNode *Op = OpV.getNode();
910+
// If we are adding a glued node, its glued user should be considered a
911+
// predecessor as well to prevent a node merge causing a non-immediate
912+
// use of a glue operand. Walk down all unvisited glue users.
913+
while (auto *GN = Op->getGluedUser()) {
914+
if ((GN == M) || Visited.count(GN))
915+
break;
916+
Op = GN;
917+
}
904918
if (Visited.insert(Op).second)
905919
Worklist.push_back(Op);
906920
if (Op == N)

0 commit comments

Comments
 (0)