From: Richard Guenther <richard.guenther@gmail.com>
To: Michael Matz <matz@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: rfa: remove get_var_ann (was: Fix PR50260)
Date: Thu, 06 Oct 2011 15:28:00 -0000 [thread overview]
Message-ID: <CAFiYyc3i8uhB5+YxZsNRU6uhN+Nhj-3T2CssNoynjCkDp2Ho=A@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1110061656490.1483@wotan.suse.de>
On Thu, Oct 6, 2011 at 4:59 PM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> On Sat, 3 Sep 2011, Richard Guenther wrote:
>
>> > OTOH it's a nice invariant that can actually be checked for (that all
>> > reachable vars whatsoever have to be in referenced_vars), so I'm going
>> > to do that.
>>
>> Yes, until we get rid of referenced_vars (which we still should do at
>> some point...) that's the best.
>
> Okay, like so then. Regstrapped on x86_64-linux. (Note that sometimes I
> use add_referenced_vars, and sometimes find_referenced_vars_in, the latter
> when I would have to add several add_referenced_vars for one statement).
>
>> IIRC we have some verification code even, and wonder why it doesn't
>> trigger.
>
> Nope, we don't. But with the patch we segfault in case this happens
> again, which is good enough checking for me.
Ok.
Thanks,
Richard.
>
> Ciao,
> Michael.
> ----------------
> * tree-flow.h (get_var_ann): Don't declare.
> * tree-flow-inline.h (get_var_ann): Remove.
> (set_is_used): Use var_ann, not get_var_ann.
> * tree-dfa.c (add_referenced_var): Inline body of get_var_ann.
> * tree-profile.c (gimple_gen_edge_profiler): Call
> find_referenced_var_in.
> (gimple_gen_interval_profiler): Ditto.
> (gimple_gen_pow2_profiler): Ditto.
> (gimple_gen_one_value_profiler): Ditto.
> (gimple_gen_average_profiler): Ditto.
> (gimple_gen_ior_profiler): Ditto.
> (gimple_gen_ic_profiler): Ditto plus call add_referenced_var.
> (gimple_gen_ic_func_profiler): Call add_referenced_var.
> * tree-mudflap.c (execute_mudflap_function_ops): Call
> add_referenced_var.
>
> Index: tree-flow.h
> ===================================================================
> --- tree-flow.h (revision 178488)
> +++ tree-flow.h (working copy)
> @@ -278,7 +278,6 @@ typedef struct immediate_use_iterator_d
> typedef struct var_ann_d *var_ann_t;
>
> static inline var_ann_t var_ann (const_tree);
> -static inline var_ann_t get_var_ann (tree);
> static inline void update_stmt (gimple);
> static inline int get_lineno (const_gimple);
>
> Index: tree-flow-inline.h
> ===================================================================
> --- tree-flow-inline.h (revision 178488)
> +++ tree-flow-inline.h (working copy)
> @@ -145,16 +145,6 @@ var_ann (const_tree t)
> return p ? *p : NULL;
> }
>
> -/* Return the variable annotation for T, which must be a _DECL node.
> - Create the variable annotation if it doesn't exist. */
> -static inline var_ann_t
> -get_var_ann (tree var)
> -{
> - var_ann_t *p = DECL_VAR_ANN_PTR (var);
> - gcc_checking_assert (p);
> - return *p ? *p : create_var_ann (var);
> -}
> -
> /* Get the number of the next statement uid to be allocated. */
> static inline unsigned int
> gimple_stmt_max_uid (struct function *fn)
> @@ -568,7 +558,7 @@ phi_arg_index_from_use (use_operand_p us
> static inline void
> set_is_used (tree var)
> {
> - var_ann_t ann = get_var_ann (var);
> + var_ann_t ann = var_ann (var);
> ann->used = true;
> }
>
> Index: tree-dfa.c
> ===================================================================
> --- tree-dfa.c (revision 178488)
> +++ tree-dfa.c (working copy)
> @@ -580,8 +580,9 @@ set_default_def (tree var, tree def)
> bool
> add_referenced_var (tree var)
> {
> - get_var_ann (var);
> gcc_assert (DECL_P (var));
> + if (!*DECL_VAR_ANN_PTR (var))
> + create_var_ann (var);
>
> /* Insert VAR into the referenced_vars hash table if it isn't present. */
> if (referenced_var_check_and_insert (var))
> Index: tree-profile.c
> ===================================================================
> --- tree-profile.c (revision 178408)
> +++ tree-profile.c (working copy)
> @@ -224,6 +224,7 @@ gimple_gen_edge_profiler (int edgeno, ed
> one = build_int_cst (gcov_type_node, 1);
> stmt1 = gimple_build_assign (gcov_type_tmp_var, ref);
> gimple_assign_set_lhs (stmt1, make_ssa_name (gcov_type_tmp_var, stmt1));
> + find_referenced_vars_in (stmt1);
> stmt2 = gimple_build_assign_with_ops (PLUS_EXPR, gcov_type_tmp_var,
> gimple_assign_lhs (stmt1), one);
> gimple_assign_set_lhs (stmt2, make_ssa_name (gcov_type_tmp_var, stmt2));
> @@ -270,6 +271,7 @@ gimple_gen_interval_profiler (histogram_
> val = prepare_instrumented_value (&gsi, value);
> call = gimple_build_call (tree_interval_profiler_fn, 4,
> ref_ptr, val, start, steps);
> + find_referenced_vars_in (call);
> gsi_insert_before (&gsi, call, GSI_NEW_STMT);
> }
>
> @@ -290,6 +292,7 @@ gimple_gen_pow2_profiler (histogram_valu
> true, NULL_TREE, true, GSI_SAME_STMT);
> val = prepare_instrumented_value (&gsi, value);
> call = gimple_build_call (tree_pow2_profiler_fn, 2, ref_ptr, val);
> + find_referenced_vars_in (call);
> gsi_insert_before (&gsi, call, GSI_NEW_STMT);
> }
>
> @@ -310,6 +313,7 @@ gimple_gen_one_value_profiler (histogram
> true, NULL_TREE, true, GSI_SAME_STMT);
> val = prepare_instrumented_value (&gsi, value);
> call = gimple_build_call (tree_one_value_profiler_fn, 2, ref_ptr, val);
> + find_referenced_vars_in (call);
> gsi_insert_before (&gsi, call, GSI_NEW_STMT);
> }
>
> @@ -340,9 +344,12 @@ gimple_gen_ic_profiler (histogram_value
>
> tmp1 = create_tmp_reg (ptr_void, "PROF");
> stmt1 = gimple_build_assign (ic_gcov_type_ptr_var, ref_ptr);
> + find_referenced_vars_in (stmt1);
> stmt2 = gimple_build_assign (tmp1, unshare_expr (value->hvalue.value));
> gimple_assign_set_lhs (stmt2, make_ssa_name (tmp1, stmt2));
> + find_referenced_vars_in (stmt2);
> stmt3 = gimple_build_assign (ic_void_ptr_var, gimple_assign_lhs (stmt2));
> + add_referenced_var (ic_void_ptr_var);
>
> gsi_insert_before (&gsi, stmt1, GSI_SAME_STMT);
> gsi_insert_before (&gsi, stmt2, GSI_SAME_STMT);
> @@ -378,9 +385,11 @@ gimple_gen_ic_func_profiler (void)
> counter_ptr = force_gimple_operand_gsi (&gsi, ic_gcov_type_ptr_var,
> true, NULL_TREE, true,
> GSI_SAME_STMT);
> + add_referenced_var (ic_gcov_type_ptr_var);
> ptr_var = force_gimple_operand_gsi (&gsi, ic_void_ptr_var,
> true, NULL_TREE, true,
> GSI_SAME_STMT);
> + add_referenced_var (ic_void_ptr_var);
> tree_uid = build_int_cst (gcov_type_node, current_function_funcdef_no);
> stmt1 = gimple_build_call (tree_indirect_call_profiler_fn, 4,
> counter_ptr, tree_uid, cur_func, ptr_var);
> @@ -429,6 +438,7 @@ gimple_gen_average_profiler (histogram_v
> true, GSI_SAME_STMT);
> val = prepare_instrumented_value (&gsi, value);
> call = gimple_build_call (tree_average_profiler_fn, 2, ref_ptr, val);
> + find_referenced_vars_in (call);
> gsi_insert_before (&gsi, call, GSI_NEW_STMT);
> }
>
> @@ -449,6 +459,7 @@ gimple_gen_ior_profiler (histogram_value
> true, NULL_TREE, true, GSI_SAME_STMT);
> val = prepare_instrumented_value (&gsi, value);
> call = gimple_build_call (tree_ior_profiler_fn, 2, ref_ptr, val);
> + find_referenced_vars_in (call);
> gsi_insert_before (&gsi, call, GSI_NEW_STMT);
> }
>
> Index: tree-mudflap.c
> ===================================================================
> --- tree-mudflap.c (revision 178600)
> +++ tree-mudflap.c (working copy)
> @@ -418,6 +418,10 @@ execute_mudflap_function_ops (void)
>
> push_gimplify_context (&gctx);
>
> + add_referenced_var (mf_cache_array_decl);
> + add_referenced_var (mf_cache_shift_decl);
> + add_referenced_var (mf_cache_mask_decl);
> +
> /* In multithreaded mode, don't cache the lookup cache parameters. */
> if (! flag_mudflap_threads)
> mf_decl_cache_locals ();
>
next prev parent reply other threads:[~2011-10-06 15:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-01 12:41 Fix PR50260 Michael Matz
2011-09-01 12:54 ` Martin Jambor
2011-09-02 8:30 ` Richard Guenther
2011-09-02 16:34 ` Michael Matz
2011-09-02 18:41 ` Michael Matz
2011-09-03 1:52 ` rfa: remove get_var_ann (was: Fix PR50260) Michael Matz
2011-09-03 8:44 ` Richard Guenther
2011-09-03 15:32 ` Michael Matz
2011-09-03 19:10 ` Richard Guenther
2011-10-06 15:06 ` Michael Matz
2011-10-06 15:28 ` Richard Guenther [this message]
2011-09-03 8:40 ` Fix PR50260 Richard Guenther
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFiYyc3i8uhB5+YxZsNRU6uhN+Nhj-3T2CssNoynjCkDp2Ho=A@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=matz@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).