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

Avoid backtracking in "deref_of_address" MIR optimization #78368

Closed
simonvandel opened this issue Oct 25, 2020 · 1 comment
Closed

Avoid backtracking in "deref_of_address" MIR optimization #78368

simonvandel opened this issue Oct 25, 2020 · 1 comment
Labels
A-mir-opt Area: MIR optimizations C-enhancement Category: An issue proposing an enhancement or a PR with one. C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@simonvandel
Copy link
Contributor

The current implementation of "deref_of_address" introduced in #76683 uses a backtracking algorithm.
That is, it first tries to locate a dereference of a local, e.g. _2 = (*_1). It then backtracks the previous statements for a definition of _1. The current implementation has an heuristic look-back value of 6, which is arbitrarily chosen.

We should instead walk the statements in the order they appear in the basic blocks, keeping track of places where the optimization could be applied. This should both be faster since we only look at each statement once. And it will apply more optimizations as the heuristic look-back value is gone.

@jonas-schievink jonas-schievink added A-mir-opt Area: MIR optimizations C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 25, 2020
@workingjubilee workingjubilee added the C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such label Oct 8, 2023
@cjgillot
Copy link
Contributor

This pass has been removed.

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 C-enhancement Category: An issue proposing an enhancement or a PR with one. C-optimization Category: An issue highlighting optimization opportunities or PRs implementing such T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants