diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2015-09-15 17:57:49 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2015-09-15 17:57:49 +0000 |
commit | cc6fbd80401445d44e4bec590038ab8ae5d4ffc5 (patch) | |
tree | 85b51c6481779050c0f263379eb0de9f37be4046 /gcc | |
parent | 10d48e7cd94b998f2e806d12a878e221eb017979 (diff) | |
download | gcc-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')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/array24.adb | 11 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/blocklocs.adb | 26 | ||||
-rw-r--r-- | gcc/tree-eh.c | 13 |
5 files changed, 34 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9acbc57..0ec1419 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-09-15 Eric Botcazou <ebotcazou@adacore.com> + + * 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. + 2015-09-15 Uros Bizjak <ubizjak@gmail.com> * config/alpha/alpha.c (alpha_expand_block_clear): Use diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f8593b3..b4eaf3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-09-15 Eric Botcazou <ebotcazou@adacore.com> + + * gnat.dg/array24.adb: New test. + * gnat.dg/blocklocs.adb: Delete. + 2015-09-15 Marek Polacek <polacek@redhat.com> PR c/67580 diff --git a/gcc/testsuite/gnat.dg/array24.adb b/gcc/testsuite/gnat.dg/array24.adb new file mode 100644 index 0000000..c697436 --- /dev/null +++ b/gcc/testsuite/gnat.dg/array24.adb @@ -0,0 +1,11 @@ +-- { dg-do compile } +-- { dg-options "-fdump-tree-optimized" } + +procedure Array24 (N : Natural) is + S : String (1 .. N); + pragma Volatile (S); +begin + S := (others => '0'); +end; + +-- { dg-final { scan-tree-dump-not "builtin_unwind_resume" "optimized" } } diff --git a/gcc/testsuite/gnat.dg/blocklocs.adb b/gcc/testsuite/gnat.dg/blocklocs.adb deleted file mode 100644 index 20ff7b3..0000000 --- a/gcc/testsuite/gnat.dg/blocklocs.adb +++ /dev/null @@ -1,26 +0,0 @@ --- { dg-do compile { target *-*-linux* } } --- { dg-options "-gdwarf-2" } - -procedure Blocklocs (Choice : Integer; N : in out Integer) is -begin - if Choice > 0 then - declare -- line 7 - S : String (1 .. N * 2); - pragma Volatile (S); - begin - S := (others => 'B'); - end; -- line 12 - else - declare -- line 14 - S : String (1 .. N ); - pragma Volatile (S); - begin - S := (others => '1'); - end; -- line 19 - end if; -end; - --- { dg-final { scan-assembler "loc 1 7" } } --- { dg-final { scan-assembler "loc 1 12" } } --- { dg-final { scan-assembler "loc 1 14" } } --- { dg-final { scan-assembler "loc 1 19" } } 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; |