<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62437>62437</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
WRONG code with -unroll-allow-loop-nests-peeling
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
JonPsson
</td>
</tr>
</table>
<pre>
clang -O3 -march=arch13 wrong0.i -o a.out -w; ./a.out
3
clang -O0 -march=arch13 wrong0.i -o a.out -w; ./a.out
3
clang -O3 -march=arch13 wrong0.i -o a.out -w -fno-inline -mllvm -unroll-allow-loop-nests-peeling; ./a.out
0
[testcase.tar.gz](https://github.com/llvm/llvm-project/files/11356750/testcase.tar.gz)
```
wrong0.i:
int printf(const char *, ...);
char a, b, c;
short d;
int e, f, g, h, i;
char(j)() { return a; }
int k(int l) {
b = 0;
for (;; ++b) {
int m;
if (b) {
h = e = c = j();
i = d = 0;
for (; d; d++)
;
return l;
}
f = 0;
for (; f; f++)
;
}
}
int main() {
g = k(3);
printf("%d\n", g);
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVMGO4ygQ_ZrypWQLF3HiHHzodJSV9rC92suesY1teghEgCea-foRJJ3E3S3NjDRW9AhU1XvPBVh4r0YjZQPVDqp9JuYwWdf8bc2_3luTtbb_1nRamBHzF475UbhuAr6PQ8nx7KwZWaEwtygKOwfMz8B3WAAd0hzYHtgTvwwXfGNjf5Tt17xhPhibK6OVkZgftf56xHw2zmqdC63tOdfWnnIjffD5SUqtzPiJA_boAKpdkD50wssiCFeM36HaA9VTCCcP_AnoAHQYVZjmtujsEegQda9DfnL2VXYB6DAoLT3QoSx5td5UDOjwnpi2C-U1u_7S9O2Fo2ZaUCbgySkTBqC6s8YH7CbhEOgJ6BmLooiEfHftZAyJGGgjdLeAn6wL2N_mkVbGlCHCGGGKoBZUQPVrpKcaaIuw2aGTYXYGRWwobPZ3si9AdRz1NfMSQWwR-B7ZjRZxsNF9HVciCe2Adu27KsTIdXyoQlRDLPuYiTglDZmwS_h6sbyoR1Qp1n9wFJ-7q9Ql7C_GbruF1-dd2bUferF8a0wi_kTuQWy4wGdiDyU3xkXPj0KZ-9685Y5JMO4HX7bgdoyACKjqoXo26W86APfMu9jybGZ9w_st34pMNuW6pk3J-KbOpqbtK8mHtixlWTIhRb9t-YaLmjiT2zXvM9UQI85WVJdbTlVdcCarnq9kS10v12UHKyaPQukiXqfCujFT3s-yWdOKbzItWql9-rwRGXnGFIzWq33mmnQF23n0sGJa-eDvLEEFLZv__3v55y_sbC_xrML0069FNjvd_PbVT6bi3U-mfwQAAP__oaeD3A">