This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Remove remove_unnecessary_notes
- From: Jeffrey A Law <law at redhat dot com>
- To: Steven Bosscher <stevenb dot gcc at gmail dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Mar 2006 17:24:14 -0700
- Subject: Re: [PATCH] Remove remove_unnecessary_notes
- References: <200603162149.23304.steven@gcc.gnu.org>
- Reply-to: law at redhat dot com
On Thu, 2006-03-16 at 21:49 +0100, Steven Bosscher wrote:
> Hi,
>
> I'm on a mission. Where others add one new pass per week, I
> try to remove two ;-)
>
> This patch removes remove_unnecessary_notes. We remove notes
> as one of the first RTL passes, but we only removed notes that
> we don't have to emit in the first place. The second time we
> call remove_unnecessary_notes is in final, but there doesn't
> seem to be a reason to justify a walk over the whole function
> just to squeeze out NOTE_INSN_DELETED notes, the only kind of
> note that remove_unnecessary_notes can remove.
>
> So, the net win here is that we walk the entire function body
> two times less than before. At -O0 this even gives a small
> but measurable speedup...
>
> Bootstrapped and tested on x86_64-linux. I have verified that
> remove_unnecessary_notes does not remove any notes when it is
> called from pass_remove_unnecessary_notes. For final, perhaps
> there are a few notes we keep in the insn stream, but I really
> don't believe that is something to worry about.
>
> While at it, I took the liberty to give tail_recursion_reentry
> a name that matches its purpose better. We only use this note
> when flag_stack_protect is set. I couldn't test this change,
> but according to Andrew P., -fstack-protect is already broken.
>
> Is this patch OK for the trunk?
>
> Gr.
> Steven
>
>
> * function.h (struct function) <x_tail_recursion_reentry>:
> Rename to x_stack_check_probe_note.
> (tail_recursion_reentry): Rename to stack_check_probe_note.
> * function.c: Replace tail_recursion_reentry with
> stack_check_probe_note everywhere.
> (expand_function_start): Only emit a note for
> stack_check_probe_note with -fstack-protect.
> * stmt.c (expand_case): Don't emit NOTE_INSN_DELETED notes.
>
> * emit-rtl.c (remove_unnecessary_notes): Remove.
> (pass_remove_unnecessary_notes): Remove.
> * rtl.h (remove_unnecessary_notes): Remove prototype.
> * final.c (final_start_function): Don't call remove_unnecessary_notes.
> * tree-pass.h (pass_remove_unnecessary_notes): Remove.
> * passes.c (pass_remove_unnecessary_notes): Don't run it.
IIRC, note removal was originally supposed to run after some of
the early optimizers had a chance to "delete" dead/unreachable
code. ie, back in the era were such code was turned into
a NOTE_INSN_DELETED and when we'd have a lot of dead code
after the early RTL optimizers.
In today's world there ought to be a lot less dead code after
the early RTL optimizers ;-)
One trivial nit, in your function.c changes you have
if(flag_stack_check)
You're missing whitespace between the "if" and the open paren.
The rename of tail_recursion_reentry should probably have
occurred when we moved tail recursion optimizations into the
tree optimizers. Oh well, better late than never.
Approved with the nit-fix.
jeff