Repository navigation
fix incorrect byte count suffix on MSVC - #165458
Conversation
|
cc @bjorn3 |
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
3536372 to
3ec1e11
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
current CI failure is pointing to this existing FIXME rust/tests/assembly-llvm/win32-byte-count-suffix.rs Lines 234 to 255 in 2d20b42 the existing |
|
@bors squash msg = "fix MSVC calling convention symbol byte counts" |
|
Unknown value for argument "". Run |
|
is it because of blank space 🤔 |
This comment has been minimized.
This comment has been minimized.
|
🔨 5 commits were squashed into 71146c7. |
19b93cf to
71146c7
Compare
71146c7 to
16191b5
Compare
|
Probably |
|
Reminder, once the PR becomes ready for a review, use |
…uwer Rollup of 24 pull requests Successful merges: - rust-lang/rust#165709 (remove 'x miri' smoke test from PR CI) - rust-lang/rust#164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - rust-lang/rust#165569 (`Move` trait feature gate) - rust-lang/rust#165575 (Upgrade bundled musl to 1.2.6) - rust-lang/rust#163241 (Add enclosing item context when pointing at `FnMut` bound) - rust-lang/rust#163992 (add `core::arch::{x86, x86_64}::x87_f80`) - rust-lang/rust#165047 (Change the span building of paths from first-to-last to chained) - rust-lang/rust#165458 (fix incorrect byte count suffix on MSVC) - rust-lang/rust#165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - rust-lang/rust#165586 (Remove `backend_optimization_level`.) - rust-lang/rust#165646 (fix NumScalableVectors::from_field_count) - rust-lang/rust#165655 (Unignore passing GCC backend tests) - rust-lang/rust#165740 (miri subtree update) - rust-lang/rust#165753 (avoid Terminator:None in MIR inliner) - rust-lang/rust#153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - rust-lang/rust#164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - rust-lang/rust#165562 (stop using gce in a test) - rust-lang/rust#165681 (Add safety requirements for Pattern and Searcher) - rust-lang/rust#165682 (interpret: ensure newly created unions have uninit in their padding) - rust-lang/rust#165693 (Move `check_attr` to attribute parsing) - rust-lang/rust#165715 (windows: check for null before wide encoding) - rust-lang/rust#165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - rust-lang/rust#165733 (docs(num): remove needless whitespaces) - rust-lang/rust#165739 (remove NOP File::flush from fs tests) Failed merges: - rust-lang/rust#165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - rust-lang/rust#164218 (Tweak private re-export errors to point at correct span and have more context)
…uwer Rollup of 24 pull requests Successful merges: - rust-lang/rust#165709 (remove 'x miri' smoke test from PR CI) - rust-lang/rust#164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - rust-lang/rust#165569 (`Move` trait feature gate) - rust-lang/rust#165575 (Upgrade bundled musl to 1.2.6) - rust-lang/rust#163241 (Add enclosing item context when pointing at `FnMut` bound) - rust-lang/rust#163992 (add `core::arch::{x86, x86_64}::x87_f80`) - rust-lang/rust#165047 (Change the span building of paths from first-to-last to chained) - rust-lang/rust#165458 (fix incorrect byte count suffix on MSVC) - rust-lang/rust#165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - rust-lang/rust#165586 (Remove `backend_optimization_level`.) - rust-lang/rust#165646 (fix NumScalableVectors::from_field_count) - rust-lang/rust#165655 (Unignore passing GCC backend tests) - rust-lang/rust#165740 (miri subtree update) - rust-lang/rust#165753 (avoid Terminator:None in MIR inliner) - rust-lang/rust#153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - rust-lang/rust#164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - rust-lang/rust#165562 (stop using gce in a test) - rust-lang/rust#165681 (Add safety requirements for Pattern and Searcher) - rust-lang/rust#165682 (interpret: ensure newly created unions have uninit in their padding) - rust-lang/rust#165693 (Move `check_attr` to attribute parsing) - rust-lang/rust#165715 (windows: check for null before wide encoding) - rust-lang/rust#165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - rust-lang/rust#165733 (docs(num): remove needless whitespaces) - rust-lang/rust#165739 (remove NOP File::flush from fs tests) Failed merges: - rust-lang/rust#165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - rust-lang/rust#164218 (Tweak private re-export errors to point at correct span and have more context)
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (ceb2a18): comparison URL. Overall result: ❌ regressions - please read:Our benchmarks found a performance regression caused by this PR. Next Steps:
@rustbot label: +perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 5.0%, secondary 7.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 3.4%, secondary 4.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis perf run didn't have relevant results for this metric. Artifact size: 406.28 MiB -> 406.34 MiB (0.02%) |
…uwer Rollup of 24 pull requests Successful merges: - rust-lang/rust#165709 (remove 'x miri' smoke test from PR CI) - rust-lang/rust#164217 (Prepare to make `rustc_trivial_field_reads` usable in user code) - rust-lang/rust#165569 (`Move` trait feature gate) - rust-lang/rust#165575 (Upgrade bundled musl to 1.2.6) - rust-lang/rust#163241 (Add enclosing item context when pointing at `FnMut` bound) - rust-lang/rust#163992 (add `core::arch::{x86, x86_64}::x87_f80`) - rust-lang/rust#165047 (Change the span building of paths from first-to-last to chained) - rust-lang/rust#165458 (fix incorrect byte count suffix on MSVC) - rust-lang/rust#165490 (Mark the compile unit for `-Zdebuginfo-for-profiling`) - rust-lang/rust#165586 (Remove `backend_optimization_level`.) - rust-lang/rust#165646 (fix NumScalableVectors::from_field_count) - rust-lang/rust#165655 (Unignore passing GCC backend tests) - rust-lang/rust#165740 (miri subtree update) - rust-lang/rust#165753 (avoid Terminator:None in MIR inliner) - rust-lang/rust#153261 (Partially stabilize `ptr_alignment_type` as `alignment_type`) - rust-lang/rust#164559 (Windows: fix Dir::remove and Dir::rename following symlinks) - rust-lang/rust#165562 (stop using gce in a test) - rust-lang/rust#165681 (Add safety requirements for Pattern and Searcher) - rust-lang/rust#165682 (interpret: ensure newly created unions have uninit in their padding) - rust-lang/rust#165693 (Move `check_attr` to attribute parsing) - rust-lang/rust#165715 (windows: check for null before wide encoding) - rust-lang/rust#165717 (mpsc_sync::stream_send_recv_stress: wait for all threads to finish) - rust-lang/rust#165733 (docs(num): remove needless whitespaces) - rust-lang/rust#165739 (remove NOP File::flush from fs tests) Failed merges: - rust-lang/rust#165727 (Normalize "beta release channel" in `const-supertrait-unstable` test) - rust-lang/rust#164218 (Tweak private re-export errors to point at correct span and have more context)
|
This caused a significant unexpected perf regression. Any idea what caused this? |
|
From cachegrind diff on 949,870 (100.0%) PROGRAM TOTALS
Ir_________________________ file:function
< 925,940 (97.5%, 97.5%) ???:
6,506,552 (685.0%) ???
-1,209,971 (-127.4%) tcache_bin_flush_small
-1,151,191 (-121.2%) pa_alloc
-1,074,007 (-113.1%) free
-671,271 (-70.7%) malloc
-448,493 (-47.2%) realloc
-295,490 (-31.1%) aligned_alloc
-255,267 (-26.9%) malloc_default
-213,207 (-22.4%) extent_try_coalesce_impl
-192,937 (-20.3%) ecache_evict
-128,869 (-13.6%) eset_remove
-104,550 (-11.0%) calloc
-103,735 (-10.9%) pa_dallocThis PR changes/adds some more String/Vec juggling around symbols, so I suspect it's something in those paths, but nothing stands out to me at a glance. |
I don't think that's relevant. Selected output from an LLM analysis of the regression says the following: My experience is that this LLM is generally very good at this kind of diagnosis, and looking at the code I think it's correct in this case. The suggested fix: In the meantime I think we should revert this change given the size of the perf regression. |
|
That sounds right, there really should be no performance impact on linux (except for when using |
Oh, it's actually totally clear from detailed results without doing anything fancy, those are red all over the place: I didn't look at those, because I didn't see anything in the |
|
Revert posted: #165856 |
Revert "fix incorrect byte count suffix on MSVC" Reverts #165458 because of a performance regression.
|
my bad, i'll put together a follow up after revert has landed |
…egression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
…egression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
…egression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
…egression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
…egression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
…egression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
Rollup merge of #165771 - paradoxicalguy:msvc-lto-preserve-regression, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of #165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
Revert "fix incorrect byte count suffix on MSVC" Reverts rust-lang/rust#165458 because of a performance regression.
Revert "fix incorrect byte count suffix on MSVC" Reverts rust-lang/rust#165458 because of a performance regression.
…, r=folkertdev tests: cover MSVC ThinLTO exported symbol preservation test-only continuation of rust-lang/rust#165458 this pr adds regression tests for exported-symbol preservation during ThinLTO on i686 MSVC. the test checks that ThinLTO preserves: ordinary exported functions, where LLVM IR names differ from COFF linker-visible names. stdcall functions with explicitly decorated symbol names. exported static data. the run-make test executes on x86_64 MSVC and cross-compiles an i686 MSVC static library using `minicore`, so it does not require an installed i686 standard-library sysroot. Verified the test against both implementations: before the fix: test fails because ThinLTO does not preserve `___rust_lto_preserve_plain`. after the fix: test passes with all expected exported symbols present. both fixture compilation steps succeeded in the failing run, confirming that the failure is caused by incorrect symbol preservation rather than a compilation or linking issue. r? @folkertdev
Revert "fix incorrect byte count suffix on MSVC" Reverts rust-lang/rust#165458 because of a performance regression.
…-v2, r=folkertdev fix MSVC calling convention byte counts performance fixed version of rust-lang#165458 original fix _reverted_ in rust-lang#165856 due to perf issues. fixes rust-lang#165299 companion test pr: rust-lang#165771 the regression came from unnecessary `fn_abi_of_instance` queries on targets that don't need symbol decoration. this now skips those queries while keeping non-windows `vectorcall` handling. perf: local rustc-perf benchmarks on aarch64 (instructions:u): original fix: +0.83% optimized fix: ~0.00% testing: fastcall, stdcall and vectorcall codegen tests i686/x86_64 msvc linking with and without thinlto, verified dll exports lto smoke tests also handles `\x01`-prefixed symbols under thinlto (related: rust-lang#165790). r? @folkertdev
…-v2, r=folkertdev fix MSVC calling convention byte counts performance fixed version of rust-lang#165458 original fix _reverted_ in rust-lang#165856 due to perf issues. fixes rust-lang#165299 companion test pr: rust-lang#165771 the regression came from unnecessary `fn_abi_of_instance` queries on targets that don't need symbol decoration. this now skips those queries while keeping non-windows `vectorcall` handling. perf: local rustc-perf benchmarks on aarch64 (instructions:u): original fix: +0.83% optimized fix: ~0.00% testing: fastcall, stdcall and vectorcall codegen tests i686/x86_64 msvc linking with and without thinlto, verified dll exports lto smoke tests also handles `\x01`-prefixed symbols under thinlto (related: rust-lang#165790). r? @folkertdev
Rollup merge of #165881 - paradoxicalguy:fix-msvc-byte-count-v2, r=folkertdev fix MSVC calling convention byte counts performance fixed version of #165458 original fix _reverted_ in #165856 due to perf issues. fixes #165299 companion test pr: #165771 the regression came from unnecessary `fn_abi_of_instance` queries on targets that don't need symbol decoration. this now skips those queries while keeping non-windows `vectorcall` handling. perf: local rustc-perf benchmarks on aarch64 (instructions:u): original fix: +0.83% optimized fix: ~0.00% testing: fastcall, stdcall and vectorcall codegen tests i686/x86_64 msvc linking with and without thinlto, verified dll exports lto smoke tests also handles `\x01`-prefixed symbols under thinlto (related: #165790). r? @folkertdev
…lkertdev fix MSVC calling convention byte counts performance fixed version of rust-lang/rust#165458 original fix _reverted_ in rust-lang/rust#165856 due to perf issues. fixes rust-lang/rust#165299 companion test pr: rust-lang/rust#165771 the regression came from unnecessary `fn_abi_of_instance` queries on targets that don't need symbol decoration. this now skips those queries while keeping non-windows `vectorcall` handling. perf: local rustc-perf benchmarks on aarch64 (instructions:u): original fix: +0.83% optimized fix: ~0.00% testing: fastcall, stdcall and vectorcall codegen tests i686/x86_64 msvc linking with and without thinlto, verified dll exports lto smoke tests also handles `\x01`-prefixed symbols under thinlto (related: rust-lang/rust#165790). r? @folkertdev
View all comments
fixes #165299
this moves the byte count calculation into a shared helper in
rustc_codegen_ssa. it now derives the count from the original argument layouts rather than the lowered signature.the fix is wired up for
llvm. symbols are emitted with a\x01prefix so llvm doesn’t decorate them a second time, and the linker-facing symbol naming path now handles the\x01and?prefixes.testing:
verified fastcall, stdcall and vectorcall on msvc, including cross-crate references.
added regression coverage for the linker failure in #165299, including a portable
build-passtest usingminicoreandrust-lld. the unpatched compiler fails with a linker error, while the patched compiler links successfully.added codegen regression tests and updated the existing abi, unwind and assembly tests for the corrected symbol names and byte counts. this also resolves the over-aligned argument
FIXMEinwin32-byte-count-suffix.rs.cc @folkertdev @workingjubilee