aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiprop.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-02-08 13:29:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-02-08 13:29:15 +0000
commit24db2556253540529a7b11ed42683b2ea9bb8989 (patch)
treec5f4c37badfc0bb93dd13c20c4b36192bb6013a5 /gcc/tree-ssa-phiprop.c
parent3d2249215e948493d5aa7ad1aaaa9d9de73207c6 (diff)
downloadgcc-24db2556253540529a7b11ed42683b2ea9bb8989.zip
gcc-24db2556253540529a7b11ed42683b2ea9bb8989.tar.gz
gcc-24db2556253540529a7b11ed42683b2ea9bb8989.tar.bz2
re PR middle-end/84233 (ICE (segfault) in gimple_assign_rhs_code)
2018-02-08 Richard Biener <rguenther@suse.de> PR tree-optimization/84233 * tree-ssa-phiprop.c (propagate_with_phi): Use separate changed flag instead of boguously re-using phi_inserted. * g++.dg/torture/pr84233.C: New testcase. From-SVN: r257486
Diffstat (limited to 'gcc/tree-ssa-phiprop.c')
-rw-r--r--gcc/tree-ssa-phiprop.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index fad81d0..03dbb39 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -270,6 +270,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
use_operand_p arg_p, use;
ssa_op_iter i;
bool phi_inserted;
+ bool changed;
tree type = NULL_TREE;
if (!POINTER_TYPE_P (TREE_TYPE (ptr))
@@ -317,6 +318,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
/* Replace the first dereference of *ptr if there is one and if we
can move the loads to the place of the ptr phi node. */
phi_inserted = false;
+ changed = false;
FOR_EACH_IMM_USE_STMT (use_stmt, ui, ptr)
{
gimple *def_stmt;
@@ -403,7 +405,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
unlink_stmt_vdef (use_stmt);
gsi_remove (&gsi, true);
- phi_inserted = true;
+ changed = true;
}
/* Found a proper dereference. Insert a phi node if this
@@ -424,6 +426,7 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
gsi_remove (&gsi, true);
phi_inserted = true;
+ changed = true;
}
else
{
@@ -431,13 +434,14 @@ propagate_with_phi (basic_block bb, gphi *phi, struct phiprop_d *phivn,
load. */
gimple_assign_set_rhs1 (use_stmt, res);
update_stmt (use_stmt);
+ changed = true;
}
next:;
/* Continue searching for a proper dereference. */
}
- return phi_inserted;
+ return changed;
}
/* Main entry for phiprop pass. */