[SDAG] Add DEBUG logging to the legalizer, fixing a "bug" found by
authorChandler Carruth <chandlerc@gmail.com>
Mon, 28 Jul 2014 17:55:07 +0000 (17:55 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Mon, 28 Jul 2014 17:55:07 +0000 (17:55 +0000)
commitd9d33c92a7cc0f29832f012d0a76d1d0718bb192
treefff70fe9141af8fc34ec06fdcd2c080384d779a9
parent3a5e9cb146a444148b1f40265acadb6a27ee7776
[SDAG] Add DEBUG logging to the legalizer, fixing a "bug" found by
inspection in the proccess, and shuffle the logging in the DAG combiner
around a bit.

With this it is much easier to follow what the legalizer is doing. It
should even accurately present most of the strange legalization
operations where a single node is replaced by multiple nodes, etc. There
is still some information lost (we log SDNodes not SDValues so we don't
log which result is used for which thing), but I think this is much
closer to a usable system. Notably, this will make it *much* more
apparant when legalization is actually happening inside the combiner, or
when there is a cycle caused by interactions of the legalizer and the
combiner.

The "bug" I fixed here I'm not sure is remotely possible to trigger. We
were only adding one of the nodes in a replacement to the updated set
rather than all of the nodes in the replacement. Realistically, the
worst result of this are nodes not getting back onto the worklist in the
DAG combiner. I doubt it is possible to trigger this today, and
I certainly don't have any ideas about how, but this at least brings the
code into alignment with the principled operation of the routine.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@214105 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp