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

    <tr>
        <th>Summary</th>
        <td>
            Implement inline __security_check_cookie call pass for AArch64 Windows
        </td>
    </tr>

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

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

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

<pre>
    The __security_check_cookie function is inserted into functions to protect against stack buffer overflows. However, the function call incurs overhead as it is a runtime library call, even though it often performs a simple comparison and returns. 

#95904  implements a pass for x86/Windows that addresses this by inlining the comparison and deferring the library call to a failure path, which reduces overhead in the common case. This issue proposes to implement similar pass for AArch64 that will inline the comparison of the __security_cookie value directly into the function.

I have conducted a SPEC 2017 benchmark run using clang-cl on Windows AArch64 comparing default behavior (/GS, with security checks enabled) with the security check cookie disabled (/GS-). Benchmarks with /GS- (No GS) typically performed slightly better than their /GS counterparts, but the differences are relatively small in most cases. However benchmarks like 511_povray_r and 641_leela_s demonstrate significantly better performance with /GS-, possibly due to the high frequency of stack operations in their workloads.

I am writing a patch for AArch64 Windows and will compare its impact on SPEC 2017 result and will share with audience here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VNGu4jYQ_ZrwMrooMXAXHvJw97a0-1JV2pX6iCb2BM_i2KnHhvL3lRO4sFtVQkKJJ-Nzzpw5KMJHT9RWm8-VUmH4jmdkUylVbX5ZYE42xPb-dtEFc22_WYLDQUjnyOl60Jb06aBDODFBn71OHDywAHuhmMgA-xQ-TgRSgDGGRDoBHpG9JJCE-gRd7nuKEM4UexcusoTfw4XOFCv1Dsk-ddfoHLDXOcpUbgkNoACncjFCzD7xQOC4ixivU31pQmfykGzIR1tqQ5_Iw0ixD3Eo3wkPoyPQYRgxsgQP6A1ESjl6WUJVv5WfWu02u3o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