[PATCH] D133676: [X86] Simplify isReplaceable (NFC)

Kazu Hirata via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 13 21:36:51 PDT 2022


kazu added inline comments.


================
Comment at: llvm/lib/Target/X86/X86OptimizeLEAs.cpp:464
     // the LEA is not replaceable.
-    if (!isIdenticalOp(MI.getOperand(MemOpNo + X86::AddrBaseReg), MO))
+    if (&MO != &MI.getOperand(MemOpNo + X86::AddrBaseReg))
       return false;
----------------
pengfei wrote:
> This cannot prevent def register been used by other operands at the same time.
> This cannot prevent def register been used by other operands at the same time.

Sure, a single iteration of the "for" loop may not prevent the def register being used by other operands, but if we check to see if all uses are used as the address base register, then no use is left for any other purpose.  Or it it possible that some uses are not counted in the use list?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133676



More information about the llvm-commits mailing list