aykevl added a comment. This patch was largely based on `X86InstrInfo::optimizeCompareInstr` in llvm/lib/Target/X86/X86InstrInfo.cpp. Of course, the X86 version is much, much larger. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140917/new/ https://reviews.llvm.org/D140917