Skip to content

Commit 0f25b95

Browse files
[bug] Cherry-pick "Fix dereferencing nullptr (#6763)" (#6769)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e4a1129 commit 0f25b95

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

taichi/transforms/loop_invariant_detector.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ class LoopInvariantDetector : public BasicStmtVisitor {
6565
bool is_invariant = true;
6666

6767
for (Stmt *operand : stmt->get_operands()) {
68+
if (operand == nullptr)
69+
continue;
6870
is_invariant &= is_operand_loop_invariant_impl(operand, current_scope);
6971
}
7072

taichi/transforms/make_thread_local.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ std::vector<std::pair<T *, AtomicOpType>> find_global_reduction_destinations(
7676
}
7777
}
7878
for (auto &op : stmt->get_operands()) {
79+
if (op == nullptr)
80+
continue;
7981
// Make sure the values of related atomic operations are not used.
8082
if (auto atomic = op->cast<AtomicOpStmt>()) {
8183
if (irpass::analysis::maybe_same_address(atomic->dest,

0 commit comments

Comments
 (0)