diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-07-21 06:52:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-21 06:52:27 +0200 |
| commit | c022c81ece9b205eb2921e5cda8d514f40c74a7c (patch) | |
| tree | c0f775df4d3b237cf511da041b20c42a44ec3165 /tests/codegen/patchable-function-entry | |
| parent | f2dded27f828ba02f76b1b714b3ab2361d4e003e (diff) | |
| parent | 2c0c87d9592d68b0cad47af9882f8bb6363187fa (diff) | |
| download | rust-c022c81ece9b205eb2921e5cda8d514f40c74a7c.tar.gz rust-c022c81ece9b205eb2921e5cda8d514f40c74a7c.zip | |
Rollup merge of #113723 - khei4:khei4/llvm-stats, r=oli-obk,nikic
Resurrect: rustc_llvm: Add a -Z `print-codegen-stats` option to expose LLVM statistics.
This resurrects PR https://github.com/rust-lang/rust/pull/104000, which has sat idle for a while. And I want to see the effect of stack-move optimizations on LLVM (like https://reviews.llvm.org/D153453) :).
I have applied the changes requested by `@oli-obk` and `@nagisa` https://github.com/rust-lang/rust/pull/104000#discussion_r1014625377 and https://github.com/rust-lang/rust/pull/104000#discussion_r1014642482 in the latest commits.
r? `@oli-obk`
-----
LLVM has a neat [statistics](https://llvm.org/docs/ProgrammersManual.html#the-statistic-class-stats-option) feature that tracks how often optimizations kick in. It's very handy for optimization work. Since we expose the LLVM pass timings, I thought it made sense to expose the LLVM statistics too.
-----
(Edit: fix broken link
(Edit2: fix segmentation fault and use malloc
If `rustc` is built with
```toml
[llvm]
assertions = true
```
Then you can see like
```
rustc +stage1 -Z print-codegen-stats -C opt-level=3 tmp.rs
===-------------------------------------------------------------------------===
... Statistics Collected ...
===-------------------------------------------------------------------------===
3 aa - Number of MayAlias results
193 aa - Number of MustAlias results
531 aa - Number of NoAlias results
...
```
And the current default build emits only
```
$ rustc +stage1 -Z print-codegen-stats -C opt-level=3 tmp.rs
===-------------------------------------------------------------------------===
... Statistics Collected ...
===-------------------------------------------------------------------------===
$
```
This might be better to emit the message to tell assertion flag necessity, but now I can't find how to do that...
Diffstat (limited to 'tests/codegen/patchable-function-entry')
0 files changed, 0 insertions, 0 deletions
