+2017-01-24 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-10-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/77855
+ * tree-ssa-pre.c (prune_clobbered_mems): Queue exprs to remove
+ instead of removing the current item while iterating over the set
+ which is not safe.
+
+ 2016-09-01 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/77436
+ * tree-chrec.c (tree_fold_binomial): Use widest_int, properly
+ check whether the result fits the desired result type.
+
+ 2016-09-19 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/77605
+ * tree-data-ref.c (analyze_subscript_affine_affine): Use the
+ proper niter to bound the loops.
+
+ 2016-11-02 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/78047
+ * tree-ssa-structalias.c (push_fields_onto_fieldstack): Initialize
+ fake field at offset zero conservatively regarding to may_have_pointers.
+
+ 2016-11-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78185
+ * loop-invariant.c (find_invariant_insn): Never hoist trapping or
+ faulting instructions.
+ * tree-ssa-loop-im.c: Include tree-ssa-loop-niter.h.
+ (fill_always_executed_in_1): Honor infinite child loops.
+
+ 2016-11-16 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78333
+ * gimplify.c (gimplify_function_tree): Do not instrument
+ GNU extern inline functions.
+
2017-01-23 Martin Liska <mliska@suse.cz>
Backport from mainline
+2017-01-24 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-09-06 Richard Biener <rguenther@suse.de>
+
+ PR c/77450
+ * c-common.c (c_common_mark_addressable_vec): Handle
+ COMPOUND_LITERAL_EXPR.
+
2017-01-10 Martin Liska <mliska@suse.cz>
Backport from mainline
/* ??? Add some way to ignore exceptions for this TFE. */
if (flag_instrument_function_entry_exit
&& !DECL_NO_INSTRUMENT_FUNCTION_ENTRY_EXIT (fndecl)
+ /* Do not instrument extern inline functions. */
+ && !(DECL_DECLARED_INLINE_P (fndecl)
+ && DECL_EXTERNAL (fndecl)
+ && DECL_DISREGARD_INLINE_LIMITS (fndecl))
&& !flag_instrument_functions_exclude_p (fndecl))
{
tree x;
FOR_EACH_EDGE (e, ei, body[i]->succs)
{
- if (flow_bb_inside_loop_p (loop, e->dest))
- continue;
-
- bitmap_set_bit (may_exit, i);
- bitmap_set_bit (has_exit, i);
- outermost_exit = find_common_loop (outermost_exit,
- e->dest->loop_father);
+ if (! flow_bb_inside_loop_p (loop, e->dest))
+ {
+ bitmap_set_bit (may_exit, i);
+ bitmap_set_bit (has_exit, i);
+ outermost_exit = find_common_loop (outermost_exit,
+ e->dest->loop_father);
+ }
+ /* If we enter a subloop that might never terminate treat
+ it like a possible exit. */
+ if (flow_loop_nested_p (loop, e->dest->loop_father))
+ bitmap_set_bit (may_exit, i);
}
continue;
}
unless the program ends due to a function call. */
static void
-find_invariant_insn (rtx_insn *insn, bool always_reached, bool always_executed)
+find_invariant_insn (rtx_insn *insn, bool, bool always_executed)
{
df_ref ref;
struct def *def;
if (can_throw_internal (insn))
return;
- /* We cannot make trapping insn executed, unless it was executed before. */
- if (may_trap_or_fault_p (PATTERN (insn)) && !always_reached)
+ /* We cannot make trapping insn executed. */
+ if (may_trap_or_fault_p (PATTERN (insn)))
return;
depends_on = BITMAP_ALLOC (NULL);
+2017-01-24 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2016-10-06 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/77855
+ * gcc.dg/torture/pr77855.c: New testcase.
+
+ 2016-09-01 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/77436
+ * gcc.dg/torture/pr77436.c: New testcase.
+
+ 2016-09-06 Richard Biener <rguenther@suse.de>
+
+ PR c/77450
+ * gcc.dg/pr77450.c: New testcase.
+
+ 2016-09-19 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/77605
+ * gcc.dg/torture/pr77605.c: New testcase.
+
+ 2016-11-02 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78185
+ * gcc.dg/pr78185.c: New testcase.
+
+ 2016-11-16 Richard Biener <rguenther@suse.de>
+
+ PR middle-end/78333
+ * gcc.dg/pr78333.c: New testcase.
+
2017-01-23 Martin Liska <mliska@suse.cz>
Backport from mainline
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-std=gnu90" } */
+
+typedef int V __attribute__((vector_size(4)));
+
+void
+foo(void)
+{
+ (V){ 0 }[0] = 0;
+}
--- /dev/null
+/* { dg-do run { target *-*-linux* *-*-gnu* } } */
+/* { dg-options "-O" } */
+
+#include <unistd.h>
+#include <signal.h>
+#include <stdlib.h>
+
+static char var1 = 0L;
+static char *var2 = &var1;
+
+void do_exit (int i)
+{
+ exit (0);
+}
+
+int main(void)
+{
+ struct sigaction s;
+ sigemptyset (&s.sa_mask);
+ s.sa_handler = do_exit;
+ s.sa_flags = 0;
+ sigaction (SIGALRM, &s, NULL);
+ alarm (1);
+ /* The following loop is infinite, the division by zero should not
+ be hoisted out of it. */
+ for (; (var1 == 0 ? 0 : (100 / var1)) == *var2; );
+ return 0;
+}
--- /dev/null
+/* { dg-do link } */
+/* { dg-options "-finstrument-functions" } */
+
+/* Add empty implementations of __cyg_profile_func_enter() and
+ __cyg_profile_func_exit() to avoid problems on non-glibc
+ systems. */
+void __attribute__((no_instrument_function))
+__cyg_profile_func_enter(void *this_fn, void *call_site)
+{
+}
+
+void __attribute__((no_instrument_function))
+__cyg_profile_func_exit(void *this_fn, void *call_site)
+{
+}
+
+extern inline __attribute__((gnu_inline, always_inline)) int foo () { }
+int main()
+{
+ foo ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+int main()
+{
+ unsigned short sum = 0;
+ for (short x = -(__SHRT_MAX__ -1); x <= (__SHRT_MAX__ -1); x++)
+ sum += x;
+ if (sum != 0)
+ __builtin_abort ();
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+int a, b, c[2][8];
+
+int main ()
+{
+ for (a = 0; a < 8; a++)
+ for (b = 0; b < 2; b++)
+ c[b][a] = c[b][b + 6] ^ 1;
+
+ if (c[0][7] != 0)
+ __builtin_abort ();
+
+ return 0;
+}
--- /dev/null
+/* { dg-do run } */
+
+int a, b = 1, c, e, f, g, k, m, n, o;
+char d, h, i, j, l;
+char res[2];
+
+void __attribute__ ((noinline,noclone)) fn2 ()
+{
+ d = 2;
+}
+
+void fn3 ()
+{
+ for (;;)
+ {
+ for (; b; b--)
+ {
+ fn2 ();
+ if (e)
+ j = 1;
+ if (f)
+ L1:
+ k = j | (a & l);
+ for (;;)
+ {
+ __builtin_snprintf (res, 2, "%d\n", d);
+ if (d)
+ break;
+ for (; o; o--)
+ for (; n;)
+ for (; m; m++)
+ ;
+ goto L1;
+ }
+ }
+ g = h;
+ c = i;
+ break;
+ }
+}
+
+int main ()
+{
+ fn3 ();
+ if (res[0] != '2')
+ __builtin_abort ();
+ return 0;
+}
{
bool overflow;
unsigned int i;
- tree res;
/* Handle the most frequent cases. */
if (k == 0)
if (k == 1)
return fold_convert (type, n);
+ widest_int num = wi::to_widest (n);
+
/* Check that k <= n. */
- if (wi::ltu_p (n, k))
+ if (wi::ltu_p (num, k))
return NULL_TREE;
/* Denominator = 2. */
- wide_int denom = wi::two (TYPE_PRECISION (TREE_TYPE (n)));
+ widest_int denom = 2;
/* Index = Numerator-1. */
- wide_int idx = wi::sub (n, 1);
+ widest_int idx = num - 1;
/* Numerator = Numerator*Index = n*(n-1). */
- wide_int num = wi::smul (n, idx, &overflow);
+ num = wi::smul (num, idx, &overflow);
if (overflow)
return NULL_TREE;
}
/* Result = Numerator / Denominator. */
- wide_int di_res = wi::udiv_trunc (num, denom);
- res = wide_int_to_tree (type, di_res);
- return int_fits_type_p (res, type) ? res : NULL_TREE;
+ num = wi::udiv_trunc (num, denom);
+ if (! wi::fits_to_tree_p (num, type))
+ return NULL_TREE;
+ return wide_int_to_tree (type, num);
}
/* Helper function. Use the Newton's interpolating formula for
if (niter > 0)
{
- HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter - i0, i1),
- FLOOR_DIV (niter - j0, j1));
+ HOST_WIDE_INT tau2 = MIN (FLOOR_DIV (niter_a - i0, i1),
+ FLOOR_DIV (niter_b - j0, j1));
HOST_WIDE_INT last_conflict = tau2 - (x1 - i0)/i1;
/* If the overlap occurs outside of the bounds of the
loop, there is no dependence. */
- if (x1 >= niter || y1 >= niter)
+ if (x1 >= niter_a || y1 >= niter_b)
{
*overlaps_a = conflict_fn_no_dependence ();
*overlaps_b = conflict_fn_no_dependence ();
#include "tree-ssa-propagate.h"
#include "trans-mem.h"
#include "gimple-fold.h"
+#include "tree-ssa-loop-niter.h"
/* TODO: Support for predicated code motion. I.e.
break;
FOR_EACH_EDGE (e, ei, bb->succs)
- if (!flow_bb_inside_loop_p (loop, e->dest))
- break;
+ {
+ /* If there is an exit from this BB. */
+ if (!flow_bb_inside_loop_p (loop, e->dest))
+ break;
+ /* Or we enter a possibly non-finite loop. */
+ if (flow_loop_nested_p (bb->loop_father,
+ e->dest->loop_father)
+ && ! finite_loop_p (e->dest->loop_father))
+ break;
+ }
if (e)
break;
{
bitmap_iterator bi;
unsigned i;
+ pre_expr to_remove = NULL;
FOR_EACH_EXPR_ID_IN_SET (set, i, bi)
{
+ /* Remove queued expr. */
+ if (to_remove)
+ {
+ bitmap_remove_from_set (set, to_remove);
+ to_remove = NULL;
+ }
+
pre_expr expr = expression_for_id (i);
if (expr->kind == REFERENCE)
{
block, gimple_bb (def_stmt)))
|| (gimple_bb (def_stmt) == block
&& value_dies_in_block_x (expr, block))))
- bitmap_remove_from_set (set, expr);
+ to_remove = expr;
}
}
else if (expr->kind == NARY)
as the available expression might be after the exit point. */
if (BB_MAY_NOTRETURN (block)
&& vn_nary_may_trap (nary))
- bitmap_remove_from_set (set, expr);
+ to_remove = expr;
}
}
+
+ /* Remove queued expr. */
+ if (to_remove)
+ bitmap_remove_from_set (set, to_remove);
}
static sbitmap has_abnormal_preds;
if (!pair
&& offset + foff != 0)
{
- fieldoff_s e = {0, offset + foff, false, false, false, false};
+ fieldoff_s e = {0, offset + foff, false, false, true, false};
pair = fieldstack->safe_push (e);
}