Draft: CPR analysis: Don't lose shared values (#19326)
This patch tries hard not to give value bindings the CPR property in multi-shot contexts and regresses terribly while doing so.
Lacks documentation, but the gist is to track which binders are defined at the current multi-shot level (e.g. there is no multi-shot lambda between the definition and the current analysis site) in ae_same_lvl :: IdSet
and refrain from unleashing the CPR signature of arity 0 things if the thing is defined outside the current multi-shot level. ae_same_lvl
is extended at each binding site and cleared when analysis passes a multi-shot lambda.
From what I can see, the analysis now regresses in quite a few places, notably product [1..n]
won't have the CPR property because the 1 case is floated out. Let's see what else CI has to say though.