[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)
commitb143274ad0b51709eb7840881eb9857330731fba
treec364708890284e8d47121b5d9f78942f88159d78
parent46645fa102dee90861ea395f592c5758e0eee4f8
[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.

llvm-svn: 214105
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp