[X86][AVX] Extract SUBV_BROADCAST constant bits from just the lower subvector range...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 6 Aug 2021 09:46:22 +0000 (10:46 +0100)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 6 Aug 2021 10:21:31 +0000 (11:21 +0100)
commit18e6a03b1a15b2661259af15ae604b4c4850cd61
treec9054d06cc7eb898986732e11e24befd01f0b678
parentaa2210a830699fbf6e218789ac3da7abffee0b0c
[X86][AVX] Extract SUBV_BROADCAST constant bits from just the lower subvector range (PR51281)

As reported on PR51281, an internal fuzz test encountered an issue when extracting constant bits from a SUBV_BROADCAST node from a constant pool source larger than the broadcasted subvector width.

The getTargetConstantBitsFromNode was assuming that the Constant would the same size as the subvector, resulting in the incorrect packing of the per-element bits data.

This patch attempts to solve this by using the SUBV_BROADCAST node to determine the subvector width, and then ensuring we extract only the lowest bits from Constant of that subvector bitsize.

Differential Revision: https://reviews.llvm.org/D107158
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/pr51281.ll