[llvm] [InstCombine] Enable folding of (select C, (x bin_op a), x) bin_op b -> x bin_op select C, (a bin_op b), b (PR #172662)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 21 00:46:38 PST 2025


https://github.com/nikic commented:

Do I understand correctly that this folds `op (select (op))` to `select (op (op))` and then relies on it getting folded to `select (op')` before the undo transform can convert it into the original form again? This seems quite fragile, as it relies on the precise worklist order to avoid infinite loops.

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


More information about the llvm-commits mailing list