<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62783>62783</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Redundant check of pointer when operator delete is called
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hiraditya
</td>
</tr>
</table>
<pre>
Testcase:
```cpp
void if_delete(char *p) {
if (p) {
delete(p);
}
}```
$ clang++ -O3 -fno-exceptions
```asm
if_delete(char*): # @if_delete(char*)
test rdi, rdi
jne operator delete(void*)@PLT # TAILCALL
ret
```
I've opened a similar issue opened with gcc a while back: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87628
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0kk9r4zwQxj_N-DIkOCP_y8GHpMFQCLwvS-9Flsa2WsU2ktxs99MvdrJtk-0K44EZaZ7nJ4303rQ9cwnpHtJDJKfQDa7sjJPahHcZ1YN-L5_YByU9g9hBfID4zz-LL58ax0vmbTAaTfOs2XJgoEJ10iHQbgTaIuT7yzZERNMgUPF3fl4fx-cyiC9VyA9X7fzwIX_jiRJUVvYt0B5oj6v_BK6afljxT8VjMEPvv0WQ_nTJ3LsH2i0mdggkEJL4HxtuAAL7MEenDdDDEm7qLz0vcRjZyTC4T-L5Bq8dk_j_4xN-u2YrT7vH48PueLx2dhzukL5yPgLlbzzr9axRojcnY6VD4_30kT6b0GGrFEo8d8Yy1lK9zuRdCKOfH58qoKpVat3203pwLVBVT-0vY60Eqnw3nJ_rqV2r1oCojAZxKPKMikiXQm_FVkZcbrIiEUm2oSTqylzUIkuF5m0hap3GclPEeZFuqWnyrFZNZEqKScTpJt_kaUrJukhrUW_jrE4yyWkhIYn5JI1dW_t2mi1FC1KZUV6IyMqarV-Gm6jn84UXiOZZd-V8ZlVPrYcktsYH_9klmGC5_MF66rXsA6qO1SsODY6D6QM7PHfc378fGo9KWss6mpwt767NhG6q12o4AVWzzjWsRje8sApA1eLOA1WL-98BAAD__5QICkw">