diff --git a/llvm/lib/Target/X86/X86InstrInfo.cpp b/llvm/lib/Target/X86/X86InstrInfo.cpp --- a/llvm/lib/Target/X86/X86InstrInfo.cpp +++ b/llvm/lib/Target/X86/X86InstrInfo.cpp @@ -4498,18 +4498,10 @@ continue; // EFLAGS is used by this instruction. - X86::CondCode OldCC = X86::COND_INVALID; - if (MI || IsSwapped || ImmDelta != 0) { - // We decode the condition code from opcode. - if (Instr.isBranch()) - OldCC = X86::getCondFromBranch(Instr); - else { - OldCC = X86::getCondFromSETCC(Instr); - if (OldCC == X86::COND_INVALID) - OldCC = X86::getCondFromCMov(Instr); - } - if (OldCC == X86::COND_INVALID) return false; - } + X86::CondCode OldCC = X86::getCondFromMI(Instr); + if ((MI || IsSwapped || ImmDelta != 0) && OldCC == X86::COND_INVALID) + return false; + X86::CondCode ReplacementCC = X86::COND_INVALID; if (MI) { switch (OldCC) {