diff --git a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp index 7d6e5ed0a46415..05fc8c6330c5ed 100644 --- a/llvm/lib/Transforms/Vectorize/VectorCombine.cpp +++ b/llvm/lib/Transforms/Vectorize/VectorCombine.cpp @@ -1200,9 +1200,7 @@ bool VectorCombine::foldShuffleFromReductions(Instruction &I) { // become a identity or concat mask. Undef elements are pushed to the end. SmallVector ConcatMask; Shuffle->getShuffleMask(ConcatMask); - sort(ConcatMask, [](int X, int Y) { - return Y == UndefMaskElem ? true : (X == UndefMaskElem ? false : X < Y); - }); + sort(ConcatMask, [](int X, int Y) { return (unsigned)X < (unsigned)Y; }); bool UsesSecondVec = any_of(ConcatMask, [&](int M) { return M >= NumInputElts; }); InstructionCost OldCost = TTI.getShuffleCost(