Skip to content

Commit

Permalink
Remove incorrect else path of cudaMalloc arg check
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Nov 3, 2024
1 parent 885ce5a commit cdda9fc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1769,11 +1769,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
if (FD->getNameAsString() == "cudaMalloc") {
if (auto addrOp = dyn_cast<UnaryOperator>(DerivedCallArgs[0])) {
if (addrOp->getOpcode() == UO_AddrOf) {
DerivedCallArgs[0] =
addrOp->getSubExpr(); // *x -> &x in cudaMalloc args
}
} else { // **x -> x in cudaMalloc args
DerivedCallArgs[0] = BuildOp(UO_Deref, DerivedCallArgs[0]);
DerivedCallArgs[0] = addrOp->getSubExpr(); // get the pointer
}
llvm::SmallVector<Expr*, 3> args = {DerivedCallArgs[0],
getZeroInit(m_Context.IntTy),
Expand Down

0 comments on commit cdda9fc

Please sign in to comment.