[llvm] [GlobalISel] Optimized MatchData Handling (PR #92115)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 08:12:36 PDT 2024


Pierre-vh wrote:

> One related thing I have never understood is, why is every combine split into a "match" function and an "apply" function? Aren't they always effectively called in tandem like this:
> 
> ```
>   if (matchFunc(MatchData))
>     applyFunc(MatchData);
> ```
> 
> ? Is there a use case for calling "match" without "apply"?

Matchers can fail/reject after doing further analysis (e.g. calling KnowBits), so the matcher is like an analysis part and the apply is the actual transform.

We can also have C++ matcher but then have the apply written in C++. Not sure if we have any combine doing that but it's something that's definitely possible

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


More information about the llvm-commits mailing list