aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-scalar-evolution.h
diff options
context:
space:
mode:
authorHao Liu <hliu@os.amperecomputing.com>2023-12-06 14:52:19 +0800
committerHao Liu <hliu@os.amperecomputing.com>2023-12-08 11:18:03 +0800
commit2efe3a7de0107618397264017fb045f237764cc7 (patch)
treeee0a1dd559c20e6e9fa0b038ad49e2f16564974c /gcc/tree-scalar-evolution.h
parent9f7ad5eff3bf1e42aac0825b37d2c9ab43eaafd2 (diff)
downloadgcc-2efe3a7de0107618397264017fb045f237764cc7.zip
gcc-2efe3a7de0107618397264017fb045f237764cc7.tar.gz
gcc-2efe3a7de0107618397264017fb045f237764cc7.tar.bz2
tree-optimization/112774: extend the SCEV CHREC tree with a nonwrapping flag
The flag is defined as CHREC_NOWRAP(tree), and will be dumped from "{offset, +, 1}_1" to "{offset, +, 1}<nw>_1" (nw is short for nonwrapping). Two SCEV interfaces record_nonwrapping_chrec and nonwrapping_chrec_p are added to set and check the flag respectively. As resetting the SCEV cache (i.e., the chrec trees) may not reset the loop->estimate_state, free_numbers_of_iterations_estimates is called explicitly in loop vectorization to make sure the flag can be calculated propriately by niter. gcc/ChangeLog: PR tree-optimization/112774 * tree-pretty-print.cc: if nonwrapping flag is set, chrec will be printed with additional <nw> info. * tree-scalar-evolution.cc: add record_nonwrapping_chrec and nonwrapping_chrec_p to set and check the new flag respectively. * tree-scalar-evolution.h: Likewise. * tree-ssa-loop-niter.cc (idx_infer_loop_bounds, infer_loop_bounds_from_pointer_arith, infer_loop_bounds_from_signedness, scev_probably_wraps_p): call record_nonwrapping_chrec before record_nonwrapping_iv, call nonwrapping_chrec_p to check the flag is set and return false from scev_probably_wraps_p. * tree-vect-loop.cc (vect_analyze_loop): call free_numbers_of_iterations_estimates explicitly. * tree-core.h: document the nothrow_flag usage in CHREC_NOWRAP * tree.h: add CHREC_NOWRAP(NODE), base.nothrow_flag is used to represent the nonwrapping info. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/scev-16.c: New test.
Diffstat (limited to 'gcc/tree-scalar-evolution.h')
-rw-r--r--gcc/tree-scalar-evolution.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/tree-scalar-evolution.h b/gcc/tree-scalar-evolution.h
index a64ed78..f57fde1 100644
--- a/gcc/tree-scalar-evolution.h
+++ b/gcc/tree-scalar-evolution.h
@@ -43,6 +43,8 @@ extern bool simple_iv (class loop *, class loop *, tree, struct affine_iv *,
bool);
extern bool iv_can_overflow_p (class loop *, tree, tree, tree);
extern tree compute_overall_effect_of_inner_loop (class loop *, tree);
+extern void record_nonwrapping_chrec (tree);
+extern bool nonwrapping_chrec_p (tree);
/* Returns the basic block preceding LOOP, or the CFG entry block when
the loop is function's body. */