[PATCH] D105069: [GlobalISel] Add re-association combine for G_PTR_ADD to allow better addressing mode usage.
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 28 17:37:23 PDT 2021
paquette added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:530
+ bool matchReassocPtrAdd(MachineInstr &MI,
+ std::function<void(MachineIRBuilder &)> &MatchInfo);
----------------
maybe a doxygen comment?
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4044
+ Register Src1Reg = PtrAdd.getOperand(1).getReg();
+ MachineInstr *Src1Def = MRI.getVRegDef(Src1Reg);
+ if (Src1Def->getOpcode() != TargetOpcode::G_PTR_ADD)
----------------
`getOpcodeDef`?
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4055
+ auto C2 = getConstantVRegVal(Src2Reg, MRI);
+ if (!C1 || !C2)
+ return false;
----------------
maybe minorly faster
```
auto C1 = getConstantVRegVal(Src1Def->getOperand(2).getReg(), MRI);
if (!C1)
return false
auto C2 = getConstantVRegVal(Src2Reg, MRI);
if (!C2)
return false;
```
You could probably pull in some of the C1/C2APIntVal stuff below into there too, although that probably matters less.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105069/new/
https://reviews.llvm.org/D105069
More information about the llvm-commits
mailing list