aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-strength-reduction.c
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2017-08-30 20:04:07 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2017-08-30 20:04:07 +0000
commit3e75ec3fab878ec6ebde748e6b57fdcaec8fd4ea (patch)
treefd322c5ad6f23760fd999a9b1ca4b6d6a2535281 /gcc/gimple-ssa-strength-reduction.c
parentba0cecd6d45506d12db4c88637565cc059e6960d (diff)
downloadgcc-3e75ec3fab878ec6ebde748e6b57fdcaec8fd4ea.zip
gcc-3e75ec3fab878ec6ebde748e6b57fdcaec8fd4ea.tar.gz
gcc-3e75ec3fab878ec6ebde748e6b57fdcaec8fd4ea.tar.bz2
re PR tree-optimization/81987 (ICE in verify_ssa with -O3 -march=skylake-avx512)
[gcc] 2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com> 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 <wschmidt@linux.vnet.ibm.com> PR tree-optimization/81987 * g++.dg/torture/pr81987.C: New file. From-SVN: r251547
Diffstat (limited to 'gcc/gimple-ssa-strength-reduction.c')
-rw-r--r--gcc/gimple-ssa-strength-reduction.c17
1 files changed, 17 insertions, 0 deletions
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))