From 820c29ec2143e30fdb20918367c3c11a7e8a76bc Mon Sep 17 00:00:00 2001 From: "petro.zarytskyi" Date: Fri, 8 Sep 2023 23:17:46 +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()) {