[llvm] [InstCombine] fold `select (trunc nuw X to i1), X, Y` to `select (trunc nuw X to i1), 1, Y` (PR #105914)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 24 00:19:02 PDT 2024


nikic wrote:

> Note that the same transform also works for trunc nsw and -1, though that's probably less practically relevant.

There's also the variant where the trunc operand is used in FalseVal rather than TrueVal. In that case we can replace with zero.

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


More information about the llvm-commits mailing list