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

[HWToBTOR2] Fix crashes on initial value corner cases #7844

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

TaoBi22
Copy link
Contributor

@TaoBi22 TaoBi22 commented Nov 19, 2024

Currently HWToBTOR2 crashes on both of the included error cases:

  1. unwrapImmutableValue throws an assert whenever it's given a value that wasn't defined by an initialOp, so I've added a check for that. While the first error case isn't technically legal anyway as instance ops aren't allowed in HWToBTOR2, the pass currently crashes before it gets to that point.
  2. Initial values given as a block argument will throw an error in requireSort as they don't have a queriable width. Pretty unlikely edge case, but can't hurt to have it covered! I've added it to the list of sorts ignored by requireSort, and it'll now get mopped up by the same check as point 1 rather than crashing

@TaoBi22 TaoBi22 requested review from uenoku and dobios November 19, 2024 17:10
Copy link
Member

@dobios dobios left a comment

Choose a reason for hiding this comment

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

LGTM apart for the small nit! Thanks for catching these!

lib/Conversion/HWToBTOR2/HWToBTOR2.cpp Outdated Show resolved Hide resolved
@TaoBi22 TaoBi22 merged commit c5f14f1 into llvm:main Nov 20, 2024
4 checks passed
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