[llvm] [InstCombine] Combine `select(C0, select(C1, b, a), b)` -> `select(C0&!C1, a, b)` (PR #177410)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 12:57:41 PST 2026


https://github.com/dtcxzyw approved this pull request.

LGTM. Although this patch may introduce additional not instructions when the inner condition cannot be freely inverted, it is still profitable since the canonical form reduces the number of uses of the common value.

The only regression I found is https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3371#discussion_r2722785220. Perhaps we can decompose and/or trees and use `simplifySelectWithEquivalence` to get the simplified value. Feel free to take this if you are interested.


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


More information about the llvm-commits mailing list