-
-
Notifications
You must be signed in to change notification settings - Fork 793
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
Simplify boolops #2467
Simplify boolops #2467
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2467 +/- ##
==========================================
- Coverage 84.52% 84.35% -0.17%
==========================================
Files 93 93
Lines 9228 9271 +43
Branches 2085 2102 +17
==========================================
+ Hits 7800 7821 +21
- Misses 939 954 +15
- Partials 489 496 +7
Continue to review full report at Codecov.
|
Does this still retain short-circuiting properties? |
FYI - this introduces an extra jump for the nested operations, each block jumps out to the enclosing block. For the most nested block it will do something like
We can analyze and optimize it out of the asm. Basically if the destination of a jump is another jump, we just jump to the final destination. But maybe I'll include that analysis in this PR before it's merged |
And yes. If we don't have a test for that, we should |
8c4f04b
to
ecbf63f
Compare
I'm pretty sure we do, I just don't know where. |
get rid of the unnecessary goto and seq_unchecked
ecbf63f
to
27d8f58
Compare
this makes it easier to inspect the assembly after it has been optimized.
`if (x) (IF_TRUE) (IF_FALSE)` is more efficiently expressed as `if (iszero(x)) (IF_FALSE) (IF_TRUE)`
35d273c
to
17c1d6e
Compare
also fixes the existing optimization which didn't properly modify the argument in place. this also collapses sequences of JUMPs. this makes exiting out of nested blocks (e.g. nested if statements) more efficient.
6eb0919
to
f6155f7
Compare
done in f6155f7 |
What I did
Removed unnecessary goto and seq_unchecked from bool ops. Also has the added benefit of making the code more efficient. The following code loses 6 bytes worth of bytecode:
The difference in IR for the
x or y or z
expression isbefore:
after:
The difference for the
x and y and z
expression is similar.How to verify it
Tests still pass, also compile the above example
Description for the changelog
Simplify code generation for boolean operations
Cute Animal Picture