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

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
So before we stream LTO byte code, we have:

BEFORE:

Released 0 names, 0.00%, removed 0 holes
A::A (struct A * const this)
{
  <bb 2> [local count: 1073741824]:
  MEM[(struct  &)this_2(D)] ={v} {CLOBBER};
  return;

}

Released 1 names, 12.50%, removed 1 holes
C::operator() (struct C * const this)
{
  struct A D.2395;
  struct B * _2;

  <bb 2> [local count: 1073741824]:
  _2 = &this_1(D)->m_basis;
  D.2395 = B::operator[] (_2, 1); [return slot optimization]
  D.2395 = B::operator[] (_2, 2);
  D.2395 ={v} {CLOBBER};
  MEM[(struct  &)&<retval>] ={v} {CLOBBER};
  return <retval>;

}

Released 1 names, 11.11%, removed 1 holes
F::F (struct F * const this, struct D & p1, const struct A & p2)
{
  struct C D.2369;

  <bb 2> [local count: 1073741824]:
  MEM[(struct  &)this_2(D)] ={v} {CLOBBER};
  D::m_fn1 (p1_4(D));
  *this_2(D).m_pivotInB = C::operator() (&D.2369); [return slot optimization]
  D.2369 ={v} {CLOBBER};
  return;
}

AFTER:

Released 0 names, 0.00%, removed 0 holes
A::A (struct A * const this)
{
  <bb 2> [local count: 1073741824]:
  *this_2(D) ={v} {CLOBBER};
  return;
}

Released 1 names, 12.50%, removed 1 holes
C::operator() (struct C * const this)
{
  struct A D.2397;
  struct B * _2;

  <bb 2> [local count: 1073741824]:
  _2 = &this_1(D)->m_basis;
  D.2397 = B::operator[] (_2, 1); [return slot optimization]
  D.2397 = B::operator[] (_2, 2);
  D.2397 ={v} {CLOBBER};
  <retval> ={v} {CLOBBER};
  return <retval>;
}

Released 1 names, 11.11%, removed 1 holes
F::F (struct F * const this, struct D & p1, const struct A & p2)
{
  struct C D.2371;

  <bb 2> [local count: 1073741824]:
  *this_2(D) ={v} {CLOBBER};
  D::m_fn1 (p1_4(D));
  *this_2(D).m_pivotInB = C::operator() (&D.2371); [return slot optimization]
  D.2371 ={v} {CLOBBER};
  return;
}

And then the LHS is emitted when we materialize clones:

#0  __memmove_avx_unaligned () at
../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:145
#1  0x00000000014350c3 in copy_node (node=0x7ffff772c810) at
/home/marxin/Programming/gcc/gcc/tree.c:1189
#2  0x0000000001104180 in copy_tree_r (tp=0x7fffffffcb38,
walk_subtrees=0x7fffffffcab4, data=0x0) at
/home/marxin/Programming/gcc/gcc/tree-inline.c:5313
#3  0x0000000000bff037 in mostly_copy_tree_r (tp=0x7fffffffcb38,
walk_subtrees=0x7fffffffcab4, data=0x0) at
/home/marxin/Programming/gcc/gcc/gimplify.c:869
#4  0x0000000001461871 in walk_tree_1 (tp=0x7fffffffcb38, func=0xbfef59
<mostly_copy_tree_r(tree*, int*, void*)>, data=0x0, pset=0x0, lh=0x0) at
/home/marxin/Programming/gcc/gcc/tree.c:12151
#5  0x0000000000bff4be in unshare_expr (expr=0x7ffff772c810) at
/home/marxin/Programming/gcc/gcc/gimplify.c:995
#6  0x00000000010f2cf8 in remap_decl (decl=0x7ffff7738348, id=0x7fffffffd6d0)
at /home/marxin/Programming/gcc/gcc/tree-inline.c:413
#7  0x00000000010f6491 in remap_gimple_op_r (tp=0x7ffff7531360,
walk_subtrees=0x7fffffffccf4, data=0x7fffffffce70) at
/home/marxin/Programming/gcc/gcc/tree-inline.c:1047
#8  0x0000000001461871 in walk_tree_1 (tp=0x7ffff7531360, func=0x10f636b
<remap_gimple_op_r(tree*, int*, void*)>, data=0x7fffffffce70, pset=0x0, lh=0x0)
at /home/marxin/Programming/gcc/gcc/tree.c:12151
#9  0x0000000000bf7cbf in walk_gimple_op (stmt=0x7ffff7531320,
callback_op=0x10f636b <remap_gimple_op_r(tree*, int*, void*)>,
wi=0x7fffffffce70) at /home/marxin/Programming/gcc/gcc/gimple-walk.c:221
#10 0x00000000010f9dd5 in remap_gimple_stmt (stmt=0x7ffff75311e0,
id=0x7fffffffd6d0) at /home/marxin/Programming/gcc/gcc/tree-inline.c:1896
#11 0x00000000010f9fed in copy_bb (id=0x7fffffffd6d0, bb=0x7ffff7736618,
num=..., den=...) at /home/marxin/Programming/gcc/gcc/tree-inline.c:1946
#12 0x00000000010fd2b7 in copy_cfg_body (id=0x7fffffffd6d0,
entry_block_map=0x7ffff77364e0, exit_block_map=0x7ffff7736680, new_entry=0x0)
at /home/marxin/Programming/gcc/gcc/tree-inline.c:2919
#13 0x00000000010fde80 in copy_body (id=0x7fffffffd6d0,
entry_block_map=0x7ffff77364e0, exit_block_map=0x7ffff7736680, new_entry=0x0)
at /home/marxin/Programming/gcc/gcc/tree-inline.c:3167
#14 0x0000000001102c05 in expand_call_inline (bb=0x7ffff77364e0,
stmt=0x7ffff7fc7cf0, id=0x7fffffffd6d0) at
/home/marxin/Programming/gcc/gcc/tree-inline.c:4909
#15 0x00000000011039b6 in gimple_expand_calls_inline (bb=0x7ffff77364e0,
id=0x7fffffffd6d0) at /home/marxin/Programming/gcc/gcc/tree-inline.c:5104
#16 0x0000000001103f22 in optimize_inline_calls (fn=0x7ffff7929900) at
/home/marxin/Programming/gcc/gcc/tree-inline.c:5244
#17 0x0000000001e30436 in inline_transform (node=0x7ffff7730438) at
/home/marxin/Programming/gcc/gcc/ipa-inline-transform.c:682
#18 0x0000000000ec99bf in execute_one_ipa_transform_pass (node=0x7ffff7730438,
ipa_pass=0x2dc7090) at /home/marxin/Programming/gcc/gcc/passes.c:2211
#19 0x0000000000ec9b02 in execute_all_ipa_transforms () at
/home/marxin/Programming/gcc/gcc/passes.c:2250
#20 0x00000000009adba7 in cgraph_node::expand (this=0x7ffff7730438) at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2187
#21 0x00000000009ae206 in expand_all_functions () at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2332
#22 0x00000000009aed62 in symbol_table::compile (this=0x7ffff7731100) at
/home/marxin/Programming/gcc/gcc/cgraphunit.c:2683
#23 0x0000000000892a69 in lto_main () at
/home/marxin/Programming/gcc/gcc/lto/lto.c:644
#24 0x000000000102d3fc in compile_file () at
/home/marxin/Programming/gcc/gcc/toplev.c:456
#25 0x0000000001030102 in do_compile () at
/home/marxin/Programming/gcc/gcc/toplev.c:2209
#26 0x00000000010303f6 in toplev::main (this=0x7fffffffda7e, argc=23,
argv=0x2d9d6e0) at /home/marxin/Programming/gcc/gcc/toplev.c:2344
#27 0x0000000001f46bfa in main (argc=23, argv=0x7fffffffdb78) at
/home/marxin/Programming/gcc/gcc/main.c:39

(gdb) p debug_function(cfun->decl, 0)
__ct_base  (struct F * const this, struct D & p1, const struct A & p2)
{
  struct A D.4335;
  struct C D.4321;
  struct B * _12;

  <bb 2> [local count: 1073741824]:
  *this_2(D) ={v} {CLOBBER};
  m_fn1 (p1_4(D));
  _12 = &D.4321.m_basis;
  D.4335 = operator[] (_12, 1); [return slot optimization]
  D.4335 = operator[] (_12, 2);
  D.4335 ={v} {CLOBBER};
  *this_2(D).m_pivotInB ={v} {CLOBBER};
  D.4321 ={v} {CLOBBER};
  return;

}

So the question is where is the code that handles the clobbers in tree inliner?

Reply via email to