提交 90e3afd4 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!87 fix wrong hoist problem in multicore loop switch hoist pass

Merge pull request !87 from yangsijia/fix-multi-core-loop-switch-hoist-bug
......@@ -176,7 +176,7 @@ class MultiCoreLoopHoister : public IRMutator {
}
Stmt Mutate_(const IfThenElse *op, const Stmt &s) final {
if (loop_stack_.empty() || !need_hoisted_) {
if (loop_stack_.empty() || !need_hoisted_ || IsScalar(op->then_case)) {
return IRMutator::Mutate_(op, s);
}
loop_stack_.back().branch_bound = true;
......@@ -298,6 +298,14 @@ class MultiCoreLoopHoister : public IRMutator {
return false;
}
bool IsScalar(const Stmt &s) {
if (s->IsInstance<Store>()) {
auto store = s.as<Store>();
return IsConstExpr(store->predicate);
}
return false;
}
struct LoopEntry {
const For *node;
bool branch_bound;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册