Halide  20.0.0
Halide compiler and libraries
Simplify.h
Go to the documentation of this file.
1 #ifndef HALIDE_SIMPLIFY_H
2 #define HALIDE_SIMPLIFY_H
3 
4 /** \file
5  * Methods for simplifying halide statements and expressions
6  */
7 
8 #include "Expr.h"
9 #include "Interval.h"
10 #include "ModulusRemainder.h"
11 #include "Scope.h"
12 
13 namespace Halide {
14 namespace Internal {
15 
16 /** Perform a wide range of simplifications to expressions and statements,
17  * including constant folding, substituting in trivial values, arithmetic
18  * rearranging, etc. Simplifies across let statements, so must not be called on
19  * stmts with dangling or repeated variable names. Can optionally be passed
20  * known bounds of any variables, known alignment properties, and any other
21  * Exprs that should be assumed to be true.
22  */
23 // @{
24 Stmt simplify(const Stmt &,
25  bool remove_dead_code = true,
28  const std::vector<Expr> &assumptions = std::vector<Expr>());
29 Expr simplify(const Expr &,
30  bool remove_dead_code = true,
33  const std::vector<Expr> &assumptions = std::vector<Expr>());
34 // @}
35 
36 /** Attempt to statically prove an expression is true using the simplifier. */
38 
39 /** Simplify expressions found in a statement, but don't simplify
40  * across different statements. This is safe to perform at an earlier
41  * stage in lowering than full simplification of a stmt. */
43 
44 } // namespace Internal
45 } // namespace Halide
46 
47 #endif
Base classes for Halide expressions (Halide::Expr) and statements (Halide::Internal::Stmt)
Defines the Interval class.
Routines for statically determining what expressions are divisible by.
Defines the Scope class, which is used for keeping track of names in a scope while traversing IR.
A common pattern when traversing Halide IR is that you need to keep track of stuff when you find a Le...
Definition: Scope.h:94
Stmt simplify_exprs(const Stmt &)
Simplify expressions found in a statement, but don't simplify across different statements.
bool can_prove(Expr e, const Scope< Interval > &bounds=Scope< Interval >::empty_scope())
Attempt to statically prove an expression is true using the simplifier.
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 >())
Perform a wide range of simplifications to expressions and statements, including constant folding,...
This file defines the class FunctionDAG, which is our representation of a Halide pipeline,...
@ Internal
Not visible externally, similar to 'static' linkage in C.
A fragment of Halide syntax.
Definition: Expr.h:258
A reference-counted handle to a statement node.
Definition: Expr.h:427