[PATCH] D88273: [SDAG] Do not convert undef to 0 when folding CONCAT/BUILD_VECTOR
Krzysztof Parzyszek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 18:23:56 PDT 2020
kparzysz created this revision.
kparzysz added a reviewer: craig.topper.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
kparzysz requested review of this revision.
When calling `DAG.getNode(ISD::CONCAT_VECTOR, ...)` with arguments that are `BUILD_VECTOR` and/or `undef`, the DAG will try to fold it into one large `BUILD_VECTOR`. In the process of preparing the operands, it may perform sign- or zero-extension of all values having width less than the required one. This includes `undef`s, which causes them to become zeros. This conversion from `undef` to "def" is not necessary and may inhibit further optimizations.
Concrete example: the original code had this operation in it:
v8i8 = BUILD_VECTOR t109, t109, t109, t109, t109, t109, t109, undef:i32
The operands were all of a legal type `i32`, `i8` as a scalar is not legal on this target. The vector was then widened to `v128i8` by concatenating it with a number of `undef` vectors. The folding described above broke up all these undef vectors into individual elements, and extended them to `i32`, which resulted in (unnecessarily) appending a number of 0s instead.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88273
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
llvm/test/CodeGen/Hexagon/autohvx/isel-undef-not-zero.ll
llvm/test/CodeGen/X86/vec-strict-cmp-sub128.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88273.294210.patch
Type: text/x-patch
Size: 7639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200925/f460f0ff/attachment.bin>
More information about the llvm-commits
mailing list