From b46f3db0e8908c49b5b8163c5e375989ed83b6a6 Mon Sep 17 00:00:00 2001 From: "petro.zarytskyi" Date: Sat, 9 Sep 2023 01:21:13 +0300 Subject: [PATCH] Remove redundant argument cloning. --- lib/Differentiator/ReverseModeVisitor.cpp | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 6709f7ac4..a6cc249b3 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -1888,17 +1888,6 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, m_ExternalSource->ActBeforeFinalizingVisitCallExpr( CE, OverloadedDerivedFn, DerivedCallArgs, ArgResultDecls, asGrad); - // FIXME: Why are we cloning args here? We already created different - // expressions for call to original function and call to gradient. - // Re-clone function arguments again, since they are required at 2 places: - // call to gradient and call to original function. At this point, each arg - // is either a simple expression or a reference to a temporary variable. - // Therefore cloning it has constant complexity. - std::transform(std::begin(CallArgs), - std::end(CallArgs), - std::begin(CallArgs), - [this](Expr* E) { return Clone(E); }); - Expr* call = nullptr; if (FD->getReturnType()->isReferenceType()) {