Skip to content

feat[venom]: add dead store elimination pass #4556

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

Merged

Conversation

harkal
Copy link
Collaborator

@harkal harkal commented Apr 4, 2025

What I did

Implement a dead store elimination pass

How I did it

How to verify it

Commit message

This commit adds a dead store elimination (DSE) optimization pass
for Venom IR, removing memory writes to locations that are never read
from. It also updates memory SSA and alias analysis, with significant
refactoring. `InstUpdater` is also improved to retain change history
for better debugging.

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->


from vyper.codegen.ir_node import IRnode
from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRVariable
from vyper.venom.memory_location import MemoryLocation

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'MemoryLocation' may not be defined if module
vyper.venom.memory_location
is imported before module
vyper.venom.function
, as the
definition
of MemoryLocation occurs after the cyclic
import
of vyper.venom.function.
from dataclasses import dataclass

from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IRLiteral' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of IRLiteral occurs after the cyclic
import
of vyper.venom.memory_location.
from dataclasses import dataclass

from vyper.exceptions import CompilerPanic
from vyper.venom.basicblock import IRLiteral, IROperand, IRVariable

Check failure

Code scanning / CodeQL

Module-level cyclic import Error

'IROperand' may not be defined if module
vyper.venom.basicblock
is imported before module
vyper.venom.memory_location
, as the
definition
of IROperand occurs after the cyclic
import
of vyper.venom.memory_location.
Copy link
Member

@charles-cooper charles-cooper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please draft a commit message!

@charles-cooper charles-cooper changed the title feat[venom]: dead store elimination feat[venom]: add dead store elimination pass May 21, 2025
@charles-cooper charles-cooper enabled auto-merge (squash) May 21, 2025 12:29
@charles-cooper charles-cooper merged commit 3a19f5c into vyperlang:master May 21, 2025
158 of 159 checks passed
@harkal harkal deleted the feat/venom/dead_store_elimination branch May 21, 2025 12:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants