[llvm] [DAG] Recognise AVGFLOOR (((A >> 1) + (B >> 1)) + (A & B & 1)) patterns (PR #169644)

Artur Bermond Torres via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 13:03:48 PST 2025


bermondd wrote:

I'll start working to make this more efficient tonight. These measures look pretty bad.

As this is a compile time impact, my first guess is that the template recursion that was done may bear some of the fault here. The number of functions instantiated grows linearly with the number of patterns provided, so maybe a different approach where this isn't necessary could help.

That being said, I personally think reducing the scope of ReassociatableOpc_match to only 3 patterns wouldn't be the right approach. The struct tried to match any number of patterns since prior to this change, so reducing the domain could break any usages that involved 4 or more, if there are any.

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


More information about the llvm-commits mailing list