On Sat, Feb 23, 2019 at 10:05:40AM +0100, Jakub Jelinek wrote: > And finally, for 1) the patch has a case for a dead .ABNORMAL_DISPATCHER, > one that has only incoming edges but no successors. I didn't want to > complicate or slow down the processing too much, so it is actually done > only if .ABNORMAL_DISPATCHER has no outgoing edges, rather than if it has > some, but all of them are in the end to non-visited basic blocks. > This means when we for 5) or 4) above remove all such bbs as dead in one > cfg cleanup, we remove .ABNORMAL_DISPATCHER only in the following cfg > cleanup.
Thinking about the above, I think we could handle that cheaply in the same cleanup cfg rather than in the next one. Don't know right now if we can have at most one .ABNORMAL_DISPATCHER in a function or more (I vaguely remember we disallow inlining in some of the ab cases like setjmp, non-local goto etc.), if there can be at most one, we could just make the .ABNORMAL_DISPATCHER visited normally, but additionally note it in some basic_block pointer, if we can have more than one, we could have auto_vec of them, and then after the loop just go through that one or more .ABNORMAL_DISPATCHER bbs and if they don't have any successors visited, unset the visited bit for them as well. Shall I modify the patch for that? > 2019-02-23 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimization/89280 > * tree-cfgcleanup.c (maybe_dead_abnormal_edge_p, > builtin_setjmp_setup_bb): New functions. > (cleanup_control_flow_pre): Ignore maybe_dead_abnormal_edge_p edges. > When visiting __builtin_setjmp_setup block, queue in special > setjmp_vec vector edges from .ABNORMAL_DISPATCHER to corresponding > __builtin_setjmp_receiver. > > * gcc.c-torture/compile/pr89280.c: New test. > * gcc.dg/torture/pr57147-2.c: Don't expect a setjmp after noreturn > function. Skip the test for -O0. Jakub