Skip to content
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

Use an interpreter in MIR jump threading #119461

Merged
merged 3 commits into from
Jan 21, 2024

Conversation

cjgillot
Copy link
Contributor

This allows to understand assignments of aggregate constants. This case appears more frequently with GVN promoting aggregates to constants.

@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@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 Dec 31, 2023
@rustbot
Copy link
Collaborator

rustbot commented Dec 31, 2023

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@cjgillot cjgillot added the A-mir-opt Area: MIR optimizations label Dec 31, 2023
@bors
Copy link
Contributor

bors commented Jan 7, 2024

☔ The latest upstream changes (presumably #119675) made this pull request unmergeable. Please resolve the merge conflicts.

@tmiasko
Copy link
Contributor

tmiasko commented Jan 20, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jan 20, 2024

📌 Commit e72b2b1 has been approved by tmiasko

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 20, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#116090 (Implement strict integer operations that panic on overflow)
 - rust-lang#118811 (Use `bool` instead of `PartiolOrd` as return value of the comparison closure in `{slice,Iteraotr}::is_sorted_by`)
 - rust-lang#119081 (Add Ipv6Addr::is_ipv4_mapped)
 - rust-lang#119461 (Use an interpreter in MIR jump threading)
 - rust-lang#119996 (Move OS String implementation into `sys`)
 - rust-lang#120015 (coverage: Format all coverage tests with `rustfmt`)
 - rust-lang#120027 (pattern_analysis: Remove `Ty: Copy` bound)
 - rust-lang#120084 (fix(rust-analyzer): use new pkgid spec to compare)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 203cc69 into rust-lang:master Jan 21, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
Rollup merge of rust-lang#119461 - cjgillot:jump-threading-interp, r=tmiasko

Use an interpreter in MIR jump threading

This allows to understand assignments of aggregate constants. This case appears more frequently with GVN promoting aggregates to constants.
@cjgillot cjgillot deleted the jump-threading-interp branch January 21, 2024 12:06
BinOp::Ne => ScalarInt::FALSE,
_ => return None,
};
let value = value.const_.normalize(self.tcx, self.param_env).try_to_scalar_int()?;
Copy link
Member

Choose a reason for hiding this comment

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

This makes little sense. If you want to evaluate the constant, call eval, not normalize. normalize is only meant for when you want to keep this around as a mir::Const but for some reason you want to be sure that if it can evaluated, it is a value (but if it cannot be evaluated that's okay, too). It's a pretty strange operation that should be rarely needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants