MachineSink: Fix strict weak ordering in GetAllSortedSuccessors

CodeGen/X86/pseudo_cmov_lower2.ll fails using libc++ debug mode
(D150264) without this change.

Reviewed By: MaskRay, aeubanks

Differential Revision: https://reviews.llvm.org/D155811
This commit is contained in:
Danila Kutenin 2023-08-02 12:52:55 -07:00 committed by Fangrui Song
parent bf8cce60c6
commit 49d41de578

View File

@ -915,7 +915,7 @@ MachineSinking::GetAllSortedSuccessors(MachineInstr &MI, MachineBasicBlock *MBB,
AllSuccs, [this](const MachineBasicBlock *L, const MachineBasicBlock *R) {
uint64_t LHSFreq = MBFI ? MBFI->getBlockFreq(L).getFrequency() : 0;
uint64_t RHSFreq = MBFI ? MBFI->getBlockFreq(R).getFrequency() : 0;
bool HasBlockFreq = LHSFreq != 0 && RHSFreq != 0;
bool HasBlockFreq = LHSFreq != 0 || RHSFreq != 0;
return HasBlockFreq ? LHSFreq < RHSFreq
: CI->getCycleDepth(L) < CI->getCycleDepth(R);
});