[all-commits] [llvm/llvm-project] 39ed39: [DAG] Fix illegal type in srl(bitcast(build_vector...
Kito Cheng via All-commits
all-commits at lists.llvm.org
Wed Jun 24 17:48:20 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 39ed392c4e890d6261e80dcbd98ebf3487c012bc
https://github.com/llvm/llvm-project/commit/39ed392c4e890d6261e80dcbd98ebf3487c012bc
Author: Kito Cheng <kito.cheng at sifive.com>
Date: 2026-06-25 (Thu, 25 Jun 2026)
Changed paths:
M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
A llvm/test/CodeGen/RISCV/rvp-srl-bitcast-bv.ll
Log Message:
-----------
[DAG] Fix illegal type in srl(bitcast(build_vector)) fold (#205074)
The fold
```
(srl (bitcast (build_vector e1, ..., eN)), (N-1) * eltsize) -> (zext eN)
```
added in #181412 built the result through a narrow element integer type,
which
can be illegal (e.g. i16 on RV32 with the P extension, where `<2 x i16>`
is
legal). When the fold runs in the last DAG combine that illegal type
hits the
"Unexpected illegal type!" assert.
Build the result directly in the result type `VT` and mask off the high
bits
instead:
```
(and (zext/trunc eN to VT), (1 << eltsize) - 1)
```
`VT` is always legal, so no illegal type is created and the fold no
longer needs
to be gated on legalization.
Assisted-by: Opus 4.8
---------
Co-authored-by: Matt Arsenault <arsenm2 at gmail.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list