This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Make switch convert arrays readonly
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 1 Jun 2010 12:27:41 +0200
- Subject: Re: Make switch convert arrays readonly
- References: <20100601094035.GH1373@kam.mff.cuni.cz>
On Tue, Jun 1, 2010 at 11:40 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>
> Hi,
> the most common variables we promote readonly are ones produced by switch conversion.
> This patch adds the missing TREE_READONLY set there.
> It should avoid the work later and let early passes to propagate further.
>
> Bootstrapped/regtested x86_64-linux, OK?
Ok.
Thanks,
Richard.
> ? ? ? ?* tree-switch-conversion.c (build_one_array): Make it readonly.
> Index: tree-switch-conversion.c
> ===================================================================
> --- tree-switch-conversion.c ? ?(revision 160079)
> +++ tree-switch-conversion.c ? ?(working copy)
> @@ -526,6 +526,7 @@
> ? ? ? DECL_NAME (decl) = create_tmp_var_name ("CSWTCH");
> ? ? ? DECL_ARTIFICIAL (decl) = 1;
> ? ? ? TREE_CONSTANT (decl) = 1;
> + ? ? ?TREE_READONLY (decl) = 1;
> ? ? ? add_referenced_var (decl);
> ? ? ? varpool_mark_needed_node (varpool_node (decl));
> ? ? ? varpool_finalize_decl (decl);
>