public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Use global ranger.
@ 2021-11-08 15:36 Martin Liska
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-11-08 15:36 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3a37d892d5e09ad2dc17b4dbc5281c7fd5156dd2
commit 3a37d892d5e09ad2dc17b4dbc5281c7fd5156dd2
Author: Martin Liska <mliska@suse.cz>
Date: Mon Nov 8 15:57:05 2021 +0100
Use global ranger.
Diff:
---
gcc/tree-ssa-loop-unswitch.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 4b4bd471acd..41261efe404 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -79,7 +79,7 @@ along with GCC; see the file COPYING3. If not see
shape. */
static class loop *tree_unswitch_loop (class loop *, basic_block, tree, edge);
-static bool tree_unswitch_single_loop (class loop *, int);
+static bool tree_unswitch_single_loop (class loop *, gimple_ranger *ranger, int);
static tree tree_may_unswitch_on (basic_block, class loop *, edge *);
static bool tree_unswitch_outer_loop (class loop *);
static edge find_loop_guard (class loop *);
@@ -96,16 +96,18 @@ unsigned int
tree_ssa_unswitch_loops (void)
{
bool changed = false;
+ gimple_ranger *ranger = enable_ranger (cfun);
/* Go through all loops starting from innermost. */
for (auto loop : loops_list (cfun, LI_FROM_INNERMOST))
{
if (!loop->inner)
/* Unswitch innermost loop. */
- changed |= tree_unswitch_single_loop (loop, 0);
+ changed |= tree_unswitch_single_loop (loop, ranger, 0);
else
changed |= tree_unswitch_outer_loop (loop);
}
+ disable_ranger (cfun);
if (changed)
{
@@ -305,7 +307,7 @@ tree_may_unswitch_on (basic_block bb, class loop *loop, edge *cond_edge)
grow exponentially. */
static bool
-tree_unswitch_single_loop (class loop *loop, int num)
+tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, int num)
{
basic_block *bbs;
class loop *nloop;
@@ -354,7 +356,6 @@ tree_unswitch_single_loop (class loop *loop, int num)
bbs = get_loop_body (loop);
found = loop->num_nodes;
- gimple_ranger ranger;
while (1)
{
/* Find a bb to unswitch on. */
@@ -386,7 +387,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
tree result;
int_range_max r;
- if (ranger.range_of_stmt (r, stmt) && r.singleton_p (&result))
+ if (ranger->range_of_stmt (r, stmt) && r.singleton_p (&result))
{
gimple_cond_set_condition_from_tree (condition,
result);
@@ -407,7 +408,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
edge e = find_edge (gimple_bb (stmt), dest);
int_range_max r;
- if (ranger.range_on_edge (r, e, gimple_switch_index (swtch))
+ if (ranger->range_on_edge (r, e, gimple_switch_index (swtch))
&& r.undefined_p ())
{
e->flags |= EDGE_IGNORE;
@@ -542,8 +543,8 @@ tree_unswitch_single_loop (class loop *loop, int num)
free_original_copy_tables ();
/* Invoke itself on modified loops. */
- tree_unswitch_single_loop (nloop, num + 1);
- tree_unswitch_single_loop (loop, num + 1);
+ tree_unswitch_single_loop (nloop, ranger, num + 1);
+ tree_unswitch_single_loop (loop, ranger, num + 1);
free (bbs);
return true;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Use global ranger.
@ 2021-11-08 15:30 Martin Liska
0 siblings, 0 replies; 2+ messages in thread
From: Martin Liska @ 2021-11-08 15:30 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5
commit 5df2804ff8197cfd7d45a9e28ee9d22ad1e6a3a5
Author: Martin Liska <mliska@suse.cz>
Date: Mon Nov 8 15:57:05 2021 +0100
Use global ranger.
Diff:
---
gcc/tree-ssa-loop-unswitch.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c
index 4b4bd471acd..41261efe404 100644
--- a/gcc/tree-ssa-loop-unswitch.c
+++ b/gcc/tree-ssa-loop-unswitch.c
@@ -79,7 +79,7 @@ along with GCC; see the file COPYING3. If not see
shape. */
static class loop *tree_unswitch_loop (class loop *, basic_block, tree, edge);
-static bool tree_unswitch_single_loop (class loop *, int);
+static bool tree_unswitch_single_loop (class loop *, gimple_ranger *ranger, int);
static tree tree_may_unswitch_on (basic_block, class loop *, edge *);
static bool tree_unswitch_outer_loop (class loop *);
static edge find_loop_guard (class loop *);
@@ -96,16 +96,18 @@ unsigned int
tree_ssa_unswitch_loops (void)
{
bool changed = false;
+ gimple_ranger *ranger = enable_ranger (cfun);
/* Go through all loops starting from innermost. */
for (auto loop : loops_list (cfun, LI_FROM_INNERMOST))
{
if (!loop->inner)
/* Unswitch innermost loop. */
- changed |= tree_unswitch_single_loop (loop, 0);
+ changed |= tree_unswitch_single_loop (loop, ranger, 0);
else
changed |= tree_unswitch_outer_loop (loop);
}
+ disable_ranger (cfun);
if (changed)
{
@@ -305,7 +307,7 @@ tree_may_unswitch_on (basic_block bb, class loop *loop, edge *cond_edge)
grow exponentially. */
static bool
-tree_unswitch_single_loop (class loop *loop, int num)
+tree_unswitch_single_loop (class loop *loop, gimple_ranger *ranger, int num)
{
basic_block *bbs;
class loop *nloop;
@@ -354,7 +356,6 @@ tree_unswitch_single_loop (class loop *loop, int num)
bbs = get_loop_body (loop);
found = loop->num_nodes;
- gimple_ranger ranger;
while (1)
{
/* Find a bb to unswitch on. */
@@ -386,7 +387,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
tree result;
int_range_max r;
- if (ranger.range_of_stmt (r, stmt) && r.singleton_p (&result))
+ if (ranger->range_of_stmt (r, stmt) && r.singleton_p (&result))
{
gimple_cond_set_condition_from_tree (condition,
result);
@@ -407,7 +408,7 @@ tree_unswitch_single_loop (class loop *loop, int num)
edge e = find_edge (gimple_bb (stmt), dest);
int_range_max r;
- if (ranger.range_on_edge (r, e, gimple_switch_index (swtch))
+ if (ranger->range_on_edge (r, e, gimple_switch_index (swtch))
&& r.undefined_p ())
{
e->flags |= EDGE_IGNORE;
@@ -542,8 +543,8 @@ tree_unswitch_single_loop (class loop *loop, int num)
free_original_copy_tables ();
/* Invoke itself on modified loops. */
- tree_unswitch_single_loop (nloop, num + 1);
- tree_unswitch_single_loop (loop, num + 1);
+ tree_unswitch_single_loop (nloop, ranger, num + 1);
+ tree_unswitch_single_loop (loop, ranger, num + 1);
free (bbs);
return true;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-08 15:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-08 15:36 [gcc(refs/users/marxin/heads/loop-unswitching-switch-v5)] Use global ranger Martin Liska
-- strict thread matches above, loose matches on Subject: below --
2021-11-08 15:30 Martin Liska
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).