From: Vladimir Yanovsky Date: Sat, 28 Jul 2007 21:51:53 +0000 (+0000) Subject: Avoid SMS when the candidate loop contains INC instruction X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9b6dd300181991dc03186c3534062afbf9058824;p=gcc.git Avoid SMS when the candidate loop contains INC instruction Co-Authored-By: Revital Eres From-SVN: r127027 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47af5547893..c8468a17642 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-07-29 Vladimir Yanovsky + Revital Eres + + * modulo-sched.c (sms_schedule): Avoid loops which includes + auto-increment instructions. + 2007-07-28 Richard Guenther PR middle-end/32920 diff --git a/gcc/modulo-sched.c b/gcc/modulo-sched.c index d543e6bdaf0..16cd5d88e24 100644 --- a/gcc/modulo-sched.c +++ b/gcc/modulo-sched.c @@ -987,12 +987,16 @@ sms_schedule (void) if ( !(count_reg = doloop_register_get (tail))) continue; - /* Don't handle BBs with calls or barriers, or !single_set insns. */ + /* Don't handle BBs with calls or barriers, or !single_set insns, + or auto-increment insns (to avoid creating invalid reg-moves + for the auto-increment insns). + ??? Should handle auto-increment insns. */ for (insn = head; insn != NEXT_INSN (tail); insn = NEXT_INSN (insn)) if (CALL_P (insn) || BARRIER_P (insn) || (INSN_P (insn) && !JUMP_P (insn) - && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE)) + && !single_set (insn) && GET_CODE (PATTERN (insn)) != USE) + || (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0)) break; if (insn != NEXT_INSN (tail)) @@ -1003,6 +1007,8 @@ sms_schedule (void) fprintf (dump_file, "SMS loop-with-call\n"); else if (BARRIER_P (insn)) fprintf (dump_file, "SMS loop-with-barrier\n"); + else if (FIND_REG_INC_NOTE (insn, NULL_RTX) != 0) + fprintf (dump_file, "SMS reg inc\n"); else fprintf (dump_file, "SMS loop-with-not-single-set\n"); print_rtl_single (dump_file, insn); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7c4fd7d0a66..4bf697bcde6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2007-07-29 Vladimir Yanovsky + Revital Eres + + * gfortran.dg/sms-1.f90: New test. + 2007-07-28 Richard Guenther * gcc.c-torture/compile/pr32920.c: New testcase. diff --git a/gcc/testsuite/gfortran.dg/sms-1.f90 b/gcc/testsuite/gfortran.dg/sms-1.f90 new file mode 100644 index 00000000000..f9bfafe9208 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/sms-1.f90 @@ -0,0 +1,28 @@ +! { dg-do run } +! { dg-options "-O2 -fmodulo-sched" } +program main + integer (kind = 8) :: i, l8, u8, step8 + integer (kind = 4) :: l4, step4 + integer (kind = 8), parameter :: big = 10000000000_8 + + u8 = big * 40 + 200 + l4 = 200 + step8 = -big + call test ((/ (i, i = u8, l4, step8) /), u8, l4 + 0_8, step8) +contains + subroutine test (a, l, u, step) + integer (kind = 8), dimension (:), intent (in) :: a + integer (kind = 8), intent (in) :: l, u, step + integer (kind = 8) :: i + integer :: j + + j = 1 + do i = l, u, step + if (a (j) .ne. i) call abort + j = j + 1 + end do + if (size (a, 1) .ne. j - 1) call abort + end subroutine test +end program main + +