From 5673588be4bed93ba327fbcf5d74eddf102d2566 Mon Sep 17 00:00:00 2001 From: Joe Savona Date: Mon, 13 Feb 2023 15:26:07 -0800 Subject: [PATCH] [be] Tidy up some mutableRange logic --- compiler/forget/src/Inference/InferMutableLifetimes.ts | 6 +++--- .../src/ReactiveScopes/InferReactiveScopeVariables.ts | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/compiler/forget/src/Inference/InferMutableLifetimes.ts b/compiler/forget/src/Inference/InferMutableLifetimes.ts index bc07edf69c..52a6dacc95 100644 --- a/compiler/forget/src/Inference/InferMutableLifetimes.ts +++ b/compiler/forget/src/Inference/InferMutableLifetimes.ts @@ -102,14 +102,14 @@ export function inferMutableLifetimes( for (const [_, block] of func.body.blocks) { for (const phi of block.phis) { let start = Number.MAX_SAFE_INTEGER; - let end = Number.MIN_SAFE_INTEGER; + let end = phi.id.mutableRange.end as number; for (const [_, operand] of phi.operands) { start = Math.min(start, operand.mutableRange.start); end = Math.max(end, operand.mutableRange.end); } invariant( - start !== Number.MAX_SAFE_INTEGER && end !== Number.MIN_SAFE_INTEGER, - "Expected phi to have set start/end range values" + start !== Number.MAX_SAFE_INTEGER, + "Expected phi to have a start range value" ); phi.id.mutableRange = { start: makeInstructionId(start), diff --git a/compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts b/compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts index 33ca29c416..a3674bd2c4 100644 --- a/compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts +++ b/compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts @@ -148,15 +148,6 @@ export function inferReactiveScopeVariables(fn: HIRFunction): void { } vars.add(identifier); }); - - // Copy scope ranges to identifier ranges: not strictly required but this is useful - // for visualization - for (const [scope, vars] of scopeVariables) { - for (const identifier of vars) { - identifier.mutableRange.start = scope.range.start; - identifier.mutableRange.end = scope.range.end; - } - } } // Is the operand mutable at this given instruction