[all-commits] [llvm/llvm-project] 270936: [DAGCombiner] Don't ignore N2's undef elements in ...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Sat Mar 1 04:21:50 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2709366f75b054e2cba4f61310de5a9605f4aa24
      https://github.com/llvm/llvm-project/commit/2709366f75b054e2cba4f61310de5a9605f4aa24
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2025-03-01 (Sat, 01 Mar 2025)

  Changed paths:
    M llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    M llvm/test/CodeGen/X86/vselect-constants.ll

  Log Message:
  -----------
  [DAGCombiner] Don't ignore N2's undef elements in `foldVSelectOfConstants` (#129272)

Since N2 will be reused in the fold, we cannot skip N2's undef elements
if the corresponding element in N1 is well-defined.
For example:
```
t2: v4i32 = BUILD_VECTOR Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>
t24: v4i32 = BUILD_VECTOR undef:i32, undef:i32, Constant:i32<1>, undef:i32
t11: v4i32 = vselect t8, t2, t10
```
Before this patch, we fold t11 into:
```
t26: v4i32 = sign_extend t8
t27: v4i32 = add t26, t24
```
The last element of t27 is incorrect.

Closes https://github.com/llvm/llvm-project/issues/129181.



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