[llvm] [ValueTracking] Support trunc nuw condition in isImpliedCondition (PR #141528)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon May 26 20:09:13 PDT 2025


https://github.com/dtcxzyw approved this pull request.

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
}
```


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


More information about the llvm-commits mailing list