public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Remove unnecessary jump threading restriction
@ 2016-08-05  7:46 Richard Biener
  2016-08-05 20:43 ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2016-08-05  7:46 UTC (permalink / raw)
  To: gcc-patches


There is no need to avoid threading to a loop header, the threading
code can cope with this just fine.  Noticed when working on PR72772.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2016-08-05  Richard Biener  <rguenther@suse.de>

	* tree-ssa-threadupdate.c (thread_block_1): Remove unnecessary
	restriction on threading to a loop header.

Index: gcc/tree-ssa-threadupdate.c
===================================================================
--- gcc/tree-ssa-threadupdate.c	(revision 239117)
+++ gcc/tree-ssa-threadupdate.c	(working copy)
@@ -1531,10 +1531,8 @@ thread_block_1 (basic_block bb, bool nol
 	     threading path that crosses loop boundaries.  We do not try
 	     and thread this elsewhere, so just cancel the jump threading
 	     request by clearing the AUX field now.  */
-	  if ((bb->loop_father != e2->src->loop_father
-	       && !loop_exit_edge_p (e2->src->loop_father, e2))
-	      || (e2->src->loop_father != e2->dest->loop_father
-		  && !loop_exit_edge_p (e2->src->loop_father, e2)))
+	  if (bb->loop_father != e2->src->loop_father
+	      && !loop_exit_edge_p (e2->src->loop_father, e2))
 	    {
 	      /* Since this case is not handled by our special code
 		 to thread through a loop header, we must explicitly

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Remove unnecessary jump threading restriction
  2016-08-05  7:46 [PATCH] Remove unnecessary jump threading restriction Richard Biener
@ 2016-08-05 20:43 ` Jeff Law
  2016-08-06 11:34   ` Richard Biener
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Law @ 2016-08-05 20:43 UTC (permalink / raw)
  To: Richard Biener, gcc-patches

On 08/05/2016 01:45 AM, Richard Biener wrote:
>
> There is no need to avoid threading to a loop header, the threading
> code can cope with this just fine.  Noticed when working on PR72772.
>
> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
>
> Richard.
>
> 2016-08-05  Richard Biener  <rguenther@suse.de>
>
> 	* tree-ssa-threadupdate.c (thread_block_1): Remove unnecessary
> 	restriction on threading to a loop header.
This restriction exists to help prevent threading through a loop header 
into the loop which can easily create an irreducible region.

In fact what you've done is revert the fix for 58343.  Now there is of 
course a test for 58343 in the regression suite.

It's entirely possible that 58343 is just latent now or other changes in 
tree-ssa-threadupdate.c prevent the problems that we saw with 58343.

Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Remove unnecessary jump threading restriction
  2016-08-05 20:43 ` Jeff Law
@ 2016-08-06 11:34   ` Richard Biener
  2016-08-08 19:15     ` Jeff Law
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Biener @ 2016-08-06 11:34 UTC (permalink / raw)
  To: Jeff Law; +Cc: Richard Biener, GCC Patches

On Fri, Aug 5, 2016 at 10:43 PM, Jeff Law <law@redhat.com> wrote
> On 08/05/2016 01:45 AM, Richard Biener wrote:
>>
>>
>> There is no need to avoid threading to a loop header, the threading
>> code can cope with this just fine.  Noticed when working on PR72772.
>>
>> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
>>
>> Richard.
>>
>> 2016-08-05  Richard Biener  <rguenther@suse.de>
>>
>>         * tree-ssa-threadupdate.c (thread_block_1): Remove unnecessary
>>         restriction on threading to a loop header.
>
> This restriction exists to help prevent threading through a loop header into
> the loop which can easily create an irreducible region.
>
> In fact what you've done is revert the fix for 58343.  Now there is of
> course a test for 58343 in the regression suite.
>
> It's entirely possible that 58343 is just latent now or other changes in
> tree-ssa-threadupdate.c prevent the problems that we saw with 58343.

Well, I removed the restriction that the forward threading path ends in a loop
header.  I did this to restore threadings we've done when there was a forwarder
before the loop header we threaded to -- a forwarder with a degenerate PHI
that was later removed and merged with the header anyway.  So I basically
changed nothing here.  I also don't see how forward threading to a loop header
(not across it) can cause an irreducible region to appear - the other part of
the condition which I retained certainly guards the case of crossing a
loop header.

But maybe I am missing something.

Richard.

> Jeff
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Remove unnecessary jump threading restriction
  2016-08-06 11:34   ` Richard Biener
@ 2016-08-08 19:15     ` Jeff Law
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Law @ 2016-08-08 19:15 UTC (permalink / raw)
  To: Richard Biener; +Cc: Richard Biener, GCC Patches

On 08/06/2016 05:34 AM, Richard Biener wrote:
> On Fri, Aug 5, 2016 at 10:43 PM, Jeff Law <law@redhat.com> wrote
>> On 08/05/2016 01:45 AM, Richard Biener wrote:
>>>
>>>
>>> There is no need to avoid threading to a loop header, the threading
>>> code can cope with this just fine.  Noticed when working on PR72772.
>>>
>>> Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
>>>
>>> Richard.
>>>
>>> 2016-08-05  Richard Biener  <rguenther@suse.de>
>>>
>>>         * tree-ssa-threadupdate.c (thread_block_1): Remove unnecessary
>>>         restriction on threading to a loop header.
>>
>> This restriction exists to help prevent threading through a loop header into
>> the loop which can easily create an irreducible region.
>>
>> In fact what you've done is revert the fix for 58343.  Now there is of
>> course a test for 58343 in the regression suite.
>>
>> It's entirely possible that 58343 is just latent now or other changes in
>> tree-ssa-threadupdate.c prevent the problems that we saw with 58343.
>
> Well, I removed the restriction that the forward threading path ends in a loop
> header.  I did this to restore threadings we've done when there was a forwarder
> before the loop header we threaded to -- a forwarder with a degenerate PHI
> that was later removed and merged with the header anyway.  So I basically
> changed nothing here.  I also don't see how forward threading to a loop header
> (not across it) can cause an irreducible region to appear - the other part of
> the condition which I retained certainly guards the case of crossing a
> loop header.
>
> But maybe I am missing something.
I think we can thread to the loop header, but into the loop.

Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-08-08 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-05  7:46 [PATCH] Remove unnecessary jump threading restriction Richard Biener
2016-08-05 20:43 ` Jeff Law
2016-08-06 11:34   ` Richard Biener
2016-08-08 19:15     ` 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).