[llvm] [GlobalIsel] Combine G_PTR_ADD. (PR #95647)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 16 23:59:04 PDT 2024
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>,
Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/95647 at github.com>
================
@@ -7437,3 +7437,212 @@ bool CombinerHelper::matchNonNegZext(const MachineOperand &MO,
return false;
}
+
+bool CombinerHelper::matchPtrAddWithSub(const MachineOperand &MO,
+ BuildFnTy &MatchInfo) {
+ GPtrAdd *Inner = cast<GPtrAdd>(MRI.getVRegDef(MO.getReg()));
+ GSub *Sub = cast<GSub>(MRI.getVRegDef(Inner->getOffsetReg()));
----------------
Pierre-vh wrote:
You can just pass the MI directly from the combine rule by giving a name to the pattern and using that in C++
Same for all other patterns below
https://github.com/llvm/llvm-project/pull/95647
More information about the llvm-commits
mailing list