[AArch64] GlobalISel lowerBitcast asserts on bitcast between irregular vectors
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
Live Reproducer: https://godbolt.org/z/TTv1eEvs8
Compiling the following LLVM IR with `llc -global-isel` aborts with the assertion `!EC.isScalar() && "invalid number of vector elements"` failed.
```llvm
target triple = "aarch64-unknown-linux-gnu"
define void @f(<3 x i16> %a, ptr %p) {
%r = bitcast <3 x i16> %a to <2 x i24>
store volatile <2 x i24> %r, ptr %p, align 1
ret void
}
```
llc command:
```sh
llc -global-isel repro.ll
```
Error output:
```
llc: /root/llvm-project/llvm/include/llvm/CodeGenTypes/LowLevelType.h:129: static constexpr llvm::LLT llvm::LLT::vector(llvm::ElementCount, llvm::LLT): Assertion `!EC.isScalar() && "invalid number of vector elements"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -global-isel
1. Running pass 'Function Pass Manager' on module ''.
2. Running pass 'Legalizer' on function '@f'
#9 0x0000000000b456bf llvm::LLT::vector(llvm::ElementCount, llvm::LLT) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0xb456bf)
#10 0x0000000004d336b9 llvm::LegalizerHelper::lowerBitcast(llvm::MachineInstr&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4d336b9)
#11 0x0000000004d7deda llvm::LegalizerHelper::lower(llvm::MachineInstr&, unsigned int, llvm::LLT) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4d7deda)
...
```
A sibling input, `bitcast <6 x i8> to <16 x i3>`, reaches the same `LegalizerHelper::lowerBitcast` and instead aborts with `DstOps[0].getLLTTy(*getMRI()).getSizeInBits() == SrcOps[0].getLLTTy(*getMRI()).getSizeInBits() && "invalid bitcast"`: https://godbolt.org/z/zscPGnEq9
Contributor guide
Assessment
This issue has not been assessed yet.