From c884e18cd26c8e734174fef206ed9953758e63e4 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Tue, 3 Jun 2025 09:01:36 -0700 Subject: [PATCH] Update base for Update on "[compiler] InferMutationAliasingRanges precisely models which values mutate when" It turns out that InferMutationAliasingRanges does need a fixpoint loop, but the approach is arguably simpler overall and more precise than the previous implementation. Like InferMutationAliasingEffects (which is the new InferReferenceEffects), we build an abstract model of the heap. But here we know what the effects are, so we can do abstract interpretation of the effects. Each abstract value stores a set of values that it has captured (for transitive mutation), while each variable keeps a set of values it may directly mutate (for assign/alias/capturefrom). This means that at each mutation, we can mark _exactly_ the set of variables/values that are affected by that specific instruction. This means we can correctly infer that `mutate(b)` can't impact `a` here: ``` a = make(); b = make(); mutate(b); // when we interpret the mutation here, a isn't captured yet b.a = a; ``` We will need to make this a fixpoint, but only if there are backedges in the CFG. [ghstack-poisoned]