public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Allow DCE of const or pure calls
@ 2007-11-02 20:06 Jakub Jelinek
  2007-11-03 14:25 ` Eric Botcazou
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2007-11-02 20:06 UTC (permalink / raw)
  To: gcc-patches

Hi!

This has been discussed recently, but I've posted it together with other
hacks which weren't intended for 4.3.  So here is the patch again alone,
bootstrapped/regtested on x86_64-linux (and will regtest it on ia64-linux
tonight as well).

Ok for trunk?

2007-11-02  Jakub Jelinek  <jakub@redhat.com>

	* dce.c (deletable_insn_p): Make const or pure calls deletable.

--- gcc/dce.c.jj	2007-10-28 19:34:17.000000000 +0100
+++ gcc/dce.c	2007-11-02 18:36:14.000000000 +0100
@@ -99,7 +99,8 @@ deletable_insn_p (rtx insn, bool fast)
   rtx body, x;
   int i;
 
-  if (!NONJUMP_INSN_P (insn))
+  if (!NONJUMP_INSN_P (insn)
+      && (!CALL_P (insn) || !CONST_OR_PURE_CALL_P (insn)))
     return false;
 
   body = PATTERN (insn);

	Jakub

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

* Re: [PATCH] Allow DCE of const or pure calls
  2007-11-02 20:06 [PATCH] Allow DCE of const or pure calls Jakub Jelinek
@ 2007-11-03 14:25 ` Eric Botcazou
  2007-11-05  0:11   ` Mark Mitchell
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Botcazou @ 2007-11-03 14:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

> 2007-11-02  Jakub Jelinek  <jakub@redhat.com>
>
> 	* dce.c (deletable_insn_p): Make const or pure calls deletable.

Note that flow.c didn't delete these calls (unless inside libcalls) so I'm not 
sure we want this for 4.3.

-- 
Eric Botcazou

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

* Re: [PATCH] Allow DCE of const or pure calls
  2007-11-03 14:25 ` Eric Botcazou
@ 2007-11-05  0:11   ` Mark Mitchell
  2007-11-05  0:22     ` Jakub Jelinek
  2007-11-05  8:13     ` Eric Botcazou
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Mitchell @ 2007-11-05  0:11 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: Jakub Jelinek, gcc-patches

Eric Botcazou wrote:
>> 2007-11-02  Jakub Jelinek  <jakub@redhat.com>
>>
>> 	* dce.c (deletable_insn_p): Make const or pure calls deletable.
> 
> Note that flow.c didn't delete these calls (unless inside libcalls) so I'm not 
> sure we want this for 4.3.

Do you mean that you think that this might be undesirable because it
would be a surprise to users?  Or because it's a new feature, and thus
not suitable for Stage 3?

I'm not sure I agree with either statement, not having thought about it
much, but before I say anything I'd like to make sure I understand your
point of view.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

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

* Re: [PATCH] Allow DCE of const or pure calls
  2007-11-05  0:11   ` Mark Mitchell
@ 2007-11-05  0:22     ` Jakub Jelinek
  2007-11-05  0:33       ` Andrew Pinski
  2007-11-05  8:13     ` Eric Botcazou
  1 sibling, 1 reply; 7+ messages in thread
From: Jakub Jelinek @ 2007-11-05  0:22 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Eric Botcazou, gcc-patches

On Sun, Nov 04, 2007 at 04:11:11PM -0800, Mark Mitchell wrote:
> Eric Botcazou wrote:
> >> 2007-11-02  Jakub Jelinek  <jakub@redhat.com>
> >>
> >> 	* dce.c (deletable_insn_p): Make const or pure calls deletable.
> > 
> > Note that flow.c didn't delete these calls (unless inside libcalls) so I'm not 
> > sure we want this for 4.3.
> 
> Do you mean that you think that this might be undesirable because it
> would be a surprise to users?  Or because it's a new feature, and thus
> not suitable for Stage 3?

While the patch worked just fine during bootstrap/regtesting on
x86_64-linux, during later testing I found it caused a bootstrap failure
on ia64-linux (which I haven't had time to analyze yet).
Therefore I'm withdrawing that patch for now.  Most of the dead const/pure calls
should be hopefully DCEd already in tree passes and at least in 4.3
__tls_get_addr etc. is using libcall blocks which are now DCEable again
even without this patch.

	Jakub

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

* Re: [PATCH] Allow DCE of const or pure calls
  2007-11-05  0:22     ` Jakub Jelinek
@ 2007-11-05  0:33       ` Andrew Pinski
  2007-11-05  8:23         ` Eric Botcazou
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Pinski @ 2007-11-05  0:33 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Mark Mitchell, Eric Botcazou, gcc-patches

On 11/4/07, Jakub Jelinek <jakub@redhat.com> wrote:
> On Sun, Nov 04, 2007 at 04:11:11PM -0800, Mark Mitchell wrote:
> > Eric Botcazou wrote:
> > >> 2007-11-02  Jakub Jelinek  <jakub@redhat.com>
> > >>
> > >>    * dce.c (deletable_insn_p): Make const or pure calls deletable.
> > >
> > > Note that flow.c didn't delete these calls (unless inside libcalls) so I'm not
> > > sure we want this for 4.3.

At one point, we used to put pure/const functions in libcalls but we
don't after:
http://gcc.gnu.org/ml/gcc-patches/2005-07/msg01198.html

So I think this is fixing a regression from 3.4 on a RTL level optimization.

-- Pnski

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

* Re: [PATCH] Allow DCE of const or pure calls
  2007-11-05  0:11   ` Mark Mitchell
  2007-11-05  0:22     ` Jakub Jelinek
@ 2007-11-05  8:13     ` Eric Botcazou
  1 sibling, 0 replies; 7+ messages in thread
From: Eric Botcazou @ 2007-11-05  8:13 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: gcc-patches, Jakub Jelinek

> Do you mean that you think that this might be undesirable because it
> would be a surprise to users?  Or because it's a new feature, and thus
> not suitable for Stage 3?

The latter.  And, as Jakub said, I don't think it would buy us much.

-- 
Eric Botcazou

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

* Re: [PATCH] Allow DCE of const or pure calls
  2007-11-05  0:33       ` Andrew Pinski
@ 2007-11-05  8:23         ` Eric Botcazou
  0 siblings, 0 replies; 7+ messages in thread
From: Eric Botcazou @ 2007-11-05  8:23 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: gcc-patches, Jakub Jelinek, Mark Mitchell

> So I think this is fixing a regression from 3.4 on a RTL level
> optimization.

Note that, with this reasoning, every optimization that has been moved from 
RTL to Tree level is the source of a regression from 3.4.  But users cannot 
tell the difference between Tree level and RTL level optimizations, and DCE
of const or pure calls should already happen at the Tree level.

-- 
Eric Botcazou

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

end of thread, other threads:[~2007-11-05  8:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-02 20:06 [PATCH] Allow DCE of const or pure calls Jakub Jelinek
2007-11-03 14:25 ` Eric Botcazou
2007-11-05  0:11   ` Mark Mitchell
2007-11-05  0:22     ` Jakub Jelinek
2007-11-05  0:33       ` Andrew Pinski
2007-11-05  8:23         ` Eric Botcazou
2007-11-05  8:13     ` Eric Botcazou

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).