From 9b80f3d4b4bda1d352c4cb2db6638fe168d6cf13 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Sun, 11 Oct 2026 14:45:30 -0500 Subject: [PATCH 1/2] Update constant-table emission test for exact index checks --- packages/compiler/test/constant-table-emission.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/compiler/test/constant-table-emission.test.ts b/packages/compiler/test/constant-table-emission.test.ts index 60be74507..5fddb2663 100644 --- a/packages/compiler/test/constant-table-emission.test.ts +++ b/packages/compiler/test/constant-table-emission.test.ts @@ -33,14 +33,15 @@ console.log(lookup(1), mutated[0] * 1); expect(llvm).toContain("@sc_const_numbers_0 = private constant [3 x double]"); expect(llvm).toContain("%initialized = icmp ne ptr %a, null"); - expect(llvm).toContain("br i1 %safe, label %convert, label %fallback"); - expect(llvm).toContain("br i1 %integer, label %read, label %fallback"); + expect(llvm).toContain("%ix0 = fptosi double %i to i64"); + expect(llvm).toContain("%safe = and i1 %initialized, %ix5"); + expect(llvm).toContain("br i1 %safe, label %read, label %fallback"); expect(llvm).toMatch(/call double @sc_const_numbers_0_get\(/); expect(llvm).toContain("call double @scr_arr_get_number(ptr %a, double %i)"); expect(llvm).toMatch(/call double @scr_arr_push_many\(ptr [^,]+, i64 3, ptr /); const wasm = emitLlvmModule(mod, { pointerBits: 32, wasi: true }); - expect(wasm).toContain("%index = fptoui double %i to i32"); - expect(wasm).toContain("ptr @sc_const_numbers_0, i32 0, i32 %index"); + expect(wasm).toContain("%ix0 = fptosi double %i to i64"); + expect(wasm).toContain("ptr @sc_const_numbers_0, i64 0, i64 %ix1"); } finally { await rm(dir, { recursive: true, force: true }); } From f3cfa80a8ebfb065de51558df4ade06861a6a422 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Sun, 11 Oct 2026 14:48:03 -0500 Subject: [PATCH 2/2] Update byte-loop emission test for exact index checks --- packages/compiler/test/bytes-element-emission.test.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/compiler/test/bytes-element-emission.test.ts b/packages/compiler/test/bytes-element-emission.test.ts index 953687993..3c001a148 100644 --- a/packages/compiler/test/bytes-element-emission.test.ts +++ b/packages/compiler/test/bytes-element-emission.test.ts @@ -314,7 +314,7 @@ test("canonical byte loops keep their induction variable and indices integral", expect(ll).toContain("alloca i64 ; integer induction index"); expect(ll).toContain("icmp ult i64"); - expect(ll).not.toContain("bytes.index.range"); + expect(ll).not.toContain("fptosi double"); }); test("a body mutation keeps the byte loop on the general f64 path", () => { @@ -324,8 +324,8 @@ test("a body mutation keeps the byte loop on the general f64 path", () => { const ll = emitLlvmModule(mod); expect(ll).not.toContain("integer induction index"); - expect(ll).toContain("bytes.index.range"); - expect(ll).toContain("fptoui double"); + expect(ll).toContain("bytes.index.valid"); + expect(ll).toContain("fptosi double"); }); test("large record clones stay outlined while small clones remain inlineable", () => {