-
Notifications
You must be signed in to change notification settings - Fork 29
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
fix: rearrange so assert(false) not on return path #150
base: dev14
Are you sure you want to change the base?
Conversation
lib/seadsa/Graph.cc
Outdated
if (m_links.count(omni)) return *m_links.at(omni); | ||
|
||
assert(false); // unreachable | ||
assert(m_links.count(omni)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is important
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the diff is too confusing. You are replacing a return with assert. That cannot be correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The earlier code was
if (m_links.count(omni)) return *m_links.at(omni)
// else fall through to
assert(false)
// ** possibly undefined return value depending on semantics of assert **
// ** Thus, compiler complains.
Now it is rewritten such that intent is clearer and we pass the compiler check
assert(m_links.count(omni))
// ** possibly incorrect return value if assert is nop. However, **
// ** based on existing logic, we expect the assert to never fail **
return *m_links.at(omni)
lib/seadsa/RemovePtrToInt.cc
Outdated
ptr, {I.getOperand(1)}); | ||
auto *gep = | ||
IRB.CreateGEP(ptr->getType()->getScalarType()->getPointerElementType(), | ||
ptr, I.getOperand(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
important: braces around scalar initializer removed
2687495
to
aaaa30e
Compare
aaaa30e
to
8eabd0f
Compare
other changes are format only