diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/tools/translate-to-fuzz.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/tools/translate-to-fuzz.h b/src/tools/translate-to-fuzz.h index 36639ce84..307604af6 100644 --- a/src/tools/translate-to-fuzz.h +++ b/src/tools/translate-to-fuzz.h @@ -452,14 +452,20 @@ private: // make something with no chance of infinite recursion Expression* makeTrivial(WasmType type) { if (isConcreteWasmType(type)) { - return makeConst(type); + if (oneIn(2)) { + return makeGetLocal(type); + } else { + return makeConst(type); + } } else if (type == none) { return makeNop(type); } assert(type == unreachable); - return builder.makeReturn( - isConcreteWasmType(func->result) ? makeConst(func->result) : nullptr - ); + Expression* ret = nullptr; + if (isConcreteWasmType(func->result)) { + ret = makeTrivial(func->result); + } + return builder.makeReturn(ret); } // specific expression creators @@ -650,7 +656,7 @@ private: Expression* makeGetLocal(WasmType type) { auto& locals = typeLocals[type]; - if (locals.empty()) return makeTrivial(type); + if (locals.empty()) return makeConst(type); return builder.makeGetLocal(vectorPick(locals), type); } |