| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-O3 -fno-inline -fwhole-program -fdump-ipa-cp-details -fdump-tree-lversion-details" } |
| 3 |
|
| 4 |
module x |
| 5 |
implicit none |
| 6 |
contains |
| 7 |
subroutine foo(a, b) |
| 8 |
real :: a(:,:) |
| 9 |
real :: b |
| 10 |
integer :: i,j |
| 11 |
b = 0. |
| 12 |
do j=1,size(a,2) |
| 13 |
do i=1,size(a,1) |
| 14 |
b = b + a(i,j) * i * j |
| 15 |
end do |
| 16 |
end do |
| 17 |
end subroutine foo |
| 18 |
|
| 19 |
subroutine bar(a, b) |
| 20 |
real :: a(:,:) |
| 21 |
real :: b |
| 22 |
call foo (a,b) |
| 23 |
end subroutine bar |
| 24 |
|
| 25 |
end module x |
| 26 |
|
| 27 |
program main |
| 28 |
use x |
| 29 |
implicit none |
| 30 |
integer :: n, m |
| 31 |
real, dimension(4,3) :: a |
| 32 |
real, dimension(3,4) :: c |
| 33 |
real :: b |
| 34 |
call random_number(a) |
| 35 |
call bar(a,b) |
| 36 |
print *,b |
| 37 |
|
| 38 |
call random_number(c) |
| 39 |
call bar(c,b) |
| 40 |
print *,b |
| 41 |
|
| 42 |
end program main |
| 43 |
|
| 44 |
! { dg-final { scan-ipa-dump "op assert_expr 1" "cp" } } |
| 45 |
! { dg-final { scan-tree-dump-not "versioned this loop for when certain strides are 1" "lversion" } } |