From 3e75ec3fab878ec6ebde748e6b57fdcaec8fd4ea Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Wed, 30 Aug 2017 20:04:07 +0000 Subject: re PR tree-optimization/81987 (ICE in verify_ssa with -O3 -march=skylake-avx512) [gcc] 2017-08-30 Bill Schmidt PR tree-optimization/81987 * gimple-ssa-strength-reduction.c (insert_initializers): Don't insert an initializer in a location not dominated by the stride definition. [gcc/testsuite] 2017-08-30 Bill Schmidt PR tree-optimization/81987 * g++.dg/torture/pr81987.C: New file. From-SVN: r251547 --- gcc/gimple-ssa-strength-reduction.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/gimple-ssa-strength-reduction.c') diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 8fe7c17..6e3e93d 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -3340,6 +3340,23 @@ insert_initializers (slsr_cand_t c) that block, the earliest one will be returned in WHERE. */ bb = nearest_common_dominator_for_cands (c, incr, &where); + /* If the NCD is not dominated by the block containing the + definition of the stride, we can't legally insert a + single initializer. Mark the increment as unprofitable + so we don't make any replacements. FIXME: Multiple + initializers could be placed with more analysis. */ + gimple *stride_def = SSA_NAME_DEF_STMT (c->stride); + basic_block stride_bb = gimple_bb (stride_def); + + if (stride_bb && !dominated_by_p (CDI_DOMINATORS, bb, stride_bb)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, + "Initializer #%d cannot be legally placed\n", i); + incr_vec[i].cost = COST_INFINITE; + continue; + } + /* If the nominal stride has a different type than the recorded stride type, build a cast from the nominal stride to that type. */ if (!types_compatible_p (TREE_TYPE (c->stride), c->stride_type)) -- cgit v1.1