[llvm] [DAG] SDPatternMatch - Fix m_Reassociatable mismatching (PR #170061)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 10 10:56:34 PST 2025
mshockwave wrote:
> Looking at this again due to the compile time increase reported on #169644 - since NumPatterns is known at compile time, maybe we should be trying harder to avoid runtime data structures?
>
> ```
> SmallVector<SDValue> Leaves; -> std::array<SDValue, NumPatterns>
> SmallBitVector -> llvm::Bitset<NumPatterns>
> ```
I think it's a good idea. I somehow had a wrong impression that the number of leaves might be larger than the number of patterns.
Another potential cause is that the worst time complexity now becomes `O(n!)`, and given the use cases in #169644 which nested two m_Reassociatable patterns, we might experience even higher time complexity -- about `O((n!)^2)`? -- in the worst case
https://github.com/llvm/llvm-project/pull/170061
More information about the llvm-commits
mailing list