[all-commits] [llvm/llvm-project] 861f5d: [X86][NFC] Minor improvement in X86InstrInfo::opti...

KanRobert via All-commits all-commits at lists.llvm.org
Mon Nov 21 05:00:22 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 861f5dd688c19d206cc44718be9ff75894065d46
      https://github.com/llvm/llvm-project/commit/861f5dd688c19d206cc44718be9ff75894065d46
  Author: Shengchen Kan <shengchen.kan at intel.com>
  Date:   2022-11-21 (Mon, 21 Nov 2022)

  Changed paths:
    M llvm/lib/Target/X86/X86InstrInfo.cpp

  Log Message:
  -----------
  [X86][NFC] Minor improvement in X86InstrInfo::optimizeCompareInstr

Before this patch, the code enumerated `getCondFromBranch`, `getCondFromSETCC` and `getCondFromFromCMov` to get the condition code of a `MachineInstr`, and assigned the result to variable `OldCC` when `MI || IsSwapped || ImmDelta != 0` was satisfiled.

After this patch, the `if-else` structure is eliminated by using `getCondFromMI`. Since `OldCC` is only used when  `MI || IsSwapped || ImmDelta != 0`  is true, it is initialized with `getCondFromMI` directly outside the scope of `if` now.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D138349




More information about the All-commits mailing list