diff options
author | Richard Biener <rguenther@suse.de> | 2019-11-15 09:09:16 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-11-15 09:09:16 +0000 |
commit | f0af4848ac40d2342743c9b16416310d61db85b5 (patch) | |
tree | b64ffc105c8bdfb89f1ac8de221eae89109d1df0 /gcc/tree-ssa-loop-ivcanon.c | |
parent | 0227ffa98e122d5716d508c435cb8323cd93bfef (diff) | |
download | gcc-f0af4848ac40d2342743c9b16416310d61db85b5.zip gcc-f0af4848ac40d2342743c9b16416310d61db85b5.tar.gz gcc-f0af4848ac40d2342743c9b16416310d61db85b5.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-ssa-loop-ivcanon.c')
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.c b/gcc/tree-ssa-loop-ivcanon.c index c2543ee..63c2c6b 100644 --- a/gcc/tree-ssa-loop-ivcanon.c +++ b/gcc/tree-ssa-loop-ivcanon.c @@ -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)) |