From b29a983ab9df96084fcf4b665c471abc0e9a8c7c Mon Sep 17 00:00:00 2001 From: primoly <168267431+primoly@users.noreply.github.com> Date: Sat, 18 May 2024 22:08:00 +0200 Subject: [PATCH] prevent const prop of const op --- src/passes/basic_opt.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/passes/basic_opt.rs b/src/passes/basic_opt.rs index 1ce7880..7313d40 100644 --- a/src/passes/basic_opt.rs +++ b/src/passes/basic_opt.rs @@ -204,7 +204,14 @@ impl<'a> BasicOptPass<'a> { .iter() .map(|&arg| value_is_const(arg, body)) .collect::>(); - let const_val = const_eval(op, &arg_values[..], None); + let const_val = match op { + Operator::I32Const { .. } + | Operator::I64Const { .. } + | Operator::F32Const { .. } + | Operator::F64Const { .. } + | Operator::V128Const { .. } => None, + _ => const_eval(op, &arg_values[..], None), + }; match const_val { Some(ConstVal::I32(val)) => { value = ValueDef::Operator(