@@ -4123,6 +4123,7 @@ struct ilb_data
{
class loop *loop;
gimple *stmt;
+ bool reliable;
};
static bool
@@ -4131,7 +4132,7 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta)
struct ilb_data *data = (struct ilb_data *) dta;
tree ev, init, step;
tree low, high, type, next;
- bool sign, upper = true, has_flexible_size = false;
+ bool sign, upper = data->reliable, has_flexible_size = false;
class loop *loop = data->loop;
if (TREE_CODE (base) != ARRAY_REF)
@@ -4224,12 +4225,14 @@ idx_infer_loop_bounds (tree base, tree *idx, void *dta)
STMT is guaranteed to be executed in every iteration of LOOP.*/
static void
-infer_loop_bounds_from_ref (class loop *loop, gimple *stmt, tree ref)
+infer_loop_bounds_from_ref (class loop *loop, gimple *stmt, tree ref,
+ bool reliable)
{
struct ilb_data data;
data.loop = loop;
data.stmt = stmt;
+ data.reliable = reliable;
for_each_index (&ref, idx_infer_loop_bounds, &data);
}
@@ -4238,7 +4241,7 @@ infer_loop_bounds_from_ref (class loop *loop, gimple *stmt, tree ref)
executed in every iteration of LOOP. */
static void
-infer_loop_bounds_from_array (class loop *loop, gimple *stmt)
+infer_loop_bounds_from_array (class loop *loop, gimple *stmt, bool reliable)
{
if (is_gimple_assign (stmt))
{
@@ -4248,10 +4251,10 @@ infer_loop_bounds_from_array (class loop *loop, gimple *stmt)
/* For each memory access, analyze its access function
and record a bound on the loop iteration domain. */
if (REFERENCE_CLASS_P (op0))
- infer_loop_bounds_from_ref (loop, stmt, op0);
+ infer_loop_bounds_from_ref (loop, stmt, op0, reliable);
if (REFERENCE_CLASS_P (op1))
- infer_loop_bounds_from_ref (loop, stmt, op1);
+ infer_loop_bounds_from_ref (loop, stmt, op1, reliable);
}
else if (is_gimple_call (stmt))
{
@@ -4260,13 +4263,13 @@ infer_loop_bounds_from_array (class loop *loop, gimple *stmt)
lhs = gimple_call_lhs (stmt);
if (lhs && REFERENCE_CLASS_P (lhs))
- infer_loop_bounds_from_ref (loop, stmt, lhs);
+ infer_loop_bounds_from_ref (loop, stmt, lhs, reliable);
for (i = 0; i < n; i++)
{
arg = gimple_call_arg (stmt, i);
if (REFERENCE_CLASS_P (arg))
- infer_loop_bounds_from_ref (loop, stmt, arg);
+ infer_loop_bounds_from_ref (loop, stmt, arg, reliable);
}
}
}
@@ -4410,7 +4413,7 @@ infer_loop_bounds_from_undefined (class loop *loop, basic_block *bbs)
{
gimple *stmt = gsi_stmt (bsi);
- infer_loop_bounds_from_array (loop, stmt);
+ infer_loop_bounds_from_array (loop, stmt, reliable);
if (reliable)
{