optimization/9553: No induction variable elimination

binsh00@hotmail.com binsh00@hotmail.com
Mon Feb 3 20:16:00 GMT 2003

>Number:         9553
>Category:       optimization
>Synopsis:       No induction variable elimination
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          pessimizes-code
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 03 20:16:01 UTC 2003
>Originator:     binsh00@hotmail.com
>Release:        gcc (GCC) 3.3 20030129 (prerelease)
Debian GNU/Linux (unstable)

| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name           Version        Description
ii  gcc            3.2.2-0        The GNU C compiler.
int a[20];
int b[20];
    int i1, i2;
    for (i1 = 0, i2 = 0; i1 < 20; ++i1)
        a[i1] = b[i2++];

In the above code i2 equals i1 and can be eliminated.

% /usr/lib/gcc-snapshot/bin/gcc -Wall -O3 -S -o - bug.c

        xorl    %edx, %edx
        xorl    %ecx, %ecx
        .p2align 2,,3
        movl    b(,%ecx,4), %eax
        movl    %eax, a(,%edx,4)
        incl    %edx
        incl    %ecx
        cmpl    $19, %edx
        jle     .L6



More information about the Gcc-bugs mailing list