[llvm] [GlobalISel] Combine (X == 0) & (Y == 0) -> (X | Y) == 0 (PR #71949)
Dávid Ferenc Szabó via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 26 09:29:15 PST 2024
================
@@ -945,6 +945,37 @@ def redundant_binop_in_equality : GICombineRule<
[{ return Helper.matchRedundantBinOpInEquality(*${root}, ${info}); }]),
(apply [{ Helper.applyBuildFn(*${root}, ${info}); }])>;
+// Transform: (X == 0 & Y == 0) -> (X | Y) == 0
+def double_icmp_zero_and_combine: GICombineRule<
+ (defs root:$root),
+ (match (G_ICMP $d1, $p, $s1, 0),
+ (G_ICMP $d2, $p, $s2, 0),
+ (G_AND $root, $d1, $d2),
+ [{ return ${p}.getPredicate() == CmpInst::ICMP_EQ &&
+ !MRI.getType(${s1}.getReg()).isPointer() &&
+ (MRI.getType(${s1}.getReg()) ==
+ MRI.getType(${s2}.getReg())); }]),
----------------
dfszabo wrote:
I got this error when using it
`error: GISpecialType is not supported in 'match' patterns`
Maybe its only usable in the `apply` part atm.
https://github.com/llvm/llvm-project/pull/71949
More information about the llvm-commits
mailing list