diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index dffd119f1..759abe28a 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -2248,20 +2248,8 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, // For x, AssignedDiff is _d_x, for x[i] its _d_x[i], for reference exprs // like (x = y) it propagates recursively, so _d_x is also returned. Expr* AssignedDiff = Ldiff.getExpr_dx(); - if (!AssignedDiff) { - // If either LHS or RHS is a declaration reference, visit it to avoid - // naming collision - auto* LDRE = dyn_cast(L); - auto* RDRE = dyn_cast(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); - } + if (!AssignedDiff) + return Clone(BinOp); ResultRef = AssignedDiff; // If assigned expr is dependent, first update its derivative; auto Lblock_begin = Lblock->body_rbegin();