public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump
@ 2021-03-10 17:10 acoplan at gcc dot gnu.org
  2021-03-11  8:27 ` [Bug tree-optimization/99523] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-03-10 17:10 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99523

            Bug ID: 99523
           Summary: Declarations for variable names missing in GIMPLE dump
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: acoplan at gcc dot gnu.org
  Target Milestone: ---

For the following testcase:

int f(__builtin_va_list *ap) { return __builtin_va_arg(*ap, int); }

on AArch64 at -O2 with -fdump-tree-optimized=-, we get:

;; Function f (f, funcdef_no=0, decl_uid=3583, cgraph_uid=1, symbol_order=0)

f (struct  * ap)
{
  int D.3591;
  void * D.3592;
  int * iftmp.2;
  sizetype D.3596;
  sizetype D.3597;
  sizetype D.3598;
  void * D.3599;
  int D.3601;
  int * iftmp.3;
  void * D.3607;
  sizetype D.3608;
  int _4;

  <bb 2> [local count: 1073741824]:
  _9 = ap_2(D)->__gr_offs;
  _10 = ap_2(D)->__stack;
  if (_9 >= 0)
    goto <bb 3>; [59.00%]
  else
    goto <bb 4>; [41.00%]

where the variables _9 and _10 are apparently missing declarations in the IR
dump. I believe the variables came from calls to get_initialized_tmp_var in
aarch64_gimplify_va_arg_expr.

Not sure if this is some missing bookkeeping around the gimplification or
perhaps a bug in the dumping code?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/99523] Declarations for variable names missing in GIMPLE dump
  2021-03-10 17:10 [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump acoplan at gcc dot gnu.org
@ 2021-03-11  8:27 ` rguenth at gcc dot gnu.org
  2021-03-11  9:13 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-11  8:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99523

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
They are there, it's the

  sizetype D.3596;
  sizetype D.3597;
  sizetype D.3598;
  void * D.3599;
  int D.3601;

etc. variables, but they are DECL_IGNORED (they have no "name") and so
dumping which does

    case SSA_NAME:
      if (SSA_NAME_IDENTIFIER (node))
        {
          if ((flags & TDF_NOUID)
              && SSA_NAME_VAR (node)
              && DECL_NAMELESS (SSA_NAME_VAR (node)))
            dump_fancy_name (pp, SSA_NAME_IDENTIFIER (node));
          else if (! (flags & TDF_GIMPLE)
                   || SSA_NAME_VAR (node))
            dump_generic_node (pp, SSA_NAME_IDENTIFIER (node),
                               spc, flags, false);
        }
      pp_underscore (pp);
      pp_decimal_int (pp, SSA_NAME_VERSION (node));
      if (SSA_NAME_IS_DEFAULT_DEF (node))
        pp_string (pp, "(D)");
      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
        pp_string (pp, "(ab)");
      break;

sees a NULL SSA_NAME_IDENTIFIER.

I suppose

diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index d04ce212561..4e40b7c0155 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -8155,7 +8155,7 @@ dump_function_to_file (tree fndecl, FILE *file,
dump_flags_t flags)
       if (gimple_in_ssa_p (cfun))
        FOR_EACH_SSA_NAME (ix, name, cfun)
          {
-           if (!SSA_NAME_VAR (name))
+           if (!SSA_NAME_IDENTIFIER (name))
              {
                fprintf (file, "  ");
                print_generic_expr (file, TREE_TYPE (name), flags);

would display them similar to anonymous SSA names (but then the dumped
decls above are redundant and useless).

The testcase shows the same on x86_64 btw.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/99523] Declarations for variable names missing in GIMPLE dump
  2021-03-10 17:10 [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump acoplan at gcc dot gnu.org
  2021-03-11  8:27 ` [Bug tree-optimization/99523] " rguenth at gcc dot gnu.org
@ 2021-03-11  9:13 ` rguenth at gcc dot gnu.org
  2021-03-11 11:36 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-11  9:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99523

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2021-03-11

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Going to test this.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/99523] Declarations for variable names missing in GIMPLE dump
  2021-03-10 17:10 [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump acoplan at gcc dot gnu.org
  2021-03-11  8:27 ` [Bug tree-optimization/99523] " rguenth at gcc dot gnu.org
  2021-03-11  9:13 ` rguenth at gcc dot gnu.org
@ 2021-03-11 11:36 ` cvs-commit at gcc dot gnu.org
  2021-03-11 11:38 ` rguenth at gcc dot gnu.org
  2021-03-11 12:07 ` acoplan at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-11 11:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99523

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:b08c978f2e18507cbd9853305185665edf05c598

commit r11-7619-gb08c978f2e18507cbd9853305185665edf05c598
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Mar 11 10:09:43 2021 +0100

    tree-optimization/99523 - missing SSA decls in dumps

    This makes sure to dump SSA names without identifier in the
    declaration part of a function dump.  While we dump the
    anonymous variable decls the SSA names referencing them appear
    without a clear reference as to what anonymous variable is used
    (_3 vs. D.1234).

    2021-03-11  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/99523
            * tree-cfg.c (dump_function_to_file): Dump SSA names
            w/o identifier to the decls section as well, not only those
            without a VAR_DECL.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/99523] Declarations for variable names missing in GIMPLE dump
  2021-03-10 17:10 [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump acoplan at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-11 11:36 ` cvs-commit at gcc dot gnu.org
@ 2021-03-11 11:38 ` rguenth at gcc dot gnu.org
  2021-03-11 12:07 ` acoplan at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-11 11:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99523

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug tree-optimization/99523] Declarations for variable names missing in GIMPLE dump
  2021-03-10 17:10 [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump acoplan at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-03-11 11:38 ` rguenth at gcc dot gnu.org
@ 2021-03-11 12:07 ` acoplan at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-03-11 12:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99523

--- Comment #5 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Thanks for the fix!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-11 12:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 17:10 [Bug tree-optimization/99523] New: Declarations for variable names missing in GIMPLE dump acoplan at gcc dot gnu.org
2021-03-11  8:27 ` [Bug tree-optimization/99523] " rguenth at gcc dot gnu.org
2021-03-11  9:13 ` rguenth at gcc dot gnu.org
2021-03-11 11:36 ` cvs-commit at gcc dot gnu.org
2021-03-11 11:38 ` rguenth at gcc dot gnu.org
2021-03-11 12:07 ` acoplan at gcc dot gnu.org

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).