+2016-02-11 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2015-02-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/62217
+ * tree-ssa-dom.c (cprop_operand): Avoid propagating copies
+ into BIVs.
+
+ 2015-06-18 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2015-06-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66375
+ * tree-scalar-evolution.c (follow_ssa_edge_binary): First
+ add to the evolution before following SSA edges.
+
+ 2015-06-23 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2015-06-09 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/66413
+ * tree-inline.c (insert_init_debug_bind): Unshare value.
+
+ 2015-07-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66794
+ * gimple-ssa-isolate-paths.c (gimple_ssa_isolate_erroneous_paths):
+ Free post-dominators.
+
+ 2015-07-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66823
+ * tree-if-conv.c (memrefs_read_or_written_unconditionally): Fix
+ inverted predicate.
+
2016-02-11 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
/* We scramble the CFG and loop structures a bit, clean up
appropriately. We really should incrementally update the
loop structures, in theory it shouldn't be that hard. */
+ free_dominance_info (CDI_POST_DOMINATORS);
if (cfg_altered)
{
free_dominance_info (CDI_DOMINATORS);
- free_dominance_info (CDI_POST_DOMINATORS);
loops_state_set (LOOPS_NEED_FIXUP);
return TODO_cleanup_cfg | TODO_update_ssa;
}
&& TYPE_OVERFLOW_TRAPS (t)),
div));
+ case GIMPLE_COND:
+ t = TREE_TYPE (gimple_cond_lhs (s));
+ return operation_could_trap_p (gimple_cond_code (s),
+ FLOAT_TYPE_P (t), false, NULL_TREE);
+
default:
break;
}
+2016-02-11 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2015-02-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/62217
+ * gcc.dg/tree-ssa/cunroll-11.c: New testcase.
+
+ 2015-06-18 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2015-06-03 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66375
+ * gcc.dg/torture/pr66375.c: New testcase.
+
+ 2015-06-23 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2015-06-09 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/66413
+ * gcc.dg/torture/pr66413.c: New testcase.
+
+ 2015-07-08 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/66794
+ * gcc.dg/torture/pr66794.c: New testcase.
+
2016-02-11 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
--- /dev/null
+/* { dg-do run } */
+
+int a;
+extern void abort (void);
+int main ()
+{
+ int c = 0;
+ for (; a < 13; ++a)
+ c = (signed char)c - 11;
+ if (c != 113)
+ abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-g" } */
+
+int a, b, c, d, i, j, q, *e, *h, *k, *r, **p = &e;
+const int *f, **n = &f;
+static int g;
+
+void
+fn1 (int p1)
+{
+ c = p1;
+}
+
+static int *
+fn2 (int *p1, const int *p2)
+{
+ if (g)
+ n = &p2;
+ *n = p2;
+ int o[245];
+ fn1 (o != p2);
+ return p1;
+}
+
+static int *
+fn3 ()
+{
+ int s[54], *t = &s[0], u = 0, v = 1;
+ h = &v;
+ q = 1;
+ for (; q; q++)
+ {
+ int *w[] = { &u };
+ for (; v;)
+ return *p;
+ }
+ *r = *t + b >= 0;
+ return *p;
+}
+
+static int
+fn4 (int *p1)
+{
+ int *l[2], **m[7];
+ for (; i < 1; i++)
+ for (; j < 1; j++)
+ m[i * 70] = &l[0];
+ k = fn3 ();
+ fn2 (0, p1);
+ if ((m[0] == 0) & a)
+ for (;;)
+ ;
+ return 0;
+}
+
+int
+main ()
+{
+ fn4 (&d);
+ return 0;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-additional-options "-w" } */
+
+int a, *b, e;
+static int **c = &b;
+
+struct
+{
+ int f0;
+} d;
+
+int *
+fn1 ()
+{
+ int f, **g = &b;
+ e = a;
+ for (; a;)
+ for (; d.f0; d.f0++)
+ ;
+ *g = &f;
+ return *c;
+}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O3 -Warray-bounds -fdump-tree-cunroll-details" } */
+
+typedef struct { unsigned data; } s1;
+s1 g_x[4];
+
+extern void foo (s1 *x1, s1 *x2, int a, int b)
+{
+ int i;
+ for(i = 0; i < a; i++)
+ if(i == b)
+ g_x[i] = *x1;
+ else
+ g_x[i] = *x2;
+}
+
+/* { dg-final { scan-tree-dump "Loop 1 iterates at most 3 times" "cunroll" } } */
+/* { dg-final { cleanup-tree-dump "cunroll" } } */
|| TREE_CODE (ref_base_b) == REALPART_EXPR)
ref_base_b = TREE_OPERAND (ref_base_b, 0);
- if (!operand_equal_p (ref_base_a, ref_base_b, 0))
+ if (operand_equal_p (ref_base_a, ref_base_b, 0))
{
tree cb = bb_predicate (gimple_bb (DR_STMT (b)));
base_stmt = gsi_stmt (gsi);
}
- note = gimple_build_debug_bind (tracked_var, value, base_stmt);
+ note = gimple_build_debug_bind (tracked_var, unshare_expr (value), base_stmt);
if (bb)
{
limit++;
evol = *evolution_of_loop;
- res = follow_ssa_edge
- (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, &evol, limit);
-
- if (res == t_true)
- *evolution_of_loop = add_to_evolution
+ evol = add_to_evolution
(loop->num,
chrec_convert (type, evol, at_stmt),
code, rhs1, at_stmt);
-
+ res = follow_ssa_edge
+ (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi, &evol, limit);
+ if (res == t_true)
+ *evolution_of_loop = evol;
else if (res == t_false)
{
+ *evolution_of_loop = add_to_evolution
+ (loop->num,
+ chrec_convert (type, *evolution_of_loop, at_stmt),
+ code, rhs0, at_stmt);
res = follow_ssa_edge
(loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
evolution_of_loop, limit);
-
if (res == t_true)
- *evolution_of_loop = add_to_evolution
- (loop->num,
- chrec_convert (type, *evolution_of_loop, at_stmt),
- code, rhs0, at_stmt);
-
+ ;
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
}
{
/* Match an assignment under the form:
"a = b + ...". */
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type, *evolution_of_loop,
+ at_stmt),
+ code, rhs1, at_stmt);
res = follow_ssa_edge
(loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
evolution_of_loop, limit);
if (res == t_true)
- *evolution_of_loop = add_to_evolution
- (loop->num, chrec_convert (type, *evolution_of_loop,
- at_stmt),
- code, rhs1, at_stmt);
-
+ ;
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
}
{
/* Match an assignment under the form:
"a = ... + c". */
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type, *evolution_of_loop,
+ at_stmt),
+ code, rhs0, at_stmt);
res = follow_ssa_edge
(loop, SSA_NAME_DEF_STMT (rhs1), halting_phi,
evolution_of_loop, limit);
if (res == t_true)
- *evolution_of_loop = add_to_evolution
- (loop->num, chrec_convert (type, *evolution_of_loop,
- at_stmt),
- code, rhs0, at_stmt);
-
+ ;
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
}
if (TREE_CODE (rhs1) == SSA_NAME)
limit++;
+ *evolution_of_loop = add_to_evolution
+ (loop->num, chrec_convert (type, *evolution_of_loop, at_stmt),
+ MINUS_EXPR, rhs1, at_stmt);
res = follow_ssa_edge (loop, SSA_NAME_DEF_STMT (rhs0), halting_phi,
evolution_of_loop, limit);
if (res == t_true)
- *evolution_of_loop = add_to_evolution
- (loop->num, chrec_convert (type, *evolution_of_loop, at_stmt),
- MINUS_EXPR, rhs1, at_stmt);
-
+ ;
else if (res == t_dont_know)
*evolution_of_loop = chrec_dont_know;
}
if (loop_depth_of_name (val) > loop_depth_of_name (op))
return;
- /* Do not propagate copies into simple IV increment statements.
- See PR23821 for how this can disturb IV analysis. */
- if (TREE_CODE (val) != INTEGER_CST
- && simple_iv_increment_p (stmt))
- return;
+ /* Do not propagate copies into BIVs.
+ See PR23821 and PR62217 for how this can disturb IV and
+ number of iteration analysis. */
+ if (TREE_CODE (val) != INTEGER_CST)
+ {
+ gimple def = SSA_NAME_DEF_STMT (op);
+ if (gimple_code (def) == GIMPLE_PHI
+ && gimple_bb (def)->loop_father->header == gimple_bb (def))
+ return;
+ }
/* Dump details. */
if (dump_file && (dump_flags & TDF_DETAILS))