[PATCH] D101970: [X86FixupLEAs] Transform the sequence LEA/SUB to SUB/SUB

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 6 06:11:46 PDT 2021


RKSimon added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetInstrInfo.h:462
 
+  virtual bool hasCommutePreference(MachineInstr &MI, bool &Commute) const {
+    return false;
----------------
Add doxygen description


================
Comment at: llvm/lib/Target/X86/X86FixupLEAs.cpp:454
+  while (CurInst != AluI) {
+    for (unsigned i = 0; i < CurInst->getNumOperands(); ++i) {
+      MachineOperand &opnd = CurInst->getOperand(i);
----------------
```
for (unsigned I = 0, E = CurInst->getNumOperands(); I != E; ++I)
```


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:2708
+  MachineOperand *Op = MRI.getOneDef(Reg1);
+  if (Op) {
+    MachineInstr *Inst = Op->getParent();
----------------
Reduce scope:
```
if (MachineOperand *Op = MRI.getOneDef(Reg1))
```


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:2718
+  Op = MRI.getOneDef(Reg2);
+  if (Op) {
+    MachineInstr *Inst = Op->getParent();
----------------
Reduce scope:
```
if (MachineOperand *Op = MRI.getOneDef(Reg2))
```


================
Comment at: llvm/test/CodeGen/X86/lea-opt2.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s
+
----------------
I think its ok to pre-commit this (with a suitable extra FIXME/TODO explanation comment) and then rebase the patch to show the diffs.


================
Comment at: llvm/test/CodeGen/X86/lea-opt2.ll:145
+  store i64 %1, i64* %p, align 8
+  %sub1 = sub nsw i64 %ld, %b
+  ret i64 %sub1
----------------
are the nsw relevant?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101970



More information about the llvm-commits mailing list