Commit 8d9d6561 by Eric Botcazou Committed by Eric Botcazou

tree-ssa-dom.c (tree_ssa_dominator_optimize): Reset cfg_altered.

	* tree-ssa-dom.c (tree_ssa_dominator_optimize): Reset cfg_altered.
	Free dominance info before purging EH edges as well as after.
	(eliminate_degenerate_phis): Likewise.
	(propagate_rhs_into_lhs): Set cfg_altered to true instead of 1.

From-SVN: r124498
parent 2cb7995f
2007-05-07 Eric Botcazou <ebotcazou@adacore.com>
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Reset cfg_altered.
Free dominance info before purging EH edges as well as after.
(eliminate_degenerate_phis): Likewise.
(propagate_rhs_into_lhs): Set cfg_altered to true instead of 1.
2007-05-07 Jan Hubicka <jh@suse.cz> 2007-05-07 Jan Hubicka <jh@suse.cz>
* gimplify.c (gimplify_expr): Do not crash when folding * gimplify.c (gimplify_expr): Do not crash when folding
......
2007-05-07 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/opt1.ad[sb]: New testcase.
2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> 2007-05-07 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR fortran/31399 PR fortran/31399
-- { dg-do compile }
-- { dg-options "-O -gnatws" }
package body Opt1 is
function De_Linear_Index
(Index : Natural;
D : Natural;
Ind_Lengths : Dimention_Length)
return Dimension_Indexes
is
Len : Natural := 1;
Tmp_Ind : Natural := Index;
Tmp_Res : Natural;
Result : Dimension_Indexes (1 .. D);
begin
for J in 1 .. D loop
Len := Len * Ind_Lengths (J);
end loop;
for J in Result'Range loop
Result (J) := Tmp_Res;
Tmp_Ind := Tmp_Ind - Len * (Result (J) - 1);
end loop;
return Result;
end;
end Opt1;
package Opt1 is
type Dimention_Length is array (1 .. 16) of Natural;
type Dimension_Indexes is array (Positive range <>) of Positive;
function De_Linear_Index
(Index : Natural;
D : Natural;
Ind_Lengths : Dimention_Length)
return Dimension_Indexes;
end Opt1;
...@@ -275,6 +275,7 @@ tree_ssa_dominator_optimize (void) ...@@ -275,6 +275,7 @@ tree_ssa_dominator_optimize (void)
init_walk_dominator_tree (&walk_data); init_walk_dominator_tree (&walk_data);
calculate_dominance_info (CDI_DOMINATORS); calculate_dominance_info (CDI_DOMINATORS);
cfg_altered = false;
/* We need to know which edges exit loops so that we can /* We need to know which edges exit loops so that we can
aggressively thread through loop headers to an exit aggressively thread through loop headers to an exit
...@@ -320,17 +321,18 @@ tree_ssa_dominator_optimize (void) ...@@ -320,17 +321,18 @@ tree_ssa_dominator_optimize (void)
/* Thread jumps, creating duplicate blocks as needed. */ /* Thread jumps, creating duplicate blocks as needed. */
cfg_altered |= thread_through_all_blocks (); cfg_altered |= thread_through_all_blocks ();
if (cfg_altered)
free_dominance_info (CDI_DOMINATORS);
/* Removal of statements may make some EH edges dead. Purge /* Removal of statements may make some EH edges dead. Purge
such edges from the CFG as needed. */ such edges from the CFG as needed. */
if (!bitmap_empty_p (need_eh_cleanup)) if (!bitmap_empty_p (need_eh_cleanup))
{ {
cfg_altered |= tree_purge_all_dead_eh_edges (need_eh_cleanup); if (tree_purge_all_dead_eh_edges (need_eh_cleanup))
free_dominance_info (CDI_DOMINATORS);
bitmap_zero (need_eh_cleanup); bitmap_zero (need_eh_cleanup);
} }
if (cfg_altered)
free_dominance_info (CDI_DOMINATORS);
/* Finally, remove everything except invariants in SSA_NAME_VALUE. /* Finally, remove everything except invariants in SSA_NAME_VALUE.
Long term we will be able to let everything in SSA_NAME_VALUE Long term we will be able to let everything in SSA_NAME_VALUE
...@@ -2336,7 +2338,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names) ...@@ -2336,7 +2338,7 @@ propagate_rhs_into_lhs (tree stmt, tree lhs, tree rhs, bitmap interesting_names)
te->count += e->count; te->count += e->count;
remove_edge (e); remove_edge (e);
cfg_altered = 1; cfg_altered = true;
} }
else else
ei_next (&ei); ei_next (&ei);
...@@ -2485,6 +2487,9 @@ eliminate_degenerate_phis (void) ...@@ -2485,6 +2487,9 @@ eliminate_degenerate_phis (void)
interesting_names = BITMAP_ALLOC (NULL); interesting_names = BITMAP_ALLOC (NULL);
interesting_names1 = BITMAP_ALLOC (NULL); interesting_names1 = BITMAP_ALLOC (NULL);
calculate_dominance_info (CDI_DOMINATORS);
cfg_altered = false;
/* First phase. Eliminate degenerate PHIs via a dominator /* First phase. Eliminate degenerate PHIs via a dominator
walk of the CFG. walk of the CFG.
...@@ -2493,7 +2498,6 @@ eliminate_degenerate_phis (void) ...@@ -2493,7 +2498,6 @@ eliminate_degenerate_phis (void)
phase in dominator order. Presumably this is because walking phase in dominator order. Presumably this is because walking
in dominator order leaves fewer PHIs for later examination in dominator order leaves fewer PHIs for later examination
by the worklist phase. */ by the worklist phase. */
calculate_dominance_info (CDI_DOMINATORS);
eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR, interesting_names); eliminate_degenerate_phis_1 (ENTRY_BLOCK_PTR, interesting_names);
/* Second phase. Eliminate second order degenerate PHIs as well /* Second phase. Eliminate second order degenerate PHIs as well
...@@ -2522,18 +2526,20 @@ eliminate_degenerate_phis (void) ...@@ -2522,18 +2526,20 @@ eliminate_degenerate_phis (void)
} }
} }
if (cfg_altered)
free_dominance_info (CDI_DOMINATORS);
/* Propagation of const and copies may make some EH edges dead. Purge /* Propagation of const and copies may make some EH edges dead. Purge
such edges from the CFG as needed. */ such edges from the CFG as needed. */
if (!bitmap_empty_p (need_eh_cleanup)) if (!bitmap_empty_p (need_eh_cleanup))
{ {
cfg_altered |= tree_purge_all_dead_eh_edges (need_eh_cleanup); if (tree_purge_all_dead_eh_edges (need_eh_cleanup))
free_dominance_info (CDI_DOMINATORS);
BITMAP_FREE (need_eh_cleanup); BITMAP_FREE (need_eh_cleanup);
} }
BITMAP_FREE (interesting_names); BITMAP_FREE (interesting_names);
BITMAP_FREE (interesting_names1); BITMAP_FREE (interesting_names1);
if (cfg_altered)
free_dominance_info (CDI_DOMINATORS);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment