| Issue |
235368
|
| Summary |
[NVPTX] "Cannot select: v2bf16 = scalar_to_vector" for a byte-wise copy of an unaligned bfloat through a local array (regression in LLVM 23)
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
jeffchen006
|
The IR below crashes instruction selection at -O3 for sm_80, sm_90a and sm_100a with LLVM 23.1.4 and main (5916210dbe10).
LLVM 22.1.8 and 20.1.8 compile it; `llc -O0` compiles it; `llc -O1` / `-O2` crash too. Running `opt -O1` (or higher)
first avoids it (SROA removes the local array), so it shows up when unoptimized IR reaches `llc`.
```llvm
target triple = "nvptx64-nvidia-cuda"
define ptx_kernel void @k(ptr addrspace(1) %in, ptr addrspace(1) %out) {
%loc = alloca [4 x i8], align 4
%a = load i8, ptr addrspace(1) %in, align 1
store i8 %a, ptr %loc, align 1
%pi = getelementptr inbounds i8, ptr addrspace(1) %in, i64 1
%b = load bfloat, ptr addrspace(1) %pi, align 1
%pl = getelementptr inbounds i8, ptr %loc, i64 1
store bfloat %b, ptr %pl, align 1
%pi3 = getelementptr inbounds i8, ptr addrspace(1) %in, i64 3
%c = load i8, ptr addrspace(1) %pi3, align 1
%pl3 = getelementptr inbounds i8, ptr %loc, i64 3
store i8 %c, ptr %pl3, align 1
%v = load <2 x i16>, ptr %loc, align 4
store <2 x i16> %v, ptr addrspace(1) %out, align 4
ret void
}
```
```
$ llc -mcpu=sm_90a -O3 local_bf16_generic.ll -o -
LLVM ERROR: Cannot select: 0x...: v2bf16 = scalar_to_vector 0x...
0x...: bf16 = bitcast 0x...
0x...: i16 = or 0x..., 0x...
0x...: i16 = shl 0x..., Constant:i32<8>
0x...: i16,ch = load<(invariant load (s8) from %ir.pi + 1, addrspace 1), zext from i8> ...
In function: k
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs