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

    <tr>
        <th>Summary</th>
        <td>
            compile time regression introduced by Sema checking for __builtin_counted_by_ref
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang:bounds-safety
      </td>
    </tr>

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

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

<pre>
    As reported by @nikic 
https://github.com/llvm/llvm-project/pull/114495#issuecomment-2464318302

This is likely because the checks are currently implemented to walk through the whole child nodes for every single assignments. We may be able to remove the overhead by rolling up the information about usage of `counted_by` or `__builtin_counted_by_ref` to the assignment, instead of re-visiting child nodes.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkruO4zgQRb-GSgo2KOrRVqDAuw3_wC4wocFHSaoxRQp8uKG_H1DuRk8ywSQSQLJu3bp1ZIw0O8SRdf8wIYLcyEQnmRCse69kTosP49dppbzZx2uEgJsPCQ2oHVjLHT1IA-PvjF-XlLbImisTNyZuM6Ulq7P2KxM3a59fv9MW_E_UiYnblq1l4lbXbTt0TDQUY0bt1xVdOom2b5v60nDxUn99_18oAkWw9EC7g0Itc0RIC4JeUD8iyICgcwjokt2B1s1i0UMDycOHtA9IS_B5Xo6ij8XbUkrWgPMGI0w-AD4x7BDJzRbhlVPRiGf4gbDK0hekslgkA67--XLgnxgWlEc2wVtLboa8HVfkJh9Wmcg7kMrnBDnKGcFPwHqufS4O72pnPQcfytn9rjLZRO7-fXsPOJUXyR-i386Y-BfIxVSa-wkCnp4UKRUDv812rszYmKEZZIVj_dbU_PImeFctIzed7GTfq8vQG23aVta9mAZjmkEPbdtXNAou2rrml_qtaUR3VpdJ86kzBtVFKilYy3GVZM9lx2cf5urY5ljXXSd4ZaVCGz9R01a6mTVX5bMz8RTlhGn_5C6MByQqz5G13FJM8VsyUbI4ar9uVMKnFSHgHDDGkiu5FLzJ-gXnf7jKFxMlhbLVPyVa5WDHv4b3GC8e-B4TPkfxKwAA__-xFyC7">