Hi, this removes the last member of var_ann_d, a bit used only locally in remove_unused_locals, so we can as well just use a bitmap. (The funny renaming of the member I had to do because gengtype doesn't like empty structs, the whole thing will be removed momentarily with the third patch).
The only remaining semantic of var_ann now is "if it's non-zero it's a non-global variable that was put into referenced_vars". Regstrapped on x86_64-linux (with the other two patches). Okay for trunk? Ciao, Michael. -- * tree-flow.h (struct var_ann_d): Rename used member. (set_is_used): Don't declare. * tree-flow-inline.h (clear_is_used): Remove. (set_is_used, is_used_p): Move to ... * tree-ssa-live.c (set_is_used, is_used_p): ... here, and use on the side bitmap. (usedvars): New bitmap. (dump_scope_block): Don't dump unusedness. (remove_unused_locals): Allocate and free usedvars. * tree-nrv.c (tree_nrv): Don't clear used flags here. Index: gcc/tree-flow-inline.h =================================================================== *** gcc.orig/tree-flow-inline.h 2012-08-01 15:58:33.000000000 +0200 --- gcc/tree-flow-inline.h 2012-08-01 16:00:42.000000000 +0200 *************** phi_arg_index_from_use (use_operand_p us *** 558,590 **** return index; } - /* Mark VAR as used, so that it'll be preserved during rtl expansion. */ - - static inline void - set_is_used (tree var) - { - var_ann_t ann = var_ann (var); - ann->used = true; - } - - /* Clear VAR's used flag. */ - - static inline void - clear_is_used (tree var) - { - var_ann_t ann = var_ann (var); - ann->used = false; - } - - /* Return true if VAR is marked as used. */ - - static inline bool - is_used_p (tree var) - { - var_ann_t ann = var_ann (var); - return ann->used; - } - /* Return true if T (assumed to be a DECL) is a global variable. A variable is considered global if its storage is not automatic. */ --- 558,563 ---- Index: gcc/tree-flow.h =================================================================== *** gcc.orig/tree-flow.h 2012-08-01 15:59:35.000000000 +0200 --- gcc/tree-flow.h 2012-08-01 16:00:42.000000000 +0200 *************** enum need_phi_state { *** 180,186 **** struct GTY(()) var_ann_d { /* Nonzero if this variable was used after SSA optimizations were applied. We set this when translating out of SSA form. */ ! unsigned used : 1; }; --- 180,186 ---- struct GTY(()) var_ann_d { /* Nonzero if this variable was used after SSA optimizations were applied. We set this when translating out of SSA form. */ ! unsigned donotuse : 1; }; *************** extern enum move_pos movement_possibilit *** 741,747 **** char *get_lsm_tmp_name (tree, unsigned); /* In tree-flow-inline.h */ - static inline void set_is_used (tree); static inline bool unmodifiable_var_p (const_tree); static inline bool ref_contains_array_ref (const_tree); --- 741,746 ---- Index: gcc/tree-nrv.c =================================================================== *** gcc.orig/tree-nrv.c 2012-08-01 15:58:33.000000000 +0200 --- gcc/tree-nrv.c 2012-08-01 16:00:42.000000000 +0200 *************** tree_nrv (void) *** 261,268 **** SET_DECL_VALUE_EXPR (found, result); DECL_HAS_VALUE_EXPR_P (found) = 1; - /* FOUND is no longer used. Ensure it gets removed. */ - clear_is_used (found); return 0; } --- 261,266 ---- Index: gcc/tree-ssa-live.c =================================================================== *** gcc.orig/tree-ssa-live.c 2012-08-01 15:59:35.000000000 +0200 --- gcc/tree-ssa-live.c 2012-08-01 16:00:42.000000000 +0200 *************** partition_view_bitmap (var_map map, bitm *** 329,334 **** --- 329,352 ---- } + static bitmap usedvars; + + /* Mark VAR as used, so that it'll be preserved during rtl expansion. */ + + static inline void + set_is_used (tree var) + { + bitmap_set_bit (usedvars, DECL_UID (var)); + } + + /* Return true if VAR is marked as used. */ + + static inline bool + is_used_p (tree var) + { + return bitmap_bit_p (usedvars, DECL_UID (var)); + } + static inline void mark_all_vars_used (tree *, void *data); /* Helper function for mark_all_vars_used, called via walk_tree. */ *************** dump_scope_block (FILE *file, int indent *** 623,636 **** fprintf (file, " \n"); for (var = BLOCK_VARS (scope); var; var = DECL_CHAIN (var)) { - bool used = false; - - if (var_ann (var)) - used = is_used_p (var); - fprintf (file, "%*s", indent, ""); print_generic_decl (file, var, flags); ! fprintf (file, "%s\n", used ? "" : " (unused)"); } for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (scope); i++) { --- 641,649 ---- fprintf (file, " \n"); for (var = BLOCK_VARS (scope); var; var = DECL_CHAIN (var)) { fprintf (file, "%*s", indent, ""); print_generic_decl (file, var, flags); ! fprintf (file, "\n"); } for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (scope); i++) { *************** remove_unused_locals (void) *** 695,703 **** mark_scope_block_unused (DECL_INITIAL (current_function_decl)); ! /* Assume all locals are unused. */ ! FOR_EACH_REFERENCED_VAR (cfun, t, rvi) ! clear_is_used (t); /* Assume all globals in local decls are unused. */ global_unused_vars = BITMAP_ALLOC (NULL); --- 708,714 ---- mark_scope_block_unused (DECL_INITIAL (current_function_decl)); ! usedvars = BITMAP_ALLOC (NULL); /* Assume all globals in local decls are unused. */ global_unused_vars = BITMAP_ALLOC (NULL); *************** remove_unused_locals (void) *** 850,855 **** --- 861,867 ---- global_unused_vars); BITMAP_FREE (global_unused_vars); + BITMAP_FREE (usedvars); if (dump_file && (dump_flags & TDF_DETAILS)) {