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

            Bug ID: 68583
           Summary: [5/6 Regression] Missed if-conversion
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

We don't if-convert

void foo (long *a)
{
  int i;
  for (i = 0; i < 100; i+=2)
    {
      if (a[i] == 0)
        {
          a[i+1] = 2;
          a[i] = 3;
        }
      else
        {
          a[i+1] = 3;
          a[i] = 4;
        }
    }
}

even though both a[i] and a[i+1] are written to unconditionally.  We only
keep a base_master to see if sth is writable but if we'd have separate
read-unconditionally and write-unconditionally flags from the master_dr
we could handle the above just fine.  That would require the master_dr
entry to be associated with two different predicates, one for
reads and writes (for read-or-written-unconditionally) and one for writes
only (for written-unconditionally).

PR56624 suggests this missed if-conversion is a regression which it is
as GCC 4.9 and GCC 5.1.0 happily if-convert it.

Reply via email to