From bf4b4b2012992a5e8f59359d0dd6c89df1993cca Mon Sep 17 00:00:00 2001 From: Max Graey Date: Thu, 14 Oct 2021 02:44:56 +0300 Subject: [Selectify] Increase TooCostlyToRunUnconditionally from 7 to 9 (#4228) This makes Binaryen match LLVM on a real-world case, which is probably the safest heuristic to use. --- src/passes/RemoveUnusedBrs.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/passes/RemoveUnusedBrs.cpp b/src/passes/RemoveUnusedBrs.cpp index cbad81247..01c465f18 100644 --- a/src/passes/RemoveUnusedBrs.cpp +++ b/src/passes/RemoveUnusedBrs.cpp @@ -80,7 +80,10 @@ static bool canTurnIfIntoBrIf(Expression* ifCondition, return !EffectAnalyzer(options, wasm, ifCondition).invalidates(value); } -const Index TooCostlyToRunUnconditionally = 7; +// This leads to similar choices as LLVM does. +// See https://github.com/WebAssembly/binaryen/pull/4228 +// It can be tuned more later. +const Index TooCostlyToRunUnconditionally = 9; // Check if it is not worth it to run code unconditionally. This // assumes we are trying to run two expressions where previously -- cgit v1.2.3