wangpc-pp wrote: Have you tried https://github.com/llvm/llvm-project/pull/77461 yet? I don't mean my solution is better, but it seems to save the logic to decide whether the pair can be fused. I can rework it if you like. https://github.com/llvm/llvm-project/pull/123860