-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output LLVM optimization remark kind in -Cremark
output
#111203
Conversation
For programmatic use, the serialized format is definitely way to go. It can be configured with @bors r+ |
I was trying to force LLVM to output the remarks to yaml using LLVM flags, but I was unable to do it. Even using Clang, the only options that worked were -Rpass-missed and -fsave-optimization-record, but these are Clang flags, not LLVM flags. It seems that currently it's not possible to tell rustc to output remarks to yaml. Could I add something like -Cremark-output= as a rustc flag? Or introduce some minisyntax to -Cremark to enable the serialized format? Or maybe we could do it through an environment variable? |
Sure, sound good in general. Of those variants a new flag (or more?) seem the most appropriate. |
Output LLVM optimization remark kind in `-Cremark` output Since rust-lang#90833, the optimization remark kind has not been printed. Therefore it wasn't possible to easily determine from the log (in a programmatic way) which remark kind was produced. I think that the most interesting remarks are the missed ones, which can lead users to some code optimization. Maybe we could also change the format closer to the "old" one: ``` note: optimization remark for tailcallelim at /checkout/src/libcore/num/mod.rs:1:0: marked this call a tail call candidate ``` I wanted to programatically parse the remarks so that they could work e.g. with https://github.com/OfekShilon/optview2. However, now that I think about it, probably the proper solution is to tell rustc to output them to YAML and then use the YAML as input for the opt remark visualization tools. The flag for enabling this does not seem to work though (rust-lang#96705 (comment)). Still I think that it's good to output the remark kind anyway, it's an important piece of information. r? `@tmiasko`
Output LLVM optimization remark kind in `-Cremark` output Since rust-lang#90833, the optimization remark kind has not been printed. Therefore it wasn't possible to easily determine from the log (in a programmatic way) which remark kind was produced. I think that the most interesting remarks are the missed ones, which can lead users to some code optimization. Maybe we could also change the format closer to the "old" one: ``` note: optimization remark for tailcallelim at /checkout/src/libcore/num/mod.rs:1:0: marked this call a tail call candidate ``` I wanted to programatically parse the remarks so that they could work e.g. with https://github.com/OfekShilon/optview2. However, now that I think about it, probably the proper solution is to tell rustc to output them to YAML and then use the YAML as input for the opt remark visualization tools. The flag for enabling this does not seem to work though (rust-lang#96705 (comment)). Still I think that it's good to output the remark kind anyway, it's an important piece of information. r? ``@tmiasko``
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#111002 (Fix the test directories suggested by `./x.py suggest`) - rust-lang#111077 (Make more ConstProp tests unit.) - rust-lang#111151 (check bootstrap scripts syntax) - rust-lang#111203 (Output LLVM optimization remark kind in `-Cremark` output) - rust-lang#111237 (asm: loongarch64: Implementation of clobber_abi) - rust-lang#111274 (Expand the LLVM coverage of `--print target-cpus`) - rust-lang#111289 (Check arguments length in trivial diagnostic lint) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Drive-by comment: use JSON, not YAML, for machine-produced and machine-read compile diagnostic outputs. If you wanted to output a human-editable configuration, TOML would fit with existing practice in Rust. |
So in general, I agree with your comment. However, there are existing visualization tools for these optimization remarks (e.g. optview), and these work with a specific YAML format which is produced by LLVM. Therefore, to reuse the existing LLVM logic, I need to use its format. Otherwise we would need to come up with a new, custom format, which also wouldn't be compatible with the existing visualization tools. Therefore, I think that it might be better to just reuse the format that is already produced by LLVM. |
Since #90833, the optimization remark kind has not been printed. Therefore it wasn't possible to easily determine from the log (in a programmatic way) which remark kind was produced. I think that the most interesting remarks are the missed ones, which can lead users to some code optimization.
Maybe we could also change the format closer to the "old" one:
I wanted to programatically parse the remarks so that they could work e.g. with https://github.com/OfekShilon/optview2. However, now that I think about it, probably the proper solution is to tell rustc to output them to YAML and then use the YAML as input for the opt remark visualization tools. The flag for enabling this does not seem to work though (#96705 (comment)).
Still I think that it's good to output the remark kind anyway, it's an important piece of information.
r? @tmiasko