https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117043

--- Comment #1 from Yi <652023330028 at smail dot nju.edu.cn> ---
I'm sorry that there is a possible alias relationship in the code of this
report. 

The following is the modified code that does not have an alias relationship and
may have missed vectorization.

https://godbolt.org/z/Keh3e98Mn

int data[100];
void f()
{
    int a[100];
    for(int i = 0; i < 100; i++){
        a[i] = 0;
    }
    for(int i = 0; i < 100; i++){
        data[i] = data[i - a[i]] + 1;
    }
}

GCC -O3 -fno-vect-cost-model:
f():
        xor     eax, eax
.L2:
        movsx   rdx, eax
        mov     edx, DWORD PTR data[0+rdx*4]
        add     edx, 1
        mov     DWORD PTR data[0+rax*4], edx
        add     rax, 1
        cmp     rax, 100
        jne     .L2
        ret

Reply via email to