From ffb0aa990d6da2879e609bbb435b4d78ef8d6273 Mon Sep 17 00:00:00 2001 From: Changqing Jing Date: Tue, 14 Jul 2026 12:50:49 +0800 Subject: [PATCH] WIP --- src/ir/possible-contents.cpp | 2 +- src/passes/TypeGeneralizing.cpp | 2 +- src/tools/wasm-fuzz-lattices.cpp | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ir/possible-contents.cpp b/src/ir/possible-contents.cpp index d9fa0e7b8c9..bd2ea7192db 100644 --- a/src/ir/possible-contents.cpp +++ b/src/ir/possible-contents.cpp @@ -1865,7 +1865,7 @@ void TNHOracle::infer() { auto ensureCFG = [&]() { if (!blockIndexes) { - auto cfg = analysis::CFG::fromFunction(func); + auto cfg = analysis::CFG::fromFunction(func, &wasm); blockIndexes = analysis::CFGBlockIndexes(cfg); } }; diff --git a/src/passes/TypeGeneralizing.cpp b/src/passes/TypeGeneralizing.cpp index 749372ff107..75c1ae956c7 100644 --- a/src/passes/TypeGeneralizing.cpp +++ b/src/passes/TypeGeneralizing.cpp @@ -928,7 +928,7 @@ struct TypeGeneralizing : WalkerPass> { runner.add("dce"); runner.runOnFunction(func); - auto cfg = CFG::fromFunction(func); + auto cfg = CFG::fromFunction(func, wasm); DBG(cfg.print(std::cerr)); TransferFn txfn(*wasm, func, cfg); MonotoneCFGAnalyzer analyzer(txfn.lattice, txfn, cfg); diff --git a/src/tools/wasm-fuzz-lattices.cpp b/src/tools/wasm-fuzz-lattices.cpp index 4b29e8eb477..7ca385633fa 100644 --- a/src/tools/wasm-fuzz-lattices.cpp +++ b/src/tools/wasm-fuzz-lattices.cpp @@ -990,7 +990,8 @@ struct Fuzzer { // Helper function to run per-function tests. latticeElementSeed is used to // generate three lattice elements randomly. It is also used to select which // analysis is to be tested for the function. - void runOnFunction(Function* func, uint64_t latticeElementSeed) { + void + runOnFunction(Module* wasm, Function* func, uint64_t latticeElementSeed) { RandEngine getFuncRand(latticeElementSeed); // Fewer bytes are needed to generate three random lattices. @@ -1002,7 +1003,7 @@ struct Fuzzer { Random rand(std::move(funcBytes)); checkLatticeProperties(rand, verbose); - CFG cfg = CFG::fromFunction(func); + CFG cfg = CFG::fromFunction(func, wasm); switch (rand.upTo(2)) { case 0: { @@ -1047,13 +1048,14 @@ struct Fuzzer { // If a specific function and lattice element seed is specified, only run // that. if (latticeElementSeed && funcName) { - runOnFunction(testModule.getFunction(*funcName), *latticeElementSeed); + runOnFunction( + &testModule, testModule.getFunction(*funcName), *latticeElementSeed); return; } ModuleUtils::iterDefinedFunctions(testModule, [&](Function* func) { uint64_t funcSeed = getRand(); - runOnFunction(func, funcSeed); + runOnFunction(&testModule, func, funcSeed); }); } };