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

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Breakpoint 5, set_cond_stmt_execution_predicate (fbi=0x7fffffffce60, 
    summary=0x7ffff74087e8, params_summary=0x0, 
    bb=<basic_block 0x7ffff7403720 (2)>)
    at ../../src/gcc/gcc/ipa-fnsummary.cc:1732
1732      if (!aggpos.by_ref)
(gdb) p aggpos
$1 = {offset = 0, agg_contents = true, by_ref = false}

so avoiding agg_contents might make this more robust as well.  Dropping
the predicate when propagating through multiple aggregate copies might
also be a good idea.  After inlining we have

int f ()
{
...
  <bb 2> [local count: 1073741824]:
  MEM <char[8]> [(struct SV *)&D.2991] = {};
  D.2991.m_size = 1;
  sought = D.2991;
  n_7 = sought.m_size;
  idx_8 = -n_7;
  goto <bb 4>; [100.00%]

  <bb 3> [local count: 8687547538]:
  matched_10 = matched_9 + 1;

  <bb 4> [local count: 9761289362]:
  # idx_11 = PHI <idx_8(2), idx_13(3)>
  # matched_9 = PHI <0(2), matched_10(3)>
  _12 = n_7 + idx_11;
  s = sought;
  s$m_size_14 = s.m_size;
  _15 = __builtin_constant_p (s$m_size_14);
  if (_15 != 0)
    goto <bb 5>; [67.00%]
  else
    goto <bb 7>; [33.00%]

  <bb 7> [local count: 9005257994]:
  __builtin_unreachable ();


But IMO the inliner should have replaced the condition itself, not simply
made one edge unreachable.  But it seems this all works somehow via
callgraph edge redirection and the IPA predicates itself are never "applied"?

Reply via email to