<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/63366>63366</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [AArch64][SVE] Why does a minor difference in code affect the emitted code?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          k-arrows
      </td>
    </tr>
</table>

<pre>
    Consider the following two functions `foo` and `bar`.
```c
int foo(int a, const int n)
{
    for(int i=0;i<147;i++) a ^= n;
    return a;
}

int bar(int a, const int n)
{
    for(int i=0;i<149;i++) a ^= n;
    return a;
}

```

I would like to know why the code output for `foo` and the code output for `bar` are so different, when compiled with `-Ofast -march=armv8+sve`.
https://godbolt.org/z/KPfbPhPTz
```asm
foo(int, int):                               // @foo(int, int)
        eor     w0, w0, w1
        ret
bar(int, int):                               // @bar(int, int)
        cnth    x9
        mov     w10, #149 // =0x95
        sub     w8, w9, #1
        mov     z0.s, #0 // =0x0
        and     w8, w8, w10
        mov z1.d, z0.d
        eor     w10, w8, w10
        ptrue   p0.s, vl1
 mov     z1.s, p0/m, w0
        mov     z2.s, w1
.LBB1_1: // =>This Inner Loop Header: Depth=1
        subs w10, w10, w9
        eor     z1.d, z1.d, z2.d
        eor     z0.d, z0.d, z2.d
        b.ne    .LBB1_1
        eor     z0.d, z0.d, z1.d
 ptrue   p0.s
        eorv    s0, p0, z0.s
        fmov    w0, s0
.LBB1_3:                                // =>This Inner Loop Header: Depth=1
        eor     w0, w0, w1
        subs    w8, w8, #1
 b.ne    .LBB1_3
        ret
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVVGPozYQ_jWTl1GQsQMJDzxslo166kldqaf2sTLYBHfBjmyT3ObXV4aETXJJe-odQowx3wzffDO2uXNqq6XMIVlDUsx47xtj87c5t9Yc3Kw04j1_NtopIS36RmJt2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