+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.
+
2017-08-30 Eric Botcazou <ebotcazou@adacore.com>
* tree-eh.c (lower_try_finally_switch): Set the location of the finally
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))
+2017-08-30 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR tree-optimization/81987
+ * g++.dg/torture/pr81987.C: New file.
+
2017-08-30 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/aggr22.ad[sb]: New test.
--- /dev/null
+extern short var_1;
+extern const short var_3;
+extern unsigned long int var_9;
+extern short var_13;
+extern const unsigned long int var_15;
+extern const unsigned long int var_37;
+extern unsigned long int var_40;
+extern long long int var_47;
+extern short var_48;
+extern const short var_54;
+extern long long int var_79;
+extern long long int var_81;
+extern long long int var_94;
+extern long long int var_95;
+extern long long int var_701;
+extern unsigned long int var_786;
+extern short var_788;
+extern long long int var_844;
+
+struct struct_1 {
+ short member_1_2 : 15;
+ static long long int member_1_3;
+};
+
+extern struct_1 struct_obj_6;
+extern struct_1 struct_obj_8;
+
+void foo() {
+ int a = var_3 <= 602154393864UL;
+ if (var_81 ? 0 : var_3 && var_9)
+ ;
+ else {
+ var_94 = 0;
+ if (var_3 && var_48 || var_13) {
+ if (var_48)
+ var_95 = 0;
+ short b((2364461588881776511UL + var_3) * (2 ? var_13 : 0) || var_1);
+ struct_obj_8.member_1_2 = b;
+ if (var_15) {
+ if (var_81)
+ if (var_47)
+ ;
+ else if (var_40)
+ var_701 = 0;
+ } else {
+ if (var_40)
+ var_79 = 0;
+ if (var_54) {
+ if (var_37)
+ var_786 = 0;
+ else
+ var_788 = 0;
+ struct_obj_6.member_1_3 =
+ (2364461588881776511UL + var_3) * (2 ? var_13 : 0);
+ }
+ }
+ if ((2364461588881776511UL + var_3) * (2 ? var_13 : 0))
+ var_844 = 0;
+ }
+ }
+}