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

C#: Adopt shared SSA data-flow integration #16936

Merged
merged 2 commits into from
Sep 17, 2024

Conversation

hvitved
Copy link
Contributor

@hvitved hvitved commented Jul 9, 2024

This PR adopts the newly introduced shared SSA data-flow integration layer. A side-effect is that we get phi-input barrier guards for free, which had not previously been ported to C#.

@github-actions github-actions bot added the C# label Jul 9, 2024
@@ -1118,3 +1055,64 @@
result = this.getSourceVariable().getEnclosingCallable()
}
}

private module DataFlowIntegrationInput implements Impl::DataFlowIntegrationInputSig {
private import csharp as Cs

Check warning

Code scanning / CodeQL

Names only differing by case Warning

Cs is only different by casing from CS that is used elsewhere for modules.
shared/ssa/codeql/ssa/Ssa.qll Fixed Show fixed Hide fixed
shared/ssa/codeql/ssa/Ssa.qll Fixed Show fixed Hide fixed
shared/ssa/codeql/ssa/Ssa.qll Fixed Show fixed Hide fixed
@hvitved hvitved force-pushed the csharp/ssa-integration branch 2 times, most recently from 2b175c6 to df69c4e Compare July 11, 2024 09:46
@hvitved hvitved force-pushed the csharp/ssa-integration branch 2 times, most recently from 5b70129 to 86f7735 Compare July 11, 2024 19:38
@hvitved hvitved force-pushed the csharp/ssa-integration branch from 86f7735 to 591b745 Compare July 12, 2024 09:06

private newtype TNode =
TParamNode(DfInput::Parameter p) {
exists(WriteDefinition def | DfInput::ssaDefInitializesParam(def, p))

Check warning

Code scanning / CodeQL

Omittable 'exists' variable Warning

This exists variable can be omitted by using a don't-care expression
in this argument
.
@hvitved hvitved force-pushed the csharp/ssa-integration branch from 591b745 to ac08fc5 Compare July 12, 2024 12:24
@hvitved hvitved added the no-change-note-required This PR does not need a change note label Jul 12, 2024
@hvitved hvitved marked this pull request as ready for review July 12, 2024 12:42
@hvitved hvitved requested a review from a team as a code owner July 12, 2024 12:42
Comment on lines 182 to 184
exists(Guard g, Expr e, AbstractValue v |
guardChecks(g, e, v) and
g.controlsNode(result.getControlFlowNode(), e, v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this second disjunct not redundant now? Does it cover more than ssa variable reads?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question: Yes, it covers more than SSA variable reads (it uses GVN, which--although it is unsound in general--is likely to produce valid guards).

@hvitved hvitved force-pushed the csharp/ssa-integration branch from ac08fc5 to 6506034 Compare August 13, 2024 13:26
@hvitved hvitved force-pushed the csharp/ssa-integration branch from 6506034 to 89a2381 Compare August 14, 2024 06:39
Comment on lines 758 to 760
isUseStep = false
or
// Flow into phi (read)/uncertain SSA definition node from read
exists(Node read | LocalFlow::localFlowSsaInputFromRead(read, def, nodeTo) |
nodeFrom = read and
not FlowSummaryImpl::Private::Steps::prohibitsUseUseFlow(nodeFrom, _)
or
nodeFrom.(PostUpdateNode).getPreUpdateNode() = read
)
not FlowSummaryImpl::Private::Steps::prohibitsUseUseFlow(nodeFrom, _)
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a pipeline duplication here, better add isUseStep = true to the second disjunct.

@hvitved hvitved requested a review from a team as a code owner September 16, 2024 12:46
@github-actions github-actions bot added the Ruby label Sep 16, 2024
Copy link
Contributor

@aschackmull aschackmull 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.

@hvitved hvitved merged commit d680a54 into github:main Sep 17, 2024
32 checks passed
@hvitved hvitved deleted the csharp/ssa-integration branch September 17, 2024 11:45
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 Ruby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants