<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153991>153991</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missed optimization: fold x*a == b -> x == b/a
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zxt5
</td>
</tr>
</table>
<pre>
```
define i1 @src(i64 %arg0, ptr %arg1) {
%v0 = getelementptr inbounds nuw float, ptr %arg1, i64 %arg0
%v1 = load float, ptr %v0, align 4
%v2 = fmul nsz float %v1, 5.000000e-01
%v3 = fcmp nsz olt float %v2, 8.000000e+00
ret i1 %v3
}
define i1 @tgt(i64 %arg0, ptr %arg1) {
%v0 = getelementptr inbounds nuw float, ptr %arg1, i64 %arg0
%v1 = load float, ptr %v0, align 4
%v2 = fcmp nsz olt float %v1, 1.600000e+01
ret i1 %v2
}
```
Alive2: https://alive2.llvm.org/ce/z/LcL7YT
Godbolt: https://godbolt.org/z/WPMbTh7GP
Pattern found in https://github.com/dtcxzyw/llvm-opt-benchmark/blob/main/bench/ffmpeg/optimized/af_arnndn.ll
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMk8tuozwUgJ_msLES2QcMYcGCtj_dtFIXlX7NamSwIZ4xNsImTfP0I5M0rdrRaJaDEJIv37l82MJ7PVilKuA3wO8SsYS9m6vTMfCkdfK1gpxeXlpL1WuriGYEMurnDnCn84wAcjEPFPCWTGG-DBlgSaC4AVrHmQMlkN6RQQVl1KhsiDu1bd1ipSd2eSG9cSJ8iXFLPmagNVmDsTWYcUJ-wQ5rHcLowZLsCuAK9ONiiPWnM3SOFHfzLV0ftaHsiqRnpBunFXEmfMAwYrs3DPCGnoubVVj1RB5oDcVd_H4yF4bwt-b-HXW_97CmYdv83QP77AHfPXw4SkDr2uiDQkhrsg9h8pDWgA1gI9b5rTGHcevmAbDpFGBzAmweuofi2zPQ-t7J1pnwFR7OCxcwMv8_PbbP--L-6Zz1SYSgZkv6qI9o-5nXYb-0286NgI0M3fH0-gLYxGI2bgqbVtluP4r5J2DTGtcCNqPQNo7iCmDT9-OkYnI3BT3qk5Kxp_67mK2VdmsM0DqRVSrLtBSJqljBeUZpwYpkX_E8K2SXU8FTQXOOrOdFimWOGZclzdJEV0iR0x0raMp2abEtBWKvepYJxjueM8ioGoU2V3-J9n5RFeNpWbLEiFYZv952RKteyLoKiPHyz9XaZ7sMHjJqtA_-PUzQwajqUXuvJLn0JoJ2Nv6E3hlJjoC1iKclHpiWbCD9jxyv42ghWWZT_UF4TPZme5rdD9UFwGYt0QM2lx4OFf4KAAD___IeYOc">