This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/11710] New: loop optimizer cannot figure out # iterations for shift and / * "increments"
- From: "rguenth at tat dot physik dot uni-tuebingen dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jul 2003 18:15:03 -0000
- Subject: [Bug optimization/11710] New: loop optimizer cannot figure out # iterations for shift and / * "increments"
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11710
Summary: loop optimizer cannot figure out # iterations for shift
and / * "increments"
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: enhancement
Priority: P2
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rguenth at tat dot physik dot uni-tuebingen dot de
CC: gcc-bugs at gcc dot gnu dot org
All loops in the following testcases run a small constant amout of iterations.
If compiled with -O2 -funroll-loops they dont get unrolled, though, probably due
to the lack of the loop optimizer finding out the constant number of iterations.
This hurts optimization of libstdc++ pow(T, int) implementation for constant
second argument.
int shift()
{
int n = 5, i = 0;
while (n <<= 2)
++i;
return i;
}
int divide()
{
int n = 5, i = 0;
while (n /= 2)
++i;
return i;
}
int multiply()
{
int n = 5, i = 0;
while (n *= 2 < 20)
++i;
return i;
}