Check whether check_for_negated_jmpif_condition
optimization would benefit ACIR functions.
#6624
Labels
check_for_negated_jmpif_condition
optimization would benefit ACIR functions.
#6624
In #5891 we started swapping the
then
andelse
branches of if-else statements in brillig functions if the if condition was being negated. Due to some issues with the flattening pass we didn't apply this optimization to ACIR functions.The CFG allows querying the block in which the two branches will merge again:
noir/compiler/noirc_evaluator/src/ssa/opt/flatten_cfg/branch_analysis.rs
Lines 32 to 55 in 10a9f81
Using this we can perform some inspection to determine whether we're in a situation where the two blocks merge inside of the
else
branch (and so swapping the condition would move it to thethen
branch) or whether it's save to negate the condition.The text was updated successfully, but these errors were encountered: