rust/compiler/rustc_codegen_llvm/src
Matthias Krüger 2734b5ada9
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...
2023-07-21 06:52:27 +02:00
..
back Auto merge of #112591 - jfgoog:better-dlltool-diagnostics, r=WaffleLapkin 2023-07-19 07:27:50 +00:00
coverageinfo Auto merge of #113430 - Zalathar:hash, r=b-naber 2023-07-16 01:56:23 +00:00
debuginfo refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
llvm address feedback from nikic and oli-obk https://github.com/rust-lang/rust/pull/113723/files 2023-07-20 16:53:06 +09:00
abi.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
allocator.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
asm.rs Rollup merge of #111332 - loongarch-rs:inline-asm, r=Amanieu 2023-05-08 19:41:51 +09:00
attributes.rs Add the no-builtins attribute to functions when no_builtins is applied at the crate level. 2023-07-18 22:15:47 +08:00
base.rs Introduce MonoItemData. 2023-07-17 08:44:48 +10:00
builder.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
callee.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
common.rs Reuse LLVMConstInBoundsGEP2 2023-07-10 00:20:56 -07:00
consts.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
context.rs Revert "use new c literals instead of cstr! macro" 2023-07-05 13:11:27 +02:00
declare.rs CFI: Fix SIGILL reached via trait objects 2023-05-09 20:04:19 +00:00
errors.rs Better diagnostics for dlltool errors. 2023-07-17 20:20:01 +00:00
intrinsic.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
lib.rs address feedback from nikic and oli-obk https://github.com/rust-lang/rust/pull/113723/files 2023-07-20 16:53:06 +09:00
llvm_util.rs rustc_llvm: Add a -Z print-llvm-stats option to expose LLVM statistics. 2023-07-16 22:56:04 +09:00
mono_item.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
type_.rs add wasm eh intrinsics 2023-06-07 17:46:34 +02:00
type_of.rs refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
va_arg.rs Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
value.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00