diff --git a/taichi/transforms/simplify.cpp b/taichi/transforms/simplify.cpp index 1f6c6ad8294a75..584bd791826e13 100644 --- a/taichi/transforms/simplify.cpp +++ b/taichi/transforms/simplify.cpp @@ -840,7 +840,7 @@ class BasicBlockSimplify : public IRVisitor { clause[i]->is() || !has_side_effects) { // This stmt can be kept. } else if (clause[i]->is()) { - plain_clause = !is_atomic_value_used(clause, i); + plain_clause = plain_clause && !is_atomic_value_used(clause, i); } else { plain_clause = false; }