aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-manip.c
diff options
context:
space:
mode:
authorRichard Biener <rguenth@gcc.gnu.org>2018-11-05 14:55:53 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-11-05 14:55:53 +0000
commit733441e2e1d207a1ab0a4a255dea03ee7c6c8774 (patch)
tree62bd882842e65e9ca1e9b1bfc1b94458f8753104 /gcc/tree-ssa-loop-manip.c
parent546f678c5cc27adf9ca02cbcc578b2ddaffc0d81 (diff)
downloadgcc-733441e2e1d207a1ab0a4a255dea03ee7c6c8774.zip
gcc-733441e2e1d207a1ab0a4a255dea03ee7c6c8774.tar.gz
gcc-733441e2e1d207a1ab0a4a255dea03ee7c6c8774.tar.bz2
re PR tree-optimization/87873 (ICE: verify_gimple failed (error: incompatible types in PHI argument 0))
2018-11-05 Richard Biener <rguenther@suse.de> PR tree-optimization/87873 * tree-ssa-loop-manip.h (split_loop_exit_edge): Add copy_constants_p argument. * tree-ssa-loop-manip.c (split_loop_exit_edge): Likewise. * tree-vect-loop.c (vect_transform_loop): When splitting the loop exit also create forwarder PHIs for constants. * tree-vect-loop-manip.c (slpeel_duplicate_current_defs_from_edges): Handle constant to_arg, add extra checking we match up the correct PHIs. * gcc.dg/pr87873.c: New testcase. From-SVN: r265812
Diffstat (limited to 'gcc/tree-ssa-loop-manip.c')
-rw-r--r--gcc/tree-ssa-loop-manip.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 5acee6c..726590a 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -773,10 +773,12 @@ verify_loop_closed_ssa (bool verify_ssa_p, struct loop *loop)
}
/* Split loop exit edge EXIT. The things are a bit complicated by a need to
- preserve the loop closed ssa form. The newly created block is returned. */
+ preserve the loop closed ssa form. If COPY_CONSTANTS_P is true then
+ forwarder PHIs are also created for constant arguments.
+ The newly created block is returned. */
basic_block
-split_loop_exit_edge (edge exit)
+split_loop_exit_edge (edge exit, bool copy_constants_p)
{
basic_block dest = exit->dest;
basic_block bb = split_edge (exit);
@@ -796,12 +798,13 @@ split_loop_exit_edge (edge exit)
/* If the argument of the PHI node is a constant, we do not need
to keep it inside loop. */
- if (TREE_CODE (name) != SSA_NAME)
+ if (TREE_CODE (name) != SSA_NAME
+ && !copy_constants_p)
continue;
/* Otherwise create an auxiliary phi node that will copy the value
of the SSA name out of the loop. */
- new_name = duplicate_ssa_name (name, NULL);
+ new_name = duplicate_ssa_name (PHI_RESULT (phi), NULL);
new_phi = create_phi_node (new_name, bb);
add_phi_arg (new_phi, name, exit, locus);
SET_USE (op_p, new_name);