From 79ddec0279508bee9a68b640a9633d874b06ac4a Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Sat, 17 Oct 2009 22:17:26 +0000 Subject: gimple-low.c (lower_stmt): If the call is noreturn, remove a subsequent GOTO or RETURN statement. * gimple-low.c (lower_stmt) : If the call is noreturn, remove a subsequent GOTO or RETURN statement. From-SVN: r152959 --- gcc/gimple-low.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gcc/gimple-low.c') diff --git a/gcc/gimple-low.c b/gcc/gimple-low.c index b58fd7b..39c7351 100644 --- a/gcc/gimple-low.c +++ b/gcc/gimple-low.c @@ -387,6 +387,19 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data) lower_builtin_setjmp (gsi); return; } + + /* After a noreturn call, remove a subsequent GOTO or RETURN that might + have been mechanically added; this will prevent the EH lowering pass + from adding useless edges and thus complicating the initial CFG. */ + if (decl && (flags_from_decl_or_type (decl) & ECF_NORETURN)) + { + gsi_next (gsi); + if (!gsi_end_p (*gsi) + && (gimple_code (gsi_stmt (*gsi)) == GIMPLE_GOTO + || gimple_code (gsi_stmt (*gsi)) == GIMPLE_RETURN)) + gsi_remove (gsi, false); + return; + } } break; -- cgit v1.1