提交 4cf8dda4 编写于 作者: D dabaiji

fix wrong hoist problem in multicore loop switch hoist pass

上级 3b74f272
......@@ -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.
先完成此消息的编辑!
想要评论请 注册