llvm.org GIT mirror llvm / b09bb10
[X86] lowerVectorShuffle - use any_of to detect out of bounds shuffle indices. NFCI. Fixes cppcheck local shadow warning as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360027 91177308-0d34-0410-b5e6-96231b3b80d8 Simon Pilgrim 1 year, 5 months ago
1 changed file(s) with 8 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
1646916469 // Check for non-undef masks pointing at an undef vector and make the masks
1647016470 // undef as well. This makes it easier to match the shuffle based solely on
1647116471 // the mask.
16472 if (V2IsUndef)
16473 for (int M : Mask)
16474 if (M >= NumElements) {
16475 SmallVector NewMask(Mask.begin(), Mask.end());
16476 for (int &M : NewMask)
16477 if (M >= NumElements)
16478 M = -1;
16479 return DAG.getVectorShuffle(VT, DL, V1, V2, NewMask);
16480 }
16472 if (V2IsUndef &&
16473 any_of(Mask, [NumElements](int M) { return M >= NumElements; })) {
16474 SmallVector NewMask(Mask.begin(), Mask.end());
16475 for (int &M : NewMask)
16476 if (M >= NumElements)
16477 M = -1;
16478 return DAG.getVectorShuffle(VT, DL, V1, V2, NewMask);
16479 }
1648116480
1648216481 // Check for illegal shuffle mask element index values.
1648316482 int MaskUpperLimit = Mask.size() * (V2IsUndef ? 1 : 2); (void)MaskUpperLimit;