If the alternate cmp instruction is a swapped predicate of the main cmp
instruction, need to generate alternate instruction, not the one with
the swapped predicate. Also, the lane with the alternate opcode should
be selected only, if the corresponding operands are not compatible.
Correctness confirmed:
https://alive2.llvm.org/ce/z/94BG66
May be not for this quick fix, but I would make a static bool IsAltOp() to prevent copy/paste from getEntryCost() to vectorize(), or even inlined it to buildShuffleEntryMask() itself, since it isn't used anywhere.
Also, typo: buildSuffleEntryMask() -> buildShuffleEntryMask().