[all-commits] [llvm/llvm-project] abe92a: [DAGCombine] Fix an incorrect folding of extract_s...

Min-Yih Hsu via All-commits all-commits at lists.llvm.org
Thu Aug 14 16:37:43 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: abe92a50005a2a4998e4a006417fdfe6ff36eb6b
      https://github.com/llvm/llvm-project/commit/abe92a50005a2a4998e4a006417fdfe6ff36eb6b
  Author: Min-Yih Hsu <min.hsu at sifive.com>
  Date:   2025-08-14 (Thu, 14 Aug 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    A llvm/test/CodeGen/RISCV/rvv/incorrect-extract-subvector-combine.ll

  Log Message:
  -----------
  [DAGCombine] Fix an incorrect folding of extract_subvector (#153709)

Reported from
https://github.com/llvm/llvm-project/pull/153393#issuecomment-3189898813

During DAGCombine, an intermediate extract_subvector sequence was
generated:
```
  t8: v9i16 = extract_subvector t3, Constant:i64<9>
t24: v8i16 = extract_subvector t8, Constant:i64<0>
```
And one of the DAGCombine rule which turns `(extract_subvector
(extract_subvector X, C), 0)` into `(extract_subvector X, C)` kicked in
and turn that into `v8i16 = extract_subvector t3, Constant:i64<9>`. But
it forgot to check if the extracted index is a multiple of the minimum
vector length of the result type, hence the crash.

This patch fixes this by adding an additional check.



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