This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] Add scev_reset to cleanup_tree_cfg_loop
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 20 Aug 2005 21:13:19 +0200
- Subject: [patch] Add scev_reset to cleanup_tree_cfg_loop
Hello,
scev info does not have to be correct when the loop structure changes
in cleanup_tree_cfg_loop. This patch adds the call to scev_reset to the
function. It also makes cleanup_tree_cfg_loop do the additional work
to fixup things only in the case when cleanup_tree_cfg changed cfg.
Bootstrapped & regtested on ia64.
Zdenek
* Makefile.in (tree-cfgcleanup.o): Add SCEV_H dependency.
* tree-cfgcleanup.c: Include tree-scalar-evolution.h.
(cleanup_tree_cfg_loop): Call scev_reset. Only fix up loop
structures when cleanup_tree_cfg changed cfg.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1536
diff -c -3 -p -r1.1536 Makefile.in
*** Makefile.in 15 Aug 2005 12:26:02 -0000 1.1536
--- Makefile.in 20 Aug 2005 15:04:18 -0000
*************** tree-cfg.o : tree-cfg.c $(TREE_FLOW_H) $
*** 1824,1832 ****
tree-cfgcleanup.o : tree-cfgcleanup.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(FLAGS_H) output.h \
$(DIAGNOSTIC_H) errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h \
! $(TREE_DUMP_H) except.h langhooks.h $(CFGLOOP_H) tree-pass.h \
! $(CFGLAYOUT_H) $(BASIC_BLOCK_H) hard-reg-set.h $(HASHTAB_H) toplev.h \
! tree-ssa-propagate.h
tree-tailcall.o : tree-tailcall.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) function.h $(TM_H) coretypes.h \
$(TREE_DUMP_H) $(DIAGNOSTIC_H) except.h tree-pass.h $(FLAGS_H) langhooks.h \
--- 1824,1830 ----
tree-cfgcleanup.o : tree-cfgcleanup.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) $(GGC_H) $(FLAGS_H) output.h \
$(DIAGNOSTIC_H) errors.h function.h $(TIMEVAR_H) $(TM_H) coretypes.h \
! tree-ssa-propagate.h $(SCEV_H)
tree-tailcall.o : tree-tailcall.c $(TREE_FLOW_H) $(CONFIG_H) $(SYSTEM_H) \
$(RTL_H) $(TREE_H) $(TM_P_H) function.h $(TM_H) coretypes.h \
$(TREE_DUMP_H) $(DIAGNOSTIC_H) except.h tree-pass.h $(FLAGS_H) langhooks.h \
Index: tree-cfgcleanup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-cfgcleanup.c,v
retrieving revision 2.7
diff -c -3 -p -r2.7 tree-cfgcleanup.c
*** tree-cfgcleanup.c 19 Aug 2005 18:52:55 -0000 2.7
--- tree-cfgcleanup.c 20 Aug 2005 15:04:18 -0000
*************** Boston, MA 02110-1301, USA. */
*** 44,49 ****
--- 44,50 ----
#include "cfgloop.h"
#include "cfglayout.h"
#include "hashtab.h"
+ #include "tree-scalar-evolution.h"
#include "tree-ssa-propagate.h"
/* Remove any fallthru edge from EV. Return true if an edge was removed. */
*************** cleanup_tree_cfg (void)
*** 559,581 ****
void
cleanup_tree_cfg_loop (void)
{
! bitmap changed_bbs = BITMAP_ALLOC (NULL);
! cleanup_tree_cfg ();
!
! fix_loop_structure (current_loops, changed_bbs);
! calculate_dominance_info (CDI_DOMINATORS);
! /* This usually does nothing. But sometimes parts of cfg that originally
! were inside a loop get out of it due to edge removal (since they
! become unreachable by back edges from latch). */
! rewrite_into_loop_closed_ssa (changed_bbs, TODO_update_ssa);
! BITMAP_FREE (changed_bbs);
#ifdef ENABLE_CHECKING
! verify_loop_structure (current_loops);
#endif
}
/* Merge the PHI nodes at BB into those at BB's sole successor. */
--- 560,585 ----
void
cleanup_tree_cfg_loop (void)
{
! bool changed = cleanup_tree_cfg ();
! if (changed)
! {
! bitmap changed_bbs = BITMAP_ALLOC (NULL);
! fix_loop_structure (current_loops, changed_bbs);
! calculate_dominance_info (CDI_DOMINATORS);
! /* This usually does nothing. But sometimes parts of cfg that originally
! were inside a loop get out of it due to edge removal (since they
! become unreachable by back edges from latch). */
! rewrite_into_loop_closed_ssa (changed_bbs, TODO_update_ssa);
! BITMAP_FREE (changed_bbs);
#ifdef ENABLE_CHECKING
! verify_loop_structure (current_loops);
#endif
+ scev_reset ();
+ }
}
/* Merge the PHI nodes at BB into those at BB's sole successor. */