LLVM: slpvectorizer::BoUpSLP::ShuffleInstructionBuilder Class Reference (original) (raw)
Merges shuffle masks and emits final shuffle instruction, if required.
It supports shuffling of 2 input vectors. It implements lazy shuffles emission, when the actual shuffle instruction is generated only if this is actually required. Otherwise, the shuffle instruction emission is delayed till the end of the process, to reduce the number of emitted instructions and further analysis/transformations. The class also will look through the previously emitted shuffle instructions and properly mark indices in mask as undef. For example, given the code
%s1 = shufflevector <2 x ty> %0, poison, <1, 0>
%s2 = shufflevector <2 x ty> %1, poison, <1, 0>
and if need to emit shuffle of s1 and s2 with mask <1, 0, 3, 2>, it will look through s1 and s2 and emit
%res = shufflevector <2 x ty> %0, %1, <0, 1, 2, 3>
instead. If 2 operands are of different size, the smallest one will be resized and the mask recalculated properly. For example, given the code
%s1 = shufflevector <2 x ty> %0, poison, <1, 0, 1, 0>
%s2 = shufflevector <2 x ty> %1, poison, <1, 0, 1, 0>
and if need to emit shuffle of s1 and s2 with mask <1, 0, 5, 4>, it will look through s1 and s2 and emit
%res = shufflevector <2 x ty> %0, %1, <0, 1, 2, 3>
instead.
Definition at line 18120 of file SLPVectorizer.cpp.