diff --git a/lib/Differentiator/ReverseModeVisitor.cpp b/lib/Differentiator/ReverseModeVisitor.cpp index 91082f376..ee5b8e259 100644 --- a/lib/Differentiator/ReverseModeVisitor.cpp +++ b/lib/Differentiator/ReverseModeVisitor.cpp @@ -1767,10 +1767,10 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context, llvm::MutableArrayRef(DerivedCallArgs), Loc) .get(); if (FD->getNameAsString() == "cudaMalloc") { - if (auto addrOp = dyn_cast(DerivedCallArgs[0])) { - if (addrOp->getOpcode() == UO_AddrOf) { + if (auto* addrOp = dyn_cast(DerivedCallArgs[0])) + if (addrOp->getOpcode() == UO_AddrOf) DerivedCallArgs[0] = addrOp->getSubExpr(); // get the pointer - } + llvm::SmallVector args = {DerivedCallArgs[0], getZeroInit(m_Context.IntTy), DerivedCallArgs[1]};