[SelectionDAG] Force cycle detection in AssignTopologicalOrder before aborting
authorAdam Nemet <anemet@apple.com>
Sat, 31 May 2014 16:23:20 +0000 (16:23 +0000)
committerAdam Nemet <anemet@apple.com>
Sat, 31 May 2014 16:23:20 +0000 (16:23 +0000)
commitb4690e3fd1c6b660fc4e9ef58ab8b34964a1c7a9
treec3d4b77f9a34401edbb6a3c75122624416e19da2
parent7d39430a14a8846f53069aa232e77a63a171f636
[SelectionDAG] Force cycle detection in AssignTopologicalOrder before aborting

DAG cycle detection is only enabled with ENABLE_EXPENSIVE_CHECKS.  However we
can run it just before we would crash in order to provide more informative
diagnostics.

Now in addition to the "Overran sorted position" message we also get the Node
printed if a cycle was detected.

Tested by building several configs: Debug+Assert, Debug+Assert+Check (this is
ENABLE_EXPENSIVE_CHECKS), Release+Assert and Release.  Also tried that the
AssignTopologicalOrder assert produces the expected results.

llvm-svn: 209977
llvm/include/llvm/CodeGen/SelectionDAG.h
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp