| Issue |
242240
|
| Summary |
[RISCV] error in backend "Do not know how to promote this operator!" with BitInt and RVV
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
hazohelet
|
Live Reproducer: [https://godbolt.org/z/fj7dPf8qa](<https://godbolt.org/z/fj7dPf8qa>)
Compiling the following C code for `riscv64` with `-march=rv64gcv` and `clang -O2` crashes.
```c
_BitInt(10) f(_BitInt(10) n) {
_BitInt(10) x = 0;
for (_BitInt(10) i = n; i; i++)
x = i;
return x;
}
```
clang command:
```sh
clang --target=riscv64-linux-gnu -march=rv64gcv -O2 -c repro.c
```
The compiler crashes with the following output:
```
PromoteIntegerResult #0: t21: nxv16i10 = experimental_vp_splice t3, t6, Constant:i32<-1>, t12, t15, t19
fatal error: error in backend: Do not know how to promote this operator!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and dumped files.
Stack dump:
0. Program arguments: clang --target=riscv64-linux-gnu -march=rv64gcv -O2 -c repro.c
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'repro.c'.
4. Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@f'
...
#7 0x... llvm::DAGTypeLegalizer::PromoteIntegerResult(llvm::SDNode*, unsigned int)
#8 0x... llvm::DAGTypeLegalizer::run()
#9 0x... llvm::SelectionDAG::LegalizeTypes()
#10 0x... llvm::SelectionDAGISel::CodeGenAndEmitDAG()
```
Notes:
* `-O2`, `-O3` and `-Os` crash; `-O1`, `-Oz`, `-fno-vectorize` and `-march=rv64gc` compile it
* `_BitInt(7)`, `_BitInt(12)` and `unsigned _BitInt(10)` crash too; `_BitInt(16)`, `_BitInt(17)`, `_BitInt(33)` and `_BitInt(64)` compile
* Clang 22.1.8 compiles it; 23.1.2 crashes
clang version:
```text
clang version 24.0.0git (https://github.com/llvm/llvm-project 7d25e4f9cd72686727beaf0b661ce3e910ee1349)
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs