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

            Bug ID: 119852
           Summary: The output of -fdump-ipa-clones can contain "(null)"
                    as the suffix/reason for cloning
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jamborm at gcc dot gnu.org
                CC: hubicka at gcc dot gnu.org
  Target Milestone: ---

The output of -fdump-ipa-clones can contain "(null)" as the
suffix/reason for cloning, for example when compiling our own testcase
testsuite/gcc.dg/ipa/pr58106.c:

~/gcc/trunk/inst/bin/gcc -O3 -S -fdump-ipa-clones
~/gcc/trunk/src/gcc/testsuite/gcc.dg/ipa/pr58106.c

the generated file contains entries:

Callgraph
clone;for_each_rtx_1.isra.0;1;/home/mjambor/gcc/trunk/src/gcc/testsuite/gcc.dg/ipa/pr58106.c;28;1;for_each_rtx_1.isra.0;1;/home/mjambor/gcc/trunk/src/gcc/testsuite/gcc.dg/ipa/pr58106.c;28;1;(null)
Callgraph
clone;for_each_rtx_1.constprop.0.isra.0;1;/home/mjambor/gcc/trunk/src/gcc/testsuite/gcc.dg/ipa/pr58106.c;28;1;for_each_rtx_1.constprop.0.isra.0;1;/home/mjambor/gcc/trunk/src/gcc/testsuite/gcc.dg/ipa/pr58106.c;28;1;(null)

These are apparently results of the following snippet from function
recursive_inlining in ipa-inline.c:

  /* We need original clone to copy around.  */
  master_clone = node->create_clone (node->decl, node->count,
    false, vNULL, true, NULL, NULL);

I guess in this case we should simply not output any record of the
clone used for copying stuff.  However there is one more invocation of
create_clone with both parameters new_inlined_to and suffix set to
NULL which could lead to the same result in function input_node in
lto-cgraph.cc:

  clone_ref = streamer_read_hwi (ib);
  bool has_thunk_info;

  fn_decl = lto_input_fn_decl_ref (ib, file_data);

  if (clone_ref != LCC_NOT_FOUND)
    {
      node = dyn_cast<cgraph_node *> (nodes[clone_ref])->create_clone (fn_decl,
        profile_count::uninitialized (), false,
        vNULL, false, NULL, NULL);
    }

Because of -fdump-ipa-clones, I'd also argue that the suffix parameter
of create_clone should not default to NULL too.

Reply via email to