[llvm] [InstCombine] Fold `(trunc X)` into `X & Mask` inside `decomposeBitTestICmp` (PR #171195)

Tirthankar Mazumder via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 11 13:04:46 PST 2025


wermos wrote:

The test diffs I just pushed are all of the form `trunc i32 %x to i8` and then `icmp eq i8 %v1, %c` (where `%c` is small enough to fit inside an `i8` without overflowing).

I'm [attaching](https://alive2.llvm.org/ce/z/pBci7k) an Alive2 link for this transform for the `i32 -> i8` case, but I didn't bother writing a test for the `i128 -> i64`, `i64 -> i32`, and the `i32 -> i16` cases. I eyeballed them and the masks look correct to me.

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


More information about the llvm-commits mailing list