* predict.def: Add fortran loop preheader predictor.
* gimple-fold.c (gimple_fold_stmt_to_constant_1): Properly
fold IFN_BUILTIN_EXPECT with a known constant argument.
* trans-stmt.c (gfc_trans_simple_do): Predict the edge.
* gfortran.dg/predict-1.f90: New test.
From-SVN: r237533
+2016-06-16 Martin Liska <mliska@suse.cz>
+
+ * predict.def: Add fortran loop preheader predictor.
+ * gimple-fold.c (gimple_fold_stmt_to_constant_1): Properly
+ fold IFN_BUILTIN_EXPECT with a known constant argument.
+
2016-06-16 Martin Liska <mliska@suse.cz>
* predict.def: Add 'Fortran' to display text of all
+2016-06-16 Martin Liska <mliska@suse.cz>
+
+ * trans-stmt.c (gfc_trans_simple_do): Predict the edge.
+
2016-06-16 Martin Liska <mliska@suse.cz>
* trans-array.c (gfc_array_allocate): Do not generate expect
else
cond = fold_build2_loc (loc, GE_EXPR, boolean_type_node, dovar,
to);
- tmp = fold_build3_loc (loc, COND_EXPR, void_type_node, cond, tmp,
+
+ tmp = fold_build3_loc (loc, COND_EXPR, void_type_node,
+ gfc_likely (cond, PRED_FORTRAN_LOOP_PREHEADER), tmp,
build_empty_stmt (loc));
gfc_add_expr_to_block (pblock, tmp);
case IFN_UBSAN_CHECK_MUL:
subcode = MULT_EXPR;
break;
+ case IFN_BUILTIN_EXPECT:
+ {
+ tree arg0 = gimple_call_arg (stmt, 0);
+ tree op0 = (*valueize) (arg0);
+ if (TREE_CODE (op0) == INTEGER_CST)
+ return op0;
+ return NULL_TREE;
+ }
default:
return NULL_TREE;
}
which in turn has an optional argument. */
DEF_PREDICTOR (PRED_FORTRAN_ABSENT_DUMMY, "Fortran absent dummy", \
HITRATE (60), 0)
+
+/* Fortran DO statement generates a pre-header guard:
+ empty = (step > 0 ? to < from : to > from), which can be predicted
+ to be very likely. */
+DEF_PREDICTOR (PRED_FORTRAN_LOOP_PREHEADER, "Fortran loop preheader", \
+ HITRATE (99), 0)
+2016-06-16 Martin Liska <mliska@suse.cz>
+
+ * gfortran.dg/predict-1.f90: New test.
+
2016-06-16 Uros Bizjak <ubizjak@gmail.com>
PR target/71242
--- /dev/null
+! { dg-do compile }
+! { dg-options "-O2 -fdump-tree-profile_estimate" }
+
+subroutine test(block, array)
+integer :: i, block(9), array(2)
+
+do i = array(1), array(2)
+ block(i) = i
+end do
+end subroutine test
+
+! { dg-final { scan-tree-dump-times "Fortran loop preheader heuristics of edge\[^:\]*: 99.0%" 1 "profile_estimate" } }