[be] Tidy up some mutableRange logic
Joe Savona committed
Feb 13, 2023 at 15:26 UTC
5673588be4bed93ba327fbcf5d74eddf102d2566
2 files changed
+3
-12
compiler/forget/src/Inference/InferMutableLifetimes.ts
+3
-3
@@ -102,14 +102,14 @@ export function inferMutableLifetimes(
102
for (const [_, block] of func.body.blocks) {
103
for (const phi of block.phis) {
104
let start = Number.MAX_SAFE_INTEGER;
105
- let end = Number.MIN_SAFE_INTEGER;
105
+ let end = phi.id.mutableRange.end as number;
106
for (const [_, operand] of phi.operands) {
107
start = Math.min(start, operand.mutableRange.start);
108
end = Math.max(end, operand.mutableRange.end);
109
}
110
invariant(
111
- start !== Number.MAX_SAFE_INTEGER && end !== Number.MIN_SAFE_INTEGER,
112
- "Expected phi to have set start/end range values"
111
+ start !== Number.MAX_SAFE_INTEGER,
112
+ "Expected phi to have a start range value"
113
);
114
phi.id.mutableRange = {
115
start: makeInstructionId(start),
compiler/forget/src/ReactiveScopes/InferReactiveScopeVariables.ts
-9
@@ -148,15 +148,6 @@ export function inferReactiveScopeVariables(fn: HIRFunction): void {
148
}
149
vars.add(identifier);
150
});
151
-
152
- // Copy scope ranges to identifier ranges: not strictly required but this is useful
153
- // for visualization
154
- for (const [scope, vars] of scopeVariables) {
155
- for (const identifier of vars) {
156
- identifier.mutableRange.start = scope.range.start;
157
- identifier.mutableRange.end = scope.range.end;
158
- }
159
- }
151
}
152
153
// Is the operand mutable at this given instruction