-
Notifications
You must be signed in to change notification settings - Fork 13.3k
mir-opt: execute MatchBranchSimplification after GVN #140115
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
Conversation
This can provide more opportunities for MatchBranchSimplification.
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
mir-opt: execute MatchBranchSimplification after GVN This can provide more opportunities for MatchBranchSimplification. Currently, rustc does not optimize the following code into a single statement at mir-opt, and this PR fixes the first case. ```rust pub fn match1(c: bool, v1: i32, v2: i32) -> i32 { if c { v1 - v2 } else { v1 - v2 } } pub fn match2(c: bool, v1: i32) -> i32 { if c { v1 - 1 } else { v1 - 1 } } ``` https://rust.godbolt.org/z/Y8xPMjrfM r? mir-opt
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (1aadc7f): comparison URL. Overall result: no relevant changes - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)Results (primary -0.2%, secondary -2.2%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesResults (primary 0.5%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeResults (primary 0.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Bootstrap: 773.608s -> 771.589s (-0.26%) |
r? mir-opt |
@bors r+ rollup |
mir-opt: execute MatchBranchSimplification after GVN This can provide more opportunities for MatchBranchSimplification. Currently, rustc does not optimize the following code into a single statement at mir-opt, and this PR fixes the first case. ```rust pub fn match1(c: bool, v1: i32, v2: i32) -> i32 { if c { v1 - v2 } else { v1 - v2 } } pub fn match2(c: bool, v1: i32) -> i32 { if c { v1 - 1 } else { v1 - 1 } } ``` https://rust.godbolt.org/z/Y8xPMjrfM r? mir-opt
…llaumeGomez Rollup of 11 pull requests Successful merges: - rust-lang#139764 (Consistent trait bounds for ExtractIf Debug impls) - rust-lang#140035 (Implement RFC 3503: frontmatters) - rust-lang#140080 (mir-opt: Use one MirPatch in MatchBranchSimplification) - rust-lang#140115 (mir-opt: execute MatchBranchSimplification after GVN) - rust-lang#140357 (bypass linker configuration and cross target check on `x check`) - rust-lang#140374 (Resolve instance for SymFn in global/naked asm) - rust-lang#140393 (std: get rid of `sys_common::process`) - rust-lang#140532 (Fix RustAnalyzer discovery of rustc's `stable_mir` crate) - rust-lang#140559 (Removing rustc_type_ir in the rustc_infer codebase) - rust-lang#140636 (implement `PanicTracker` to track `t` panics) - rust-lang#140661 (Make `-Zfixed-x18` into a target modifier) r? `@ghost` `@rustbot` modify labels: rollup
…llaumeGomez Rollup of 11 pull requests Successful merges: - rust-lang#140080 (mir-opt: Use one MirPatch in MatchBranchSimplification) - rust-lang#140115 (mir-opt: execute MatchBranchSimplification after GVN) - rust-lang#140357 (bypass linker configuration and cross target check on `x check`) - rust-lang#140374 (Resolve instance for SymFn in global/naked asm) - rust-lang#140559 (Removing rustc_type_ir in the rustc_infer codebase) - rust-lang#140605 (`fn check_opaque_type_parameter_valid` defer error) - rust-lang#140636 (implement `PanicTracker` to track `t` panics) - rust-lang#140661 (Make `-Zfixed-x18` into a target modifier) - rust-lang#140670 (calculate step duration in a panic-safe way) - rust-lang#140672 (Deeply normalize in the new solver in WF) - rust-lang#140676 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#140115 - dianqk:gvn-matchbr, r=oli-obk mir-opt: execute MatchBranchSimplification after GVN This can provide more opportunities for MatchBranchSimplification. Currently, rustc does not optimize the following code into a single statement at mir-opt, and this PR fixes the first case. ```rust pub fn match1(c: bool, v1: i32, v2: i32) -> i32 { if c { v1 - v2 } else { v1 - v2 } } pub fn match2(c: bool, v1: i32) -> i32 { if c { v1 - 1 } else { v1 - 1 } } ``` https://rust.godbolt.org/z/Y8xPMjrfM r? mir-opt
This can provide more opportunities for MatchBranchSimplification.
Currently, rustc does not optimize the following code into a single statement at mir-opt, and this PR fixes the first case.
https://rust.godbolt.org/z/Y8xPMjrfM
r? mir-opt