From: Jonas Hansen <[email protected]>

With -ftrivial-auto-var-init, an anonymous temporary can be initialized
by an SSA name defined by .DEFERRED_INIT.  Inlining gives the destination
declaration a new DECL_UID while the call retains the original D.N name.
warn_uninit then fails to recognize the artificial initialization store
and diagnoses it as an uninitialized read.

Remap the anonymous variable name when copying .DEFERRED_INIT calls,
using the declaration mapping for the copied body.  Build a UID lookup
lazily and release it after copying the body.  This also handles function
cloning and repeated inlining without changing warn_uninit.

Document the operands and semantics of .DEFERRED_INIT, including the
AUTO_INIT_CXX26 bit and the anonymous variable identity.  Add tests for
zero and pattern initialization with sanitizers, repeated inlining
without sanitizers, and IPA constant-propagation cloning.

gcc/ChangeLog:

        PR middle-end/124380
        * tree-inline.h (copy_body_data): Add deferred_init_map.
        * tree-inline.cc (remap_deferred_init): New function.
        (copy_bb): Remap anonymous variable names in .DEFERRED_INIT calls.
        (copy_cfg_body): Release deferred_init_map.
        * doc/ifn.texi (IFN_DEFERRED_INIT): Document operands and semantics.

gcc/testsuite/ChangeLog:

        PR middle-end/124380
        * g++.dg/asan/auto-init-uninit-1.C: New test.
        * g++.dg/asan/auto-init-uninit-2.C: New test.
        * g++.dg/asan/auto-init-uninit-3.C: New test.
        * g++.dg/uninit-pr124380.C: New test.

Signed-off-by: Jonas Hansen <[email protected]>
---
Fixes the reported non-LTO reproductions of [PR 
middle-end/124380](https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124380).

Inlining changes an anonymous temporary's declaration UID while its 
`.DEFERRED_INIT` call retains the original `D.N` name. The warning pass then 
mistakes the artificial initialization store for an
uninitialized read.

Update the recorded name when copying the call, using the copied declaration's 
UID. This handles repeated inlining and function cloning. Build the UID lookup 
lazily once per copied body.

Changes since v1:

- Move the repair into body copying and remove the `DECL_ORIGIN` fallback from 
`warn_uninit`, as suggested by Richard Biener.
- Document `.DEFERRED_INIT` operands and semantics in `ifn.texi`.
- Retain the zero/pattern ASan+UBSan tests and add tests for repeated inlining 
without sanitizers and IPA cloning.

Validation on x86_64-pc-linux-gnu:

- C/C++ compiler build, front-end self-tests, and GCC internals manual build 
passed.
- Targeted warning, auto-init, inlining, IPA, ASan and UBSan tests: 3,611 
expected passes, 30 expected failures, 17 unsupported tests, and no unexpected 
results.
- The new regression tests produce 21 failure-to-pass results.
- Genuine uninitialized warnings remain, and assembly is identical across 192 
configurations covering optimization levels, initialization modes, sanitizers, 
debug settings and 32/64-bit code.
- Numeric assembly comparisons at `-O2` and `-Os`, with and without sanitizers, 
are also identical.

The separate LTO UID-renumbering problem remains: recorded names are not 
rewritten during LTO streaming. Existing false warnings can now repeat for each 
copied initialization. All 32 tested LTO
compile-and-link pipelines completed, and additional valid-code checks found no 
previously clean case gaining a warning.

A complete bootstrap and full GCC testsuite run were not performed.



This is a forge pull request published on the gcc-patches mailing list mailing 
list
as requested by Jonas Hansen via Sourceware Forge 
<[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/252

Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/252/*:refs/versioned_pull/252/*"
git switch -c "pr-252-v2" "refs/versioned_pull/252/2/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/252.diff
Created on: 2026-10-22 05:19:48+00:00
Latest update: 2026-10-23 16:10:28+00:00
Changes: 7 changed files, 166 additions, 2 deletions
Head revision: hrjonashansen/gcc ref fix-uninit-inlined-temporary commit 
1a4cf66d552c55f1b1115e899fd9d69265e3a235 
Base revision: gcc/gcc ref trunk commit 
2d1f1bc18a59c0f106c551304ac459ad7781a711 r17-5299-g2d1f1bc18a59c0
Merge base: 2d1f1bc18a59c0f106c551304ac459ad7781a711
Requested Reviewers: RichardBiener, pinskia

Changed files:
- A: gcc/testsuite/g++.dg/asan/auto-init-uninit-1.C
- A: gcc/testsuite/g++.dg/asan/auto-init-uninit-2.C
- A: gcc/testsuite/g++.dg/asan/auto-init-uninit-3.C
- A: gcc/testsuite/g++.dg/uninit-pr124380.C
- M: gcc/doc/ifn.texi
- M: gcc/tree-inline.cc
- M: gcc/tree-inline.h

 gcc/doc/ifn.texi                              | 29 +++++++++-
 .../g++.dg/asan/auto-init-uninit-1.C          | 24 +++++++++
 .../g++.dg/asan/auto-init-uninit-2.C          |  4 ++
 .../g++.dg/asan/auto-init-uninit-3.C          | 26 +++++++++
 gcc/testsuite/g++.dg/uninit-pr124380.C        | 27 ++++++++++
 gcc/tree-inline.cc                            | 54 +++++++++++++++++++
 gcc/tree-inline.h                             |  4 ++
 7 files changed, 166 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/asan/auto-init-uninit-1.C
 create mode 100644 gcc/testsuite/g++.dg/asan/auto-init-uninit-2.C
 create mode 100644 gcc/testsuite/g++.dg/asan/auto-init-uninit-3.C
 create mode 100644 gcc/testsuite/g++.dg/uninit-pr124380.C

diff --git a/gcc/doc/ifn.texi b/gcc/doc/ifn.texi
index d80e089685a3c..8232408d99d05 100644
--- a/gcc/doc/ifn.texi
+++ b/gcc/doc/ifn.texi
@@ -1389,8 +1389,33 @@ lowered to PHI nodes.
 
 @cindex @code{IFN_DEFERRED_INIT} internal function
 @item @samp{IFN_DEFERRED_INIT}
-The @code{IFN_DEFERRED_INIT} internal function is expanded by the
-@code{expand_DEFERRED_INIT} function.
+@smallexample
+@var{lhs} = .DEFERRED_INIT (@var{size}, @var{init_type}, @var{name})
+@end smallexample
+
+Represent deferred initialization of an automatic variable for
+@option{-ftrivial-auto-var-init} or C++26.  @var{size} is the size of the
+variable in bytes.  @var{init_type} is an integer constant encoding an
+@code{auto_init_type}.  After masking out @code{AUTO_INIT_CXX26} (4),
+@code{AUTO_INIT_PATTERN} (1) requests a repeated @code{0xFE} byte pattern.
+@code{AUTO_INIT_ZERO} (2), or zero with @code{AUTO_INIT_CXX26} set,
+requests zero initialization.  Boolean scalars that fit in registers are
+always initialized to zero.  Padding is initialized as well.  The call
+is expanded by @code{expand_DEFERRED_INIT}.
+
+The @code{AUTO_INIT_CXX26} bit requires all uses of the result to have the
+same value.  Without this bit, optimizers can treat the result as
+undefined.
+
+The initialized value is still treated as uninitialized by the
+@option{-Wuninitialized} and @option{-Wmaybe-uninitialized} diagnostics.
+@var{name} points to a string literal identifying the original variable.
+For a named variable this is its declaration name.  For an anonymous
+variable it is @samp{D.} followed by the decimal @code{DECL_UID}.
+This identifies the artificial initialization store so that it does not
+itself trigger an uninitialized warning.  When a declaration is copied
+during inlining or function cloning, the recorded UID is updated to
+refer to the copied declaration.
 
 @cindex @code{IFN_ACCESS_WITH_SIZE} internal function
 @item @samp{IFN_ACCESS_WITH_SIZE}
diff --git a/gcc/testsuite/g++.dg/asan/auto-init-uninit-1.C 
b/gcc/testsuite/g++.dg/asan/auto-init-uninit-1.C
new file mode 100644
index 0000000000000..5585558f63674
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/auto-init-uninit-1.C
@@ -0,0 +1,24 @@
+// { dg-do compile { target c++14 } }
+// { dg-options "-O2 -Wuninitialized -fsanitize=undefined 
-ftrivial-auto-var-init=zero" }
+
+template <typename T>
+const T &
+max (const T &a, const T &b)
+{
+  return a < b ? b : a;
+}
+
+template <typename A, typename B>
+auto
+max_mixed (const A &a, const B &b)
+{
+  const unsigned long &x = a;
+  const unsigned long &y = b;
+  return max (x, y);
+}
+
+unsigned long
+f (unsigned long a)
+{
+  return max_mixed (a, 1);
+}
diff --git a/gcc/testsuite/g++.dg/asan/auto-init-uninit-2.C 
b/gcc/testsuite/g++.dg/asan/auto-init-uninit-2.C
new file mode 100644
index 0000000000000..b0ce10863824f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/auto-init-uninit-2.C
@@ -0,0 +1,4 @@
+// { dg-do compile { target c++14 } }
+// { dg-options "-O2 -Wuninitialized -fsanitize=undefined 
-ftrivial-auto-var-init=pattern" }
+
+#include "auto-init-uninit-1.C"
diff --git a/gcc/testsuite/g++.dg/asan/auto-init-uninit-3.C 
b/gcc/testsuite/g++.dg/asan/auto-init-uninit-3.C
new file mode 100644
index 0000000000000..f83a4766b3e7e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/asan/auto-init-uninit-3.C
@@ -0,0 +1,26 @@
+// PR middle-end/124380
+// { dg-do compile }
+// { dg-options "-O3 -Wuninitialized -fsanitize=undefined 
-ftrivial-auto-var-init=zero -fipa-cp-clone --param=ipa-cp-eval-threshold=0 
-fno-early-inlining" }
+
+int get ();
+void sink (const int &);
+
+static __attribute__((noinline)) int
+body (int selector, int value)
+{
+  const int &temporary = get ();
+  sink (temporary);
+  return selector ? value + 1 : value - 1;
+}
+
+int
+caller_a (int value)
+{
+  return body (0, value);
+}
+
+int
+caller_b (int value)
+{
+  return body (1, value);
+}
diff --git a/gcc/testsuite/g++.dg/uninit-pr124380.C 
b/gcc/testsuite/g++.dg/uninit-pr124380.C
new file mode 100644
index 0000000000000..a3bec28fc30a5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/uninit-pr124380.C
@@ -0,0 +1,27 @@
+// PR middle-end/124380
+// { dg-do compile }
+// { dg-options "-O1 -Wuninitialized -ftrivial-auto-var-init=zero" }
+
+int get ();
+void sink (const int &);
+
+inline __attribute__((always_inline)) void
+two ()
+{
+  const int &result = get ();
+  sink (result);
+}
+
+inline __attribute__((always_inline)) void
+three ()
+{
+  two ();
+  two ();
+}
+
+void
+one ()
+{
+  two ();
+  three ();
+}
diff --git a/gcc/tree-inline.cc b/gcc/tree-inline.cc
index 8162b1f5051a8..17bca6c06cf95 100644
--- a/gcc/tree-inline.cc
+++ b/gcc/tree-inline.cc
@@ -2049,6 +2049,52 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
 }
 
 
+/* Update the anonymous variable name in CALL to refer to the copied
+   declaration in ID.  */
+
+static void
+remap_deferred_init (gcall *call, copy_body_data *id)
+{
+  tree name = gimple_call_arg (call, 2);
+  name = TREE_OPERAND (TREE_OPERAND (name, 0), 0);
+  const char *name_str = TREE_STRING_POINTER (name);
+  if (strncmp (name_str, "D.", 2) != 0 || !ISDIGIT (name_str[2]))
+    return;
+
+  char *end;
+  unsigned long uid = strtoul (name_str + 2, &end, 10);
+  if (*end || uid > UINT_MAX)
+    return;
+
+  if (!id->deferred_init_map)
+    {
+      /* Build this map once per body copy, rather than searching all
+        local declarations for each .DEFERRED_INIT call.  */
+      id->deferred_init_map = new hash_map<int_hash<unsigned, -1U>, tree>;
+      tree var;
+      unsigned int i;
+      FOR_EACH_LOCAL_DECL (id->src_cfun, i, var)
+       if (VAR_P (var) && !DECL_NAME (var))
+         if (tree *new_var = id->decl_map->get (var))
+           if (VAR_P (*new_var))
+             id->deferred_init_map->put (DECL_UID (var), *new_var);
+    }
+
+  if (tree *var = id->deferred_init_map->get (uid))
+    {
+      tree new_name;
+      if (DECL_NAME (*var))
+       new_name = build_string_literal (DECL_NAME (*var));
+      else
+       {
+         char buf[3 + (HOST_BITS_PER_INT + 2) / 3];
+         sprintf (buf, "D.%u", DECL_UID (*var));
+         new_name = build_string_literal (buf);
+       }
+      gimple_call_set_arg (call, 2, new_name);
+    }
+}
+
 /* Copy basic block, scale profile accordingly.  Edges will be taken care of
    later  */
 
@@ -2107,6 +2153,9 @@ copy_bb (copy_body_data *id, basic_block bb,
        {
          stmt = gsi_stmt (stmts_gsi);
 
+         if (gimple_call_internal_p (stmt, IFN_DEFERRED_INIT))
+           remap_deferred_init (as_a <gcall *> (stmt), id);
+
          /* Advance iterator now before stmt is moved to seq_gsi.  */
          gsi_next (&stmts_gsi);
 
@@ -3254,6 +3303,11 @@ copy_cfg_body (copy_body_data * id,
       delete id->dependence_map;
       id->dependence_map = NULL;
     }
+  if (id->deferred_init_map)
+    {
+      delete id->deferred_init_map;
+      id->deferred_init_map = NULL;
+    }
 
   return new_fndecl;
 }
diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h
index aeedab0c26fd9..f435c9ed3cca9 100644
--- a/gcc/tree-inline.h
+++ b/gcc/tree-inline.h
@@ -156,6 +156,10 @@ struct copy_body_data
      equivalents in the function into which it is being inlined.  */
   hash_map<dependence_hash, unsigned short> *dependence_map;
 
+  /* Map anonymous variable UIDs to remapped declarations for
+     .DEFERRED_INIT calls.  */
+  hash_map<int_hash<unsigned, -1U>, tree> *deferred_init_map;
+
   /* A list of addressable local variables remapped into the caller
      when inlining a call within an OpenMP SIMD-on-SIMT loop.  */
   vec<tree> *dst_simt_vars;

Range-diff against v1:
1:  060a44135bea8 ! 1:  1a4cf66d552c5 tree-ssa: Avoid false uninitialized 
warnings after inlining [PR124380]
    @@ Metadata
     Author: Jonas Hansen <[email protected]>
     
      ## Commit message ##
    -    tree-ssa: Avoid false uninitialized warnings after inlining [PR124380]
    +    tree-inline: Update deferred initialization names when copying bodies 
[PR124380]
     
         With -ftrivial-auto-var-init, an anonymous temporary can be initialized
         by an SSA name defined by .DEFERRED_INIT.  Inlining gives the 
destination
         declaration a new DECL_UID while the call retains the original D.N 
name.
         warn_uninit then fails to recognize the artificial initialization store
    -    and diagnoses it as an uninitialized read.  This occurs, for example,
    -    with a reference bound to a conversion temporary when ASan, UBSan and
    -    -ftrivial-auto-var-init=zero are enabled.
    +    and diagnoses it as an uninitialized read.
     
    -    Keep the existing current-UID comparison and also check DECL_ORIGIN 
when
    -    recognizing this artificial store.  Add regression tests for zero and
    -    pattern initialization.
    +    Remap the anonymous variable name when copying .DEFERRED_INIT calls,
    +    using the declaration mapping for the copied body.  Build a UID lookup
    +    lazily and release it after copying the body.  This also handles 
function
    +    cloning and repeated inlining without changing warn_uninit.
    +
    +    Document the operands and semantics of .DEFERRED_INIT, including the
    +    AUTO_INIT_CXX26 bit and the anonymous variable identity.  Add tests for
    +    zero and pattern initialization with sanitizers, repeated inlining
    +    without sanitizers, and IPA constant-propagation cloning.
     
         gcc/ChangeLog:
     
                 PR middle-end/124380
    -            * tree-ssa-uninit.cc (warn_uninit): Also match the original
    -            declaration's UID when recognizing the artificial 
initialization
    -            of an anonymous variable after inlining.
    +            * tree-inline.h (copy_body_data): Add deferred_init_map.
    +            * tree-inline.cc (remap_deferred_init): New function.
    +            (copy_bb): Remap anonymous variable names in .DEFERRED_INIT 
calls.
    +            (copy_cfg_body): Release deferred_init_map.
    +            * doc/ifn.texi (IFN_DEFERRED_INIT): Document operands and 
semantics.
     
         gcc/testsuite/ChangeLog:
     
                 PR middle-end/124380
                 * g++.dg/asan/auto-init-uninit-1.C: New test.
                 * g++.dg/asan/auto-init-uninit-2.C: New test.
    +            * g++.dg/asan/auto-init-uninit-3.C: New test.
    +            * g++.dg/uninit-pr124380.C: New test.
     
         Signed-off-by: Jonas Hansen <[email protected]>
     
    + ## gcc/doc/ifn.texi ##
    +@@ gcc/doc/ifn.texi: lowered to PHI nodes.
    + 
    + @cindex @code{IFN_DEFERRED_INIT} internal function
    + @item @samp{IFN_DEFERRED_INIT}
    +-The @code{IFN_DEFERRED_INIT} internal function is expanded by the
    +-@code{expand_DEFERRED_INIT} function.
    ++@smallexample
    ++@var{lhs} = .DEFERRED_INIT (@var{size}, @var{init_type}, @var{name})
    ++@end smallexample
    ++
    ++Represent deferred initialization of an automatic variable for
    ++@option{-ftrivial-auto-var-init} or C++26.  @var{size} is the size of the
    ++variable in bytes.  @var{init_type} is an integer constant encoding an
    ++@code{auto_init_type}.  After masking out @code{AUTO_INIT_CXX26} (4),
    ++@code{AUTO_INIT_PATTERN} (1) requests a repeated @code{0xFE} byte pattern.
    ++@code{AUTO_INIT_ZERO} (2), or zero with @code{AUTO_INIT_CXX26} set,
    ++requests zero initialization.  Boolean scalars that fit in registers are
    ++always initialized to zero.  Padding is initialized as well.  The call
    ++is expanded by @code{expand_DEFERRED_INIT}.
    ++
    ++The @code{AUTO_INIT_CXX26} bit requires all uses of the result to have the
    ++same value.  Without this bit, optimizers can treat the result as
    ++undefined.
    ++
    ++The initialized value is still treated as uninitialized by the
    ++@option{-Wuninitialized} and @option{-Wmaybe-uninitialized} diagnostics.
    ++@var{name} points to a string literal identifying the original variable.
    ++For a named variable this is its declaration name.  For an anonymous
    ++variable it is @samp{D.} followed by the decimal @code{DECL_UID}.
    ++This identifies the artificial initialization store so that it does not
    ++itself trigger an uninitialized warning.  When a declaration is copied
    ++during inlining or function cloning, the recorded UID is updated to
    ++refer to the copied declaration.
    + 
    + @cindex @code{IFN_ACCESS_WITH_SIZE} internal function
    + @item @samp{IFN_ACCESS_WITH_SIZE}
    +
      ## gcc/testsuite/g++.dg/asan/auto-init-uninit-1.C (new) ##
     @@
     +// { dg-do compile { target c++14 } }
    @@ gcc/testsuite/g++.dg/asan/auto-init-uninit-2.C (new)
     +
     +#include "auto-init-uninit-1.C"
     
    - ## gcc/tree-ssa-uninit.cc ##
    -@@ gcc/tree-ssa-uninit.cc: warn_uninit (opt_code opt, tree t, tree var, 
gimple *context,
    -           {
    -             char lhs_var_name_str_buf[3 + (HOST_BITS_PER_INT + 2) / 3];
    -             sprintf (lhs_var_name_str_buf, "D.%u", DECL_UID (lhs_var));
    -+            /* Inlining changes DECL_UID, but not the name recorded in
    -+               the DEFERRED_INIT call.  Also check the original decl.  */
    -+            if (strcmp (lhs_var_name_str_buf, var_name_str) != 0)
    -+              sprintf (lhs_var_name_str_buf, "D.%u",
    -+                       DECL_UID (DECL_ORIGIN (lhs_var)));
    -             if (strcmp (lhs_var_name_str_buf, var_name_str) == 0)
    -               return;
    -           }
    + ## gcc/testsuite/g++.dg/asan/auto-init-uninit-3.C (new) ##
    +@@
    ++// PR middle-end/124380
    ++// { dg-do compile }
    ++// { dg-options "-O3 -Wuninitialized -fsanitize=undefined 
-ftrivial-auto-var-init=zero -fipa-cp-clone --param=ipa-cp-eval-threshold=0 
-fno-early-inlining" }
    ++
    ++int get ();
    ++void sink (const int &);
    ++
    ++static __attribute__((noinline)) int
    ++body (int selector, int value)
    ++{
    ++  const int &temporary = get ();
    ++  sink (temporary);
    ++  return selector ? value + 1 : value - 1;
    ++}
    ++
    ++int
    ++caller_a (int value)
    ++{
    ++  return body (0, value);
    ++}
    ++
    ++int
    ++caller_b (int value)
    ++{
    ++  return body (1, value);
    ++}
    +
    + ## gcc/testsuite/g++.dg/uninit-pr124380.C (new) ##
    +@@
    ++// PR middle-end/124380
    ++// { dg-do compile }
    ++// { dg-options "-O1 -Wuninitialized -ftrivial-auto-var-init=zero" }
    ++
    ++int get ();
    ++void sink (const int &);
    ++
    ++inline __attribute__((always_inline)) void
    ++two ()
    ++{
    ++  const int &result = get ();
    ++  sink (result);
    ++}
    ++
    ++inline __attribute__((always_inline)) void
    ++three ()
    ++{
    ++  two ();
    ++  two ();
    ++}
    ++
    ++void
    ++one ()
    ++{
    ++  two ();
    ++  three ();
    ++}
    +
    + ## gcc/tree-inline.cc ##
    +@@ gcc/tree-inline.cc: remap_gimple_stmt (gimple *stmt, copy_body_data *id)
    + }
    + 
    + 
    ++/* Update the anonymous variable name in CALL to refer to the copied
    ++   declaration in ID.  */
    ++
    ++static void
    ++remap_deferred_init (gcall *call, copy_body_data *id)
    ++{
    ++  tree name = gimple_call_arg (call, 2);
    ++  name = TREE_OPERAND (TREE_OPERAND (name, 0), 0);
    ++  const char *name_str = TREE_STRING_POINTER (name);
    ++  if (strncmp (name_str, "D.", 2) != 0 || !ISDIGIT (name_str[2]))
    ++    return;
    ++
    ++  char *end;
    ++  unsigned long uid = strtoul (name_str + 2, &end, 10);
    ++  if (*end || uid > UINT_MAX)
    ++    return;
    ++
    ++  if (!id->deferred_init_map)
    ++    {
    ++      /* Build this map once per body copy, rather than searching all
    ++   local declarations for each .DEFERRED_INIT call.  */
    ++      id->deferred_init_map = new hash_map<int_hash<unsigned, -1U>, tree>;
    ++      tree var;
    ++      unsigned int i;
    ++      FOR_EACH_LOCAL_DECL (id->src_cfun, i, var)
    ++  if (VAR_P (var) && !DECL_NAME (var))
    ++    if (tree *new_var = id->decl_map->get (var))
    ++      if (VAR_P (*new_var))
    ++        id->deferred_init_map->put (DECL_UID (var), *new_var);
    ++    }
    ++
    ++  if (tree *var = id->deferred_init_map->get (uid))
    ++    {
    ++      tree new_name;
    ++      if (DECL_NAME (*var))
    ++  new_name = build_string_literal (DECL_NAME (*var));
    ++      else
    ++  {
    ++    char buf[3 + (HOST_BITS_PER_INT + 2) / 3];
    ++    sprintf (buf, "D.%u", DECL_UID (*var));
    ++    new_name = build_string_literal (buf);
    ++  }
    ++      gimple_call_set_arg (call, 2, new_name);
    ++    }
    ++}
    ++
    + /* Copy basic block, scale profile accordingly.  Edges will be taken care 
of
    +    later  */
    + 
    +@@ gcc/tree-inline.cc: copy_bb (copy_body_data *id, basic_block bb,
    +   {
    +     stmt = gsi_stmt (stmts_gsi);
    + 
    ++    if (gimple_call_internal_p (stmt, IFN_DEFERRED_INIT))
    ++      remap_deferred_init (as_a <gcall *> (stmt), id);
    ++
    +     /* Advance iterator now before stmt is moved to seq_gsi.  */
    +     gsi_next (&stmts_gsi);
    + 
    +@@ gcc/tree-inline.cc: copy_cfg_body (copy_body_data * id,
    +       delete id->dependence_map;
    +       id->dependence_map = NULL;
    +     }
    ++  if (id->deferred_init_map)
    ++    {
    ++      delete id->deferred_init_map;
    ++      id->deferred_init_map = NULL;
    ++    }
    + 
    +   return new_fndecl;
    + }
    +
    + ## gcc/tree-inline.h ##
    +@@ gcc/tree-inline.h: struct copy_body_data
    +      equivalents in the function into which it is being inlined.  */
    +   hash_map<dependence_hash, unsigned short> *dependence_map;
    + 
    ++  /* Map anonymous variable UIDs to remapped declarations for
    ++     .DEFERRED_INIT calls.  */
    ++  hash_map<int_hash<unsigned, -1U>, tree> *deferred_init_map;
    ++
    +   /* A list of addressable local variables remapped into the caller
    +      when inlining a call within an OpenMP SIMD-on-SIMT loop.  */
    +   vec<tree> *dst_simt_vars;
-- 
2.54.0

Reply via email to