]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Enable ranger for ipa-prop
authorJan Hubicka <jh@suse.cz>
Wed, 28 Jun 2023 07:34:53 +0000 (09:34 +0200)
committerJan Hubicka <jh@suse.cz>
Wed, 28 Jun 2023 07:35:26 +0000 (09:35 +0200)
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.

gcc/ipa-prop.cc
gcc/testsuite/gcc.dg/ipa/pr110377.c [new file with mode: 0644]

index 41c812194ca6d0e12fdb322a46da4a41f2773460..33bda8288fc7d600b2e0d1b478697b3877dd2985 100644 (file)
@@ -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 (file)
index 0000000..63120a9
--- /dev/null
@@ -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" } }  */