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

            Bug ID: 63169
           Summary: ivopts rewrite_uses pessimizes debug info
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: amodra at gmail dot com

Extract from 122t.ivopts for gcc.c-torture/compile/pr60655-2.c on powerpc,
showing loop in mp_compare.  The thing to note is the good expression for #
DEBUG r1, a simple dependency on one iv, but the bad choice for # DEBUG r2
(which triggers pr60655 on powerpc).
# DEBUG r2 => (sizetype) (ivtmp.19_20 + 4294967295) is correct also and leads
to much simpler debug info.

  <bb 3>:
  # ivtmp.17_24 = PHI <ivtmp.17_22(2), ivtmp.17_23(6)>
  # ivtmp.19_20 = PHI <ivtmp.19_26(2), ivtmp.19_25(6)>
  # DEBUG precision => (short int) (((unsigned short) precision_6 - (unsigned
short) (unsigned int) (r1_10 + 1)) + (unsigned short) ivtmp.17_24)
  # DEBUG r2 => r2_12 + (((sizetype) ivtmp.17_24 - (sizetype) r1_10) +
4294967295)
  # DEBUG r1 => (const unit *) (ivtmp.17_24 + 4294967295)
  ivtmp.17_23 = ivtmp.17_24 - 1;
  _28 = (void *) ivtmp.17_23;
  _13 = MEM[base: _28, offset: 0B];
  ivtmp.19_25 = ivtmp.19_20 - 1;
  _29 = (void *) ivtmp.19_25;
  _14 = MEM[base: _29, offset: 0B];
  if (_13 < _14)
    goto <bb 7>;
  else
    goto <bb 4>;

  <bb 4>:
  # DEBUG r1 => (const unit *) (ivtmp.17_23 + 4294967295)
  # DEBUG r2 => r2_12 + (((sizetype) ivtmp.17_23 - (sizetype) r1_10) +
4294967295)
  if (_13 > _14)
    goto <bb 7>;
  else
    goto <bb 5>;

  <bb 5>:
  # DEBUG precision => (short int) (((unsigned short) precision_6 - (unsigned
short) (unsigned int) (r1_10 + 1)) + (unsigned short) ivtmp.17_23)
  if (ivtmp.17_23 != _35)
    goto <bb 6>;
  else
    goto <bb 7>;

  <bb 6>:
  goto <bb 3>;

Reply via email to