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

Don't use original stmts in the generated code #1229

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2325,15 +2325,7 @@ Expr* ReverseModeVisitor::getStdInitListSizeExpr(const Expr* E) {
BinOp->getEndLoc(),
"derivative of an assignment attempts to assign to unassignable "
"expr, assignment ignored");
auto* LDRE = dyn_cast<DeclRefExpr>(L);
auto* RDRE = dyn_cast<DeclRefExpr>(R);

if (!LDRE && !RDRE)
return Clone(BinOp);
Expr* LExpr = LDRE ? Visit(L).getRevSweepAsExpr() : L;
Expr* RExpr = RDRE ? Visit(R).getRevSweepAsExpr() : R;

return BuildOp(opCode, LExpr, RExpr);
return Clone(BinOp);
}

// Visit LHS, but delay emission of its derivative statements, save them
Expand Down
Loading