summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/tree-ssa-loop-niter.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gcc/tree-ssa-loop-niter.c')
-rw-r--r--contrib/gcc/tree-ssa-loop-niter.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/gcc/tree-ssa-loop-niter.c b/contrib/gcc/tree-ssa-loop-niter.c
index b087bca..429622b 100644
--- a/contrib/gcc/tree-ssa-loop-niter.c
+++ b/contrib/gcc/tree-ssa-loop-niter.c
@@ -1747,6 +1747,12 @@ infer_loop_bounds_from_undefined (struct loop *loop)
{
bb = bbs[i];
+ /* If BB is not executed in each iteration of the loop, we cannot
+ use the operations in it to infer reliable upper bound on the
+ # of iterations of the loop. */
+ if (!dominated_by_p (CDI_DOMINATORS, loop->latch, bb))
+ continue;
+
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
OpenPOWER on IntegriCloud