[PATCH] D105069: [GlobalISel] Add re-association combine for G_PTR_ADD to allow better addressing mode usage.
Matt Arsenault via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 28 17:30:39 PDT 2021
arsenm added inline comments.
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:1677
+ // to go beyond the bounds of our legal addressing modes.
+ if (!MRI.hasOneNonDBGUse(Add2))
+ return false;
----------------
Check isLegalAddressingMode, or some similar hook?
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4040-4041
+ MachineInstr &PtrAdd) {
+ if (PtrAdd.getOpcode() != TargetOpcode::G_PTR_ADD)
+ return false;
+
----------------
This should be impossible?
================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4069-4070
+ for (auto &UseMI : MRI.use_nodbg_instructions(Src1Reg)) {
+ // This combine may end up running before ptrtoint/inttoptr combines
+ // manage to eliminate redundant conversions, so try to look through them.
+ MachineInstr *ConvUseMI = &UseMI;
----------------
Don't we retry combines like the DAG? This seems like a bigger structural problem to solve rather than specially treating this
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