aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-if-conv.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-11-29 08:05:03 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-11-29 08:05:03 +0000
commitd5e82c9f686f6c8e2feabfe753258f9fc13d980f (patch)
tree363be524c513dea66ba05c50050f4acbe8e50312 /gcc/tree-if-conv.c
parent34b43828f840640f8275712867fc52ef6c2714dd (diff)
downloadgcc-d5e82c9f686f6c8e2feabfe753258f9fc13d980f.zip
gcc-d5e82c9f686f6c8e2feabfe753258f9fc13d980f.tar.gz
gcc-d5e82c9f686f6c8e2feabfe753258f9fc13d980f.tar.bz2
re PR tree-optimization/92704 (ICE: Segmentation fault (in process_bb))
2019-11-29 Richard Biener <rguenther@suse.de> PR tree-optimization/92704 * tree-if-conv.c (combine_blocks): Deal with virtual PHIs in loops performing only loads. * gcc.dg/torture/pr92704.c: New testcase. From-SVN: r278828
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r--gcc/tree-if-conv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c
index 33d6cdd..d2e40d4 100644
--- a/gcc/tree-if-conv.c
+++ b/gcc/tree-if-conv.c
@@ -2624,6 +2624,11 @@ combine_blocks (class loop *loop)
vphi = get_virtual_phi (bb);
if (vphi)
{
+ /* When there's just loads inside the loop a stray virtual
+ PHI merging the uses can appear, update last_vdef from
+ it. */
+ if (!last_vdef)
+ last_vdef = gimple_phi_arg_def (vphi, 0);
imm_use_iterator iter;
use_operand_p use_p;
gimple *use_stmt;
@@ -2655,6 +2660,10 @@ combine_blocks (class loop *loop)
if (gimple_vdef (stmt))
last_vdef = gimple_vdef (stmt);
}
+ else
+ /* If this is the first load we arrive at update last_vdef
+ so we handle stray PHIs correctly. */
+ last_vdef = gimple_vuse (stmt);
if (predicated[i])
{
ssa_op_iter i;