diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 054d110c6..4a9ca6c11 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -65,14 +65,9 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, ReverseModeVisitor::CladTapeResult ReverseModeVisitor::MakeCladTapeFor(Expr* E, llvm::StringRef prefix) { assert(E && "must be provided"); - if (auto* IE = dyn_cast(E)) { - E = IE->getSubExpr()->IgnoreImplicit(); - } - QualType EQt = E->getType(); - if (isa(EQt)) - EQt = GetCladArrayOfType(utils::GetValueType(EQt)); + E = E->IgnoreImplicit(); QualType TapeType = - GetCladTapeOfType(getNonConstType(EQt, m_Context, m_Sema)); + GetCladTapeOfType(getNonConstType(E->getType(), m_Context, m_Sema)); LookupResult& Push = GetCladTapePush(); LookupResult& Pop = GetCladTapePop(); Expr* TapeRef = @@ -93,17 +88,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, Expr* PopExpr = m_Sema.ActOnCallExpr(getCurrentScope(), PopDRE, noLoc, TapeRef, noLoc) .get(); - Expr* exprToPush = E; - if (const auto* AT = dyn_cast(E->getType())) { - Expr* init = getArraySizeExpr(AT, m_Context, *this); - llvm::SmallVector pushArgs{E, init}; - SourceLocation loc = E->getExprLoc(); - TypeSourceInfo* TSI = m_Context.getTrivialTypeSourceInfo(EQt, loc); - exprToPush = - m_Sema.BuildCXXTypeConstructExpr(TSI, loc, pushArgs, loc, false) - .get(); - } - Expr* CallArgs[] = {TapeRef, exprToPush}; + Expr* CallArgs[] = {TapeRef, E}; Expr* PushExpr = m_Sema.ActOnCallExpr(getCurrentScope(), PushDRE, noLoc, CallArgs, noLoc) .get();