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

    <tr>
        <th>Summary</th>
        <td>
            [AArch64] Broken code generated calling a non-streaming function from a streaming function
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AArch64
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          efriedma-quic
      </td>
    </tr>
</table>

<pre>
    Consider something like the following:

```
#include <arm_sve.h>
#include <assert.h>
void __arm_tpidr2_save() {}
void __arm_tpidr2_restore() {}
svint32_t identity(svint32_t f) {
  return f;
}
__arm_locally_streaming
void f(void) {
 assert(identity(svdup_s32(1))[0] == svdup_s32(1)[0]);
}
int main() {
  f();
}
```

This builds and runs on qemu with the default vector lengths (I think it's 512-bit non-streaming/256-bit streaming), but the assertion fails.  We try to spill/restore across the call, but it doesn't work because the addressing is wrong: the meaning of a "mul vl" addressing mode changes when you smstart/smstop.

I'm not sure if this should be considered a code generation bug, or a missing diagnostic; it's not 100% clear what this construct is supposed to do.  But we shouldn't silently miscompile.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VF2PqzgM_TXpizUVmFLgoQ_T261031faxyokBrITkt44adV_vwp0dmZ27kqIpv7IsY8PlsxmdEQHUR9FfdrIFCcfDjQEQ3qWL7-SUZve68fhh3dsNAVgP1OcjBvBmjeCOBEM3lp_N24U1asoTqJ4f--L57P-xco4ZZMmENUPGeYL32g7ieqP3_qZKcRP7ps3Gi6XnBevRge8sLyRwFZgB6I5iub0f4GBOPrwu1i-GRcrvEQwmlw08SGw_TAO7_FLMECgmIKDQVRP078XrXjWK2nt48IxkJwzIx8VDQLbfPh65dqmwPYLvk7XC1cosC0Fdvmpj4WoTyCqk6hO8C1idefTt8qMizBL4z51_-xmWE3fU_47uOX952QY-mSsZpBOQ0iOwTv4RXOCu4nTogVNg0w2wo1U9AEsuTFODALbn5Bl8wYmCmwY6hJfehPBeffyQReesd4v9k-2TuAP6FNcAFbCjHcwSGN5C_AXQQwPiB74aqwVeH7OG6QKnnlJy3N5v8ZE0J7YCWwi3H14g56UTLyqWWodiDkr3DDcg190vbhmki7b_QASBOKcLNysQPycNHtNoCbpRmK4T-Tg4RPwzFHmQZ_zyV-3n6n9KbCZwfkInAKBGTJVDDz5ZDX0BOr59ZEGCSoDjOQoyIWHPo25Mx9AwmzWIrSRo_McjRLV8Z3yDFAWhcAalCUZ4D7JuEJlgBiSirlnTterZ9KZUu23AMcU4U7Pelba2Fhy0T4yovLz1VjabvSh0l3VyQ0dyn3XdnXR7JvNdGh3fVMOVOtOqwrbfYO0x67sqGnLQWm9MQcssCrLAst2ty-ardw1TT3ormraYid1L3YFzdLYrbW3eevDuDHMiQ5NWXTVxsqeLC9LDLGX6o2cFtXr62tQ034nEPNuC4ec-9KnkcWusIYjf9wWTbTLFnzPqU9wDP6N3Be6SS9CygzLr8qFITm1yjL4GSR892xSsIcpxivnPYlngefRxCn1W-VngedczPPn5Rr836SyXJY-WeB5afWfAAAA__8M0c-v">