From fa71b52e719c44394241d52620f3628edb066902 Mon Sep 17 00:00:00 2001 From: looop5 Date: Wed, 9 Jul 2025 10:20:13 +0800 Subject: [PATCH] nullptr check --- src/composite/utils/dimension_peeling.cc | 20 ++++++++++++-------- src/pass/reduction_factor.cc | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/composite/utils/dimension_peeling.cc b/src/composite/utils/dimension_peeling.cc index 3cff46df..c965f6a9 100644 --- a/src/composite/utils/dimension_peeling.cc +++ b/src/composite/utils/dimension_peeling.cc @@ -420,10 +420,12 @@ void DimensionPeeler::MapDimToSpace(AffinityAnalyzer &aff, Dim *dom_dim, int axi if (visited.count(prod)) return false; if (prod != nullptr) visited.insert(prod); if (!this->Propagation(axis_idx, dim, prod, affinity)) return false; - for (auto &c : prod->cons) { - if (!visited.count(c.first)) { - cons_visit.emplace_back(prod); - break; + if (prod != nullptr) { + for (auto &c : prod->cons) { + if (!visited.count(c.first)) { + cons_visit.emplace_back(prod); + break; + } } } return true; @@ -432,10 +434,12 @@ void DimensionPeeler::MapDimToSpace(AffinityAnalyzer &aff, Dim *dom_dim, int axi if (visited.count(cons)) return false; if (cons != nullptr) visited.insert(cons); if (!this->Propagation(axis_idx, dim, cons, affinity)) return false; - for (auto &p : cons->prod) { - if (!visited.count(p.first)) { - prod_visit.emplace_back(cons); - break; + if (cons != nullptr) { + for (auto &p : cons->prod) { + if (!visited.count(p.first)) { + prod_visit.emplace_back(cons); + break; + } } } return true; diff --git a/src/pass/reduction_factor.cc b/src/pass/reduction_factor.cc index e10a936c..0c29c569 100644 --- a/src/pass/reduction_factor.cc +++ b/src/pass/reduction_factor.cc @@ -699,7 +699,7 @@ class ReduceVectorizeEnable : public IRMutator { } // step 2: final reduce area - if (!cur_reduce_data_->isolate_reduce_provide.empty()) { + if (!cur_reduce_data_->isolate_reduce_provide.empty() && isolate_reduce_provide != nullptr) { isolate_value = isolate_reduce_provide->value; } auto value = reduce_provide->value; -- Gitee