Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat[venom]: only stack_reorder before join points (vyperlang#4247)
fix a venom performance bug, where the stack would be reordered before all jump instructions. for "joining" jump instructions (where the target basic block can have multiple cfg inputs), the stack reorder is needed, since we need the invariant that the stack layout needs to be the same no matter which basic block we jump to the target basic block from. however, before jumping into a block with only a single `cfg_in` (which, after cfg normalization, is equivalent to "splitting" jump instructions `jnz` and `djmp`), the stack reorder is unneeded, since stack reordering happens anyways in the target basic block, and no invariant on the incoming stack layout is required. this commit changes the behavior so that stack reordering only occurs before these "joining" jump instructions. on branch-heavy code, this can improve codesize by as much as 25%, with corresponding gas improvement, especially in the presence of loops.
- Loading branch information