<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64595>64595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Redundant infinity check on sqrt not folded away
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:optimizations,
floating-point
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
arsenm
</td>
</tr>
</table>
<pre>
test/CodeGen/AMDGPU/fsqrt.ll has this test:
```
; FUNC-LABEL: {{^}}elim_redun_check_ult:
; GCN: v_sqrt_f32_e32
; GCN-NOT: v_cndmask
define amdgpu_kernel void @elim_redun_check_ult(ptr addrspace(1) %out, float %in) {
entry:
%sqrt = call float @llvm.sqrt.f32(float %in)
%cmp = fcmp ult float %in, -0.000000e+00
%res = select i1 %cmp, float 0x7FF8000000000000, float %sqrt
store float %res, ptr addrspace(1) %out
ret void
}
```
We remove this pointless check for a negative input on sqrt in codegen, when it should have been done in instcombine. This is probably a leftover from when llvm.sqrt tried to avoid defining the negative input behavior
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8VFGP4yYQ_jX4ZZSIQBw7D35I4vO-XLdVdac-RtiMbboYXMC-pr--gmRvd6tVEcLGM9_M8H2DhfdqMIgVyc8krzOxhNG6SjiPZspaK29VQB8Iay5W4hMawprTL_XTb98Ja3r_lwtbrWEUHsKoPCRffiK0JvR1PdDHvG_5GZrvz5fN19P5y1fCT0CKc5z5F1LUpKhRq-nqUC7m2o3YvVwX_S4kP8PT5TnC1mvMfu05uyJnH8yb51-_3V06IyfhX-5Wib0yCGKSw7xcX9AZ1LBaJYHs6adpWTkHB0JK52fRIWHljrAjEJbbJRB2gV5bEeJemWQozvdUaIK7_aw6OsRigfAaOqH1K25PtV6nbaKx54yw8mPABzzuu2lO8D6-LDp8TH2BDd3SNJCwM6XvkA59QnrU2AVQu0e4t_rp30XTlPTd-HC2WN5rPB-swzeTQx9d_4-lB9BhSFw_hCrqz7sjrX8gOJzsivemmq0yQaP3kJSB3joQYHAQQa0IysxLAGsgUawMdFbigImVHyMaUAH8aBctYRQrQotoQFoTkaCMD52dWmVwC99itpjQ2Va0-gYCNPbBruigd3a6h_spGQSnUEKwIFIXpf5SZoAw4n_La3EUq7IukxWXR34UGVa7w3F3KPYlLbOxOnIudnvaCdkfDkLmHZe87QRKhruOlmWmKkYZp-WO7vie0nJ7KHOk8tiyouxbzg-xiSeh9DYVaN2QKe8XrA77_JhnWrSofbrmjEUPwk92DmpS_4igrPGEMcIuhLEkrjLDJvEeP-d15qqI2bTL4GPXKh_8W56ggsbq93h5pDBRg0hEuD30epXG2AC91RIliB_ili1OV2MIs48XhTWENYMK49JuOzsR1qQi74_N7Oyf2MXfUDqTJ6xJx_o3AAD__yAOe4Y">