Commit 7119f1b1 by Martin Liska Committed by Martin Liska

Add PRED_FORTRAN_LOOP_PREHEADER to DO loops with step

	* trans-stmt.c (gfc_trans_do): Add expect builtin for DO
	loops with step bigger than +-1.
	* gfortran.dg/predict-1.f90: Ammend the test.
	* gfortran.dg/predict-2.f90: Likewise.

From-SVN: r238112
parent 0e77949e
2016-07-07 Martin Liska <mliska@suse.cz>
* trans-stmt.c (gfc_trans_do): Add expect builtin for DO
loops with step bigger than +-1.
2016-07-05 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com>
* array.c (gfc_match_array_ref): Add parsing support for
......
......@@ -2109,7 +2109,8 @@ gfc_trans_do (gfc_code * code, tree exit_cond)
pos = build2 (COMPOUND_EXPR, void_type_node,
fold_build2 (MODIFY_EXPR, void_type_node,
countm1, tmp2),
build3_loc (loc, COND_EXPR, void_type_node, tmp,
build3_loc (loc, COND_EXPR, void_type_node,
gfc_unlikely (tmp, PRED_FORTRAN_LOOP_PREHEADER),
build1_loc (loc, GOTO_EXPR, void_type_node,
exit_label), NULL_TREE));
......@@ -2123,7 +2124,8 @@ gfc_trans_do (gfc_code * code, tree exit_cond)
neg = build2 (COMPOUND_EXPR, void_type_node,
fold_build2 (MODIFY_EXPR, void_type_node,
countm1, tmp2),
build3_loc (loc, COND_EXPR, void_type_node, tmp,
build3_loc (loc, COND_EXPR, void_type_node,
gfc_unlikely (tmp, PRED_FORTRAN_LOOP_PREHEADER),
build1_loc (loc, GOTO_EXPR, void_type_node,
exit_label), NULL_TREE));
......
2016-07-07 Martin Liska <mliska@suse.cz>
* gfortran.dg/predict-1.f90: Ammend the test.
* gfortran.dg/predict-2.f90: Likewise.
2016-07-07 Ilya Enkovich <ilya.enkovich@intel.com>
PR ipa/71624
......
......@@ -4,9 +4,14 @@
subroutine test(block, array)
integer :: i, block(9), array(2)
do i = array(1), array(2)
do i = array(1), array(2), 2
block(i) = i
end do
do i = array(1), array(2), -2
block(i) = 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" } }
! { dg-final { scan-tree-dump-times "Fortran loop preheader heuristics of edge\[^:\]*: 1.0%" 2 "profile_estimate" } }
......@@ -4,12 +4,12 @@
subroutine test(block, array)
integer :: i,j, block(9), array(2)
do i = array(1), array(2)
do j = array(1), array(2)
do i = array(1), array(2), 2
do j = array(1), array(2), 3
block(i) = j
end do
end do
end subroutine test
! { dg-final { scan-tree-dump-times "Fortran loop preheader heuristics of edge" 2 "profile_estimate" } }
! { dg-final { scan-tree-dump-times "loop gueard" 0 "profile_estimate" } }
! { dg-final { scan-tree-dump-times "loop guard" 0 "profile_estimate" } }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment