re PR tree-optimization/92039 (Spurious -Warray-bounds warnings building 32-bit glibc)

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

	PR tree-optimization/92039
	PR tree-optimization/91975
	* tree-ssa-loop-ivcanon.c (constant_after_peeling): Revert
	previous change, treat invariants consistently as non-constant.
	(tree_estimate_loop_size): Ternary ops with just the first op
	constant are not optimized away.

	* gcc.dg/tree-ssa/cunroll-2.c: Revert to state previous to
	unroller adjustment.
	* g++.dg/tree-ssa/ivopts-3.C: Likewise.

From-SVN: r278281
This commit is contained in:
Richard Biener 2019-11-15 09:09:16 +00:00 committed by Richard Biener
parent 0227ffa98e
commit f0af4848ac
5 changed files with 27 additions and 10 deletions

View File

@ -1,3 +1,12 @@
2019-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/92039
PR tree-optimization/91975
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Revert
previous change, treat invariants consistently as non-constant.
(tree_estimate_loop_size): Ternary ops with just the first op
constant are not optimized away.
2019-11-15 Jakub Jelinek <jakub@redhat.com>
* gimplify.c (gimplify_call_expr): Don't call

View File

@ -1,3 +1,11 @@
2019-11-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/92039
PR tree-optimization/91975
* gcc.dg/tree-ssa/cunroll-2.c: Revert to state previous to
unroller adjustment.
* g++.dg/tree-ssa/ivopts-3.C: Likewise.
2019-11-15 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/gomp/declare-variant-13.c: New test.

View File

@ -70,8 +70,6 @@ int main ( int , char** ) {
return 0;
}
// Verify that on x86_64 and i?86 we unroll the innsermost loop and
// use three IVs for the then innermost loop
// Verify that on x86_64 and i?86 we use a single IV for the innermost loop
// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:63, 127 avg niters, 3 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
// { dg-final { scan-tree-dump-not "Selected IV set for loop \[0-9\]* at \[^ \]*:64" "ivopts" { target x86_64-*-* i?86-*-* } } }
// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:64, 3 avg niters, 1 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }

View File

@ -1,5 +1,5 @@
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-cunrolli-details" } */
/* { dg-options "-O3 -fdump-tree-cunroll-details" } */
int a[2];
int test2 (void);
void
@ -14,4 +14,4 @@ test(int c)
}
}
/* We are not able to get rid of the final conditional because the loop has two exits. */
/* { dg-final { scan-tree-dump "loop with 2 iterations completely unrolled" "cunrolli"} } */
/* { dg-final { scan-tree-dump "loop with 1 iterations completely unrolled" "cunroll"} } */

View File

@ -163,7 +163,7 @@ struct loop_size
static bool
constant_after_peeling (tree op, gimple *stmt, class loop *loop)
{
if (is_gimple_min_invariant (op))
if (CONSTANT_CLASS_P (op))
return true;
/* We can still fold accesses to constant arrays when index is known. */
@ -195,8 +195,9 @@ constant_after_peeling (tree op, gimple *stmt, class loop *loop)
/* Induction variables are constants when defined in loop. */
if (loop_containing_stmt (stmt) != loop)
return false;
tree ev = instantiate_parameters (loop, analyze_scalar_evolution (loop, op));
if (chrec_contains_undetermined (ev))
tree ev = analyze_scalar_evolution (loop, op);
if (chrec_contains_undetermined (ev)
|| chrec_contains_symbols (ev))
return false;
return true;
}
@ -293,7 +294,8 @@ tree_estimate_loop_size (class loop *loop, edge exit, edge edge_to_cancel,
stmt, loop)
&& (gimple_assign_rhs_class (stmt) != GIMPLE_BINARY_RHS
|| constant_after_peeling (gimple_assign_rhs2 (stmt),
stmt, loop)))
stmt, loop))
&& gimple_assign_rhs_class (stmt) != GIMPLE_TERNARY_RHS)
{
size->constant_iv = true;
if (dump_file && (dump_flags & TDF_DETAILS))