Skip to content

Commit

Permalink
Check that E arg of shouldUseAtomicOps is defined before calling it
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristin22 committed Oct 15, 2024
1 parent 77a020b commit 8accef3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Differentiator/ReverseModeVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ Expr* getArraySizeExpr(const ArrayType* AT, ASTContext& context,
else {
derivedE = BuildOp(UnaryOperatorKind::UO_Deref, diff_dx);
// Create the (target += dfdx) statement.
if (dfdx()) {
if (dfdx() && derivedE) {
if (shouldUseCudaAtomicOps(diff_dx)) {
Expr* atomicCall = BuildCallToCudaAtomicAdd(diff_dx, dfdx());
// Add it to the body statements.
Expand Down

0 comments on commit 8accef3

Please sign in to comment.