Refactor non_ssa_locals
to remove LocalAnalyzer::process_place
#72931
Labels
A-codegen
Area: Code generation
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Uh oh!
There was an error while loading. Please reload this page.
While doing an initial implementation of rust-lang/compiler-team#300, I began replacing all uses of
{Non,}MutatingUseContext::Projection
. One user wasrustc_codegen_ssa::mir::analyze::LocalAnalyzer
, which is doing a custom recursive traversal inprocess_place
. There's aHACK
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
forNonUseContext::VarDebugInfo
, butvisit_local
does nothing forNonUse
s. 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?The text was updated successfully, but these errors were encountered: