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.
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
Detect and reroll unrolled do-while loops #76
base: master
Are you sure you want to change the base?
Detect and reroll unrolled do-while loops #76
Changes from 46 commits
0de7b12
9d10258
d394e9b
ad167f7
8d99b31
24f5e2f
e35518b
db72018
9bf11da
b3b8e22
09e85cb
0a1156b
03a8ab0
0b22145
c937919
b4ed8e0
75ce71f
1997ed4
7919a49
f637685
2d58683
8a5bf38
2fe2c7d
24e6066
3517860
57f6697
f4aa9e6
2768028
49fbcfa
c359b3b
e4ce1f1
8073b65
ce9ba4e
cc67261
0ec795e
03b6d42
90c8f2c
4379021
a2ed466
fb23b5d
774d467
914479e
ea1593f
75a6c19
5849d59
4fdaadc
25e798f
2f9dcd0
66083c3
85e9d55
b595ce8
ec17645
ef59716
fc7fff9
d63b4af
0df65fc
c89f8a0
f9b25ed
587e770
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
At first glance, I think the
break
should becontinue
(if it's OK to have missing edges) orreturn False
(if it's not OK) -- otherwise, right now the behavior seems dependent on the order of the children in the list?I think the fix here might actually be to iterate over
set(children)
instead. Ifn
isn't inincoming_edges[s]
, then I think that meanss.parents
was not constructed correctly? (Sorry that this might be a pre-existing bug)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.
Does that mean
n.children()
might have repeats? That makes sense actually, and is probably why my extremely old version of this PR didn't need this fix (I changedchildren()
to aSet
.)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.
Oh wait, I'm wrong, my bad!
n.children()
shouldn't have repeats: the implementations for that fn inSwitchNode
&ConditionalNode
explicitly deduplicate the children.I can take a look and figure out what's going on here.
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.
Add a comment with the structure/asm we're trying to pattern-match here (or refer to a test?).
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.
It'd be nice to include a
dot
representation of what's going on:And maybe a link to an online render, like https://bit.ly/3A2MEJt
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 is actually nearly exactly what the new reroll.py does -- stay tuned
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 think we should also check that these nodes have the parents we expect. I feel like this pass has a large potential for misdetection and changing the asm into something non-equivalent, so we should be as careful as we can in the pattern-matching.
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 function modifies
flow_graph
in-place, so I don't think it needs to return anything.