Solves issue https://github.com/llvm/llvm-project/issues/63321.
This patch explicitly folds (-1 + A) & B into A ? 0 : B. Additional trunc will be created when A is neither i1 nor <N x i1>.
Differential D153148
[InstCombine] Fold `(-1 + A) & B` into `A ? 0 : B` where A is effectively a bool dtcxzyw on Jun 16 2023, 8:39 AM. Authored by
Details Solves issue https://github.com/llvm/llvm-project/issues/63321. This patch explicitly folds (-1 + A) & B into A ? 0 : B. Additional trunc will be created when A is neither i1 nor <N x i1>.
Diff Detail
Event Timeline
|
i1/!range {0,2} isn't really the necessary condition. The necessary condition is A is 0 or 1 which can be proven in a lot more cases.
Please also update the title/summary with this precondition of A being 0/1.