aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-eh.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-09-15 17:57:49 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-09-15 17:57:49 +0000
commitcc6fbd80401445d44e4bec590038ab8ae5d4ffc5 (patch)
tree85b51c6481779050c0f263379eb0de9f37be4046 /gcc/tree-eh.c
parent10d48e7cd94b998f2e806d12a878e221eb017979 (diff)
downloadgcc-cc6fbd80401445d44e4bec590038ab8ae5d4ffc5.zip
gcc-cc6fbd80401445d44e4bec590038ab8ae5d4ffc5.tar.gz
gcc-cc6fbd80401445d44e4bec590038ab8ae5d4ffc5.tar.bz2
tree-eh.c (lower_try_finally_dup_block): Clear location information on stack restore statements.
* tree-eh.c (lower_try_finally_dup_block): Clear location information on stack restore statements. (decide_copy_try_finally): Do not consider a stack restore statement as coming from sources. From-SVN: r227805
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r--gcc/tree-eh.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index c1ca468..1a55d22 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -915,7 +915,12 @@ lower_try_finally_dup_block (gimple_seq seq, struct leh_state *outer_state,
for (gsi = gsi_start (new_seq); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
- if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
+ /* We duplicate __builtin_stack_restore at -O0 in the hope of eliminating
+ it on the EH paths. When it is not eliminated, make it transparent in
+ the debug info. */
+ if (gimple_call_builtin_p (stmt, BUILT_IN_STACK_RESTORE))
+ gimple_set_location (stmt, UNKNOWN_LOCATION);
+ else if (LOCATION_LOCUS (gimple_location (stmt)) == UNKNOWN_LOCATION)
{
tree block = gimple_block (stmt);
gimple_set_location (stmt, loc);
@@ -1604,8 +1609,12 @@ decide_copy_try_finally (int ndests, bool may_throw, gimple_seq finally)
for (gsi = gsi_start (finally); !gsi_end_p (gsi); gsi_next (&gsi))
{
+ /* Duplicate __builtin_stack_restore in the hope of eliminating it
+ on the EH paths and, consequently, useless cleanups. */
gimple stmt = gsi_stmt (gsi);
- if (!is_gimple_debug (stmt) && !gimple_clobber_p (stmt))
+ if (!is_gimple_debug (stmt)
+ && !gimple_clobber_p (stmt)
+ && !gimple_call_builtin_p (stmt, BUILT_IN_STACK_RESTORE))
return false;
}
return true;