llvm-project
llvm-project copied to clipboard
Missed fcmp(frem, inf) => false
For the IR pattern:
define i1 @test_frem_fcmp_inf(double %a, double %b) {
entry:
%rem = frem double %a, %b
%is.inf = fcmp oeq double %rem, 0x7FF0000000000000 ; INF
ret i1 %is.inf
}
Since the frem will never return an inf, so it can be optimized into a constant false return as follows:
define i1 @test_frem_fcmp_inf(double %a, double %b) {
entry:
ret i1 false
}
Currently the LLVM just missed this potential optimization by simply leaving it as is: https://godbolt.org/z/PKfT5M8TY.
The alive2 at Compiler Explorer timed out, so I ran alive2 locally (takes 3m42s):
I already have a fix for that. Please assign it to me.