This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] third liveness pass
- From: Jan Hubicka <jh at suse dot cz>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Jan Hubicka <jh at suse dot cz>, gcc at gcc dot gnu dot org, law at cygnus dot com,gcc-pdo at atrey dot karlin dot mff dot cuni dot cz, gcc-patches at gcc dot gnu dot org
- Date: Mon, 27 May 2002 09:00:44 +0200
- Subject: Re: [RFC] third liveness pass
- References: <20020526122147.GM21915@atrey.karlin.mff.cuni.cz> <20020526163817.A1939@redhat.com>
>
> How can we, when the local property is dependent on which
> insns are deleted as dead code?
Andreas just benchmarked the attached patch to disable dead store
removal when not explicitly asked for (and we do that twice now).
It looks like the dead store removal is by far the most expensive part
of flow, so the attached patch cuts bootstrap time by about 1%.
Honza
Mon May 27 08:57:35 CEST 2002 Jan Hubicka <jh@suse.cz>
* basic-block.h (PEOP_SCAN_DEAD_STORES): New.
(PROP_FINAL): Include.
* flow.c (life_analysis, update_life_info,
init_propagate_block_info, mark_set_1, mark_used_rgs):
Support SCAN_DEAD_STORE.
Index: basic-block.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/basic-block.h,v
retrieving revision 1.145
diff -c -3 -p -r1.145 basic-block.h
*** basic-block.h 23 May 2002 15:22:04 -0000 1.145
--- basic-block.h 26 May 2002 19:01:18 -0000
*************** enum update_life_extent
*** 582,588 ****
by dead code removal. */
#define PROP_AUTOINC 64 /* Create autoinc mem references. */
#define PROP_EQUAL_NOTES 128 /* Take into account REG_EQUAL notes. */
! #define PROP_FINAL 127 /* All of the above. */
#define CLEANUP_EXPENSIVE 1 /* Do relativly expensive optimizations
except for edge forwarding */
--- 582,593 ----
by dead code removal. */
#define PROP_AUTOINC 64 /* Create autoinc mem references. */
#define PROP_EQUAL_NOTES 128 /* Take into account REG_EQUAL notes. */
! #define PROP_SCAN_DEAD_STORES 256 /* Scan for dead code. */
! #define PROP_FINAL (PROP_DEATH_NOTES | PROP_LOG_LINKS \
! | PROP_REG_INFO | PROP_KILL_DEAD_CODE \
! | PROP_SCAN_DEAD_CODE | PROP_AUTOINC \
! | PROP_ALLOW_CFG_CHANGES \
! | PROP_SCAN_DEAD_STORES)
#define CLEANUP_EXPENSIVE 1 /* Do relativly expensive optimizations
except for edge forwarding */
Index: flow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/flow.c,v
retrieving revision 1.524
diff -c -3 -p -r1.524 flow.c
*** flow.c 23 May 2002 19:23:40 -0000 1.524
--- flow.c 26 May 2002 19:05:08 -0000
*************** life_analysis (f, file, flags)
*** 447,453 ****
flags &= ~(PROP_REG_INFO | PROP_AUTOINC);
/* We want alias analysis information for local dead store elimination. */
! if (optimize && (flags & PROP_SCAN_DEAD_CODE))
init_alias_analysis ();
/* Always remove no-op moves. Do this before other processing so
--- 447,453 ----
flags &= ~(PROP_REG_INFO | PROP_AUTOINC);
/* We want alias analysis information for local dead store elimination. */
! if (optimize && (flags & PROP_SCAN_DEAD_STORES))
init_alias_analysis ();
/* Always remove no-op moves. Do this before other processing so
*************** life_analysis (f, file, flags)
*** 477,483 ****
update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
/* Clean up. */
! if (optimize && (flags & PROP_SCAN_DEAD_CODE))
end_alias_analysis ();
if (file)
--- 477,483 ----
update_life_info (NULL, UPDATE_LIFE_GLOBAL, flags);
/* Clean up. */
! if (optimize && (flags & PROP_SCAN_DEAD_STORES))
end_alias_analysis ();
if (file)
*************** update_life_info (blocks, extent, prop_f
*** 646,651 ****
--- 646,652 ----
calculate_global_regs_live (blocks, blocks,
prop_flags & (PROP_SCAN_DEAD_CODE
+ | PROP_SCAN_DEAD_STORES
| PROP_ALLOW_CFG_CHANGES));
if ((prop_flags & (PROP_KILL_DEAD_CODE | PROP_ALLOW_CFG_CHANGES))
*************** update_life_info (blocks, extent, prop_f
*** 659,664 ****
--- 660,666 ----
COPY_REG_SET (tmp, bb->global_live_at_end);
changed |= propagate_block (bb, tmp, NULL, NULL,
prop_flags & (PROP_SCAN_DEAD_CODE
+ | PROP_SCAN_DEAD_STORES
| PROP_KILL_DEAD_CODE));
}
*************** update_life_info (blocks, extent, prop_f
*** 667,673 ****
removing dead code can affect global register liveness, which
is supposed to be finalized for this call after this loop. */
stabilized_prop_flags
! &= ~(PROP_SCAN_DEAD_CODE | PROP_KILL_DEAD_CODE);
if (! changed)
break;
--- 669,676 ----
removing dead code can affect global register liveness, which
is supposed to be finalized for this call after this loop. */
stabilized_prop_flags
! &= ~(PROP_SCAN_DEAD_CODE | PROP_SCAN_DEAD_STORES
! | PROP_KILL_DEAD_CODE);
if (! changed)
break;
*************** init_propagate_block_info (bb, live, loc
*** 1922,1928 ****
&& ! (TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE
&& (TYPE_RETURNS_STACK_DEPRESSED
(TREE_TYPE (current_function_decl))))
! && (flags & PROP_SCAN_DEAD_CODE)
&& (bb->succ == NULL
|| (bb->succ->succ_next == NULL
&& bb->succ->dest == EXIT_BLOCK_PTR
--- 1925,1931 ----
&& ! (TREE_CODE (TREE_TYPE (current_function_decl)) == FUNCTION_TYPE
&& (TYPE_RETURNS_STACK_DEPRESSED
(TREE_TYPE (current_function_decl))))
! && (flags & PROP_SCAN_DEAD_STORES)
&& (bb->succ == NULL
|| (bb->succ->succ_next == NULL
&& bb->succ->dest == EXIT_BLOCK_PTR
*************** mark_set_1 (pbi, code, reg, cond, insn,
*** 2609,2615 ****
/* If this set is a MEM, then it kills any aliased writes.
If this set is a REG, then it kills any MEMs which use the reg. */
! if (optimize && (flags & PROP_SCAN_DEAD_CODE))
{
if (GET_CODE (reg) == REG)
invalidate_mems_from_set (pbi, reg);
--- 2612,2618 ----
/* If this set is a MEM, then it kills any aliased writes.
If this set is a REG, then it kills any MEMs which use the reg. */
! if (optimize && (flags & PROP_SCAN_DEAD_STORES))
{
if (GET_CODE (reg) == REG)
invalidate_mems_from_set (pbi, reg);
*************** mark_used_regs (pbi, x, cond, insn)
*** 3712,3718 ****
case MEM:
/* Don't bother watching stores to mems if this is not the
final pass. We'll not be deleting dead stores this round. */
! if (optimize && (flags & PROP_SCAN_DEAD_CODE))
{
/* Invalidate the data for the last MEM stored, but only if MEM is
something that can be stored into. */
--- 3715,3721 ----
case MEM:
/* Don't bother watching stores to mems if this is not the
final pass. We'll not be deleting dead stores this round. */
! if (optimize && (flags & PROP_SCAN_DEAD_STORES))
{
/* Invalidate the data for the last MEM stored, but only if MEM is
something that can be stored into. */