Repository navigation
Avoid unnecessary LLVM passes when thin LTO buffer is null - #166084
Conversation
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Avoid unnecessary LLVM passes when thin LTO buffer is null
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (7fa4664): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (secondary -2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%, secondary -2.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.6%, secondary -1.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 467.993s -> 465.25s (-0.59%) |
|
@rust-timer: 🔑 Insufficient privileges: not in review users |
This is my mistake oops, fixed in rust-lang/bors#892 |
|
@bors rollup=never rustc-perf |
|
|
`LLVMRustOptimize` runs three passes when `NeedThinLTOBufferPasses` is true: `CanonicalizeAliasesPass`, `NameAnonGlobalPass` and `AssignGUIDPass`. These passes are only needed when the module's bitcode or summary will be written. This commit updates how `NeedThinLTOBufferPasses` is initialized in `LLVMRustOptimize`; instead of being initialized as always true, it's now only true if a thin LTO buffer is provided. (Subsequent existing code in the function may change `NeedThinLTOBufferPasses` to false.) Avoiding the unnecessary passes improves compile times a little, e.g. on debug builds (which are `O0` + `PreLinkNoLTO`). That requires a change to the passes added by `LLVMRustModuleSerialize`, because it currently relies on `LLVMRustOptimize` having run `CanonicalizeAliasesPass` and `NameAnonGlobalPass`, and this is no longer true in some cases such as `--emit=llvm-bc`. The passes are idempotent so it doesn't hurt if they are run twice in other cases. Non-LTO `--emit=llvm-ir,asm` output changes in two ways: unnamed globals stay unnamed (or are named `__unnamed` by LLVM) instead of being named `anon` (this requires updating some tests) and `!guid` metadata disappears.
08946c8 to
ce8a6c8
Compare
|
I addressed the single nit. @bors r=nikic |
|
Creating a perf-sensitive rollup |
…uwer Rollup of 4 perf-sensitive pull requests Successful merges: - #165396 (Perf - Separate flag computation & intern functions per `TyKind`) - #165774 (Auto trait finder: Avoid recomputing `ParamEnv` if nothing changed) - #165863 (Avoid instantiating `FnSig` when not necessary) - #166084 (Avoid unnecessary LLVM passes when thin LTO buffer is null)
Rollup merge of #166084 - nnethercote:unnecessary-llvm-passes, r=nikic Avoid unnecessary LLVM passes when thin LTO buffer is null `LLVMRustOptimize` runs three passes when `NeedThinLTOBufferPasses` is true: `CanonicalizeAliasesPass`, `NameAnonGlobalPass` and `AssignGUIDPass`. These passes are only needed when the module's bitcode or summary will be written. This commit updates how `NeedThinLTOBufferPasses` is initialized in `LLVMRustOptimize`; instead of being initialized as always true, it's now only true if a thin LTO buffer is provided. (Subsequent existing code in the function may change `NeedThinLTOBufferPasses` to false.) Avoiding the unnecessary passes improves compile times a little, e.g. on debug builds (which are `O0` + `PreLinkNoLTO`). That requires a change to the passes added by `LLVMRustModuleSerialize`, because it currently relies on `LLVMRustOptimize` having run `CanonicalizeAliasesPass` and `NameAnonGlobalPass`, and this is no longer true in some cases such as `--emit=llvm-bc`. The passes are idempotent so it doesn't hurt if they are run twice in other cases. Non-LTO `--emit=llvm-ir,asm` output changes in two ways: unnamed globals stay unnamed (or are named `__unnamed` by LLVM) instead of being named `anon` (this requires updating some tests) and `!guid` metadata disappears. r? @nikic
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (db947ef): comparison URL. Overall result: ✅ improvements - no action needed@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 -1.2%, secondary -2.5%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary -5.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -1.0%, secondary -1.7%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Artifact size: 405.23 MiB -> 405.24 MiB (0.00%) |
LLVMRustOptimizeruns three passes whenNeedThinLTOBufferPassesis true:CanonicalizeAliasesPass,NameAnonGlobalPassandAssignGUIDPass. These passes are only needed when the module's bitcode or summary will be written.This commit updates how
NeedThinLTOBufferPassesis initialized inLLVMRustOptimize; instead of being initialized as always true, it's now only true if a thin LTO buffer is provided. (Subsequent existing code in the function may changeNeedThinLTOBufferPassesto false.) Avoiding the unnecessary passes improves compile times a little, e.g. on debug builds (which areO0+PreLinkNoLTO).That requires a change to the passes added by
LLVMRustModuleSerialize, because it currently relies onLLVMRustOptimizehaving runCanonicalizeAliasesPassandNameAnonGlobalPass, and this is no longer true in some cases such as--emit=llvm-bc. The passes are idempotent so it doesn't hurt if they are run twice in other cases.Non-LTO
--emit=llvm-ir,asmoutput changes in two ways: unnamed globals stay unnamed (or are named__unnamedby LLVM) instead of being namedanon(this requires updating some tests) and!guidmetadata disappears.r? @nikic