noir
noir copied to clipboard
Ssa rename/simplify Jeq and Jne instructions
Currently we have two instructions for conditional jumps, Jeq and Jne, which take 1 NodeId argument and 1 block argument. They jump to the block if their arguments are non-zero and zero respectfully. This is opposite of the x86 instruction Jeq which jumps if the (comparison register) is 0, which can be confusing. I propose we:
- Rename Jne to Jz or even JumpIfZero
- Get rid of the other instruction since having both is unnecessary. Traditional architectures have both because the underlying target has both and thus avoiding extra boolean-not instructions is more efficient. Our jumps are all removed before Acir so this isn't an issue.
Jeq means JumpOnEqual and Jne means JumpOnNotEqual. We can rename them like this if jeq is confusing.
I don't see the point to keep only one of them as it will introduce unnecessary NOT instructions in the IR
Is this issue still actionable, needs further discussion or should it be closed?
I think it is still actionable, just rather low priority as it is a small refactor.
Closing as we are moving to new SSA code