re PR tree-optimization/92039 (Spurious -Warray-bounds warnings building 32-bit glibc)
authorRichard Biener <rguenther@suse.de>
Fri, 15 Nov 2019 09:09:16 +0000 (09:09 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 15 Nov 2019 09:09:16 +0000 (09:09 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/ivopts-3.C
gcc/testsuite/gcc.dg/tree-ssa/cunroll-2.c
gcc/tree-ssa-loop-ivcanon.c

index 6810dfb194bcc408e856edef5cfb66bc3eead846..ca1c5ac9744b6c5243b11585e1c2eff58de76d0f 100644 (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
index 6d7a132f08f185e48c42ef86788b18786a763541..e537e5d6cadd5227e65da8694663e638598bb98f 100644 (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.
index b0da5e68abcc18d484d5176f0f43759f078c59b6..cbb6c850baabca68d6c8d494c5b894110950f8b8 100644 (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-*-* } } }
index ae3fec9974971a42f5c0e16f242fccd635738db9..b1d1c7d3d852c00ca269ab9fe49f717bf42a562c 100644 (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"} } */
index c2543eec925f3564fa42c1aad1bc44bf5f1f0681..63c2c6bdb083f340c0da52dd53db7acab9831d04 100644 (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))