Skip to content

C++: Don't count every conversion as a use #11976

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

Conversation

MathiasVP
Copy link
Contributor

@MathiasVP MathiasVP commented Jan 24, 2023

This PR reduces the number of SSA reads by not considering conversions as reads. This partially fixes the looping behavior observed in #11963 (but it doesn't fix the one observed in #11975).

It should also provide a small speedup boost since we're reducing the amount of reads considered in the SSA phase.

Commit-by-commit review recommended. The meat of the PR is in 9de8d5c (which includes conversions from the set of uses). However, I saw a number of missing results from just that commit, and it took some time to debug why. The reason is as follows:

We mark a number of ad-hoc things as conversions for iterator flow (to handle temporary variables created by rvalue-to-lvalue conversions). When we mark these as conversions we'd also excluding those from the set of uses, and this breaks a bunch of things. So 7ecc346 adds an additional column to the conversionFlow predicate that we can use to decide whether to consider those ad-hoc conversions. This column should be _ for most things, but must be false when we're excluding the conversions in isUse.

Finally, the last two commits just accepts test changes. These all appear to be fine 🎉.

@MathiasVP MathiasVP requested a review from a team as a code owner January 24, 2023 09:57
@github-actions github-actions bot added the C++ label Jan 24, 2023
@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Jan 24, 2023
@MathiasVP
Copy link
Contributor Author

MathiasVP commented Jan 24, 2023

Converting this to a draft while investigating the result changes (on both CI and DCA). Done. The tests should be okay now. Will start another DCA run.

@MathiasVP MathiasVP marked this pull request as draft January 24, 2023 12:52
@MathiasVP MathiasVP marked this pull request as ready for review January 30, 2023 09:26
Copy link
Contributor

@geoffw0 geoffw0 left a comment

Choose a reason for hiding this comment

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

LGTM. I'm definitely seeking that additional reassurance from DCA though. In the tests I see that we lose quite a lot of taint steps (as we'd expect) and some duplicate results (which is a good change).

@MathiasVP
Copy link
Contributor Author

LGTM. I'm definitely seeking that additional reassurance from DCA though. In the tests I see that we lose quite a lot of taint steps (as we'd expect) and some duplicate results (which is a good change).

Indeed. I've started a DCA run as well. I expected quite a lot of "lost results" in DCA. Mostly because we're getting less duplication, but also because we're fixing a class of dataflow looping that's demonstrated by the sink_then_source_1 test.

@MathiasVP
Copy link
Contributor Author

I've looked through all the results on DCA. They all appear to be either:

  • Result deduplications (as we've seen in our query tests on this PR), or
  • FPs removed because of the false flows that's removed (similar to the ones in the dataflow-library tests).

@MathiasVP MathiasVP merged commit be359a3 into github:mathiasvp/replace-ast-with-ir-use-usedataflow Jan 30, 2023
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