-
Notifications
You must be signed in to change notification settings - Fork 217
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
Implement common subexpression elimination #550
Implement common subexpression elimination #550
Conversation
3a61cb2
to
c74fec1
Compare
The codegen test fails randomly, that's why the mac/windows tests have failed. |
87ffbd6
to
a4cdd1b
Compare
Please can you merge your commits into one commit, or more than one if it makes sense. It would be nice if commits are a set of logical changes. Also please ensure your commits have the correct |
143c08f
to
53074dc
Compare
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.
Please add some words to docs/optimizer.rst
. The documentation should at least explain that there is a CSE pass, and what it does (not necessarily how it works)
@@ -1254,6 +1257,10 @@ pub fn optimize_and_check_cfg( | |||
if opt.dead_storage { | |||
dead_storage::dead_storage(cfg, ns); | |||
} | |||
|
|||
if opt.common_subexpression_elimination && func_no.is_some() { |
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.
Any reason for func_no.some()
?
A default constructor has no function number, so it is None
in that case.
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.
A default constructor has no sub expression to be optimized.
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.
True, although that is worth 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.
Done
Signed-off-by: Lucas Steuernagel <[email protected]>
4990368
to
1ff5dc8
Compare
Added - On Solana, the accounts that were passed into the transactions are listed in the `tx.accounts` builtin. There is also a builtin struct `AccountInfo` - A new common subexpression elimination pass was added, thanks to [LucasSte](hyperledger-solang#550) - A graphviz dot file can be generated from the ast, using `--emit ast-dot` - Many improvements to the solidity parser, and the parser has been spun out in it's own create `solang-parser`. Changed - Solang now uses LLVM 13.0, based on the [Solana LLVM tree](https://github.com/solana-labs/llvm-project/) - The ast datastructure has been simplified. - Many bugfixes across the entire tree. Signed-off-by: Sean Young <[email protected]>
Added - On Solana, the accounts that were passed into the transactions are listed in the `tx.accounts` builtin. There is also a builtin struct `AccountInfo` - A new common subexpression elimination pass was added, thanks to [LucasSte](hyperledger-solang#550) - A graphviz dot file can be generated from the ast, using `--emit ast-dot` - Many improvements to the solidity parser, and the parser has been spun out in it's own create `solang-parser`. Changed - Solang now uses LLVM 13.0, based on the [Solana LLVM tree](https://github.com/solana-labs/llvm-project/) - The ast datastructure has been simplified. - Many bugfixes across the entire tree. Signed-off-by: Sean Young <[email protected]>
Added - On Solana, the accounts that were passed into the transactions are listed in the `tx.accounts` builtin. There is also a builtin struct `AccountInfo` - A new common subexpression elimination pass was added, thanks to [LucasSte](#550) - A graphviz dot file can be generated from the ast, using `--emit ast-dot` - Many improvements to the solidity parser, and the parser has been spun out in it's own create `solang-parser`. Changed - Solang now uses LLVM 13.0, based on the [Solana LLVM tree](https://github.com/solana-labs/llvm-project/) - The ast datastructure has been simplified. - Many bugfixes across the entire tree. Signed-off-by: Sean Young <[email protected]>
This PR implements common subexpression elimination for the Solang compiler. It runs an available expression analysis during the first pass. Then, during a second pass we exchange common expressions by a temporaries.
This PR is the last milestone for the Linux Mentorship for the Hyperledger foundation. For more information about the project, please check the wiki.