mirror of
https://github.com/vercel-labs/scriptc.git
synced 2026-11-03 07:54:40 +08:00
Merge main into perf/array-layout-main
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user