optimization remarks broken, names mangled, no file/line addresses (-C remark=all)
ad9a1daa819bbeb8e643a01167b3b69055b88d57 added support for optimization remarks RUSTFLAGS="-C remark=all" cargo build --release
however the output is very hard to use since source locations are broken and names are mangled.
note: optimization analysis for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog517ha0cfb85674d1470fE can be inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E with cost=-14065 (threshold=275)
note: optimization remark for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog517ha0cfb85674d1470fE inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E
note: optimization analysis for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog617hf4efcc03917e607cE can be inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E with cost=-14065 (threshold=275)
note: optimization remark for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog617hf4efcc03917e607cE inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E
note: optimization analysis for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog717h9a70d5bf4650de27E can be inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E with cost=-13915 (threshold=275)
note: optimization remark for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog717h9a70d5bf4650de27E inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E
note: optimization analysis for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog817h899b896fff77b7eaE can be inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E with cost=-14065 (threshold=275)
note: optimization remark for inline at <unknown file>:0:0: _ZN11pathfinding12test_prolog817h899b896fff77b7eaE inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E
note: optimization missed for inline at <unknown file>:0:0: _ZN11pathfinding20print_shortest_paths17hac2d4d48645262b5E will not be inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E
note: optimization missed for inline at <unknown file>:0:0: _ZN4core3ptr13drop_in_place17h9afff73c9d313742E will not be inlined into _ZN11pathfinding4main17hc3ab21b80a078ef2E
note: optimization floating-point for loop-vectorize at <unknown file>:0:0: loop not vectorized: cannot prove it is safe to reorder floating-point operations
cargo 0.25.0-nightly (a88fbace4 2017-12-29) rustc 1.25.0-nightly (ee220daca 2018-01-07)
This is to be expected since
--releasedisables line info. Mangled names are displayed because they come directly from LLVM and it doesn't know about (un-)mangling.As a workaround for the mangling issue, you can try to pipe the output through rustfilt. To get line info, you can probably enable it in Cargo's
releaseprofile.Jonas Schievink at 2018-01-08 13:32:35
Update: was able to get at least file locations with
RUSTFLAGS="-C remark=all -C debuginfo=2"(would it make sense to turn this on by default for remark-all?), however names were still mangled.Matthias Krüger at 2018-01-08 16:20:57
Triage: not aware of any changes here
Steve Klabnik at 2019-10-21 12:15:05
It seems we now have a warning for
-Cremarkswithout debug info.As for name mangling, improving that would be welcome. Some notes: the function names are handed to rustc from LLVM, but we can post-process them (e.g., in
OptimizationDiagnostic::unpack) to demangle them. I don't know off-hand what APIs rustc has for demangling names, but @eddyb should know.Hanna Kruppe at 2019-10-21 12:45:04
We already depend on
rustc-demangle, so might as well use that (it's a dependency ofrustc_codegen_utils, among other things).Jonas Schievink at 2019-10-21 12:56:45
rustc-demanglealready is used for demangling IR comments somewhere else.Eduard-Mihai Burtescu at 2019-10-23 15:42:58