Issue 237812
Summary [InstSimplify] Redundant infinity comparison is not folded into range comparison
Labels new issue
Assignees
Reporter and2049
    The infinity comparison below is redundant, but both comparisons remain after InstCombine.

Reproducer:
```llvm
define i1 @test(double %x) {
  %a = fcmp ueq double %x, 0x7FF0000000000000
  %b = fcmp ugt double %x, 1.0
  %r = or i1 %a, %b
  ret i1 %r
}
```

```sh
opt -passes=instcombine -S test.ll
```

The function is unchanged apart from constant formatting.

Expected:
```llvm
define i1 @test(double %x) {
  %r = fcmp ugt double %x, 1.0
  ret i1 %r
}
```

Whenever `%a` is true, `%x` is either positive infinity or NaN, both of which already make `%b` true. No fast-math flags are required.

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

Reproduced on LLVM 24.0.0git.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to