Don't optimize across storage markers in SimplifyComparisonIntegral - #159220
Conversation
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
I don't think scanning only for This will push the I think the simplest and safest bet here is to further limit the optimization so it bails out if there's any |
|
@rustbot author |
|
Reminder, once the PR becomes ready for a review, use |
Done. now rejects both, and removes the old StorageDead successor-relocation machinery entirely @rustbot ready |
|
@rustbot author |
|
The last commit looks good to me, but (sorry for not realizing this before!) please squash the commits. The simplest thing would be to squash it all into one commit, but if possible it would be great to reorganize this into two commits:
Either approach is fine, depends on how confident you are in your git skills :) |
cd8b7a4 to
479836d
Compare
|
The first commit is not self contained as requested, the @rustbot author |
ran wit got only one output file for --> /rust/tests/mir-opt/if_condition_int.rs:161:13
|
161 | c = b == 42;
| ^^^^^^^^^^^
note: using internal features is not supported and expected to cause internal compiler errors when used incorrectly@rustbot ready |
|
Oh, the ICE is @bors r+ rollup |
Don't optimize across storage markers in SimplifyComparisonIntegral This PR rejects `SimplifyComparisonIntegral` candidates when either `StorageLive` or `StorageDead` for the compared local occurs between the comparison and the terminator. Since those candidates are rejected, the pass no longer relocates `StorageDead` into switch successors. This conservatively leaves one comparison in `issue_59352` unoptimized, so its MIR snapshots are updated. Resolves rust-lang#158231. r? @hanna-kruppe
Rollup of 9 pull requests Successful merges: - #153563 (Lint against iterator functions that panic when `N` is zero ) - #159960 (Allow `UnsafeCell` content access without `get` in `invalid_reference_casting` lint) - #158893 (Clarify preconditions of raw size/align methods) - #159220 (Don't optimize across storage markers in SimplifyComparisonIntegral) - #159309 (Move tests batch 18) - #159450 (Add codegen test for enum clone) - #160017 (Make BorrowSet methods public again) - #160022 (Refactor rustc_hir re-exports) - #160041 (Correct tracking issue for `casefold` feature)
Rollup merge of #159220 - qaijuang:issue-158231, r=hanna-kruppe Don't optimize across storage markers in SimplifyComparisonIntegral This PR rejects `SimplifyComparisonIntegral` candidates when either `StorageLive` or `StorageDead` for the compared local occurs between the comparison and the terminator. Since those candidates are rejected, the pass no longer relocates `StorageDead` into switch successors. This conservatively leaves one comparison in `issue_59352` unoptimized, so its MIR snapshots are updated. Resolves #158231. r? @hanna-kruppe
|
@rust-timer build 990bfa8 |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (990bfa8): comparison URL. Overall result: ❌✅ regressions and improvements - please read:Benchmarking 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. Next, please: If you can, justify the regressions found in this try perf run in writing along with @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 (primary -7.1%, secondary 1.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -3.0%, secondary -1.3%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.2%, secondary 0.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 487.856s -> 491.177s (0.68%) |
View all comments
This PR rejects
SimplifyComparisonIntegralcandidates when eitherStorageLiveorStorageDeadfor the compared local occurs between the comparison and the terminator.Since those candidates are rejected, the pass no longer relocates
StorageDeadinto switch successors. This conservatively leaves one comparison inissue_59352unoptimized, so its MIR snapshots are updated.Resolves #158231.
r? @hanna-kruppe