[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

Guy David via cfe-commits cfe-commits at lists.llvm.org
Sun May 4 06:58:00 PDT 2025


guy-david wrote:

Comparison between latest Clang and GCC's output for a snippet out of a benchmark that could use this optimization: https://godbolt.org/z/35EEvcsPr.

I've ran llvm-test-suite ten times for the before and after, it executed correctly and expectedly saw no performance gains:
```
Tests: 3326
Metric: exec_time

           exec_time                            
l/r              lhs            rhs         diff
count  3326.000000    3326.000000    1554.000000
mean   885.285851     885.132328     inf        
std    20163.199507   20160.504672  NaN         
min    0.000000       0.000000      -1.000000   
25%    0.000000       0.000000      -0.004020   
50%    0.000000       0.000000       0.000000   
75%    1.741165       1.840265       0.003943   
max    802971.672414  802823.530425  inf
```

Also built a bootstrap build and confirmed that `ninja stage2-check-all` passes successfully, except for a few libcxx benchmarks that seem to fail regardless.

https://github.com/llvm/llvm-project/pull/136792


More information about the cfe-commits mailing list