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

SSA CFG Liveness #15439

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

SSA CFG Liveness #15439

wants to merge 4 commits into from

Conversation

clonker
Copy link
Member

@clonker clonker commented Sep 18, 2024

depends on #15429

@clonker clonker added the has dependencies The PR depends on other PRs that must be merged first label Sep 18, 2024
@clonker clonker force-pushed the ssaCfg-fix-trivial-phi-fct-removal branch from 17b71f7 to 7e9ac48 Compare September 19, 2024 06:54
size_t index = 1;
for (auto const& [function, functionGraph]: functionGraphMapping)
output << functionGraph->toDot(false, index++);
output << mainGraph->toDot(false, std::nullopt, _liveness ? _liveness->mainLiveness.get() : nullptr);
Copy link
Member

@r0qs r0qs Sep 19, 2024

Choose a reason for hiding this comment

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

It is not directly related with this PR, but is here, and also for the functions below, the only cases where we need the boolean _includeDiGraphDefinition to be set to false? Why do we need this parameter at all? I believe we could remove it, or if it's truly necessary to keep, we could remove the digraph definition on line 55 and set the parameter to true.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is so that the toDot method of a SSACFG can also be used stand-alone :)

{
std::ostringstream output;
if (_includeDiGraphDefinition)
output << "digraph SSACFG {\nnodesep=0.7;\ngraph[fontname=\"DejaVu Sans\"]\nnode[shape=box,fontname=\"DejaVu Sans\"];\n\n";
if (function)
output << SSACFGPrinter(*this, _functionIndex ? *_functionIndex : static_cast<size_t>(1), *function);
output << SSACFGPrinter(*this, _functionIndex ? *_functionIndex : static_cast<size_t>(1), *function, _liveness);
Copy link
Member

Choose a reason for hiding this comment

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

I just noticed this now, but why 1 if _functionIndex is null? In fact, why do we even need functionIndex in SSACFGPrinter at all? Doesn't the SSACFG already contain all the functions?

Copy link
Member Author

Choose a reason for hiding this comment

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

SSACFG contains only one function (or the main graph), ControlFlow contains all of it :) the indices are needed to disambiguate the nodes in the dot graph

libyul/backends/evm/ControlFlow.h Show resolved Hide resolved
Base automatically changed from ssaCfg-fix-trivial-phi-fct-removal to develop September 19, 2024 23:17
@clonker clonker marked this pull request as ready for review September 20, 2024 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
has dependencies The PR depends on other PRs that must be merged first
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants