[llvm] [SelectionDAG] Preserve element width when scalarizing widened extracts (PR #221165)

Oscar Priego via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 02:23:44 PDT 2026


Opriego wrote:

Thanks — I reworked the fix around the type contract of the transform rather than special-casing rotates.

For a promoted integer `EXTRACT_VECTOR_ELT`, `scalarizeExtractedBinOp()` now keeps the scalar binop at the original vector element type and any-extends the result back to the extract result type afterward. If that element type cannot legally be introduced after type legalization, the combine is skipped.

This means the semantic validity check happens before `shouldScalarizeBinop()`, removes the opcode whitelist entirely, and preserves the original operation width.

I also removed `optnone`; the RISC-V regression naturally reaches the widened-extract SelectionDAG path without it.

Validation:
- RISC-V regression: PASS
- RISCV/rvv: 1254/1254 PASS
- focused X86 scalarization/rotate tests: PASS
- `git diff --check`: clean

https://github.com/llvm/llvm-project/pull/221165


More information about the llvm-commits mailing list