//! > Test match optimizer simple scenario.
//! > test_runner_name
test_branch_inversion
//! > function
fn foo(a: bool, x: felt252) -> felt252 {
if !a {
1
} else {
x
}
}
//! > function_name
foo
//! > module_code
//! > semantic_diagnostics
//! > lowering_diagnostics
//! > before
Parameters: v0: core::bool, v1: core::felt252
blk0 (root):
Statements:
(v7: core::bool) <- core::bool_not_impl(v0)
End:
Match(match_enum(v7) {
bool::False(v5) => blk1,
bool::True(v3) => blk2,
})
blk1:
Statements:
End:
Goto(blk3, {v1 -> v6})
blk2:
Statements:
(v4: core::felt252) <- 1u
End:
Goto(blk3, {v4 -> v6})
blk3:
Statements:
End:
Return(v6)
//! > after
Parameters: v0: core::bool, v1: core::felt252
blk0 (root):
Statements:
(v7: core::bool) <- core::bool_not_impl(v0)
End:
Match(match_enum(v0) {
bool::False(v3) => blk2,
bool::True(v5) => blk1,
})
blk1:
Statements:
End:
Goto(blk3, {v1 -> v6})
blk2:
Statements:
(v4: core::felt252) <- 1u
End:
Goto(blk3, {v4 -> v6})
blk3:
Statements:
End:
Return(v6)