[llvm] [InstCombine] Canonicalize `(sitofp x)` -> `(uitofp x)` if `x >= 0` (PR #82404)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 01:54:35 PST 2024


dtcxzyw wrote:

Regression:
```
define float @src(i32 %shr.i) {
  %and.i = and i32 %shr.i, 32767
  %sub = uitofp i32 %and.i to float
  %add = fadd float %sub, -16383.0
  ret float %add
}

define float @tgt(i32 %shr.i) {
  %and.i = and i32 %shr.i, 32767
  %addconv = add nsw i32 %and.i, -16383
  %sub = sitofp i32 %addconv to float
  ret float %sub
}
```

Alive2: https://alive2.llvm.org/ce/z/W6Ik5C

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


More information about the llvm-commits mailing list