[DAG] Handle build_vector with all undefs in reduceBuildVecTruncToBitCast
authorpvanhout <pierre.vanhoutryve@amd.com>
Mon, 13 Feb 2023 09:20:14 +0000 (10:20 +0100)
committerpvanhout <pierre.vanhoutryve@amd.com>
Tue, 14 Feb 2023 07:52:28 +0000 (08:52 +0100)
commit04f69345894dc6f750b25e7cfb1d4240817203a7
tree9490a731a90241fde1d0071db796788b577b740f
parent2e9549db268645accb83ebf031fbb1de84b00ca9
[DAG] Handle build_vector with all undefs in reduceBuildVecTruncToBitCast

While working on D143731 I hit a case where a build_vector with 2 undef operands could be generated (with one undef hidden behind a bitcast).
That made `reduceBuildVecTruncToBitCast` crash because it seems to assume there is at least one good operand.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D143886
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AMDGPU/undef-build-vector.ll [new file with mode: 0644]