Strong PHI elimination asserts in RegisterCoalescer.C:1388

I've started using the strong PHI elimination pass, and it seems to work beautifully (producing much better placement of copy instructions) - though I'm seeing that it triggers an assert in debug+assert builds. The assertion is on line 1388 of RegisterCoalescer.C. Attached is the -debug output from the machine optimization part of the optimizer, for the simplest test case I could create that triggers this behavior.

Any idea what might be going wrong? Are there known issues with strong PHI elimination?

Andrew

log_debug_coalescing (8.28 KB)

I'm the person who wrote it, and it's not really maintained, as we decided we wanted to go in a different direction long-term by having fewer passes making independent coalescing decisions rather than more. At the time I stopped working on it, it worked fine on x86 but caused problems with armv7 NEON code.

If you file a PR with a test case, I am happy to take a quick look and try to fix it. There have been some changes to the backend that might not have been updated correctly in StrongPHIElimination.

Cameron

I will try to make a standalone test case but the one that is failing uses a custom back end, so it's not really portable.

So is the plan to have the strong PHI elimination behavior rolled into other passes?

Andrew

Okay, maybe I'll just try turning it on and look for any obvious problems on x86 test cases.

I think the plan is still to move phi elimination into RegisterCoalescer and only insert actual copies on interference like StrongPHIElimination does, but I shouldn't speak too strongly on behalf of the people who will actually do the work. :slight_smile:

Cameron