[llvm] [GlobalISel] Combine (X == 0) & (Y == 0) -> (X | Y) == 0 (PR #69017)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 15 22:39:44 PDT 2023


Pierre-vh wrote:

> > Can you try doing this with the new tablegen combiner support?
> 
> Good idea, but for the reason @aemerson mentioned it does not seem feasible.

You can mix MIR patterns and C++. You can do most of the matching with MIR patterns, have an "out" pattern as well, and just use a smaller C++ function to verify the more complex matching predicates.
You'd need two rules though, one for AND and one for OR, since the output inst is different for each. Also I'm not sure how ICMP works yet with MIR patterns, I'll need to take a look at that.

Can you try that approach and if it proves impossible or just too annoying, let me know your thoughts? It'd help a lot :)

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


More information about the llvm-commits mailing list