RKSimon wrote: collectLeaves can technically collect too many nested leaves - so we'd need to do some kind of bound check. In the meantime I can split the m_ReassociatableAdd / m_ReassociatableAnd pairs in #169644 https://github.com/llvm/llvm-project/pull/170061