diff options
author | Jakub Jelinek <jakub@redhat.com> | 2012-02-16 11:20:26 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2012-02-16 11:20:26 +0100 |
commit | e20f6b4bde8a93aefb4bb2a9b3946a24edeea5ef (patch) | |
tree | bcc4d6f1cbee98dbf9bb01d20e7a4e350b084a42 /gcc/tree-vect-loop-manip.c | |
parent | 672ed3139a0c2aced7c702f3ce4b26dd34672dd2 (diff) | |
download | gcc-e20f6b4bde8a93aefb4bb2a9b3946a24edeea5ef.zip gcc-e20f6b4bde8a93aefb4bb2a9b3946a24edeea5ef.tar.gz gcc-e20f6b4bde8a93aefb4bb2a9b3946a24edeea5ef.tar.bz2 |
re PR tree-optimization/52255 (ICE: verify_ssa failed, block does not dominate use)
PR tree-optimization/52255
* tree-vect-loop-manip.c (slpeel_tree_peel_loop_to_edge): If
loop->header has virtual PHI, but exit_e->dest doesn't, add
virtual PHI to exit_e->dest and adjust all uses after the loop.
* gcc.c-torture/compile/pr52255.c: New test.
From-SVN: r184306
Diffstat (limited to 'gcc/tree-vect-loop-manip.c')
-rw-r--r-- | gcc/tree-vect-loop-manip.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop-manip.c b/gcc/tree-vect-loop-manip.c index 7ac3f67..70c4f89 100644 --- a/gcc/tree-vect-loop-manip.c +++ b/gcc/tree-vect-loop-manip.c @@ -513,7 +513,7 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop, !gsi_end_p (gsi_orig) && !gsi_end_p (gsi_update); gsi_next (&gsi_orig), gsi_next (&gsi_update)) { - source_location loop_locus, guard_locus;; + source_location loop_locus, guard_locus; orig_phi = gsi_stmt (gsi_orig); update_phi = gsi_stmt (gsi_update); @@ -1171,6 +1171,7 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, basic_block bb_before_first_loop; basic_block bb_between_loops; basic_block new_exit_bb; + gimple_stmt_iterator gsi; edge exit_e = single_exit (loop); LOC loop_loc; tree cost_pre_condition = NULL_TREE; @@ -1184,6 +1185,40 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, the function tree_duplicate_bb is called. */ gimple_register_cfg_hooks (); + /* If the loop has a virtual PHI, but exit bb doesn't, create a virtual PHI + in the exit bb and rename all the uses after the loop. This simplifies + the *guard[12] routines, which assume loop closed SSA form for all PHIs + (but normally loop closed SSA form doesn't require virtual PHIs to be + in the same form). Doing this early simplifies the checking what + uses should be renamed. */ + for (gsi = gsi_start_phis (loop->header); !gsi_end_p (gsi); gsi_next (&gsi)) + if (!is_gimple_reg (gimple_phi_result (gsi_stmt (gsi)))) + { + gimple phi = gsi_stmt (gsi); + for (gsi = gsi_start_phis (exit_e->dest); + !gsi_end_p (gsi); gsi_next (&gsi)) + if (!is_gimple_reg (gimple_phi_result (gsi_stmt (gsi)))) + break; + if (gsi_end_p (gsi)) + { + gimple new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (phi)), + exit_e->dest); + tree vop = PHI_ARG_DEF_FROM_EDGE (phi, EDGE_SUCC (loop->latch, 0)); + imm_use_iterator imm_iter; + gimple stmt; + tree new_vop = make_ssa_name (SSA_NAME_VAR (PHI_RESULT (phi)), + new_phi); + use_operand_p use_p; + + add_phi_arg (new_phi, vop, exit_e, UNKNOWN_LOCATION); + gimple_phi_set_result (new_phi, new_vop); + FOR_EACH_IMM_USE_STMT (stmt, imm_iter, vop) + if (stmt != new_phi && gimple_bb (stmt) != loop->header) + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + SET_USE (use_p, new_vop); + } + break; + } /* 1. Generate a copy of LOOP and put it on E (E is the entry/exit of LOOP). Resulting CFG would be: |