-
Notifications
You must be signed in to change notification settings - Fork 15.6k
[SimplifyCFG] Delete the unnecessary range check for small mask operation #65835
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
Conversation
|
ping ? |
|
sorry for ping |
78e4159 to
76bde92
Compare
zmodem
left a comment
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 basically looks good to me. Just some minor comments.
fa48021 to
7d66f9b
Compare
zmodem
left a comment
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.
lgtm
Please wait for @nikic to check too.
03fb9ae to
5dcb980
Compare
nikic
left a comment
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.
LGTM
…tion
When the small mask value little than 64, we can eliminate the checking
for upper limit of the range by enlarge the lookup table size to the maximum
index value. (Then the final table size grows to the next pow2 value)
```
bool f(unsigned x) {
switch (x % 8) {
case 0: return 1;
case 1: return 0;
case 2: return 0;
case 3: return 1;
case 4: return 1;
case 5: return 0;
case 6: return 1;
// This would remove the range check: case 7: return 0;
}
return 0;
}
```
Use WouldFitInRegister instead of fitsInLegalInteger to support
more result type beside bool.
Fixes llvm#65120
Reviewed By: zmodem, nikic, RKSimon
|
It looks like this causes assertion failures on some build bots, for example https://lab.llvm.org/buildbot/#/builders/176/builds/6529:
|
|
ok, I revert it soon, sorry |
…k operation (#70542) Fix the compile crash when the default result has no result for llvm/llvm-project#65835 Fixes llvm/llvm-project#65120 Reviewed By: zmodem, nikic
…mall mask operation (#70542)" This caused llvm/llvm-project#71329 > Fix the compile crash when the default result has no result for > llvm/llvm-project#65835 > > Fixes llvm/llvm-project#65120 > Reviewed By: zmodem, nikic This reverts commit 7c4180a.
When the small mask value little than 64, we can eliminate the checking for upper limit of the range by enlarge the lookup table size to its next pow2 value. Consider: https://godbolt.org/z/3qnE45YWj
Fixes #65120