-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Only use SSA locals in SimplifyComparisonIntegral #150925
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
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
|
r? @saethlin (I think you may be interested.) |
|
#75370 (comment) is this still true? (edit: yes) |
|
Looking at #75144 which suggested the pass it does look like it's beneficial for Cranelift but entirely useless for LLVM (also confirmed by https://godbolt.org/z/7jMsGjYvP). I suggest we delete this pass and let Cranelift implement this optimization on their side, their ISLE framework should be much better suited for these transforms than our MIR opts. |
|
I have no objection to removing this pass since it also isn't beneficial for other passes, but perhaps the pass can be removed after Cranelift implements the optimization. cc @bjorn3 |
This comment has been minimized.
This comment has been minimized.
|
SsaLocals is not a trivial amount of analysis, so using it here will need a perf run. But I agree that SsaLocals and removing the pass are the only real options here. |
Given the current status of the Cranelift backend (not production ready) I see no reason to block removal on Cranelift implementing anything. That can happen at a later point just fine. |
|
If this pass is giving trouble, it is fine to remove it by me. I can implement a replacement in cg_clif if necessary, but no need to block on that. |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
|
🔒 Merge conflict This pull request and the base branch diverged in a way that cannot How do I rebase?Assuming
You may also read Please avoid the "Resolve conflicts" button on GitHub. Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
The test that is from #128627 is correct but fragile. The test expects the output is: not: I have dug more into why the The assembly code with .LBB40_21:
.loc 6 14 16 is_stmt 1
mov byte ptr [rsp + 79], 5
.loc 6 0 0 is_stmt 0
jmp .LBB40_23
...
.Ltmp314:
.LBB40_23:
.loc 6 18 1 is_stmt 1
lea rdi, [rsp + 112]
call qword ptr [rip + core[270d1373c8f6a07d]::ptr::drop_in_place::<alloc[206d51544a00c3e8]::string::String>@GOTPCREL]
jmp .LBB40_27without .LBB40_22:
.loc 6 14 16 is_stmt 1
mov byte ptr [rsp + 79], 5
.loc 6 0 0 is_stmt 0
jmp .LBB40_27
...
.Ltmp319:
.LBB40_26:
.loc 6 18 2 is_stmt 0
mov al, byte ptr [rsp + 79]
.loc 6 18 2 epilogue_begin
add rsp, 360
.cfi_def_cfa_offset 8
ret
.LBB40_27:
.cfi_def_cfa_offset 368
.Ltmp320:
.loc 6 18 1 # What about is_stmt here?
lea rdi, [rsp + 112]
call qword ptr [rip + core[270d1373c8f6a07d]::ptr::drop_in_place::<alloc[206d51544a00c3e8]::string::String>@GOTPCREL]
jmp .LBB40_26IIUC, the This can be verified by changing llvm-mc -filetype=obj -triple=x86_64 dummy_span.s -o dummy_span.o
llvm-dwarfdump --debug-line dummy_span.oThere is some note from https://llvm.org/docs/KeyInstructionsDebugInfo.html:
This tells us:
I think this has explained why LLDB passes the test. I have a more reliable test: https://gist.github.com/dianqk/dd1ce92143bbee077e2af2a3db9c8340, but this can also be fragile when the BBs are reordered due to some changes. I have no objection to removing the test. cc @khuey @nnethercote (#128627) |
|
I'm not sure I follow what the behavior change is ultimately introduced in the test. Are you saying that after this PR stepping through the test in gdb has a jump to line 1? |
No, just gdb skips |
|
Ah that's interesting. Based on your other example it seems like your impl Drop for Foo is still attributed to #loc2. Do we understand why std::env::Args's Drop impl isn't? I'm fine with changing the test to add our own struct with a custom Drop impl if we need it to trigger something on #loc2 |
|
|
@bors retry (potential flaky test) |
|
This comment has been minimized.
This comment has been minimized.
Interesting, the middle portion of the baseline ICE message is just I'll disable it on i686 msvc again EDIT: #151185 |
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 22c74ba (parent) -> 18ae990 (this PR) Test differencesShow 11 test diffs11 doctest diffs were found. These are ignored, as they are noisy. Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 18ae99075575810a158cc670dcc7579f1c2ca012 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (18ae990): comparison URL. Overall result: ❌ regressions - please read the text belowOur 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 -0.9%, secondary -2.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 3.8%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary -0.0%, secondary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 471.202s -> 471.758s (0.12%) |
Disable `dump-ice-to-disk` on `i686-pc-windows-msvc` Sometimes the middle frames of the ICE backtrace becomes `<unknown>` on `i686-pc-windows-msvc` which then makes this test flaky. Noticed in rust-lang#150925 (comment). Originally expanded in rust-lang#142563 to see if it's still flaky for other `*-windows-*` targets, unfortunately the answer is yes for `i686-pc-windows-msvc` as well. r? @dianqk (or compiler or anyone really)
Disable `dump-ice-to-disk` on `i686-pc-windows-msvc` Sometimes the middle frames of the ICE backtrace becomes `<unknown>` on `i686-pc-windows-msvc` which then makes this test flaky. Noticed in rust-lang#150925 (comment). Originally expanded in rust-lang#142563 to see if it's still flaky for other `*-windows-*` targets, unfortunately the answer is yes for `i686-pc-windows-msvc` as well. r? @dianqk (or compiler or anyone really)
Disable `dump-ice-to-disk` on `i686-pc-windows-msvc` Sometimes the middle frames of the ICE backtrace becomes `<unknown>` on `i686-pc-windows-msvc` which then makes this test flaky. Noticed in rust-lang#150925 (comment). Originally expanded in rust-lang#142563 to see if it's still flaky for other `*-windows-*` targets, unfortunately the answer is yes for `i686-pc-windows-msvc` as well. r? @dianqk (or compiler or anyone really)
Rollup merge of #151185 - disable-dump-ice-i686, r=dianqk Disable `dump-ice-to-disk` on `i686-pc-windows-msvc` Sometimes the middle frames of the ICE backtrace becomes `<unknown>` on `i686-pc-windows-msvc` which then makes this test flaky. Noticed in #150925 (comment). Originally expanded in #142563 to see if it's still flaky for other `*-windows-*` targets, unfortunately the answer is yes for `i686-pc-windows-msvc` as well. r? @dianqk (or compiler or anyone really)
|
#151244 refines the test. |
Fixes #150904.
The place may be modified from the comparison statement to the switchInt terminator.
Best reviewed commit by commit.