[PATCH] SelectionDAG Debug

Just so this doesn't get lost in threads dealing with SelectionDAG
issues, I'd like to post this patch for review. It changes the SDUse
list from an intrusive list to a std::list<> under XDEBUG. This allows
us to use the debugging features of the standard library to track down
stubborn bugs.

I've used this to diagnose in issue in SelectionDAG in our sources and
also in the Blackfin codegen on TOT.

Please review, comment and let me know what needs to change for
commit.

Thanks!

                                          -Dave

sdxdebug.patch (7.7 KB)

Do you have a fix for the blackfin codegen? That would be a great
way to motivate this patch.

Otherwise, at a glance, it appears you fixed the issues I raised,
so this is fine, if it catches real bugs.

Dan

Do you have a fix for the blackfin codegen? That would be a great
way to motivate this patch.

I'm not following you. Why does a fix for a bug have anything to do
with a patch that catches bugs?

Otherwise, at a glance, it appears you fixed the issues I raised,
so this is fine, if it catches real bugs.

Oh, it catches real bugs. I'm still trying to determine what in our code
causes it to trip elsewhere. But regardless, it's a defensive programming
technique and to me that's valuable even if it never finds a bug.

                                     -Dave

It helps people understand what's being checked.

On an unrelated topic, the patch works by replacing the normal use
list with a std::list. To be really complete, it should leave the
normal use list in place, so that it the normal use list code
continues to be tested in XDEBUG builds. A parallel std::list
could be maintained for consistency checking.

Dan

> I'm not following you. Why does a fix for a bug have anything to do
> with a patch that catches bugs?

It helps people understand what's being checked.

I can add some commentary about that. That's a good idea, actually. :slight_smile:

On an unrelated topic, the patch works by replacing the normal use
list with a std::list. To be really complete, it should leave the
normal use list in place, so that it the normal use list code
continues to be tested in XDEBUG builds. A parallel std::list
could be maintained for consistency checking.

Hmm, I can see value there. It would require defining a use_iterator to
hold both an "original use_iterator" and a std::list<>::iterator and we'd
have to make all of the operations update two parallel lists.

Does that sound like the right approach to you?

                                                      -Dave