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 optimization/11710] New: loop optimizer cannot figure out # iterations for shift and / * "increments"


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;
}


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