Skip to content

Conversation

dianqk
Copy link
Member

@dianqk dianqk commented Oct 9, 2025

Fixes #147485.

r? cjgillot

@rustbot
Copy link
Collaborator

rustbot commented Oct 9, 2025

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 9, 2025
Copy link
Contributor

@cjgillot cjgillot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain this is the best approach. Maintaining this invariant during optimizations will be error-prone. Should SimplifyLocals drop dbg statements whose LHS is dead?

View changes since this review

location: Location,
) {
if let StmtDebugInfo::AssignRef(local, _) = stmt_debuginfo
&& let Value::Pointer(target, _) = self.targets[*local]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this mirrors visit_var_debug_info, we need an extra condition on target.projection, don't we?

- StorageDead(_3);
- StorageDead(_1);
+ // DBG: _1 = &(*_5);
+ // DBG: _5 = &(*_5);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this statement, or drop it as a tautology?

@durin42
Copy link
Contributor

durin42 commented Oct 9, 2025

This doesn't fix the case we saw internally in netlink-proto. Could you also give it a shot against the non-minimized reproducer in #147485?

@durin42
Copy link
Contributor

durin42 commented Oct 9, 2025

This doesn't fix the case we saw internally in netlink-proto. Could you also give it a shot against the non-minimized reproducer in #147485?

Had a few minutes, so I checked: with this PR applied the reproducer in https://github.com/krasimirgg/netlink-proto branch ice still ICEs. :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

thread 'rustc' panicked at compiler/rustc_mir_transform/src/simplify.rs:677:27
4 participants