public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-3911] Don't add dependencies in update_stmt.
@ 2022-11-11 19:48 Andrew Macleod
  0 siblings, 0 replies; only message in thread
From: Andrew Macleod @ 2022-11-11 19:48 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0a7b437ca71e2721e9bcf070762fc54ef7991aeb

commit r13-3911-g0a7b437ca71e2721e9bcf070762fc54ef7991aeb
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Fri Nov 11 12:22:33 2022 -0500

    Don't add dependencies in update_stmt.
    
    gimple_ranger::update_stmt has no idea what the context of an update
    is, and should not be adding relations when it re-evaluates a stmt.
    
            PR tree-optimization/107523
            gcc/
            * gimple-range.cc (gimple_ranger::update_stmt): Use fur_stmt
            rather than fur_depend.
    
            gcc/testsuite/
            * gcc.dg/pr107523.c: New.

Diff:
---
 gcc/gimple-range.cc             |  2 +-
 gcc/testsuite/gcc.dg/pr107523.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/gcc/gimple-range.cc b/gcc/gimple-range.cc
index 2885d0fa21e..ecd6039e0fd 100644
--- a/gcc/gimple-range.cc
+++ b/gcc/gimple-range.cc
@@ -546,7 +546,7 @@ gimple_ranger::update_stmt (gimple *s)
       // Re-calculate a new value using just cache values.
       Value_Range tmp (TREE_TYPE (lhs));
       fold_using_range f;
-      fur_depend src (s, &(gori ()), &m_cache);
+      fur_stmt src (s, &m_cache);
       f.fold_stmt (tmp, s, src, lhs);
 
       // Combine the new value with the old value to check for a change.
diff --git a/gcc/testsuite/gcc.dg/pr107523.c b/gcc/testsuite/gcc.dg/pr107523.c
new file mode 100644
index 00000000000..1e5ed46c636
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr107523.c
@@ -0,0 +1,32 @@
+/* { dg-do run } */
+/* { dg-options "-O2 " } */
+
+int a, b = 1;
+unsigned int c = 1;
+int main() {
+  int d = 1, f;
+  if (b)
+    d = 0;
+  a = -1;
+  b = ~d ^ 465984011;
+ L1:;
+  if (b < 2)
+    f = b;
+  b = f;
+  if (f <= a) {
+    int g = -(a && 1), h = g - f && a, i = ~(c / f) && 1 % (a | h);
+    if (c) {
+      g = f;
+      if (i || (g && (g > -465984012)))
+        goto L2;
+    }
+    c = g | f / c;
+  }
+  if (0)
+  L2:
+    a = 0;
+  if (a <= c)
+    goto L1;
+  return 0;
+}
+

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-11 19:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11 19:48 [gcc r13-3911] Don't add dependencies in update_stmt Andrew Macleod

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).