aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Carlotti <andrew.carlotti@arm.com>2022-10-06 15:59:15 +0100
committerAndrew Carlotti <andrew.carlotti@arm.com>2022-11-21 15:59:21 +0000
commitf0e4f676aab589e53dbd67610378a1769030f462 (patch)
treeef4c7ac20342bd01946b3d8838499db8b546557b
parent9df85f331fa78ddfdbbe3b0fd5ff3727d2f57333 (diff)
downloadgcc-f0e4f676aab589e53dbd67610378a1769030f462.zip
gcc-f0e4f676aab589e53dbd67610378a1769030f462.tar.gz
gcc-f0e4f676aab589e53dbd67610378a1769030f462.tar.bz2
Ensure at_stmt is defined before an early exit
This prevents a null dereference error when outputing debug information following an early exit from number_of_iterations_exit_assumptions. gcc/ChangeLog: * tree-ssa-loop-niter.cc (number_of_iterations_exit_assumptions): Move at_stmt assignment.
-rw-r--r--gcc/tree-ssa-loop-niter.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc
index 3fbbf43..df995a6 100644
--- a/gcc/tree-ssa-loop-niter.cc
+++ b/gcc/tree-ssa-loop-niter.cc
@@ -2537,6 +2537,9 @@ number_of_iterations_exit_assumptions (class loop *loop, edge exit,
if (!stmt)
return false;
+ if (at_stmt)
+ *at_stmt = stmt;
+
/* We want the condition for staying inside loop. */
code = gimple_cond_code (stmt);
if (exit->flags & EDGE_TRUE_VALUE)
@@ -2642,9 +2645,6 @@ number_of_iterations_exit_assumptions (class loop *loop, edge exit,
if (TREE_CODE (niter->niter) == INTEGER_CST)
niter->max = wi::to_widest (niter->niter);
- if (at_stmt)
- *at_stmt = stmt;
-
return (!integer_zerop (niter->assumptions));
}