[llvm] [CVP]: Fold `icmp eq X, C` to `trunc X to i1` if C=2k+1 and X in [2k, 2k+1] (PR #83829)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 9 01:05:58 PST 2024


nikic wrote:

> FYI, `trunc X to i1` will be canonicalized into `(X & 1) != 0`. godbolt: https://godbolt.org/z/cMv6K8qKd

Relevant fold seems to be: https://github.com/llvm/llvm-project/blob/a84e66a92d7b97f68aa3ae7d2c5839f3fb0d291d/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp#L737-L745

Quite the unusual choice, probably worth trying to remove.

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


More information about the llvm-commits mailing list