Skip to content

wrong code at -O{s,2} with "-mllvm -force-vector-width=1 -mllvm -force-vector-interleave=2" on x86_64-linux-gnu #154967

@zhendongsu

Description

@zhendongsu

Compiler Explorer: https://godbolt.org/z/eEqc4oeET

Note:

[516] % clangtk -v
clang version 22.0.0git (https://github.com/llvm/llvm-project.git fc6299065794d05bcab8f6bb9628441b3d071131)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/home/suz/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/12
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /usr/local/cuda, version 12.1
[517] % 
[517] % clangtk -O2 small.c; ./a.out
[518] % 
[518] % clangtk -O2 -mllvm -force-vector-width=1 -mllvm -force-vector-interleave=2 small.c
[519] % ./a.out
Aborted
[520] % cat small.c
int a, b;
int f(int g) {
  a = 0;
  for (; a < 32; a++)
    if (g >> a & 1)
      return a;
  return 0;
}
int main() {
  if (f(b-2) != 1)
    __builtin_abort();
  return 0;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions