[llvm] [GlobalIsel] Combine G_PTR_ADD. (PR #95647)

Thorsten Schütt via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 01:01:51 PDT 2024


================
@@ -1675,6 +1675,75 @@ shl_of_vscale,
 sub_of_vscale,
 ]>;
 
+def PtrAddWithSub : GICombineRule<
+   (defs root:$root, build_fn_matchinfo:$matchinfo),
+   (match (G_CONSTANT $right, $imm),
+          (G_SUB $offset, $left, $right),
+          (G_PTR_ADD $root, $base, $offset),
+   [{ return Helper.matchPtrAddWithSub(${root}, ${matchinfo}); }]),
+   (apply [{ Helper.applyBuildFnMO(${root}, ${matchinfo}); }])>;
----------------
tschuett wrote:

We not try to remove subs from the offset register.

https://github.com/llvm/llvm-project/pull/95647


More information about the llvm-commits mailing list