Skip to content

C++: Fix dataflow node <> expression problem on prvalues #15918

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 3 commits into from
Mar 14, 2024

Conversation

MathiasVP
Copy link
Contributor

@MathiasVP MathiasVP commented Mar 13, 2024

This fixes the two surprising missing results from #15371 that @geoffw0 was seeing when he switched from interpreting Argument[-1] as this to *this.

I didn't bother adding a testcase since @geoffw0 PR will contain such tests anyway

@github-actions github-actions bot added the C++ label Mar 13, 2024
@MathiasVP MathiasVP force-pushed the fix-as-expr-for-temps branch from 88a31fd to a839c92 Compare March 13, 2024 22:59
@MathiasVP MathiasVP requested a review from geoffw0 March 14, 2024 09:05
@MathiasVP MathiasVP marked this pull request as ready for review March 14, 2024 09:05
@MathiasVP MathiasVP requested a review from a team as a code owner March 14, 2024 09:05
@MathiasVP MathiasVP added the no-change-note-required This PR does not need a change note label Mar 14, 2024
@MathiasVP MathiasVP mentioned this pull request Mar 14, 2024
15 tasks
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.

Changes look reasonable. DCA run looks clean. I'm slightly surprised there weren't any result changes.

@@ -1533,6 +1552,12 @@ private class IndirectArgumentOutExprNode extends ExprNodeBase, IndirectArgument
final override Expr getConvertedExpr(int n) { exprNodeShouldBeIndirectOutNode(this, result, n) }
}

private class IndirectTemporaryExpr extends ExprNodeBase instanceof IndirectOperand {
IndirectTemporaryExpr() { exprNodeShouldBeIndirectOperand(this, _, _) }
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like there's a mismatch between this class, which claims that the node is a temporary expr, with the QLDoc on exprNodeShouldBeIndirectOperand, which only claims the node is an IndirectOperand (that should have a .asExpr()). Its probably just be me, missing a connection here.

Copy link
Contributor Author

@MathiasVP MathiasVP Mar 14, 2024

Choose a reason for hiding this comment

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

That's fair. I'll rename the class to something more generic. It's currently true because exprNodeShouldBeIndirectOperand restricts the node to be an indirection of an operand whose definition is related to a temporary IR variable. But that's not guaranteed to be true if we find other uses of this class.

If it's okay with you, I'll do this in a subsequent PR so that you can get this change into #15371 without waiting for another round of CI

@MathiasVP MathiasVP merged commit dacf7d7 into github:main Mar 14, 2024
MathiasVP added a commit that referenced this pull request Mar 14, 2024
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