public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-8683] tree-optimization/113693 - LC SSA and region VN
@ 2024-02-01 10:13 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2024-02-01 10:13 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b84f8a5e0a7ef3e5bd0d186fc7e280d9c43c5b7f

commit r14-8683-gb84f8a5e0a7ef3e5bd0d186fc7e280d9c43c5b7f
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Feb 1 09:18:47 2024 +0100

    tree-optimization/113693 - LC SSA and region VN
    
    The following fixes LC SSA preserving with region VN which was broken
    when availability checking was enhanced to treat not visited value
    numbers as available.  The following makes sure to honor availability
    data we put in place for LC SSA preserving instead.
    
            PR tree-optimization/113693
            * tree-ssa-sccvn.cc (rpo_elim::eliminate_avail): Honor avail
            data when available.
    
            * gcc.dg/pr113693.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/pr113693.c | 13 +++++++++++++
 gcc/tree-ssa-sccvn.cc           | 11 +++++++----
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/gcc.dg/pr113693.c b/gcc/testsuite/gcc.dg/pr113693.c
new file mode 100644
index 000000000000..a6f55199d0ff
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr113693.c
@@ -0,0 +1,13 @@
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-O2 -fdbg-cnt=vect_loop:1" } */
+
+_BitInt(837) g, h;
+
+void
+fn1(void)
+{
+  for (; g; g++)
+    for (; h; h++)
+      ;
+}
+/* { dg-message "dbgcnt" "" { target *-*-* } 0 } */
diff --git a/gcc/tree-ssa-sccvn.cc b/gcc/tree-ssa-sccvn.cc
index 9bed9b3cc69c..bbcf86588f9f 100644
--- a/gcc/tree-ssa-sccvn.cc
+++ b/gcc/tree-ssa-sccvn.cc
@@ -7723,12 +7723,15 @@ rpo_elim::eliminate_avail (basic_block bb, tree op)
       if (SSA_NAME_IS_DEFAULT_DEF (valnum))
 	return valnum;
       vn_ssa_aux_t valnum_info = VN_INFO (valnum);
-      /* See above.  */
-      if (!valnum_info->visited)
-	return valnum;
       vn_avail *av = valnum_info->avail;
       if (!av)
-	return NULL_TREE;
+	{
+	  /* See above.  But when there's availability info prefer
+	     what we recorded there for example to preserve LC SSA.  */
+	  if (!valnum_info->visited)
+	    return valnum;
+	  return NULL_TREE;
+	}
       if (av->location == bb->index)
 	/* On tramp3d 90% of the cases are here.  */
 	return ssa_name (av->leader);

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

only message in thread, other threads:[~2024-02-01 10:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-01 10:13 [gcc r14-8683] tree-optimization/113693 - LC SSA and region VN Richard Biener

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).