public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-2152] Enable ranger for ipa-prop
Date: Wed, 28 Jun 2023 07:35:41 +0000 (GMT)	[thread overview]
Message-ID: <20230628073541.D4F133858D1E@sourceware.org> (raw)

https://gcc.gnu.org/g:7198573f44fb579843bff8deda695107858d8cff

commit r14-2152-g7198573f44fb579843bff8deda695107858d8cff
Author: Jan Hubicka <jh@suse.cz>
Date:   Wed Jun 28 09:34:53 2023 +0200

    Enable ranger for ipa-prop
    
    gcc/ChangeLog:
    
            PR tree-optimization/110377
            * ipa-prop.cc (ipa_compute_jump_functions_for_edge): Pass statement to
            the ranger query.
            (ipa_analyze_node): Enable ranger.
    
    gcc/testsuite/ChangeLog:
    
            PR tree-optimization/110377
            * gcc.dg/ipa/pr110377.c: New test.

Diff:
---
 gcc/ipa-prop.cc                     |  6 ++++--
 gcc/testsuite/gcc.dg/ipa/pr110377.c | 16 ++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/gcc/ipa-prop.cc b/gcc/ipa-prop.cc
index 41c812194ca..33bda8288fc 100644
--- a/gcc/ipa-prop.cc
+++ b/gcc/ipa-prop.cc
@@ -2386,7 +2386,7 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
 
 	  if (TREE_CODE (arg) == SSA_NAME
 	      && param_type
-	      && get_range_query (cfun)->range_of_expr (vr, arg)
+	      && get_range_query (cfun)->range_of_expr (vr, arg, cs->call_stmt)
 	      && vr.nonzero_p ())
 	    addr_nonzero = true;
 	  else if (tree_single_nonzero_warnv_p (arg, &strict_overflow))
@@ -2408,7 +2408,7 @@ ipa_compute_jump_functions_for_edge (struct ipa_func_body_info *fbi,
 	      && Value_Range::supports_type_p (param_type)
 	      && irange::supports_p (TREE_TYPE (arg))
 	      && irange::supports_p (param_type)
-	      && get_range_query (cfun)->range_of_expr (vr, arg)
+	      && get_range_query (cfun)->range_of_expr (vr, arg, cs->call_stmt)
 	      && !vr.undefined_p ())
 	    {
 	      Value_Range resvr (vr);
@@ -3190,7 +3190,9 @@ ipa_analyze_node (struct cgraph_node *node)
       bi->cg_edges.safe_push (cs);
     }
 
+  enable_ranger (cfun, false);
   analysis_dom_walker (&fbi).walk (ENTRY_BLOCK_PTR_FOR_FN (cfun));
+  disable_ranger (cfun);
 
   ipa_release_body_info (&fbi);
   free_dominance_info (CDI_DOMINATORS);
diff --git a/gcc/testsuite/gcc.dg/ipa/pr110377.c b/gcc/testsuite/gcc.dg/ipa/pr110377.c
new file mode 100644
index 00000000000..63120a97bd0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ipa/pr110377.c
@@ -0,0 +1,16 @@
+/* { dg-do compile */
+/* { dg-options "-O2 -fdump-ipa-cp" } */
+int test3(int);
+__attribute__ ((noinline))
+void test2(int a)
+{
+	test3(a);
+}
+void
+test(int n)
+{
+        if (n > 5)
+          __builtin_unreachable ();
+        test2(n);
+}
+/* { dg-final { scan-ipa-dump "-INF, 5" "cp" } }  */

                 reply	other threads:[~2023-06-28  7:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230628073541.D4F133858D1E@sourceware.org \
    --to=hubicka@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).