Skip to content

Commit

Permalink
early return in get_expression
Browse files Browse the repository at this point in the history
  • Loading branch information
HodanPlodky committed Jan 30, 2025
1 parent 7a59827 commit 5fb3aa3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions vyper/venom/analysis/available_expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,6 @@ def get_same(self, expr: _Expression) -> _Expression | None:

return None

def exist(self, expr: _Expression) -> bool:
if expr.opcode not in self.buckets:
return False
bucket = self.buckets[expr.opcode]
return expr in bucket

def copy(self) -> "_AvailableExpression":
res = _AvailableExpression()
for key, val in self.buckets.items():
Expand Down Expand Up @@ -351,9 +345,12 @@ def get_expression(
return self._get_expression(inst, available_exprs)

def _get_expression(self, inst: IRInstruction, available_exprs: _AvailableExpression):
if inst.opcode in IMMUTABLE_ENV_QUERIES:
return _Expression(inst, inst.opcode, [], self.ignore_msize)
operands: list[IROperand | _Expression] = self._get_operands(inst, available_exprs)
expr = _Expression(inst, inst.opcode, operands, self.ignore_msize)


same_expr = available_exprs.get_same(expr)
if same_expr is not None:
self.inst_to_expr[inst] = same_expr
Expand Down

0 comments on commit 5fb3aa3

Please sign in to comment.