Commit 2cfc56b9 by Richard Biener Committed by Richard Biener

re PR tree-optimization/55964 (Segmentation fault with -O…

re PR tree-optimization/55964 (Segmentation fault with -O -ftree-loop-distribution -funswitch-loops)

2013-01-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/55964
	* tree-flow.h (rename_variables_in_loop): Remove.
	(rename_variables_in_bb): Likewise.
	* tree-loop-distribution.c (update_phis_for_loop_copy): Remove.
	(copy_loop_before): Adjust and delete update-ssa status.
	* tree-vect-loop-manip.c (rename_variables_in_bb): Make static.
	(rename_variables_in_bb): Likewise.  Properly walk over
	predecessors.
	(rename_variables_in_loop): Remove.
	(slpeel_update_phis_for_duplicate_loop): Likewise.
	(slpeel_tree_duplicate_loop_to_edge_cfg): Handle nested loops,
	use available cfg machinery instead of duplicating it.
	Update PHI nodes and perform poor-mans SSA update here.
	(slpeel_tree_peel_loop_to_edge): Adjust.

	* gcc.dg/torture/pr55964.c: New testcase.

From-SVN: r195239
parent c25a0c60
2013-01-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/55964
* tree-flow.h (rename_variables_in_loop): Remove.
(rename_variables_in_bb): Likewise.
* tree-loop-distribution.c (update_phis_for_loop_copy): Remove.
(copy_loop_before): Adjust and delete update-ssa status.
* tree-vect-loop-manip.c (rename_variables_in_bb): Make static.
(rename_variables_in_bb): Likewise. Properly walk over
predecessors.
(rename_variables_in_loop): Remove.
(slpeel_update_phis_for_duplicate_loop): Likewise.
(slpeel_tree_duplicate_loop_to_edge_cfg): Handle nested loops,
use available cfg machinery instead of duplicating it.
Update PHI nodes and perform poor-mans SSA update here.
(slpeel_tree_peel_loop_to_edge): Adjust.
2013-01-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/54767
PR tree-optimization/53465
* tree-vrp.c (vrp_meet_1): Revert original fix for PR53465.
......
2013-01-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/55964
* gcc.dg/torture/pr55964.c: New testcase.
2013-01-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/54767
PR tree-optimization/53465
* gfortran.fortran-torture/execute/pr54767.f90: New testcase.
......
/* { dg-do compile } */
/* { dg-options "-ftree-loop-distribution -funswitch-loops -w" } */
int a, b;
void f(void)
{
lbl1:
for(b = 0; b < 1; b++)
{
int u = 1;
if((b %= 0) * (b ? 0 : a) - 1 && (u /= 0))
{
int *q = &u, **k = q;
goto lbl1;
lbl2:
lbl3:
a = **k;
goto lbl2;
}
}
goto lbl3;
}
......@@ -654,8 +654,6 @@ bool gimple_duplicate_loop_to_header_edge (struct loop *, edge,
edge, vec<edge> *,
int);
struct loop *slpeel_tree_duplicate_loop_to_edge_cfg (struct loop *, edge);
void rename_variables_in_loop (struct loop *);
void rename_variables_in_bb (basic_block bb);
tree expand_simple_operations (tree);
void substitute_in_loop_info (struct loop *, tree, tree);
edge single_dom_exit (struct loop *);
......
......@@ -151,58 +151,6 @@ stmt_has_scalar_dependences_outside_loop (loop_p loop, gimple stmt)
return false;
}
/* Update the PHI nodes of NEW_LOOP. NEW_LOOP is a duplicate of
ORIG_LOOP. */
static void
update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
{
tree new_ssa_name;
gimple_stmt_iterator si_new, si_orig;
edge orig_loop_latch = loop_latch_edge (orig_loop);
edge orig_entry_e = loop_preheader_edge (orig_loop);
edge new_loop_entry_e = loop_preheader_edge (new_loop);
/* Scan the phis in the headers of the old and new loops
(they are organized in exactly the same order). */
for (si_new = gsi_start_phis (new_loop->header),
si_orig = gsi_start_phis (orig_loop->header);
!gsi_end_p (si_new) && !gsi_end_p (si_orig);
gsi_next (&si_new), gsi_next (&si_orig))
{
tree def;
source_location locus;
gimple phi_new = gsi_stmt (si_new);
gimple phi_orig = gsi_stmt (si_orig);
/* Add the first phi argument for the phi in NEW_LOOP (the one
associated with the entry of NEW_LOOP) */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_entry_e);
locus = gimple_phi_arg_location_from_edge (phi_orig, orig_entry_e);
add_phi_arg (phi_new, def, new_loop_entry_e, locus);
/* Add the second phi argument for the phi in NEW_LOOP (the one
associated with the latch of NEW_LOOP) */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_loop_latch);
locus = gimple_phi_arg_location_from_edge (phi_orig, orig_loop_latch);
if (TREE_CODE (def) == SSA_NAME)
{
new_ssa_name = get_current_def (def);
if (!new_ssa_name)
/* This only happens if there are no definitions inside the
loop. Use the the invariant in the new loop as is. */
new_ssa_name = def;
}
else
/* Could be an integer. */
new_ssa_name = def;
add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus);
}
}
/* Return a copy of LOOP placed before LOOP. */
static struct loop *
......@@ -215,9 +163,7 @@ copy_loop_before (struct loop *loop)
res = slpeel_tree_duplicate_loop_to_edge_cfg (loop, preheader);
gcc_assert (res != NULL);
free_original_copy_tables ();
update_phis_for_loop_copy (loop, res);
rename_variables_in_loop (res);
delete_update_ssa ();
return res;
}
......
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