Stream: t-compiler/wg-mir-opt

Topic: Visiting Projections


oli (Jun 26 2020 at 17:08, on Zulip):

:wave: @ecstatic-morse about https://github.com/rust-lang/rust/pull/73732#issuecomment-650289464

oli (Jun 26 2020 at 17:09, on Zulip):

cc @Santiago Pastorino

oli (Jun 26 2020 at 17:10, on Zulip):

We haven't been able to figure out a good way to make mir::Visitor visit projections. While there were some improvements during the Place refactorings, we kinda stopped there and various visitors still require wild schemes around visiting locals in the correct order and with the correct projection information.

oli (Jun 26 2020 at 17:11, on Zulip):

the linked PR above tried another approach, which, while improving some cases, made others worse (requiring additional visitor state and such)

oli (Jun 26 2020 at 17:11, on Zulip):

Quoting from the PR

I'm starting to wonder if we would be better off with a MIR Visitor 2.0 that was designed specifically for traversing the CFG instead of the current, one-size-fits-all trait.

oli (Jun 26 2020 at 17:12, on Zulip):

Maybe we should indeed "just give up" and not have the mir::Visitor go below the visit_place level. We could then offer different schemes for visiting places (maybe as methods on Place?)

ecstatic-morse (Jun 26 2020 at 17:24, on Zulip):

oli said:

Maybe we should indeed "just give up" and not have the mir::Visitor go below the visit_place level. We could then offer different schemes for visiting places (maybe as methods on Place?)

This is the approach I favor as well. My only new proposal is that Visitor and MutVisitor should diverge here. Creating "fake places" for MutVisitors is bad, since they have to figure out whether a Place is a fake or not. I want to keep MutVisitor as close to the actual structure MIR as possible and continue to have visit_local, but have Visitor be tweaked to make it obvious how to write analysis passes.

Santiago Pastorino (Jun 26 2020 at 17:33, on Zulip):

oli said:

cc Santiago Pastorino

checking this is in my todo list, thanks for pinging me :heart:

ecstatic-morse (Jun 26 2020 at 20:07, on Zulip):

#73774 is what is required to properly handle locals/places for liveness without some version of #73732

Last update: Jan 22 2021 at 13:30UTC