On Wed, 15 Nov 2023, Kewen.Lin wrote:
> >> And I suppose it would be OK to do that. Empty BBs are usually removed by > >> CFG cleanup so the situation should only happen in rare corner cases where > >> the fix would be to actually run CFG cleanup ... > > > > Yeah, sel-sched invokes 'cfg_cleanup (0)' up front, and I suppose that > > may be a preferable compromise for sched-rgn as well. > > Inspired by this discussion, I tested the attached patch 1 which is to run > cleanup_cfg (0) first in haifa_sched_init, it's bootstrapped and > regress-tested on x86_64-redhat-linux and powerpc64{,le}-linux-gnu. I don't think you can run cleanup_cfg after sched_init. I would suggest to put it early in schedule_insns. > Then I assumed some of the current uses of no_real_insns_p won't encounter > empty blocks any more, so made a patch 2 with some explicit assertions, but > unfortunately I got ICEs during bootstrapping happens in function > compute_priorities. I'm going to investigate it further and post more > findings, but just heads-up to ensure if this is on the right track. I suspect this may be caused by invoking cleanup_cfg too late. Alexander