aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2017-05-05 18:02:44 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-05-05 18:02:44 +0200
commit8dc6a926f2eea6de3f1710a185eee5cfc052d6f8 (patch)
tree80fe8750598ef749b39239ef296b2a5101858c36 /gcc/tree-switch-conversion.c
parentac699a047f74de2bb8f1d538b07c89075cd25c84 (diff)
downloadgcc-8dc6a926f2eea6de3f1710a185eee5cfc052d6f8.zip
gcc-8dc6a926f2eea6de3f1710a185eee5cfc052d6f8.tar.gz
gcc-8dc6a926f2eea6de3f1710a185eee5cfc052d6f8.tar.bz2
re PR tree-optimization/80632 (error: invalid PHI argument with -O2)
PR tree-optimization/80632 * tree-switch-conversion.c (struct switch_conv_info): Add target_vop field. (build_arrays): Initialize it for virtual phis. (fix_phi_nodes): Use it for virtual phis. * gcc.dg/pr80632.c: New test. From-SVN: r247642
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index 14e605d..0a2a840 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -581,6 +581,9 @@ struct switch_conv_info
switch expression is out of range. */
tree *target_outbound_names;
+ /* VOP SSA_NAME. */
+ tree target_vop;
+
/* The first load statement that loads a temporary from a new static array.
*/
gimple *arr_ref_first;
@@ -1216,6 +1219,24 @@ build_arrays (gswitch *swtch, struct switch_conv_info *info)
gphi *phi = gpi.phi ();
if (!virtual_operand_p (gimple_phi_result (phi)))
build_one_array (swtch, i++, arr_index_type, phi, tidx, info);
+ else
+ {
+ edge e;
+ edge_iterator ei;
+ FOR_EACH_EDGE (e, ei, info->switch_bb->succs)
+ {
+ if (e->dest == info->final_bb)
+ break;
+ if (!info->default_case_nonstandard
+ || e->dest != info->default_bb)
+ {
+ e = single_succ_edge (e->dest);
+ break;
+ }
+ }
+ gcc_assert (e && e->dest == info->final_bb);
+ info->target_vop = PHI_ARG_DEF_FROM_EDGE (phi, e);
+ }
}
}
@@ -1279,7 +1300,7 @@ fix_phi_nodes (edge e1f, edge e2f, basic_block bbf,
gphi *phi = gsi.phi ();
tree inbound, outbound;
if (virtual_operand_p (gimple_phi_result (phi)))
- inbound = outbound = gimple_vop (cfun);
+ inbound = outbound = info->target_vop;
else
{
inbound = info->target_inbound_names[i];