This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/55814] New: Missed optimization with short-circuit evaluation
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 26 Dec 2012 17:45:39 +0000
- Subject: [Bug middle-end/55814] New: Missed optimization with short-circuit evaluation
- Auto-submitted: auto-generated
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.