C++: Field flow through reference-returning functions #11374
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
This PR adds use-use flow through examples such as:
It turns out we almost had this flow on the feature branch already. The shared dataflow library has a concept of flow-through here. This disjunct is responsible for adding a store step from
c [post update]togetB() [post update]in the following example:the rule used by the shared dataflow library is as follows:
Generate a store step from
node1tonode2(storingf) if:node1is aPostUpdateNodewith a pre-update node that is an output of a function (that'sgetB() [post update]in our example above node above with a pre-update node ofgetB())node2is aPostUpdateNodewith a pre-update node that is an argument to a function (that'sa [post update]in our example above with a pre-update node ofa).f, which then flows to a return node of the function.Step 2 and 3 already worked for our example, but there was no
PostUpdateNodewith a pre-update note that was the output of the function. So this PR simply marks the appropriateOutNodeas aPostUpdateNodeand assigns the pre-update node tothis.Having the pre-update node equal the post-update node is a consistency violation (as demonstrated by the tests). I'm not aware of anything bad happening due to this, however. I'll run DCA to make sure, though🤞 .