Skip to content
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

Remove more than half the stack usage of CFG traversal #492

Merged
merged 1 commit into from
Feb 7, 2019

Conversation

dberlin
Copy link
Contributor

@dberlin dberlin commented Feb 6, 2019

A lot of recursive stack space is used walking the statements in order, which is not necessary.

@dberlin
Copy link
Contributor Author

dberlin commented Feb 6, 2019

Sorry, missed staging a hunk on the reverse one, one minute

Copy link
Member

@s3rvac s3rvac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are completely right -- the functions do not need to be recursive. I have included just a minor suggestion to update the descriptions of the two modified functions. Otherwise, LGTM 👍

src/llvmir2hll/graphs/cfg/cfg_traversal.cpp Show resolved Hide resolved
@dberlin
Copy link
Contributor Author

dberlin commented Feb 6, 2019

Sorry, i'll fix.
I have a follow on patch that removes all the recursion (the version here still takes about 30+ gig of stack on some of my test cases), and i updated the comments in there :)

@dberlin
Copy link
Contributor Author

dberlin commented Feb 6, 2019

I updated the comment. Note that they are still recursive, as traverseNodeSuccessors will recurse back into calling us.

The traversal of CFG nodes as implemented is quite weird in actual practice. I rewrote it in a followup, i'll include more details there.

Copy link
Member

@s3rvac s3rvac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 👍

@s3rvac
Copy link
Member

s3rvac commented Feb 7, 2019

That AppVeyor build failure is due to a timeout and has nothing to do with this PR. We will have to figure what to do with it.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants