[llvm] [InstCombine] Reassociate commutative binops over select/phi/minmax (PR #187493)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 15 09:22:53 PDT 2026


dtcxzyw wrote:

> > The commuted pattern should be covered
> 
> Right, that's what I mean when talking about the generality of this patch. It's not very clean to do each of these patterns individually.

We have to duplicate the logic in SimplifyAssociativeOrCommutative.

> What do you think about this? [#187493 (comment)](https://github.com/llvm/llvm-project/pull/187493#issuecomment-4207618493)

Modifying flags/operands is also treated as creating a new instruction. Only those transformations that can be done in a single RAUW are suitable for InstSimplify.


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


More information about the llvm-commits mailing list