[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)

Gábor Spaits via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 20 09:52:57 PST 2025


spaits wrote:

@dtcxzyw Sorry for the inconvenience, but I have found another infinite loop. It was with the `rem` operators. For this PR I would like to disable `rem` and `div` optimizations.

Even when writing the tests for `div` I had some concerns performance wise: https://github.com/llvm/llvm-project/pull/172662/commits/ffdf972d46bcc65083754372fb0a9b7ce755ec8b#diff-3532c6b4d0a5a20dbd03cf4e5033379e67b45d491db84f45d58fa280372467d1R1211

So I will rethink these divison related operators later in another PR.
I will continue with the testing of all binary operators other than `div`s and `rem`s (they are still there as negative tests).

Could you please take a look at the PR again when you have time?

Sorry for the inconvenience and thank you for your time and effort!

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


More information about the llvm-commits mailing list