<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55342>55342</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
miscompile by arm64 backend
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AArch64,
llvm:codegen,
miscompilation
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
regehr
</td>
</tr>
</table>
<pre>
this function should return 1:
```llvm
define i32 @f() {
%1 = sub i8 -66, 0
%2 = icmp ugt i8 -31, %1
%3 = select i1 %2, i32 1, i32 0
ret i32 %3
}
```
however, the arm64 backend (in LLVM 14 and also top of tree) has it returning 0:
```
regehr@john-home:~$ ~/llvm-project/for-alive/bin/llc foo.ll -o - -march=aarch64
.text
.file "foo.ll"
.globl f // -- Begin function f
.p2align 2
.type f,@function
f: // @f
.cfi_startproc
// %bb.0:
mov w0, wzr
ret
.Lfunc_end0:
.size f, .Lfunc_end0-f
.cfi_endproc
// -- End function
.section ".note.GNU-stack","",@progbits
regehr@john-home:~$
```
cc @ornata @nunoplopes @ryan-berger @nbushehri @zhengyang92 @aqjune @Hatsunespica
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVM9zmzoQ_mvwZQcGBDjmwMFp2vcOaW_ttSPhBZQKiSeJpMlf35UgttNO--rxwGp_fbvfrhDm9Nz6UTroF915aTS40SzqBBb9YjUUSXlM8rskPyb7fP0r9TitqhP2UiPIkkFS5X3CDglrILm5Xc0ACasLSMo7cIsAeYB0v0_YO8iv7CzaZTfNsAw-OpVFcAqxV37lmgcVduRVxNDgFsCLV-GcmKpfy6LArfybu5_62I7xOZonfEQb8vgRgdtpX4Hg3TfUJ0pykBru7798hKICThqunAFvZjA9eIsY2h65A-k33qQeqJhfqFuPFgccLTH2YEadjmbC4HnzPmEVxNeHQHE6W_NAzdKxNzblSj4SzgchdXTooDcmUwpSAymkE7fdSAzx8N5Xr701mcfv_nLqpUJ6J4yt0SRcjIMyQpHQw59_hE9_SFO4xYGYOa9Of8k1Myp40CReAfjnOaDTorwL-7KFrfaeOPgf3LfwcePOqbtefnWeW0-sdZt682O1ENnVMPJmMo_0fMrDuJ9e7FlPs1vl7D4U95WG_yYuc_LltQG48kl_KoR0lzL-rqlrVt_Thr0lJ2LjpgjTy7TxmP3z6XNKTXffwhiJ0_BkK7mEPwjp3V9s3O9vRdcFlo3V3PMg6UWbWZkZXTjZZ65TgXZAG41icSOhyHB4GVEPZB-a-Gng_z0s9KEg6V_uHYlulh3fndry1JQN33npFbaTdJ2ZZlpREM9v7-BusaodvZ9dKDwyNUg_LiKjiO3C_HpvpHMLOhLquqzYbmy7RhzKvhG8LKpDLVjdsIJxfmiwKG6Kg9gpLlC5NqlvickNmxCPx_VWRXZpUizilcfOnIhZfdGfW-BxVqSv73ayZTljeZ03OcFW-ywvGoGVaOoSsWZ1RbzgxKXKQtrM2GFn29iKWAZHRiWddxcjd46uFmIsk_LzxY_GtuuQd7HpNnb8A2vJoZA">