[llvm] [ValueTracking] Support trunc nuw condition in isImpliedCondition (PR #141528)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Tue May 27 12:25:03 PDT 2025
andjo403 wrote:
> LGTM. Thank you!
>
> Can you have a look at the following more canonical pattern?
>
> Alive2: https://alive2.llvm.org/ce/z/SgMDwv
>
> ```
> define i1 @src(i8 %x, i1 %c) {
> %trunc = trunc nuw i8 %x to i1
> %cmp = icmp eq i8 %x, 0
> %sel11 = and i1 %cmp, %c ; <- select i1 %cmp, i1 %c, i1 false
> %sel2 = select i1 %trunc, i1 true, i1 %sel11
> ret i1 %sel2
> }
>
> define i1 @tgt(i8 %x, i1 %c) {
> %trunc = trunc nuw i8 %x to i1
> %sel2 = select i1 %trunc, i1 true, i1 %c
> ret i1 %sel2
> }
> ```
@dtcxzyw hade a look at this pattern and created a change for it but there is no improvements in llvm-opt-benchmark so it seems like it is not common.
https://github.com/llvm/llvm-project/pull/141528
More information about the llvm-commits
mailing list