gfc_start_block (&on_error);
if (status != NULL_TREE)
{
- gfc_add_expr_to_block (&on_error,
- build_predict_expr (PRED_FORTRAN_FAIL_ALLOC,
- NOT_TAKEN));
tmp = fold_build2_loc (input_location, MODIFY_EXPR, status_type, status,
build_int_cst (status_type, LIBERROR_ALLOCATION));
gfc_add_expr_to_block (&on_error, tmp);
boolean_type_node, pointer,
build_int_cst (prvoid_type_node, 0));
tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node,
- error_cond, gfc_finish_block (&on_error),
+ gfc_unlikely (error_cond, PRED_FORTRAN_FAIL_ALLOC),
+ gfc_finish_block (&on_error),
build_empty_stmt (input_location));
gfc_add_expr_to_block (block, tmp);
null_mem = gfc_unlikely (fold_build2_loc (input_location, NE_EXPR,
boolean_type_node, mem,
build_int_cst (type, 0)),
- PRED_FORTRAN_FAIL_ALLOC);
+ PRED_FORTRAN_REALLOC);
/* If mem is NULL, we call gfc_allocate_using_malloc or
gfc_allocate_using_lib. */
cond2 = fold_build2_loc (input_location, NE_EXPR, boolean_type_node,
stat, build_zero_cst (TREE_TYPE (stat)));
tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node,
- gfc_unlikely (cond2, PRED_FORTRAN_FAIL_ALLOC),
+ gfc_unlikely (cond2, PRED_FORTRAN_REALLOC),
tmp, build_empty_stmt (input_location));
gfc_add_expr_to_block (&non_null, tmp);
}
PRED_FLAG_FIRST_MATCH)
/* Branch leading to a failure status are unlikely. This can occur for out
- of memory or when trying to allocate an already allocated allocated or
- deallocating an already deallocated allocatable. This predictor only
- occurs when the user explicitly asked for a return status. By default,
- the code aborts, which is handled via PRED_NORETURN.
- FIXME: the hitrate really ought to be close to 100%. */
-DEF_PREDICTOR (PRED_FORTRAN_FAIL_ALLOC, "fail alloc", HITRATE (62), 0)
+ of memory. This predictor only occurs when the user explicitly asked
+ for a return status. By default, the code aborts,
+ which is handled via PRED_NORETURN. */
+DEF_PREDICTOR (PRED_FORTRAN_FAIL_ALLOC, "fail alloc", PROB_VERY_LIKELY, 0)
+
+/* Predictor is used for an allocation of an already allocated memory or
+ deallocating an already deallocated allocatable. */
+DEF_PREDICTOR (PRED_FORTRAN_REALLOC, "repeated allocation/deallocation", \
+ PROB_LIKELY, 0)
/* Branch leading to an I/O failure status are unlikely. This predictor is
used for I/O failures such as for invalid unit numbers. This predictor