From 7047c47918a6f84a2d5a1e63882f5af4cafb43a4 Mon Sep 17 00:00:00 2001 From: David Green Date: Fri, 29 Apr 2022 09:30:02 +0100 Subject: [PATCH] [VecCombine] Fix sort comparator logic in foldShuffleFromReductions I think this sort comparator was overly complex, and the windows expensive check bot agreed, failing as it was not giving a strict weak ordering. Change it to use the comparison of the mask values as unsigned integers. This should sort the undef elements to the end whilst keeping X 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( -- 2.7.4