[Bug optimization/11707] New: constants not propagated in unrolled loop iterations with a conditional

rguenth at tat dot physik dot uni-tuebingen dot de gcc-bugzilla@gcc.gnu.org
Tue Jul 29 13:34:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: constants not propagated in unrolled loop iterations
                    with a conditional
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: normal
          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
  GCC host triplet: i686-pc-linux-gnu

The following testcase fails to cprop:

int foo2()
{
        unsigned int n = 5, i;
        int a = 1;
        for (i=0; i<2; ++i) {
                n /= 2;
                if (n)
                        a *= a;
        }
        return a;
}

while if omitting the if (n) check which is always true, cprop works and
the result is computed at compile time.

The lack of this optimization hurts optimization of libstdc++ pow(T, int)
implementation.



More information about the Gcc-bugs mailing list