diff options
author | Richard Biener <rguenther@suse.de> | 2023-08-15 10:31:07 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-08-15 13:26:44 +0200 |
commit | 8a6097c7425c4b6294e11dea062df7a883343f47 (patch) | |
tree | b37871f6b3edeb39d3fb8a1b3923924dd2bdb9b0 | |
parent | eef192b181b8777d708671e2541896e7e31293aa (diff) | |
download | gcc-8a6097c7425c4b6294e11dea062df7a883343f47.zip gcc-8a6097c7425c4b6294e11dea062df7a883343f47.tar.gz gcc-8a6097c7425c4b6294e11dea062df7a883343f47.tar.bz2 |
Use find_loop_location from unrolling
The following uses the common find_loop_location as implemented
by the vectorizer to query a loop location also for unrolling.
That results in a more consistent reporting of locations.
* tree-ssa-loop-ivcanon.cc: Include tree-vectorizer.h
(canonicalize_loop_induction_variables): Use find_loop_location.
-rw-r--r-- | gcc/tree-ssa-loop-ivcanon.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/gcc/tree-ssa-loop-ivcanon.cc b/gcc/tree-ssa-loop-ivcanon.cc index 99e50ee..1330cf8 100644 --- a/gcc/tree-ssa-loop-ivcanon.cc +++ b/gcc/tree-ssa-loop-ivcanon.cc @@ -63,6 +63,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfgcleanup.h" #include "builtins.h" #include "tree-ssa-sccvn.h" +#include "tree-vectorizer.h" /* For find_loop_location */ #include "dbgcnt.h" /* Specifies types of loops that may be unrolled. */ @@ -1230,7 +1231,6 @@ canonicalize_loop_induction_variables (class loop *loop, tree niter; HOST_WIDE_INT maxiter; bool modified = false; - dump_user_location_t locus; class tree_niter_desc niter_desc; bool may_be_zero = false; @@ -1244,9 +1244,7 @@ canonicalize_loop_induction_variables (class loop *loop, may_be_zero = niter_desc.may_be_zero && !integer_zerop (niter_desc.may_be_zero); } - if (TREE_CODE (niter) == INTEGER_CST) - locus = last_nondebug_stmt (exit->src); - else + if (TREE_CODE (niter) != INTEGER_CST) { /* For non-constant niter fold may_be_zero into niter again. */ if (may_be_zero) @@ -1271,9 +1269,6 @@ canonicalize_loop_induction_variables (class loop *loop, || TREE_CODE (niter) != INTEGER_CST)) niter = find_loop_niter_by_eval (loop, &exit); - if (exit) - locus = last_nondebug_stmt (exit->src); - if (TREE_CODE (niter) != INTEGER_CST) exit = NULL; } @@ -1315,6 +1310,7 @@ canonicalize_loop_induction_variables (class loop *loop, populates the loop bounds. */ modified |= remove_redundant_iv_tests (loop); + dump_user_location_t locus = find_loop_location (loop); if (try_unroll_loop_completely (loop, exit, niter, may_be_zero, ul, maxiter, locus, allow_peel)) return true; |