aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-low.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@gcc.gnu.org>2009-10-17 22:17:26 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-10-17 22:17:26 +0000
commit79ddec0279508bee9a68b640a9633d874b06ac4a (patch)
tree81ce085b12daef47f014b038c52ac8126ff9fa54 /gcc/gimple-low.c
parent7e90b362e1d82c1e87c4ca010195cab28ddb5f57 (diff)
downloadgcc-79ddec0279508bee9a68b640a9633d874b06ac4a.zip
gcc-79ddec0279508bee9a68b640a9633d874b06ac4a.tar.gz
gcc-79ddec0279508bee9a68b640a9633d874b06ac4a.tar.bz2
gimple-low.c (lower_stmt): If the call is noreturn, remove a subsequent GOTO or RETURN statement.
* gimple-low.c (lower_stmt) <GIMPLE_CALL>: If the call is noreturn, remove a subsequent GOTO or RETURN statement. From-SVN: r152959
Diffstat (limited to 'gcc/gimple-low.c')
-rw-r--r--gcc/gimple-low.c13
1 files changed, 13 insertions, 0 deletions
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;