-
Couldn't load subscription status.
- Fork 13.9k
Description
While doing an initial implementation of rust-lang/compiler-team#300, I began replacing all uses of {Non,}MutatingUseContext::Projection. One user was rustc_codegen_ssa::mir::analyze::LocalAnalyzer, which is doing a custom recursive traversal in process_place. There's a HACK comment from @eddyb suggesting that this should be rewritten.
@eddyb, did you have something specific in mind? I spent some time trying to decipher the logic here, but there's parts I don't understand. For example, there's a long comment about why we need to call visit_local for NonUseContext::VarDebugInfo, but visit_local does nothing for NonUses. What's the indended behavior here?
Additionally, LocalAnalyzer visits basic blocks in numerical order, but this code assumes we will visit the assignment to a local before any uses of it. This isn't a soundness issue; The worst thing that can happen is that locals are placed onto the stack unnecessarily. However, I think we should be visiting basic blocks in RPO, no?