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

Improved diagnostics for SSAValue.erase() #101

Closed
MichalPitr opened this issue Apr 12, 2022 · 0 comments · Fixed by #120
Closed

Improved diagnostics for SSAValue.erase() #101

MichalPitr opened this issue Apr 12, 2022 · 0 comments · Fixed by #120

Comments

@MichalPitr
Copy link

SSAValue.erase() raises a generic exception "Attempting to delete SSA value that still has uses."

It would be more useful if it also printed out the specific operation.

This can be achieved by:

   def erase(self, safe_erase: bool = True) -> None:
        """
        Erase the value.
        If safe_erase is True, then check that no operations use the value anymore.
        If safe_erase is False, then replace its uses by an ErasedSSAValue.
        """
        if safe_erase and len(self.uses) != 0:
            raise Exception(
                f"Attempting to delete SSA value that still has uses: {self}")
        self.replace_by(ErasedSSAValue(self.typ))

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 a pull request may close this issue.

1 participant