-
Notifications
You must be signed in to change notification settings - Fork 787
Simplify signed reminders which compared with zero #3153
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
31a5276
Simplify signed reminders which compared with zero
MaxGraey 25aca33
add match for unary. More tests
MaxGraey 8654640
more test
MaxGraey c934b6f
Merge branch 'master' into opt-rem_s-w-cmp-zero
MaxGraey 25c5658
remove expr == 0 matching
MaxGraey 5601d17
refactor
MaxGraey 0adb236
remove redundancy and refactoring
MaxGraey 969b642
Merge branch 'master' into opt-rem_s-w-cmp-zero
MaxGraey 9ba1540
Merge branch 'master' into opt-rem_s-w-cmp-zero
MaxGraey dd6099a
update fixtures
MaxGraey d2cee70
move eqz rule on top
MaxGraey 99fe2a6
trigger ci
MaxGraey 12bec6f
Merge branch 'master' into opt-rem_s-w-cmp-zero
MaxGraey 99df9be
update fixtures after sync with master
MaxGraey a881c38
Update src/passes/OptimizeInstructions.cpp
MaxGraey 2e41728
refactor
MaxGraey 998ee26
more
MaxGraey cc4bc4e
more (scope)
MaxGraey f583965
refactor according review
MaxGraey 4a01171
space
MaxGraey 6bb1aa5
revert changes
MaxGraey 1ca1bc6
refactor
MaxGraey e8cc01b
same for eqz rule
MaxGraey c9fc299
more
MaxGraey 002906a
use c->type instead left->type which simplify expr != 0 rule
MaxGraey 4bd7810
simplify eqz rule as well
MaxGraey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
why is the cast to
uint64_t
needed?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.
IsPowerOf2
allow only unsigned types butgetInteger()
returnint64_t
Uh oh!
There was an error while loading. Please reload this page.
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.
Btw negative dividers like
x % -4 == 0
currently rejected and not optimized which is ok but it seems it could be handle as(x & 3) == 0
as well.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.
Wouldn't it work without the cast, then? The function is
which just cares about bits anyhow. There should be no compiler warning or error here? Maybe I'm not sure what you mean by "allow only".
Uh oh!
There was an error while loading. Please reload this page.
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.
I'm not sure signed type does make sense for
isPowerOf2
due to negative values always returnfalse
. But you're right casting touint64_t
here unnecessary.Uh oh!
There was an error while loading. Please reload this page.
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.
Logically, I agree, it's odd to ask about a negative number. But we just have bits here, really. A Literal just stores the bits, without a sign (just like wasm and LLVM IR, etc.).
Uh oh!
There was an error while loading. Please reload this page.
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.
I'll create PR which handle also negative dividers:
x % -C_pot == 0
->(x & (abs(C_pot) - 1)) == 0
and remove this cast as well