* [gomp4, committed] Add replace_uses_in_dominated_bbs
@ 2015-06-24 9:01 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2015-06-24 9:01 UTC (permalink / raw)
To: gcc-patches; +Cc: Jakub Jelinek, Richard Biener
[-- Attachment #1: Type: text/plain, Size: 165 bytes --]
Hi,
this patch factors out a new function replace_uses_in_dominated_bbs
out of rewrite_virtuals_into_loop_closed_ssa.
Committed to gomp-4_0-branch.
Thanks,
- Tom
[-- Attachment #2: 0003-Add-replace_uses_in_dominated_bbs.patch --]
[-- Type: text/x-patch, Size: 1878 bytes --]
Add replace_uses_in_dominated_bbs
2015-06-18 Tom de Vries <tom@codesourcery.com>
* tree-ssa-loop-manip.c (replace_uses_in_dominated_bbs): Factor out
of ...
(rewrite_virtuals_into_loop_closed_ssa): ... here.
---
gcc/tree-ssa-loop-manip.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 9c558ca..0d2c972 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -588,6 +588,21 @@ replace_uses_in_bbs_by (tree name, tree val, bitmap bbs)
}
}
+/* Replace uses of OLD_VAL with NEW_VAL in bbs dominated by BB. */
+
+static void
+replace_uses_in_dominated_bbs (tree old_val, tree new_val, basic_block bb)
+{
+ bitmap dominated = BITMAP_ALLOC (NULL);
+
+ bitmap_get_dominated_by (CDI_DOMINATORS, bb, dominated);
+ bitmap_set_bit (dominated, bb->index);
+
+ replace_uses_in_bbs_by (old_val, new_val, dominated);
+
+ BITMAP_FREE (dominated);
+}
+
/* Ensure a virtual phi is present in the exit block, if LOOP contains a vdef.
In other words, ensure loop-closed ssa normal form for virtuals. */
@@ -635,17 +650,8 @@ rewrite_virtuals_into_loop_closed_ssa (struct loop *loop)
tree res_new = copy_ssa_name (final_loop, NULL);
gphi *nphi = create_phi_node (res_new, exit->dest);
-
- /* Gather the bbs dominated by the exit block. */
- bitmap exit_dominated = BITMAP_ALLOC (NULL);
- bitmap_get_dominated_by (CDI_DOMINATORS, exit->dest, exit_dominated);
- bitmap_set_bit (exit_dominated, exit->dest->index);
-
- replace_uses_in_bbs_by (final_loop, res_new, exit_dominated);
-
+ replace_uses_in_dominated_bbs (final_loop, res_new, exit->dest);
add_phi_arg (nphi, final_loop, exit, UNKNOWN_LOCATION);
-
- BITMAP_FREE (exit_dominated);
}
/* Check invariants of the loop closed ssa form for the USE in BB. */
--
1.9.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-24 8:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-24 9:01 [gomp4, committed] Add replace_uses_in_dominated_bbs Tom de Vries
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).