From 468059bcbb8efdb31fd90369dc2ed122126413fe Mon Sep 17 00:00:00 2001 From: David Daney Date: Thu, 11 Jun 2009 23:55:45 +0000 Subject: re PR c/39252 (Request new feature __builtin_unreachable ()) 2009-06-11 David Daney PR c/39252 * doc/extend.texi ( __builtin_unreachable): Document new builtin. * builtins.c (expand_builtin_unreachable): New function. (expand_builtin): Handle BUILT_IN_UNREACHABLE case. * builtins.def (BUILT_IN_UNREACHABLE): Add new builtin. * cfgcleanup.c (try_optimize_cfg): Delete empty blocks with no successors. * cfgrtl.c (rtl_verify_flow_info): Handle empty blocks when searching for missing barriers. 2009-06-11 David Daney PR c/39252 * gcc.dg/builtin-unreachable-1.c: New test. * gcc.dg/builtin-unreachable-2.c: Same. From-SVN: r148403 --- gcc/cfgcleanup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gcc/cfgcleanup.c') diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c index 8da967a4ee0..a8b38d72472 100644 --- a/gcc/cfgcleanup.c +++ b/gcc/cfgcleanup.c @@ -1873,8 +1873,12 @@ try_optimize_cfg (int mode) edge s; bool changed_here = false; - /* Delete trivially dead basic blocks. */ - if (EDGE_COUNT (b->preds) == 0) + /* Delete trivially dead basic blocks. This is either + blocks with no predecessors, or empty blocks with no + successors. Empty blocks may result from expanding + __builtin_unreachable (). */ + if (EDGE_COUNT (b->preds) == 0 + || (EDGE_COUNT (b->succs) == 0 && BB_HEAD (b) == BB_END (b))) { c = b->prev_bb; if (dump_file) -- cgit v1.2.1