llvm / llvm-project

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

[vectorization] gcc generate better code for a loop body with scalar and array expansion #64293

Open zhongsir1 opened 11 months ago

zhongsir1 commented 11 months ago

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

void s257(void) {
  for (int i = 1; i < LEN_2D; i++) {
    for (int j = 0; j < LEN_2D; j++) {
      aa[j][i] = a[i] + bb[j][i];
    }
  }
}
vfdff commented 11 months ago

This issue seems related to the cost model of gather/scatter, https://godbolt.org/z/c3EaP7hYK