This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Make switch convert arrays readonly
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 1 Jun 2010 11:40:35 +0200
- Subject: Make switch convert arrays readonly
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?
* 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);