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

    <tr>
        <th>Summary</th>
        <td>
            [llvm-exegesis] Segfault near virtual address space ceiling when writing to rsp
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            tools:llvm-exegesis
      </td>
    </tr>

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

    <tr>
      <th>Reporter</th>
      <td>
          boomanaiden154
      </td>
    </tr>
</table>

<pre>
    Take the following snippet:
```asm
# LLVM-EXEGESIS-DEFREG RAX 12345600
# LLVM-EXEGESIS-DEFREG RCX 12345600
# LLVM-EXEGESIS-DEFREG RDX 12345600
# LLVM-EXEGESIS-DEFREG RSI 12345600
# LLVM-EXEGESIS-DEFREG RDI 12345600
# LLVM-EXEGESIS-DEFREG R8 12345600
# LLVM-EXEGESIS-DEFREG R9 12345600
# LLVM-EXEGESIS-DEFREG R10 12345600
# LLVM-EXEGESIS-DEFREG R11 12345600
# LLVM-EXEGESIS-DEFREG RBX 12345600
# LLVM-EXEGESIS-DEFREG R14 12345600
# LLVM-EXEGESIS-DEFREG R15 12345600
# LLVM-EXEGESIS-DEFREG R12 12345600
# LLVM-EXEGESIS-DEFREG R13 12345600
# LLVM-EXEGESIS-DEFREG RBP 12345600
# LLVM-EXEGESIS-DEFREG RSP 12345600
# LLVM-EXEGESIS-DEFREG RIP 12345600
# LLVM-EXEGESIS-DEFREG XMM0 12345600
# LLVM-EXEGESIS-DEFREG XMM1 12345600
# LLVM-EXEGESIS-DEFREG XMM2 12345600
# LLVM-EXEGESIS-DEFREG XMM3 12345600
# LLVM-EXEGESIS-DEFREG XMM4 12345600
# LLVM-EXEGESIS-DEFREG XMM5 12345600
# LLVM-EXEGESIS-DEFREG XMM6 12345600
# LLVM-EXEGESIS-DEFREG XMM7 12345600
# LLVM-EXEGESIS-DEFREG XMM8 12345600
# LLVM-EXEGESIS-DEFREG XMM9 12345600
# LLVM-EXEGESIS-DEFREG XMM10 12345600
# LLVM-EXEGESIS-DEFREG XMM11 12345600
# LLVM-EXEGESIS-DEFREG XMM12 12345600
# LLVM-EXEGESIS-DEFREG XMM13 12345600
# LLVM-EXEGESIS-DEFREG XMM14 12345600
# LLVM-EXEGESIS-DEFREG XMM15 12345600
# LLVM-EXEGESIS-MEM-DEF MEM 4096 12345600
# LLVM-EXEGESIS-MEM-MAP MEM 305418240
        movq    (%rdx), %r9
        movq    8(%rdx), %r10
        leaq    16(%rsp), %rdi
 movq    16(%rdx), %rax
        movq    24(%rdx), %rdx
        movq %rdi, 8(%rsp)
        movq    %r9, 16(%rsp)
        movq    %r10, 24(%rsp)
        movq    %rax, 32(%rsp)
        movq    %rdx, 40(%rsp)
```

Executing this with the following command:
```shell
llvm-exegesis -mode=latency -snippets-file=%s -execution-mode=subprocess
```

Shows a segmentation fault very high in the virtual address space:
```
error:           The snippet encountered a segmentation fault at address 7ffffffff008
```

This seems to indicate that the stack pointer register is never getting reset after it is used to setup the vector registers. More investigation is needed though.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlt9v2yoUx_8a8nKUCOMfSR780DXJVGlI01pd-RWbE5s72_gCTtv__grHzdY2W6lV1QE-nF9fkI-wVtU9Yk7SL4SxUutO9EJJ7KM0IYyRdLcQo2u0yV-vLUotn_MH8RPBNQhH3bb6UfU12F4NAzoS3xC6I_SGZPT8J2w3z7AYvn37hy_3xf7r_v7ufrnbH37sv8KPmwIiFidpRulH6G04ugtH7-_CrYajm2ByG0xGNByNgtEv4aWKknA0DUdZOBqHp_U9_ASEo3fBaMF5sFwF58F6FZwH16vgPLhgBefB6hacB8tbcJ59gl1_gg2-YwXnwbfMa_Ep4T6jXPhR9_BntAu_mh7-WD2-534D8D2HhG4_ltBv4Dffpw0xTZNow5IZhvnp9Ok__yZsQ1hq5BNhW8JuwQ-219HNNTZ6Y7dFMcFRNtN2-I2WaqZfbF6w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