https://github.com/halide/Halide
Raw File
Tip revision: db22a2390ec180ef5f36cc163cf60abb48ab958c authored by Andrew Adams on 21 February 2021, 03:34:46 UTC
Fix a few warnings from lgtm.com
Tip revision: db22a23
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