Issue 64655
Summary Miscompile of i1 vector insertelement with avx512f feature
Labels new issue
Assignees
Reporter jacobly0
    ```llvm
target triple = "x86_64"

define i32 @main() "target-features"="+avx512f" { ; no miscompile when disabled
  %1 = alloca <32 x i1>
  store <32 x i1> zeroinitializer, ptr %1
  %2 = load <32 x i1>, ptr %1
  %3 = insertelement <32 x i1> %2, i1 true, i32 1
  store <32 x i1> %3, ptr %1
  %4 = load <32 x i1>, ptr %1
  %5 = bitcast <32 x i1> %4 to i32
 ret i32 %5
}
```
```
$ clang --version
clang version 17.0.0 (https://github.com/llvm/llvm-project.git 8f4dd44097c9ae25dd203d5ac87f3b48f854bba8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jacob/.local/lib/dbg/llvm/17.x/bin
$ clang repro.ll && ./a.out; echo $?
0
$ sed -i 's/+/-/' repro.ll
$ clang repro.ll && ./a.out; echo $?
2
```

I notice that it uses a 32-bit stack slot, yet the `insertelement` is lowered to a byte write at byte offset 1.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to