Skip to content

Commit 3e21d7c

Browse files
s-barannikovvinay-deshmukh
authored andcommitted
[SelectionDAG] Make SelectionDAG::dump(true) usable from debugger (llvm#166722)
When called from DAGCombiner, there may be a HandleSDNode allocated on the stack. Since the node is not part of a DAG, we don't allocate an entry for it in the operand counting map and should not attempt to decrement its operand count.
1 parent 7acccd3 commit 3e21d7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12746,6 +12746,10 @@ void SelectionDAG::getTopologicallyOrderedNodes(
1274612746
for (unsigned i = 0U; i < SortedNodes.size(); ++i) {
1274712747
const SDNode *N = SortedNodes[i];
1274812748
for (const SDNode *U : N->users()) {
12749+
// HandleSDNode is never part of a DAG and therefore has no entry in
12750+
// RemainingOperands.
12751+
if (U->getOpcode() == ISD::HANDLENODE)
12752+
continue;
1274912753
unsigned &NumRemOperands = RemainingOperands[U];
1275012754
assert(NumRemOperands && "Invalid number of remaining operands");
1275112755
--NumRemOperands;
@@ -12759,8 +12763,6 @@ void SelectionDAG::getTopologicallyOrderedNodes(
1275912763
"First node in topological sort is not the entry token");
1276012764
assert(SortedNodes.front()->getNumOperands() == 0 &&
1276112765
"First node in topological sort has operands");
12762-
assert(SortedNodes.back()->use_empty() &&
12763-
"Last node in topologic sort has users");
1276412766
}
1276512767

1276612768
/// AddDbgValue - Add a dbg_value SDNode. If SD is non-null that means the

0 commit comments

Comments
 (0)