-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[mir-opt] avoid *&
when reading primitive from slice
#138936
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
Comments
I think GVN only tracks the value that is a local, then reuse the value (local). Maybe we can do a pre-processing before GVN to put these values into locals: https://play.rust-lang.org/?version=nightly&mode=release&edition=2024&gist=38d1e888c464c4bc190f04d7aa27ecd3. |
I think it can be done with GVN. The hard part is checking that the place still exists and has the same value. I'm surprised |
In this case, |
Allow GVN to produce places and not just locals. That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf). r? `@ghost` for perf Fixes rust-lang#138936 cc `@scottmcm` `@dianqk`
Allow GVN to produce places and not just locals. That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf). r? `@ghost` for perf Fixes rust-lang#138936 cc `@scottmcm` `@dianqk`
Allow GVN to produce places and not just locals. That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf). The second commit opts out of introducing projections that don't have a stable offset, which is probably what we want. Hence no new Deref and no new Index projections. Fixes rust-lang/rust#138936 cc `@scottmcm` `@dianqk`
Allow GVN to produce places and not just locals. That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf). The second commit opts out of introducing projections that don't have a stable offset, which is probably what we want. Hence no new Deref and no new Index projections. Fixes rust-lang/rust#138936 cc `@scottmcm` `@dianqk`
Today, this code https://play.rust-lang.org/?version=nightly&mode=release&edition=2024&gist=09a5eaf64b3be527fef5a0589d6fe377
gives this optimized MIR:
It's a shame that we need to take a reference there in the MIR instead of just copying out of the place directly, like
@cjgillot, is this something you think GVN could plausibly do?
The text was updated successfully, but these errors were encountered: