https://github.com/halide/Halide
Raw File
Tip revision: 1d073daa65c05e2ba46e3d52f741b61f2c0163b7 authored by Steven Johnson on 07 February 2024, 18:52:08 UTC
Fix clang-tidy error in runtime.printer.h (parameter shadows member)
Tip revision: 1d073da
Simplify.h
#ifndef HALIDE_SIMPLIFY_H
#define HALIDE_SIMPLIFY_H

/** \file
 * Methods for simplifying halide statements and expressions
 */

#include "Expr.h"
#include "Interval.h"
#include "ModulusRemainder.h"
#include "Scope.h"

namespace Halide {
namespace Internal {

/** Perform a wide range of simplifications to expressions and statements,
 * including constant folding, substituting in trivial values, arithmetic
 * rearranging, etc. Simplifies across let statements, so must not be called on
 * stmts with dangling or repeated variable names. Can optionally be passed
 * known bounds of any variables, known alignment properties, and any other
 * Exprs that should be assumed to be true.
 */
// @{
Stmt simplify(const Stmt &, bool remove_dead_code = true,
              const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
              const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
              const std::vector<Expr> &assumptions = std::vector<Expr>());
Expr simplify(const Expr &, bool remove_dead_code = true,
              const Scope<Interval> &bounds = Scope<Interval>::empty_scope(),
              const Scope<ModulusRemainder> &alignment = Scope<ModulusRemainder>::empty_scope(),
              const std::vector<Expr> &assumptions = std::vector<Expr>());
// @}

/** Attempt to statically prove an expression is true using the simplifier. */
bool can_prove(Expr e, const Scope<Interval> &bounds = Scope<Interval>::empty_scope());

/** Simplify expressions found in a statement, but don't simplify
 * across different statements. This is safe to perform at an earlier
 * stage in lowering than full simplification of a stmt. */
Stmt simplify_exprs(const Stmt &);

}  // namespace Internal
}  // namespace Halide

#endif
back to top