[PATCH] D138349: [X86][NFC] Minor improvement in X86InstrInfo::optimizeCompareInstr

Phoebe Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 18 22:17:04 PST 2022


pengfei added inline comments.


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:4501
     // 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)
----------------
Maybe they are not equal? `getCondFromMI` checks for `isJCC`, `isSETCC` and `isCMOVCC`, but `getCondFromBranch` only checks `JCC_1`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138349/new/

https://reviews.llvm.org/D138349



More information about the llvm-commits mailing list