This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/55814] New: Missed optimization with short-circuit evaluation


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55814

             Bug #: 55814
           Summary: Missed optimization with short-circuit evaluation
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: tkoenig@gcc.gnu.org


See PR 55806.

The Fortran front end generates code for intrinsics like ANY and ALL
which looks like (after loop unrolling)

_Bool foo(int *a, int *b)
{
  _Bool f0, f1, f2, f3;

  f0 = a[0] > b[0];
  f1 = a[1] > b[1];
  f2 = a[2] > b[2];
  f3 = a[2] > b[2];

  return f0 || f1 || f2 || f3;
}

There should be no need to perform the second comparison if the
first one is true.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]