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

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #8)
> I belive we investigated such workarounds but they didn't seem to work? 
> Other
> cases are concerned with address uses before loops (I think they start
> lifetime "correctly" now) but CLOBBERs ending lifetime inside the loop.  The
> dataflow problem then is confused with the backedge having the object not
> live IIRC.
> 
> So what would your workaround do?  Not handle address mentions as starting
> live but only its (possible) memory uses?

I meant in addition to the current cases which start uses (ADDR_EXPRs in the
IL, loads and stores) also handle like that uses of SSA_NAMEs which can contain
those ADDR_EXPRs.
So, say add a mapping from SSA_NAME_VERSION to a bitmap (or vector?) of DECLs
and propagate through uses which addresses of decl they (may) refer to and then
when
add_scope_conflicts_1 sees uses of those SSA_NAMEs, visit_conflict those too.
So, say on the testcase from this PR, when seeing
  ivtmp.40_3 = (unsigned long) &MEM <unsigned long[100]> [(void *)&bitint.6 +
8B];
mark 3 -> bitint.6
  # ivtmp.40_39 = PHI <ivtmp.40_3(2), ivtmp.40_38(3)>
mark 39 -> bitint.6
  # ivtmp.28_40 = PHI <ivtmp.40_3(4), ivtmp.28_41(5)>
mark 40 -> bitint.6
  _147 = (void *) ivtmp.40_39;
mark 147 -> bitint.6
  ivtmp.40_38 = ivtmp.40_39 + 16;
mark 38 -> bitint.6
  _27 = (void *) ivtmp.28_40;
mark 27 -> bitint.6
  ivtmp.28_41 = ivtmp.28_40 + 16;
mark 48 -> bitint.6
  _98 = MEM[(unsigned long *)_147 + -8B];
don't do anything, this is a load from it, etc.
  if (ivtmp.40_38 != _57)
again, nothing, etc.
  _7 = (unsigned long) &bitint.6;
mark 7 -> bitint.6
  _57 = _7 + 600;
mark _57 -> bitint.6
  if (ivtmp.40_38 != _57)
nothing
  ivtmp.41_139 = (unsigned long) &MEM <unsigned long[75]> [(void *)&bitint.7 +
8B];
mark 139 -> bitint.7
  # ivtmp.41_137 = PHI <ivtmp.41_139(2), ivtmp.41_138(3)>
mark 137 -> bitint.7
  _146 = (void *) ivtmp.41_137;
mark 146 -> bitint.7
  ivtmp.41_138 = ivtmp.41_137 + 16;
mark 138 -> bitint.7
  .DIVMODBITINT (0B, 0, &bitint.6, 6384, &D.2796, -8, &y, -6384);
nothing
  _108 = MEM[(unsigned long *)&bitint.6 + 592B];
nothing, etc.
Basically, only handle statements which can propagate address (or pointer-sized
integer based on it) of a tracked variable or pointer arithmetics based on that
to other SSA_NAMEs.
Of course, big question is what kind of propagation to use for that.

Reply via email to