Skip to content

C#: Include "phi reads" in DataFlow::Node #10927

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

Merged
merged 2 commits into from
Nov 23, 2022

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Oct 21, 2022

In this PR, we add SSA phi-read nodes to the DataFlow::Node type, both for C# and CIL.

The benefit of doing this (copied from the other PR) is to be able to avoid the same potential combinatorial explosion that we also avoid by including normal phi nodes in the data flow graph:

  graph TD;
      A-->read_phi;
      B-->read_phi;
      C-->read_phi;
      read_phi-->D;
      read_phi-->E;
      read_phi-->F;
Loading

Assuming that A,...,F read the same underlying variable as read_phi, one can reduce the number of data flow edges from 9 (quadratic) to 6 (linear) by including the read_phi join-point.

The work of this PR basically amounts to shifting from Ssa::Definition to SsaImpl::DefinitionExt.

On a local database, making this change I was able to reduce the size of localFlowStep from 89,121,074 to 8,349,054 tuples.

@github-actions github-actions bot added the C# label Oct 21, 2022
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch from f48f2ea to 20fab36 Compare October 21, 2022 13:50
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch 3 times, most recently from 8395647 to 35843f8 Compare November 8, 2022 15:29
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch 2 times, most recently from 3c57529 to fa8e721 Compare November 9, 2022 10:29
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch 2 times, most recently from 8ccdb9c to 17de1f1 Compare November 9, 2022 15:06
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch 3 times, most recently from 0f7e1c8 to b2215cc Compare November 9, 2022 19:32
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch 2 times, most recently from 7358f28 to b57847f Compare November 10, 2022 11:14
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch from b57847f to dbeba05 Compare November 11, 2022 11:35
@github-actions github-actions bot added the Ruby label Nov 11, 2022
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch from dbeba05 to ac29f02 Compare November 14, 2022 19:24
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch from ac29f02 to 1a8cd6e Compare November 15, 2022 11:06
@hvitved hvitved force-pushed the csharp/phi-reads-in-data-flow-graph branch from 1a8cd6e to 7cab6b5 Compare November 16, 2022 14:32
@github-actions github-actions bot removed the Swift label Nov 16, 2022
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Nov 17, 2022
@hvitved hvitved marked this pull request as ready for review November 17, 2022 12:01
@hvitved hvitved requested a review from a team as a code owner November 17, 2022 12:01
Copy link
Contributor

@michaelnebel michaelnebel left a comment

Choose a reason for hiding this comment

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

Looks plausible to me!

}
}

import Cached

private module Deprecated {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to avoid deprecation warnings or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was simply to group the deprecated predicates.

@hvitved hvitved merged commit bc6a41c into github:main Nov 23, 2022
@hvitved hvitved deleted the csharp/phi-reads-in-data-flow-graph branch November 23, 2022 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C# no-change-note-required This PR does not need a change note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants