https://github.com/halide/Halide
Raw File
Tip revision: 6ae921b1c1d58cf0b46d1c7c52027035774afcf7 authored by Steven Johnson on 29 January 2021, 17:48:13 UTC
Avoid bogus out-of-memory error for multiple_scatter under wasm
Tip revision: 6ae921b
RemoveExternLoops.cpp
#include "RemoveExternLoops.h"
#include "IRMutator.h"

namespace Halide {
namespace Internal {

namespace {

class RemoveExternLoops : public IRMutator {
private:
    using IRMutator::visit;

    Stmt visit(const For *op) override {
        if (op->for_type != ForType::Extern) {
            return IRMutator::visit(op);
        }
        // Replace the for with its first iteration (implemented with a let).
        return LetStmt::make(op->name, op->min, mutate(op->body));
    }
};

}  // namespace

Stmt remove_extern_loops(const Stmt &s) {
    return RemoveExternLoops().mutate(s);
}

}  // namespace Internal
}  // namespace Halide
back to top