-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Remove dead code after destination propagation #105420
Conversation
r? @fee1-dead (rustbot has picked a reviewer for you, use r? to override) |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Ah, yeah, that explains it. Good catch! |
eab8ff9
to
325913d
Compare
r? @oli-obk I don't see a minimal repro on the issue. Do you know how to trigger it and can add a test? |
Custom MIR doesn't support function calls yet, so I don't think I can add a test (reproducing the issue requires dead code of specific form to exist precisely at the time when destination propagation runs). |
Doesn't DestProp preserve CFG? |
When Do you prefer to remove dead blocks upfront? It is correct either way. |
Bit of a nitpick, but probably worth pointing out: This is not strictly speaking a soundness bug. Dest prop is introducing UB in dead code, which is "fine."
I can add support for this this weekend. We can delay this PR until then, or I can just add a test in a follow up at that time. |
Can/should we adjust MIR validation to ignore dead code? (if this PR is blocked on testing via custom MIR, such a PR would be too, but still...) Or... should we have MIR validation make a copy of the MIR, run |
Not in general. "Well-formed MIR" is something that ought to have a precise definition that does not depend on things like reachability, and (ignoring that that doesn't exist today) we should not intentionally diverge from that in the validator. That being said, this particular check should probably be turned off in dead code because the MIR is technically well-formed. Will file an issue |
397df84
to
adf53d4
Compare
|
LGTM |
@bors r=JakobDegen rollup |
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#96584 (Fix `x setup -h -v` should work) - rust-lang#105420 (Remove dead code after destination propagation) - rust-lang#105844 (Make the x tool use the x and x.ps1 scripts) - rust-lang#105854 (remove redundant clone) - rust-lang#105858 (Another `as_chunks` example) - rust-lang#105870 (avoid .into() conversion to identical types) - rust-lang#105875 (don't destuct references just to reborrow) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #105428.
cc @JakobDegen