[PATCH] D32277: Replace slow LEA instructions in X86
Zvi Rackover via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 8 00:14:24 PDT 2017
zvi added inline comments.
================
Comment at: lib/Target/X86/X86FixupLEAs.cpp:285
+
+static inline bool isRegOperand(const MachineInstr &MI, int Index) {
+ return MI.getOperand(Index).isReg() &&
----------------
These helpers can be improved by avoiding the operand index magic by passing the operands of interest as arguments.
The '"heavylifting" of identifying these operands happens at the beginning of 'processInstrForSlow3OpLEA'.
```
isRegOperand(const MachineOperand &Op)
hasInefficientLEABaseReg(const MachineOperand &Base,const MachineOperand& Index)
hasLEAOffset(const MachineOperand &Offset)
isThreeOperandsLEA(const MachineOperand &Base, const MachineOperand &Index, const MachineOperand &Offset)
```
================
Comment at: lib/Target/X86/X86FixupLEAs.cpp:481
+
+ const int Opcode = MI.getOpcode();
+ if (!(isLEA(Opcode) &&
----------------
Maybe rename to LEAOpcode?
================
Comment at: lib/Target/X86/X86FixupLEAs.cpp:516
+
+ // First try to replace LEA with an add instruction:
+ // 1.lea (%base,%index,1), %base => add %index,%base
----------------
with one or two (for the 3-op LEA case) add instructions?
https://reviews.llvm.org/D32277
More information about the llvm-commits
mailing list