#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 *);
\f
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. */
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fpeel-loops -ftree-loop-vectorize -fno-tree-scev-cprop --param iv-max-considered-uses=2" }
+ REAL FUNCTION FOO(M, N, A, W)
+
+ INTEGER M, N
+
+ REAL W(*)
+ COMPLEX A(*)
+
+ INTEGER II, JI, JJ, KK, LL, MP
+
+ EXTERNAL BAR
+
+ INTEGER QUX
+ EXTERNAL QUX
+
+ CALL BAR(II)
+
+ IF (M .EQ. 0) THEN
+ IF (N .EQ. 0) THEN
+ DO 140 KK = II, II + MP
+ W(KK) = 0
+ 140 CONTINUE
+ ELSE
+ KK = II + MP
+ END IF
+
+ DO 130 JI = KK, KK + MP
+ DO 120 LL = JJ, JJ + MP
+ DO 110 KK = II, II + MP
+ W(KK) = (A(KK))
+ 110 CONTINUE
+ 120 CONTINUE
+ 130 CONTINUE
+
+ IF (W(KK) .EQ. 0) THEN
+ FOO = W(QUX(MP, W, 1))
+ END IF
+
+ END IF
+
+ RETURN
+
+ END
#include "ipa-modref-tree.h"
#include "ipa-modref.h"
#include "target.h"
+#include "tree-ssa-loop-niter.h"
/* This file implements dead store elimination.
pass_dse::execute (function *fun)
{
unsigned todo = 0;
+ bool released_def = false;
+
need_eh_cleanup = BITMAP_ALLOC (NULL);
need_ab_cleanup = BITMAP_ALLOC (NULL);
auto_sbitmap live_bytes (param_dse_max_object_size);
if (gsi_remove (&gsi, true) && need_eh_cleanup)
bitmap_set_bit (need_eh_cleanup, bb->index);
release_defs (stmt);
+ released_def = true;
}
}
if (gsi_end_p (gsi))
}
remove_phi_node (&si, true);
removed_phi = true;
+ released_def = true;
}
else
gsi_next (&si);
BITMAP_FREE (need_eh_cleanup);
BITMAP_FREE (need_ab_cleanup);
+ if (released_def)
+ free_numbers_of_iterations_estimates (fun);
+
return todo;
}
/* Called via walk_tree, look for SSA_NAMEs that have already been
released. */
-static tree
+tree
find_released_ssa_name (tree *tp, int *walk_subtrees, void *data_)
{
struct walk_stmt_info *wi = (struct walk_stmt_info *) data_;
extern void delete_tree_ssa (function *);
extern bool tree_ssa_useless_type_conversion (tree);
extern tree tree_ssa_strip_useless_type_conversions (tree);
+extern tree find_released_ssa_name (tree *, int *, void *);
extern bool ssa_defined_default_def_p (tree t);