Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[venom]: binopt #4281

Draft
wants to merge 46 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
123c07d
start binopt
HodanPlodky Oct 7, 2024
bb80541
better way of doing it
HodanPlodky Oct 8, 2024
79e3880
idea with equivalence analysis
HodanPlodky Oct 8, 2024
59dcdf5
more rules
HodanPlodky Oct 9, 2024
b543c36
all the rules from the original optimizer should be done
HodanPlodky Oct 9, 2024
f4650e3
all the rules from the original optimizer were not done so I added so…
HodanPlodky Oct 9, 2024
32ff283
lint
HodanPlodky Oct 9, 2024
ba0e245
different order
HodanPlodky Oct 9, 2024
5e74741
fixed test which no longer needed to be expected to fail
HodanPlodky Oct 10, 2024
3868042
removed _handle_offsets and fully moved it to the rest of the bin opt…
HodanPlodky Oct 10, 2024
1105344
truthy rules start
HodanPlodky Oct 10, 2024
8e4500e
adapted test for out of bounds check to take account static asserts e…
HodanPlodky Oct 10, 2024
eebed21
adapted test for out of bounds check to take account static asserts e…
HodanPlodky Oct 10, 2024
41960e8
Merge branch 'master' into feat/binopt
HodanPlodky Oct 10, 2024
d025563
Merge branch 'master' into feat/binopt
HodanPlodky Oct 10, 2024
4c5ee06
truthy continuation
HodanPlodky Oct 11, 2024
63fdfd5
truthy fix of eq
HodanPlodky Oct 13, 2024
3a6dbf9
more comparison ops opt
HodanPlodky Oct 13, 2024
a4e152b
better check of dict from charles
HodanPlodky Oct 15, 2024
ec0b5f2
Merge branch 'master' into feat/binopt
HodanPlodky Oct 15, 2024
c28dc4a
quick fix after merge
HodanPlodky Oct 15, 2024
2f1367f
more rules
HodanPlodky Oct 15, 2024
6150fc7
Merge branch 'master' into feat/binopt
HodanPlodky Oct 15, 2024
a4e996a
used commutative
HodanPlodky Oct 15, 2024
6f3a06f
better adding of additional instructions
HodanPlodky Oct 15, 2024
052f6bb
better rules handling start
HodanPlodky Oct 16, 2024
db0d608
better rules handling start
HodanPlodky Oct 16, 2024
83dec6a
more rules moved
HodanPlodky Oct 16, 2024
e52f8e8
Merge branch 'master' into feat/binopt
HodanPlodky Oct 17, 2024
9620ed1
more rules and more way to implement them
HodanPlodky Oct 17, 2024
372317c
more rules in different way
HodanPlodky Oct 17, 2024
7e69bf5
more rules in different way
HodanPlodky Oct 18, 2024
d084c1f
move some of the binopt into the sccp
HodanPlodky Oct 23, 2024
b2c8bd2
fix of the negative number rules
HodanPlodky Oct 24, 2024
db29ad5
removed the opts from algebraic ops
HodanPlodky Oct 24, 2024
9655460
lint + cleanup
HodanPlodky Oct 24, 2024
4b0ec3b
moved test for offsets from algebraic optimizer to sccp test
HodanPlodky Oct 24, 2024
8989fd9
added jnz to truthy
HodanPlodky Oct 24, 2024
9603690
uses calc on fly
HodanPlodky Oct 24, 2024
7bf4667
uses calc on fly fix
HodanPlodky Oct 24, 2024
22df052
sccp reduced recalc
HodanPlodky Oct 24, 2024
53d4122
used dfg instead of the different uses computation
HodanPlodky Oct 25, 2024
c63ab04
Merge branch 'master' into feat/binopt
HodanPlodky Oct 28, 2024
137cb1e
dfg calculation on fly and assert weird behaviour
HodanPlodky Oct 28, 2024
1e0aa69
sccp static assert fix
HodanPlodky Oct 29, 2024
b99ea0e
lint and comments
HodanPlodky Oct 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions tests/functional/builtins/codegen/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
from vyper.compiler import compile_code
from vyper.compiler.settings import OptimizationLevel, Settings
from vyper.evm.opcodes import version_check
from vyper.exceptions import ArgumentException, CompilerPanic, TypeMismatch
from vyper.exceptions import (
ArgumentException,
CompilerPanic,
StaticAssertionException,
TypeMismatch,
)

_fun_bytes32_bounds = [(0, 32), (3, 29), (27, 5), (0, 5), (5, 3), (30, 2)]

Expand Down Expand Up @@ -533,9 +538,12 @@

@pytest.mark.parametrize("bad_code", oob_fail_list)
def test_slice_buffer_oob_reverts(bad_code, get_contract, tx_failed):
c = get_contract(bad_code)
with tx_failed():
c.do_slice()
try:
c = get_contract(bad_code)
with tx_failed():
c.do_slice()
except StaticAssertionException:

Check notice

Code scanning / CodeQL

Empty except Note test

'except' clause does nothing but pass and there is no explanatory comment.
pass


# tests all 3 adhoc locations: `msg.data`, `self.code`, `<address>.code`
Expand Down
4 changes: 0 additions & 4 deletions tests/functional/codegen/features/test_constructor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import pytest

from tests.evm_backends.base_env import _compile
from vyper.exceptions import StackTooDeep
from vyper.utils import method_id


Expand Down Expand Up @@ -169,7 +166,6 @@ def get_foo() -> uint256:
assert c.get_foo() == 39


@pytest.mark.venom_xfail(raises=StackTooDeep, reason="stack scheduler regression")
def test_nested_dynamic_array_constructor_arg_2(env, get_contract):
code = """
foo: int128
Expand Down
1 change: 1 addition & 0 deletions vyper/venom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
MakeSSA(ac, fn).run_pass()
Mem2Var(ac, fn).run_pass()
MakeSSA(ac, fn).run_pass()
AlgebraicOptimizationPass(ac, fn).run_pass()

Check warning on line 52 in vyper/venom/__init__.py

View check run for this annotation

Codecov / codecov/patch

vyper/venom/__init__.py#L52

Added line #L52 was not covered by tests
SCCP(ac, fn).run_pass()
StoreElimination(ac, fn).run_pass()
SimplifyCFGPass(ac, fn).run_pass()
Expand Down
4 changes: 4 additions & 0 deletions vyper/venom/analysis/dfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
uses = self._dfg_inputs.setdefault(op, [])
uses.append(inst)

def add_output(self, op: IRVariable, inst: IRInstruction):
assert op not in self._dfg_outputs.keys()
HodanPlodky marked this conversation as resolved.
Show resolved Hide resolved
self._dfg_outputs[op] = inst

Check warning on line 32 in vyper/venom/analysis/dfg.py

View check run for this annotation

Codecov / codecov/patch

vyper/venom/analysis/dfg.py#L31-L32

Added lines #L31 - L32 were not covered by tests

def remove_use(self, op: IRVariable, inst: IRInstruction):
uses = self._dfg_inputs.get(op, [])
uses.remove(inst)
Expand Down
Loading
Loading