1 #ifndef HALIDE_PURIFY_INDEX_MATH_H
2 #define HALIDE_PURIFY_INDEX_MATH_H
3 
4 /** \file
5  * Removes side-effects in integer math.
6  */
7 
8 #include "Expr.h"
9 
10 namespace Halide {
11 namespace Internal {
12 
13 /** Bounds inference and related stages can lift integer bounds
14  * expressions out of if statements that guard against those integer
15  * expressions doing side-effecty things like dividing or modding by
16  * zero. In those cases, if the lowering passes are functional, the
17  * value resulting from the division or mod is evaluated but not
18  * used. This mutator rewrites divs and mods in such expressions to
19  * fail silently (evaluate to undef) when the denominator is zero.
20  */
21 Expr purify_index_math(const Expr &);
22 
23 }  // namespace Internal
24 }  // namespace Halide
25 
26 #endif
27