Backport PRs 89677, 90071, 90194, 90213, 90474, 90637, 90930

2019-08-30  Richard Biener  <rguenther@suse.de>

	Backport from mainline
	2019-05-27  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/90637
	* tree-ssa-sink.c (statement_sink_location): Honor the
	computed sink location for single-uses.

	* gcc.dg/gomp/pr90637.c: New testcase.

	2019-06-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/90930
	* tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Set visited
	flag on new stmts to avoid re-processing them.

	2019-05-15  Richard Biener  <rguenther@suse.de>

	PR c/90474
	* c-common.c (c_common_mark_addressable_vec): Also mark
	a COMPOUND_LITERAL_EXPR_DECL addressable similar to
	c_mark_addressable.

	2019-04-25  Richard Biener  <rguenther@suse.de>

	PR middle-end/90194
	* match.pd: Add pattern to simplify view-conversion of an
	empty constructor.

	* g++.dg/torture/pr90194.C: New testcase.

	2019-04-24  Richard Biener  <rguenther@suse.de>

	PR middle-end/90213
	* gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication
	by size and BITS_PER_UNIT on poly-wide-ints.

	2019-04-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/90071
	* tree-ssa-reassoc.c (init_range_entry): Do not pick up
	abnormal operands from def stmts.

	* gcc.dg/torture/pr90071.c: New testcase.

	2019-03-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/89677
	* tree-scalar-evolution.c (simplify_peeled_chrec): Do not
	throw FP expressions at tree-affine.

	* gcc.dg/torture/pr89677.c: New testcase.

From-SVN: r275208
This commit is contained in:
Richard Biener 2019-08-30 16:44:17 +00:00 committed by Richard Biener
parent 3ae1245ec8
commit f2814a59d0
12 changed files with 149 additions and 7 deletions

View File

@ -1,3 +1,44 @@
2019-08-30 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-05-27 Richard Biener <rguenther@suse.de>
PR tree-optimization/90637
* tree-ssa-sink.c (statement_sink_location): Honor the
computed sink location for single-uses.
* gcc.dg/gomp/pr90637.c: New testcase.
2019-06-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/90930
* tree-ssa-reassoc.c (rewrite_expr_tree_parallel): Set visited
flag on new stmts to avoid re-processing them.
2019-04-25 Richard Biener <rguenther@suse.de>
PR middle-end/90194
* match.pd: Add pattern to simplify view-conversion of an
empty constructor.
2019-04-24 Richard Biener <rguenther@suse.de>
PR middle-end/90213
* gimple-fold.c (fold_const_aggregate_ref_1): Do multiplication
by size and BITS_PER_UNIT on poly-wide-ints.
2019-04-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/90071
* tree-ssa-reassoc.c (init_range_entry): Do not pick up
abnormal operands from def stmts.
2019-03-13 Richard Biener <rguenther@suse.de>
PR middle-end/89677
* tree-scalar-evolution.c (simplify_peeled_chrec): Do not
throw FP expressions at tree-affine.
2019-08-30 Segher Boessenkool <segher@kernel.crashing.org>
Backport from trunk

View File

@ -1,3 +1,13 @@
2019-08-30 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-05-15 Richard Biener <rguenther@suse.de>
PR c/90474
* c-common.c (c_common_mark_addressable_vec): Also mark
a COMPOUND_LITERAL_EXPR_DECL addressable similar to
c_mark_addressable.
2019-08-30 Jakub Jelinek <jakub@redhat.com>
Backported from mainline

View File

@ -6529,6 +6529,8 @@ c_common_mark_addressable_vec (tree t)
return;
if (!VAR_P (t) || !DECL_HARD_REGISTER (t))
TREE_ADDRESSABLE (t) = 1;
if (TREE_CODE (t) == COMPOUND_LITERAL_EXPR)
TREE_ADDRESSABLE (COMPOUND_LITERAL_EXPR_DECL (t)) = 1;
}

View File

@ -6318,14 +6318,11 @@ fold_const_aggregate_ref_1 (tree t, tree (*valueize) (tree))
= wi::sext (wi::to_offset (idx) - wi::to_offset (low_bound),
TYPE_PRECISION (TREE_TYPE (idx)));
woffset *= tree_to_uhwi (unit_size);
woffset *= BITS_PER_UNIT;
if (wi::fits_shwi_p (woffset))
{
offset = woffset.to_shwi ();
/* TODO: This code seems wrong, multiply then check
to see if it fits. */
offset *= tree_to_uhwi (unit_size);
offset *= BITS_PER_UNIT;
base = TREE_OPERAND (t, 0);
ctor = get_base_constructor (base, &offset, valueize);
/* Empty constructor. Always fold to 0. */

View File

@ -1753,6 +1753,13 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
&& (TYPE_SIZE (TREE_TYPE (@0)) == TYPE_SIZE (TREE_TYPE (@1))))
(view_convert @1)))
/* Simplify a view-converted empty constructor. */
(simplify
(view_convert CONSTRUCTOR@0)
(if (TREE_CODE (@0) != SSA_NAME
&& CONSTRUCTOR_NELTS (@0) == 0)
{ build_zero_cst (type); }))
/* Re-association barriers around constants and other re-association
barriers can be removed. */
(simplify

View File

@ -1,3 +1,21 @@
2019-08-30 Richard Biener <rguenther@suse.de>
Backport from mainline
2019-04-25 Richard Biener <rguenther@suse.de>
PR middle-end/90194
* g++.dg/torture/pr90194.C: New testcase.
2019-04-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/90071
* gcc.dg/torture/pr90071.c: New testcase.
2019-03-13 Richard Biener <rguenther@suse.de>
PR middle-end/89677
* gcc.dg/torture/pr89677.c: New testcase.
2019-08-30 Segher Boessenkool <segher@kernel.crashing.org>
Backport from trunk

View File

@ -0,0 +1,18 @@
// { dg-do compile }
// { dg-additional-options "-g" }
struct cb {
int yr;
};
void *
operator new (__SIZE_TYPE__, void *nq)
{
return nq;
}
void
af (int xn)
{
new (&xn) cb { };
}

View File

@ -0,0 +1,15 @@
/* { dg-do compile } */
/* { dg-require-effective-target int32plus } */
int a, b, d;
unsigned c;
float e, f, g;
void h() {
float *i = &g;
for (; c < 10; c += 3)
for (; d; d += 3) {
a = *i;
g = f + 0;
f = b + *i + (b - e + 305219) + -b + 3;
}
}

View File

@ -0,0 +1,24 @@
/* { dg-do compile } */
int a;
static int b;
void
foo ()
{
int d;
int e = (int) (__INTPTR_TYPE__) &&f;
void *g = &&h;
h: ++e;
if (a)
i: goto *g;
for (;;)
{
e = 0;
if (b)
goto i;
}
f:
goto *({ d || e < 0 || e >= 2; });
&e;
}

View File

@ -1413,6 +1413,11 @@ simplify_peeled_chrec (struct loop *loop, tree arg, tree init_cond)
return build_polynomial_chrec (loop->num, init_cond, right);
}
/* The affine code only deals with pointer and integer types. */
if (!POINTER_TYPE_P (type)
&& !INTEGRAL_TYPE_P (type))
return chrec_dont_know;
/* Try harder to check if they are equal. */
tree_to_aff_combination_expand (left, type, &aff1, &peeled_chrec_map);
tree_to_aff_combination_expand (step_val, type, &aff2, &peeled_chrec_map);

View File

@ -2140,7 +2140,8 @@ init_range_entry (struct range_entry *r, tree exp, gimple *stmt)
exp_type = boolean_type_node;
}
if (TREE_CODE (arg0) != SSA_NAME)
if (TREE_CODE (arg0) != SSA_NAME
|| SSA_NAME_OCCURS_IN_ABNORMAL_PHI (arg0))
break;
loc = gimple_location (stmt);
switch (code)
@ -4593,6 +4594,7 @@ rewrite_expr_tree_parallel (gassign *stmt, int width,
else
{
stmts[i] = build_and_add_sum (TREE_TYPE (last_rhs1), op1, op2, opcode);
gimple_set_visited (stmts[i], true);
}
if (dump_file && (dump_flags & TDF_DETAILS))
{

View File

@ -431,7 +431,10 @@ statement_sink_location (gimple *stmt, basic_block frombb,
if (sinkbb == frombb)
return false;
*togsi = gsi_for_stmt (use);
if (sinkbb == gimple_bb (use))
*togsi = gsi_for_stmt (use);
else
*togsi = gsi_after_labels (sinkbb);
return true;
}