diff options
author | Richard Biener <rguenther@suse.de> | 2013-01-16 14:06:58 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-01-16 14:06:58 +0000 |
commit | 2cfc56b9bd0dcda51350d8cbd9df1dafecef4d6c (patch) | |
tree | 57ef3c159a5442c7ebc9b1b98e651e37f06bfd0e /gcc/tree-loop-distribution.c | |
parent | c25a0c60a5893ae7f4ba309b5b3bb2f336873683 (diff) | |
download | gcc-2cfc56b9bd0dcda51350d8cbd9df1dafecef4d6c.zip gcc-2cfc56b9bd0dcda51350d8cbd9df1dafecef4d6c.tar.gz gcc-2cfc56b9bd0dcda51350d8cbd9df1dafecef4d6c.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-loop-distribution.c')
-rw-r--r-- | gcc/tree-loop-distribution.c | 56 |
1 files changed, 1 insertions, 55 deletions
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 93e98eb..747b6ac 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -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; } |