Skip to content

Commit

Permalink
Fix assignment differentiation
Browse files Browse the repository at this point in the history
  • Loading branch information
Max Andriychuk authored and Max Andriychuk committed Aug 9, 2024
1 parent 5889bad commit 940454c
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2657,18 +2657,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
if (!BinOp->isComparisonOp() && !BinOp->isLogicalOp())
unsupportedOpWarn(BinOp->getEndLoc());

// If either LHS or RHS is a declaration reference, visit it to avoid
// naming collision
auto* LDRE = dyn_cast<DeclRefExpr>(L);
auto* RDRE = dyn_cast<DeclRefExpr>(R);

if (!LDRE && !RDRE)
return Clone(BinOp);

Expr* LExpr = LDRE ? Visit(L).getExpr() : L;
Expr* RExpr = RDRE ? Visit(R).getExpr() : R;

return BuildOp(opCode, LExpr, RExpr);
return BuildOp(opCode, Visit(L).getExpr(), Visit(R).getExpr());
}
Expr* op = BuildOp(opCode, Ldiff.getExpr(), Rdiff.getExpr());

Expand Down

0 comments on commit 940454c

Please sign in to comment.