aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgloop.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-02-14 13:37:54 +0100
committerRichard Biener <rguenther@suse.de>2022-02-14 14:31:06 +0100
commit0a1a3afb5fb36e2d10ad92bf788e16d837451571 (patch)
tree664afa714502ef25af4cd14178dc70b457b38943 /gcc/cfgloop.cc
parent164a761a9f4798dc69ecab80097807636dc17d61 (diff)
downloadgcc-0a1a3afb5fb36e2d10ad92bf788e16d837451571.zip
gcc-0a1a3afb5fb36e2d10ad92bf788e16d837451571.tar.gz
gcc-0a1a3afb5fb36e2d10ad92bf788e16d837451571.tar.bz2
tree-optimization/104528 - free niter estimates after DSE
When DSE removes a trivially dead def we have to reset niter information on loops since that might refer to it. The patch also adds verification to make sure this does not happen. 2022-02-14 Richard Biener <rguenther@suse.de> PR tree-optimization/104528 * tree-ssa.h (find_released_ssa_name): Declare. * tree-ssa.cc (find_released_ssa_name): Export. * cfgloop.cc (verify_loop_structure): Look for released SSA names in loops nb_iterations. * tree-ssa-dse.cc (pass_dse::execute): Release number of iteration estimates. * gfortran.dg/pr104528.f: New testcase.
Diffstat (limited to 'gcc/cfgloop.cc')
-rw-r--r--gcc/cfgloop.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/cfgloop.cc b/gcc/cfgloop.cc
index 78fd6d5..5ffcc77 100644
--- a/gcc/cfgloop.cc
+++ b/gcc/cfgloop.cc
@@ -31,6 +31,8 @@ along with GCC; see the file COPYING3. If not see
#include "cfgloop.h"
#include "gimple-iterator.h"
#include "dumpfile.h"
+#include "tree-ssa.h"
+#include "tree-pretty-print.h"
static void flow_loops_cfg_dump (FILE *);
@@ -1561,6 +1563,17 @@ verify_loop_structure (void)
err = 1;
}
}
+
+ /* Check cached number of iterations for released SSA names. */
+ tree ref;
+ if (loop->nb_iterations
+ && (ref = walk_tree (&loop->nb_iterations,
+ find_released_ssa_name, NULL, NULL)))
+ {
+ error ("loop %d%'s number of iterations %qE references the"
+ " released SSA name %qE", i, loop->nb_iterations, ref);
+ err = 1;
+ }
}
/* Check irreducible loops. */