* [COMMITTED 1/5] Remove wrapper around gimple_range_global.
@ 2024-04-30 21:23 Andrew MacLeod
0 siblings, 0 replies; only message in thread
From: Andrew MacLeod @ 2024-04-30 21:23 UTC (permalink / raw)
To: gcc-patches; +Cc: hernandez, aldy
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
This came up during stage 4 when someone noticed a comment that said
when legacy EVRP was removed, the wrapper around accessing
SSA_NAME_RANGES for initial values could be removed.
To be clearer, the original discussion is here:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/571709.html
We couldn't prime ranger's initial use of an ssa-name before inlining,
or we would end up removing builtin_unreachable calls. These conditions
are no longer present, and its safe to simple always pick up whatever
the best value we can find.
It even provides a modest speedup with less condition checking on every
access to a global.
Bootstrapped on x86_64-pc-linux-gnu with no regressions. pushed.
Andrew
[-- Attachment #2: 0001-Remove-wrapper-around-gimple_range_global.patch --]
[-- Type: text/x-patch, Size: 3119 bytes --]
From f3571462b581e1b57d563268483207bc929de952 Mon Sep 17 00:00:00 2001
From: Andrew MacLeod <amacleod@redhat.com>
Date: Tue, 20 Feb 2024 12:27:51 -0500
Subject: [PATCH 1/9] Remove wrapper around gimple_range_global.
Now that legacy EVRP has been removed, we can remove the wrapper which
prevented us from using global names before inlining except under
some specific conditions. See discussion:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/571709.html
* value-query.cc (get_range_global): Rename to gimple_range_global.
(gimple_range_global): Remove wrapper function.
(global_range_query::range_of_expr): Call gimple_range_global.
---
gcc/value-query.cc | 40 +++++++---------------------------------
1 file changed, 7 insertions(+), 33 deletions(-)
diff --git a/gcc/value-query.cc b/gcc/value-query.cc
index 052b7511565..e88c8e25789 100644
--- a/gcc/value-query.cc
+++ b/gcc/value-query.cc
@@ -280,11 +280,15 @@ get_ssa_name_ptr_info_nonnull (const_tree name)
// Update the global range for NAME into the SSA_RANGE_NAME_INFO and
// Return the legacy global range for NAME if it has one, otherwise
// return VARYING.
+// See discussion here regarding why there use to be a wrapper function:
+// https://gcc.gnu.org/pipermail/gcc-patches/2021-June/571709.html
+// Legacy EVRP has been removed, leaving just this function.
-static void
-get_range_global (vrange &r, tree name, struct function *fun = cfun)
+void
+gimple_range_global (vrange &r, tree name, struct function *fun)
{
tree type = TREE_TYPE (name);
+ gcc_checking_assert (TREE_CODE (name) == SSA_NAME);
if (SSA_NAME_IS_DEFAULT_DEF (name))
{
@@ -332,36 +336,6 @@ get_range_global (vrange &r, tree name, struct function *fun = cfun)
r.set_varying (type);
}
-// This is where the ranger picks up global info to seed initial
-// requests. It is a slightly restricted version of
-// get_range_global() above.
-//
-// The reason for the difference is that we can always pick the
-// default definition of an SSA with no adverse effects, but for other
-// SSAs, if we pick things up to early, we may prematurely eliminate
-// builtin_unreachables.
-//
-// Without this restriction, the test in g++.dg/tree-ssa/pr61034.C has
-// all of its unreachable calls removed too early.
-//
-// See discussion here:
-// https://gcc.gnu.org/pipermail/gcc-patches/2021-June/571709.html
-
-void
-gimple_range_global (vrange &r, tree name, struct function *fun)
-{
- tree type = TREE_TYPE (name);
- gcc_checking_assert (TREE_CODE (name) == SSA_NAME);
-
- if (SSA_NAME_IS_DEFAULT_DEF (name) || (fun && fun->after_inlining)
- || is_a<gphi *> (SSA_NAME_DEF_STMT (name)))
- {
- get_range_global (r, name, fun);
- return;
- }
- r.set_varying (type);
-}
-
// ----------------------------------------------
// global_range_query implementation.
@@ -373,7 +347,7 @@ global_range_query::range_of_expr (vrange &r, tree expr, gimple *stmt)
if (!gimple_range_ssa_p (expr))
return get_tree_range (r, expr, stmt);
- get_range_global (r, expr);
+ gimple_range_global (r, expr);
return true;
}
--
2.41.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-04-30 21:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30 21:23 [COMMITTED 1/5] Remove wrapper around gimple_range_global 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).