llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.03k stars 11.07k forks source link

[vectorization] gcc generate better code for a loop body with control flow #65936

Open erickq opened 10 months ago

erickq commented 10 months ago

test: https://godbolt.org/z/YWE89hKvn

void test(int** aa, int* a, int LEN_2D)
{
        for (int j = 0; j < LEN_2D; j++) {
            for (int i = j+1; i < LEN_2D; i++) {
                a[i] -= aa[j][i] * a[j];
            }
        }
    return;
}
erickq commented 10 months ago

Can you give me some ideas? I probably know that LoopAccessAnalysis needs to be enhanced.

artagnon commented 7 months ago

I think this requires an enhancement to LoopDistribute.