Repository navigation
Avoid cloning CFG-related analysis data. - #156841
Conversation
This comment has been minimized.
This comment has been minimized.
|
@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 cloning CFG-related analysis data.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (218c186): 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 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 -0.1%, secondary -2.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary 2.2%, secondary -4.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 513.181s -> 524.394s (2.18%) |
This comment has been minimized.
This comment has been minimized.
7b31218 to
46b3903
Compare
This comment has been minimized.
This comment has been minimized.
|
@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 cloning CFG-related analysis data.
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (6e7d17c): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesResults (primary -2.6%, secondary -1.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. Bootstrap: 491.717s -> 493.723s (0.41%) |
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @mu001999 rustbot has assigned @mu001999. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
|
||
| impl CfgCache { | ||
| #[inline] | ||
| pub fn dominators(&self, bbs: &'_ BasicBlocks<'_>) -> &Dominators<BasicBlock> { |
There was a problem hiding this comment.
Is there another way to avoid cloning? If we expose CfgCache, we can only rely on callers to ensure that the bbs passed in is the one that cache belongs to. 🤔
There was a problem hiding this comment.
I think this is a way to keep using a mutable instance while only reading an immutable part of its data. In most cases we only have one body per pass, so I don't think we can easily make that mistake.
The alternative I can think of is to use the immutable body and collect whatever we want to modify — that's MirPatch — but it's not easy to use everywhere.
There was a problem hiding this comment.
I don't think we can easily make that mistake.
Agreed.
Just to be safe, perhaps we could change the receiver to self: &Arc<Self> and add a debug_assert!(Arc::ptr_eq(self, &bbs.cache)); for these methods?
c363acf to
5bfb2bf
Compare
…uwer Rollup of 12 pull requests Successful merges: - #164458 (Avoid stdlib's `impl Hash for Path` for stable hashing) - #161790 (update to illumos sysroot 20210501) - #163087 (rmake: Add helpers for iterating symbols and objects) - #163586 (refactor Windows remove_dir_all) - #163983 (std: use `SOCK_NONBLOCK` in `connect_timeout`) - #164307 (Rename `PostTypeckUntilBorrowck` -> `PostTypeckThroughBorrowck`) - #164425 (Declare `SyntaxContext` through `rustc_index::newtype_index!`) - #156841 (Avoid cloning CFG-related analysis data.) - #164654 (Add reference annotations for unions) - #164717 (Allow `llm-assisted` label to be set without write access) - #164735 (Remove docs mentioning instability of wasm64) - #164737 (Update LLVM PassBuilder constructor calls to pass a context) Failed merges: - #164636 (Remove `record_*` macros from the metadata encoder)
…uwer Rollup of 12 pull requests Successful merges: - #164458 (Avoid stdlib's `impl Hash for Path` for stable hashing) - #161790 (update to illumos sysroot 20210501) - #163087 (rmake: Add helpers for iterating symbols and objects) - #163586 (refactor Windows remove_dir_all) - #163983 (std: use `SOCK_NONBLOCK` in `connect_timeout`) - #164307 (Rename `PostTypeckUntilBorrowck` -> `PostTypeckThroughBorrowck`) - #164425 (Declare `SyntaxContext` through `rustc_index::newtype_index!`) - #156841 (Avoid cloning CFG-related analysis data.) - #164654 (Add reference annotations for unions) - #164717 (Allow `llm-assisted` label to be set without write access) - #164735 (Remove docs mentioning instability of wasm64) - #164737 (Update LLVM PassBuilder constructor calls to pass a context) Failed merges: - #164636 (Remove `record_*` macros from the metadata encoder)
…uwer Rollup of 12 pull requests Successful merges: - #164458 (Avoid stdlib's `impl Hash for Path` for stable hashing) - #161790 (update to illumos sysroot 20210501) - #163087 (rmake: Add helpers for iterating symbols and objects) - #163586 (refactor Windows remove_dir_all) - #163983 (std: use `SOCK_NONBLOCK` in `connect_timeout`) - #164307 (Rename `PostTypeckUntilBorrowck` -> `PostTypeckThroughBorrowck`) - #164425 (Declare `SyntaxContext` through `rustc_index::newtype_index!`) - #156841 (Avoid cloning CFG-related analysis data.) - #164654 (Add reference annotations for unions) - #164717 (Allow `llm-assisted` label to be set without write access) - #164735 (Remove docs mentioning instability of wasm64) - #164737 (Update LLVM PassBuilder constructor calls to pass a context) Failed merges: - #164636 (Remove `record_*` macros from the metadata encoder)
Rollup merge of #156841 - dianqk:avoid-clone, r=mu001999 Avoid cloning CFG-related analysis data. For perf. We can avoid cloning CFG-related data while mutating the body.
View all comments
For perf. We can avoid cloning CFG-related data while mutating the body.