public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernd Schmidt <bschmidt@redhat.com>
To: Mikhail Maltsev <maltsevm@gmail.com>,
	       Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches mailing list <gcc-patches@gcc.gnu.org>,
	       Jeff Law <law@redhat.com>
Subject: Re: [PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE
Date: Mon, 19 Oct 2015 12:19:00 -0000	[thread overview]
Message-ID: <5624DE4E.6090106@redhat.com> (raw)
In-Reply-To: <56243DA9.2030709@gmail.com>

> diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
> -
> -#ifdef ENABLE_CHECKING
> -              verify_flow_info ();
> -#endif
> +	      checking_verify_flow_info ();

This looks misindented.

> -#ifdef ENABLE_CHECKING
>         cgraph_edge *e;
>         gcc_checking_assert (
>   	!(e = caller->get_edge (call_stmt)) || e->speculative);
> -#endif

While you're here, that would look nicer as
          gcc_checking_assert (!(e = caller->get_edge (call_stmt))
                               || e->speculative);

> -#ifdef ENABLE_CHECKING
> -  if (check_same_comdat_groups)
> +  if (CHECKING_P && check_same_comdat_groups)

flag_checking

> -#ifdef ENABLE_CHECKING
> -  struct df_rd_bb_info *bb_info = DF_RD_BB_INFO (g->bb);
> -#endif
> +  struct df_rd_bb_info *bb_info = flag_checking ? DF_RD_BB_INFO (g->bb)
> +						: NULL;

I think no need to make that conditional, that's a bit too ugly.

> +      if (CHECKING_P)
> +	sparseset_set_bit (active_defs_check, regno);

> +  if (CHECKING_P)
> +    sparseset_clear (active_defs_check);

 > -#ifdef ENABLE_CHECKING
 > -  active_defs_check = sparseset_alloc (max_reg_num ());
 > -#endif

 > +  if (CHECKING_P)
 > +    active_defs_check = sparseset_alloc (max_reg_num ());

 > +  if (CHECKING_P)
 > +    sparseset_free (active_defs_check);

flag_checking. Lots of other occurrences, I'll mention some but not all 
but please fix them for consistency.

>   void
>   sem_item_optimizer::verify_classes (void)
>   {
> -#if ENABLE_CHECKING
> +  if (!flag_checking)
> +    return;
> +

Not entirely sure whether you want to wrap this into a 
checking_verify_classes instead so that it remains easily callable by 
the debugger?

> +	  if (flag_checking)
> +	    {
> +	      for (symtab_node *n = node->same_comdat_group;
> +		   n != node;
> +		   n = n->same_comdat_group)
> +		/* If at least one of same comdat group functions is external,
> +		   all of them have to be, otherwise it is a front-end bug.  */
> +		gcc_assert (DECL_EXTERNAL (n->decl));
> +	    }

Unnecessary set of braces.

> diff --git a/gcc/lra-assigns.c b/gcc/lra-assigns.c
> index 2986f57..941a829 100644
> --- a/gcc/lra-assigns.c
> +++ b/gcc/lra-assigns.c
> @@ -1591,7 +1591,7 @@ lra_assign (void)
>     bitmap_initialize (&all_spilled_pseudos, &reg_obstack);
>     create_live_range_start_chains ();
>     setup_live_pseudos_and_spill_after_risky_transforms (&all_spilled_pseudos);
> -#ifdef ENABLE_CHECKING
> +#if CHECKING_P
>     if (!flag_ipa_ra)
>       for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
>         if (lra_reg_info[i].nrefs != 0 && reg_renumber[i] >= 0

Seems inconsistent, use flag_checking and no #if? Looks like the problem 
you're trying to solve is that a structure field exists only with 
checking, I think that could just be made available unconditionally - 
the struct is huge anyway.

As mentioned in the other mail, I see no value changing the #ifdefs to 
#ifs here or elsewhere in the patch.

> -  check_rtl (false);
> -#endif
> +  if (flag_checking)
> +    check_rtl (/*final_p=*/false);

Lose the /*final_p=*/.

> -#ifdef ENABLE_CHECKING
> +#if CHECKING_P
>   	      gcc_assert (!bitmap_bit_p (output, DECL_UID (node->decl)));
>   	      bitmap_set_bit (output, DECL_UID (node->decl));
>   #endif

Not entirely clear why this isn't using flag_checking.

>   	  tree t = (*trees)[i];
> -#ifdef ENABLE_CHECKING
> -	  if (TYPE_P (t))
> +	  if (CHECKING_P && TYPE_P (t))
>   	    verify_type (t);
> -#endif

flag_checking

> @@ -14108,7 +14102,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
>         default:
>   	break;
>         case OMP_CLAUSE_MAP:
> -#ifdef ENABLE_CHECKING
> +#if CHECKING_P
>   	/* First check what we're prepared to handle in the following.  */
>   	switch (OMP_CLAUSE_MAP_KIND (c))
>   	  {

Here too...

> -#ifdef ENABLE_CHECKING
> -static void
> +static void DEBUG_FUNCTION
>   verify_curr_properties (function *fn, void *data)

Hmm, I noticed a few cases where we lost the DEBUG_FUNCTION annotation 
and was going to comment that this is one is odd - but don't we actually 
want to keep DEBUG_FUNCTION annotations for the others as well so that 
they don't get inlined everywhere and eliminated?

> +	  if (flag_checking)
> +	    {
> +	      FOR_EACH_EDGE (e, ei, bb->preds)
> +		gcc_assert (!bitmap_bit_p (tovisit, e->src->index)
> +			    || (e->flags & EDGE_DFS_BACK));
> +	    }

Unnecessary braces.

> +  if (CHECKING_P)
> +    {
> +      for (; argno < PP_NL_ARGMAX; argno++)
> +	gcc_assert (!formatters[argno]);
> +    }

Here too. Use flag_checking.

> +  if (CHECKING_P && mode != VOIDmode)

flag_checking.

> -#ifdef ENABLE_CHECKING
>   static void
>   validate_value_data (struct value_data *vd)
>   {
> +  if (!flag_checking)
> +    return;

Same thought as before, it might be better to have this check in the 
callers for easier use from the debugger.

> -#endif
> -
>
> +

Don't change the whitespace here. Looks like you probably removed a page 
break.

>
> -#ifdef ENABLE_CHECKING
> +#if CHECKING_P
>     /* This is initialized to the insn on which the driver stopped its traversal.  */
>     insn_t failed_insn;
>   #endif

I think here it would also be reasonable to make the field (and its 
initializations) unconditional and use flag_checking for the code using it.

> -#ifdef ENABLE_CHECKING
> -  {
> -    edge e;
> -    edge_iterator ei;
> +/* FIXME: (PR 67842) this check is incorrect.  dominated_by_p has no effect,
> +   but changing it to gcc_assert (dominated_by_p (...)) causes regressions,
> +   e.g., gcc.dg/graphite/block-1.c.  */
> +#if 0

This change should probably be submitted separately, people are more 
likely to see it than if it's buried in a sea of cosmetic changes.

> +      if (flag_checking)
> +	{
> +	  /* last_set_in should now be all-zero.  */
> +	  for (unsigned regno = 0; regno < max_gcse_regno; regno++)
> +	    gcc_assert (!last_set_in[regno]);
> +	}

Braces.
> @@ -211,9 +211,9 @@ pack_cumulative_args (CUMULATIVE_ARGS *arg)
>   {
>     cumulative_args_t ret;
>
> -#ifdef ENABLE_CHECKING
> +#if CHECKING_P
>     ret.magic = CUMULATIVE_ARGS_MAGIC;
> -#endif /* ENABLE_CHECKING */
> +#endif /* CHECKING_P */

In this case I think it's ok to keep using conditional compilation as 
you're doing, since the extra magic field in cumulative_args_t looks 
like it would be expensive. (Not that we're spending a huge amount of 
time computing arg layout, but still...)

>
>   static void
> -rewrite_trees (var_map map ATTRIBUTE_UNUSED)
> +rewrite_trees (var_map map)
>   {
> -#ifdef ENABLE_CHECKING
> +  if (!flag_checking)
> +    return;

Bit of an odd name for a function that only does verification. It was 
considerably bigger in 4.2 at least, so maybe it ought to be renamed at 
this point.

> -	enum ref_step_type a_step;
> -	ok = suitable_reference_p (a->ref, &a_step);
> -	gcc_assert (ok && a_step == comp->comp_step);
> -      }
> -#endif
> +      enum ref_step_type a_step;
> +      gcc_checking_assert (suitable_reference_p (a->ref, &a_step)
> +			   && a_step == comp->comp_step);

I think we're supposed to stop saying things like "enum" or "struct". If 
you really want, you can go through the places you're changing and 
modifying them so that they're changed only once. But it's not a 
requirement.

> diff --git a/gcc/tree-stdarg.c b/gcc/tree-stdarg.c
> index 3e6d98c..0ed107c 100644
> --- a/gcc/tree-stdarg.c
> +++ b/gcc/tree-stdarg.c
> @@ -1107,13 +1107,14 @@ expand_ifn_va_arg (function *fun)
>     if ((fun->curr_properties & PROP_gimple_lva) == 0)
>       expand_ifn_va_arg_1 (fun);
>
> -#if ENABLE_CHECKING
> +  if (!flag_checking)
> +    return;
> +
>     basic_block bb;
>     gimple_stmt_iterator i;
>     FOR_EACH_BB_FN (bb, fun)
>       for (i = gsi_start_bb (bb); !gsi_end_p (i); gsi_next (&i))
>         gcc_assert (!gimple_call_ifn_va_arg_p (gsi_stmt (i)));
> -#endif


I think this would be better wrapped in an "if (flag_checking)", someone 
might want to append to the function at some point.


Bernd

  reply	other threads:[~2015-10-19 12:13 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-05 23:27 [PATCH 1/9] ENABLE_CHECKING refactoring Mikhail Maltsev
2015-10-05 23:29 ` [PATCH 2/9] ENABLE_CHECKING refactoring: libcpp Mikhail Maltsev
2015-10-06 12:40   ` Bernd Schmidt
2015-10-12 20:57     ` Jeff Law
2015-10-19  1:18       ` Mikhail Maltsev
2015-10-21 22:29         ` Jeff Law
2015-10-21 21:19     ` Jeff Law
2015-10-05 23:30 ` [PATCH 3/9] ENABLE_CHECKING refactoring: Java and Ada Mikhail Maltsev
2015-10-22 19:25   ` Jeff Law
2015-10-05 23:31 ` [PATCH 4/9] ENABLE_CHECKING refactoring: Fortran Mikhail Maltsev
2015-10-23 22:38   ` Jeff Law
2015-10-05 23:32 ` [PATCH 5/9] ENABLE_CHECKING refactoring: pool allocators Mikhail Maltsev
2015-10-06 12:41   ` Bernd Schmidt
2015-10-06 12:45     ` Richard Biener
2015-10-19  0:47       ` Mikhail Maltsev
2015-10-21 11:02         ` Richard Biener
2015-10-26  2:07           ` Mikhail Maltsev
2015-10-26  9:48             ` Richard Biener
2015-10-26 10:57               ` Mikhail Maltsev
2015-10-05 23:34 ` [PATCH 6/9] ENABLE_CHECKING refactoring: generators Mikhail Maltsev
2015-10-06 12:57   ` Richard Biener
2015-10-19  0:09     ` Mikhail Maltsev
2015-10-21 10:57       ` Richard Biener
2015-10-28 16:32         ` Jeff Law
2015-10-29 16:31       ` Jeff Law
2015-10-05 23:39 ` [PATCH 7/9] ENABLE_CHECKING refactoring: middle-end, LTO FE Mikhail Maltsev
2015-10-06 12:46   ` Bernd Schmidt
2015-10-06 12:59     ` Richard Biener
2015-10-06 12:59     ` Richard Biener
2015-10-19  0:56       ` Mikhail Maltsev
2015-10-19 12:19         ` Bernd Schmidt [this message]
2015-10-26 17:04           ` Jeff Law
2015-10-26 17:15             ` Bernd Schmidt
2015-10-26 19:05               ` Jeff Law
2015-10-28  1:17                 ` Jeff Law
2015-10-28  2:12                   ` Trevor Saunders
2015-10-05 23:40 ` [PATCH 8/9] ENABLE_CHECKING refactoring: target-specific parts Mikhail Maltsev
2015-10-06 12:48   ` Bernd Schmidt
2015-10-29 19:43     ` Jeff Law
2015-10-29 21:23   ` Jeff Law
2015-10-30  4:13   ` Jeff Law
2015-10-30  4:20     ` Jeff Law
2015-10-06 12:53 ` [PATCH 1/9] ENABLE_CHECKING refactoring Richard Biener
2015-10-12 20:48 ` Jeff Law
2015-10-13 21:33 ` Jeff Law
2015-10-18  8:25   ` Mikhail Maltsev
2015-10-19 11:14     ` Bernd Schmidt
2015-10-19 13:54       ` Mikhail Maltsev
2015-10-21 15:59         ` Jeff Law
2015-10-21 16:06           ` Bernd Schmidt
2015-10-21 16:18             ` Richard Biener
2015-10-21 16:28               ` Jeff Law
2015-11-07 22:42                 ` Gerald Pfeifer
2015-10-21 16:19             ` Jeff Law
2015-10-21 16:22               ` Bernd Schmidt
2015-10-21 16:44                 ` Jakub Jelinek
2015-10-22  7:58                   ` Richard Biener
2015-10-21 20:06                 ` Jeff Law
2015-10-20 16:14     ` Jeff Law
2015-10-21 21:17     ` Jeff Law
2015-11-01 14:58 ` [PATCH 9/9] ENABLE_CHECKING refactoring: C family front ends Mikhail Maltsev
2015-11-02 23:34   ` Jeff Law
2015-11-04 14:41     ` Mikhail Maltsev
2015-11-01 20:19 ` [PATCH 10/9] ENABLE_CHECKING refactoring: remove remaining occurrences Mikhail Maltsev
2015-11-02 23:35   ` Jeff Law
2015-11-04 15:03     ` Mikhail Maltsev
2016-02-23 15:21       ` Richard Biener
2016-02-24 14:17         ` Martin Liška
2016-02-24 14:27           ` Michael Matz
2016-02-24 14:53             ` Martin Liška
2016-02-24 15:43               ` Pierre-Marie de Rodat
2016-02-25  9:24                 ` Richard Biener
2016-02-25 10:14                   ` Pierre-Marie de Rodat
2016-02-25 10:15                     ` Martin Liška
2016-02-25 10:16                       ` Pierre-Marie de Rodat
2016-02-25  9:24           ` Richard Biener
     [not found]   ` <C5BB0125-FB5F-46C6-B16D-74C3D0F07C10@gmail.com>
2015-11-08 15:37     ` Mikhail Maltsev

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=5624DE4E.6090106@redhat.com \
    --to=bschmidt@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=maltsevm@gmail.com \
    --cc=richard.guenther@gmail.com \
    /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).