Adds a transformation which converts br to if when the variable branched on was assigned in the previous instruction. The transformation itself doesn't check liveness and doesn't remove the assignment. Dead code elimination should be run afterwards to remove the assignment.
For Cairo, it only makes sense to convert br to if for equality comparisons against zero. The assignment before br will always become dead after converting br to if, because we convert to SSA before.
br
toif
when the variable branched on was assigned in the previous instruction. The transformation itself doesn't check liveness and doesn't remove the assignment. Dead code elimination should be run afterwards to remove the assignment.br
toif
for equality comparisons against zero. The assignment beforebr
will always become dead after convertingbr
toif
, because we convert to SSA before.