public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/107828] New: tree-inlining would generate SSA with incorrect def stmt
@ 2022-11-23  1:42 fxue at os dot amperecomputing.com
  2022-11-23  9:49 ` [Bug tree-optimization/107828] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fxue at os dot amperecomputing.com @ 2022-11-23  1:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107828
           Summary: tree-inlining would generate SSA with incorrect def
                    stmt
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxue at os dot amperecomputing.com
  Target Milestone: ---

In the function "remap_gimple_op_r" of tree-inlining.cc:

  ...

  if (TREE_CODE (*tp) == SSA_NAME)
    {
      *tp = remap_ssa_name (*tp, id);
      *walk_subtrees = 0;
      if (is_lhs)
         SSA_NAME_DEF_STMT (*tp) = wi_p->stmt;
      return NULL;
    }

The definition statement of original "*tp" may be same as wi_p->stmt. So, we
will end up with a statement that it is pointed by both old and new SSA name,
while the old one should have been reclaimed.

And this happens when some parameter needs to be adjusted during inline
versioning as:

remap_gimple_stmt()

{
  ...
  if (id->param_body_adjs)
    {
      ...
      if (!gimple_seq_empty_p (extra_stmts))
        {
          memset (&wi, 0, sizeof (wi));
          wi.info = id;
          for (gimple_stmt_iterator egsi = gsi_start (extra_stmts);
               !gsi_end_p (egsi);
               gsi_next (&egsi))
            walk_gimple_op (gsi_stmt (egsi), remap_gimple_op_r, &wi);
                                             ^^^^^^^^^^^^^^^^^

            ...
        }
    }
   ...
}

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

end of thread, other threads:[~2022-12-13 10:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-23  1:42 [Bug tree-optimization/107828] New: tree-inlining would generate SSA with incorrect def stmt fxue at os dot amperecomputing.com
2022-11-23  9:49 ` [Bug tree-optimization/107828] " marxin at gcc dot gnu.org
2022-12-02 17:39 ` jamborm at gcc dot gnu.org
2022-12-08  9:38 ` marxin at gcc dot gnu.org
2022-12-13 10:04 ` fxue at os dot amperecomputing.com

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