This helps handling a case where the BUILD_VECTOR has i16 element type and i32 constant operands t2: v8i16 = setcc t8, t17, setult:ch t3: v8i16 = BUILD_VECTOR Constant:i32<1>, ... t4: v8i16 = and t2, t3 t5: v8i16 = add t8, t4 This can be turned into t5: v8i16 = sub t8, t2, and allows us to remove t3 and t4 from the DAG.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
This shoudl have been picked up by foldAddSubMasked1 in the generic DAG combiner but wasn't because the BUILD_VECTOR has i8 element type and i32 constant operands. We should fix that to not require the widths to match.
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | ||
---|---|---|
10634 ↗ | (On Diff #436802) | Are all of the callers of isOneOrOneSplat ok with this change? Is this change correct for the caller you’re interested in if the element type of the build_vector is i1? |
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | ||
---|---|---|
10634 ↗ | (On Diff #436802) | Let me go through the callers one by one. There are 8 uses of isOneOrOneSplat in llvm, all in DAGCombiner.cpp. so far, I ran through check-llvm and looks good. |
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | ||
---|---|---|
10634 ↗ | (On Diff #436802) | The bitwidth check was added https://reviews.llvm.org/D25374 and I have ran check-llvm-codegen for all available targets and things are fine. |
@adriantong1024 Please can you rebase after rGadfcdb0d0d4af1194121211c125c291162b43ccd?
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | ||
---|---|---|
10665 ↗ | (On Diff #437217) | This comment can probably go - unlike Null/AllOnes this isn't going to work well if the bitcast is to a vector type with different scalar sizes |
I ran ninja check-lld check-libc check-flang check-llvm check-polly check-bolt check-mlir check-all check-clang check-clang-tools check-openmp locally and things are good.
No need to declare Known outside of the blocks they are used in.