/* The infinite cost. */
#define INFTY 10000000
-#define AVG_LOOP_NITER(LOOP) 5
-
/* Returns the expected number of loop iterations for LOOP.
The average trip count is computed from profile data if it
exists. */
if (niter == -1)
{
niter = likely_max_stmt_executions_int (loop);
- if (niter == -1 || niter > AVG_LOOP_NITER (loop))
- return AVG_LOOP_NITER (loop);
+
+ if (niter == -1 || niter > PARAM_VALUE (PARAM_AVG_LOOP_NITER))
+ return PARAM_VALUE (PARAM_AVG_LOOP_NITER);
}
return niter;
iv->biv_p = false;
iv->nonlin_use = NULL;
iv->ssa_name = NULL_TREE;
+ if (!no_overflow
+ && !iv_can_overflow_p (data->current_loop, TREE_TYPE (base),
+ base, step))
+ no_overflow = true;
iv->no_overflow = no_overflow;
iv->have_address_use = false;
iv = find_deriving_biv_for_expr (data, e2);
if (iv)
return iv;
+ gcc_fallthrough ();
- /* Fallthru. */
CASE_CONVERT:
/* Casts are simple. */
return find_deriving_biv_for_expr (data, e1);
for (i = width; i > 0; i--)
{
- off = ((unsigned HOST_WIDE_INT) 1 << i) - 1;
+ off = (HOST_WIDE_INT_1U << i) - 1;
XEXP (addr, 1) = gen_int_mode (off, addr_mode);
if (memory_address_addr_space_p (mem_mode, addr, as))
break;
/* For some strict-alignment targets, the offset must be naturally
aligned. Try an aligned offset if mem_mode is not QImode. */
- off = ((unsigned HOST_WIDE_INT) 1 << i);
+ off = (HOST_WIDE_INT_1U << i);
if (off > GET_MODE_SIZE (mem_mode) && mem_mode != QImode)
{
off -= GET_MODE_SIZE (mem_mode);
for (i = width; i >= 0; i--)
{
- off = -((unsigned HOST_WIDE_INT) 1 << i);
+ off = -(HOST_WIDE_INT_1U << i);
XEXP (addr, 1) = gen_int_mode (off, address_mode);
if (memory_address_addr_space_p (mem_mode, addr, as))
break;
for (i = width; i >= 0; i--)
{
- off = ((unsigned HOST_WIDE_INT) 1 << i) - 1;
+ off = (HOST_WIDE_INT_1U << i) - 1;
XEXP (addr, 1) = gen_int_mode (off, address_mode);
if (memory_address_addr_space_p (mem_mode, addr, as))
break;
/* For some strict-alignment targets, the offset must be naturally
aligned. Try an aligned offset if mem_mode is not QImode. */
off = mem_mode != QImode
- ? ((unsigned HOST_WIDE_INT) 1 << i)
+ ? (HOST_WIDE_INT_1U << i)
- GET_MODE_SIZE (mem_mode)
: 0;
if (off > 0)
}
bits = GET_MODE_BITSIZE (address_mode);
- mask = ~(~(unsigned HOST_WIDE_INT) 0 << (bits - 1) << 1);
+ mask = ~(HOST_WIDE_INT_M1U << (bits - 1) << 1);
offset &= mask;
if ((offset >> (bits - 1) & 1))
offset |= ~mask;
int unsignedp, reversep, volatilep;
core = get_inner_reference (addr, &bitsize, &bitpos, &toffset, &mode,
- &unsignedp, &reversep, &volatilep, false);
+ &unsignedp, &reversep, &volatilep);
if (toffset != 0
|| bitpos % BITS_PER_UNIT != 0
{
unsigned i;
bitmap depends_on;
- bool can_autoinc, first = true;
+ bool can_autoinc;
iv_inv_expr_ent *inv_expr = NULL;
struct iv_use *use = group->vuses[0];
comp_cost sum_cost = no_cost, cost;
{
struct iv_use *next = group->vuses[i];
- /* Compute cost for the first use with different offset to the main
- use and add it afterwards. Costs for these uses could be quite
- different. Given below uses in a group:
- use 0 : {base + A + offset_0, step}
- use 0.1: {base + A + offset_0, step}
- use 0.2: {base + A + offset_1, step}
- use 0.3: {base + A + offset_2, step}
- when we need to compute costs with candidate:
- cand 1 : {base + B + offset_0, step}
-
- The first use with different offset is use 0.2, its cost is larger
- than cost of use 0/0.1 because we need to compute:
- A - B + offset_1 - offset_0
- rather than:
- A - B. */
- if (first && next->addr_offset != use->addr_offset)
- {
- first = false;
- cost = get_computation_cost (data, next, cand, true,
- NULL, &can_autoinc, NULL);
- /* Remove setup cost. */
- if (!cost.infinite_cost_p ())
- cost -= cost.scratch;
- }
+ /* TODO: We could skip computing cost for sub iv_use when it has the
+ same cost as the first iv_use, but the cost really depends on the
+ offset and where the iv_use is. */
+ cost = get_computation_cost (data, next, cand, true,
+ NULL, &can_autoinc, NULL);
sum_cost += cost;
}
set_group_iv_cost (data, group, cand, sum_cost, depends_on,
aff_tree step, delta, nit;
struct iv *iv = cand->iv;
tree type = TREE_TYPE (iv->base);
- tree steptype = type;
+ tree steptype;
if (POINTER_TYPE_P (type))
steptype = sizetype;
- steptype = unsigned_type_for (type);
+ else
+ steptype = unsigned_type_for (type);
tree_to_aff_combination (iv->step, TREE_TYPE (iv->step), &step);
aff_combination_convert (&step, steptype);