-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Add known and demanded bits support for zext nneg #70858
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -1103,6 +1103,9 @@ static void computeKnownBitsFromOperator(const Operator *I, | |||
assert(SrcBitWidth && "SrcBitWidth can't be zero"); | ||||
Known = Known.anyextOrTrunc(SrcBitWidth); | ||||
computeKnownBits(I->getOperand(0), Known, Depth + 1, Q); | ||||
if (auto *Inst = dyn_cast<PossiblyNonNegInst>(I); | ||||
Inst && Inst->hasNonNeg() && !Known.isNegative()) | ||||
Known.makeNonNegative(); | ||||
|
if (isKnownNonNegative && !Known.isNegative()) |
!Known.isNegative()
check first.
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.
nit; imo should move this statement to before the if and use
&&
.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.
Not sure what you're suggesting? Why would I want to expand the scope of the Inst variable?
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.
Guess the syntax
if (A = expr; other_stuff...)
is a pretty abnormal pattern and imo prone to be misread, but its a nit and nikics approved so no need to change if you feel otherwise.