[llvm] [GlobalISel] Migrate remaining generic wip_match_opcode combines to MIR-pattern. (PR #222851)
Yaxun Liu via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 07:16:29 PDT 2026
================
@@ -1284,12 +1419,27 @@ def xor_of_and_with_same_reg: GICombineRule <
(apply [{ Helper.applyXorOfAndWithSameReg(*${root}, ${matchinfo}); }])
>;
-// Transform (ptr_add 0, x) -> (int_to_ptr x)
-def ptr_add_with_zero: GICombineRule<
+// Transform scalar (ptr_add 0, x) -> (int_to_ptr x).
+def ptr_add_with_zero_scalar: GICombineRule<
----------------
yxsamliu wrote:
This changes a constant pointer into an integer constant plus `G_INTTOPTR`, which is worse than the old result. Could we avoid this rule when the offset is also constant, so `const_ptradd_to_i2p` can fold the whole expression?
https://github.com/llvm/llvm-project/pull/222851
More information about the llvm-commits
mailing list