Revision 1e5c6cf6714efd1e02e5a9e611238b6ed88c0798 authored by Steven Johnson on 19 November 2018, 23:32:35 UTC, committed by Steven Johnson on 19 November 2018, 23:32:35 UTC
1 parent a4ed756
Raw File
RemoveExternLoops.cpp
#include "RemoveExternLoops.h"
#include "IRMutator.h"

namespace Halide {
namespace Internal {

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

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

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

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