public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2152] Enable ranger for ipa-prop
@ 2023-06-28  7:35 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2023-06-28  7:35 UTC (permalink / raw)
  To: gcc-cvs

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" } }  */

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

only message in thread, other threads:[~2023-06-28  7:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-28  7:35 [gcc r14-2152] Enable ranger for ipa-prop Jan Hubicka

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