Keep the view-header test's loops speculative

Module number globals are now proven int32 through their writes, so the test's generator state starts from a value no analysis bounds to keep its loops on the speculative path. Format int32-slots.ts.
This commit is contained in:
Chris Tate
2026-10-27 08:41:05 -05:00
parent c54c4e1d2a
commit 660ddfd90e
2 changed files with 4 additions and 4 deletions
+1 -2
View File
@@ -1722,8 +1722,7 @@ export function analyzeInt32Slots(mod: IrModule, inputs: Int32SlotInputs = {}):
if (s.kind === "assign") {
boxWrite(s.localId, s.value);
globalWrite(s.localId, s.value);
}
else if (s.kind === "varDecl" && s.init) boxWrite(s.localId, s.init);
} else if (s.kind === "varDecl" && s.init) boxWrite(s.localId, s.init);
if (s.kind === "fieldSet") {
const family = slots.family(s.className, s.field);
if (!family || !slots.hasFamily(family)) return;
@@ -188,9 +188,10 @@ test("a speculative loop reads its views' header fields once, before its copies"
// A view held by a const local or by a parameter is the same view in
// every iteration. Its data pointer is read before the branch to the fast
// copy, and no copy (ordinary, fast, or the one a failed check resumes
// in) reads it again.
// in) reads it again. `last` starts from a value no analysis bounds,
// so the loops speculate on `l`.
const llvm = await emitLlvm(`
let last = 42;
let last = Number(process.argv[2] ?? "42");
function fill(array: ArrayBuffer, count: number): void {
const buf = new Float64Array(array);
let l = last;