* [PATCH] Don't add unnecessary var self-conflicts (PR tree-optimization/86214)
@ 2019-01-16 22:49 Jakub Jelinek
2019-01-16 22:52 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2019-01-16 22:49 UTC (permalink / raw)
To: Richard Biener; +Cc: gcc-patches
Hi!
While looking at this PR (I've just started) I've noticed that
add_stack_var_conflict is quite often called with x == y.
We don't really need to record that a variable conflicts with itself,
the only reader of the conflicts bitmaps, stack_var_conflict_p,
starts with
if (x == y)
return false;
conflicts bitmap are set either by this function, or by the
EXECUTE_IF_SET_IN_BITMAP (work, 0, i, bi)
{
struct stack_var *a = &stack_vars[i];
if (!a->conflicts)
a->conflicts = BITMAP_ALLOC (&stack_var_bitmap_obstack);
bitmap_ior_into (a->conflicts, work);
}
code (where work isn't derived from any conflicts bitmap though, so
doesn't care if we've added those self-conflicts or not). The above
bitmap_ior_into stuff actually always sets self-conflicts (if you think
bitmap_clear_bit is worth it, I can add it afterwards though).
But I think the following patch is helpful, don't create the conflicts
bitmaps at all if all we'd record is just self-conflict which we'll ignore.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2019-01-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/86214
* cfgexpand.c (add_stack_var_conflict): Don't add any conflicts
if x == y.
--- gcc/cfgexpand.c.jj 2019-01-16 09:35:09.131247513 +0100
+++ gcc/cfgexpand.c 2019-01-16 20:14:11.445467399 +0100
@@ -470,6 +470,8 @@ add_stack_var_conflict (size_t x, size_t
{
struct stack_var *a = &stack_vars[x];
struct stack_var *b = &stack_vars[y];
+ if (x == y)
+ return;
if (!a->conflicts)
a->conflicts = BITMAP_ALLOC (&stack_var_bitmap_obstack);
if (!b->conflicts)
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't add unnecessary var self-conflicts (PR tree-optimization/86214)
2019-01-16 22:49 [PATCH] Don't add unnecessary var self-conflicts (PR tree-optimization/86214) Jakub Jelinek
@ 2019-01-16 22:52 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2019-01-16 22:52 UTC (permalink / raw)
To: Jakub Jelinek, Richard Biener; +Cc: gcc-patches
On 1/16/19 3:49 PM, Jakub Jelinek wrote:
> Hi!
>
> While looking at this PR (I've just started) I've noticed that
> add_stack_var_conflict is quite often called with x == y.
> We don't really need to record that a variable conflicts with itself,
> the only reader of the conflicts bitmaps, stack_var_conflict_p,
> starts with
> if (x == y)
> return false;
> conflicts bitmap are set either by this function, or by the
> EXECUTE_IF_SET_IN_BITMAP (work, 0, i, bi)
> {
> struct stack_var *a = &stack_vars[i];
> if (!a->conflicts)
> a->conflicts = BITMAP_ALLOC (&stack_var_bitmap_obstack);
> bitmap_ior_into (a->conflicts, work);
> }
> code (where work isn't derived from any conflicts bitmap though, so
> doesn't care if we've added those self-conflicts or not). The above
> bitmap_ior_into stuff actually always sets self-conflicts (if you think
> bitmap_clear_bit is worth it, I can add it afterwards though).
>
> But I think the following patch is helpful, don't create the conflicts
> bitmaps at all if all we'd record is just self-conflict which we'll ignore.
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2019-01-16 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/86214
> * cfgexpand.c (add_stack_var_conflict): Don't add any conflicts
> if x == y.
Yea. Seems reasonable.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-16 22:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-16 22:49 [PATCH] Don't add unnecessary var self-conflicts (PR tree-optimization/86214) Jakub Jelinek
2019-01-16 22:52 ` Jeff Law
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).