1! { dg-do compile }
2! { dg-options "-O3 -fdump-ipa-cp-details -fno-inline" }
3
4module foo
5  implicit none
6contains
7  subroutine bar(a,x)
8    real, dimension(:,:), intent(in) :: a
9    real, intent(out) :: x
10    integer :: i,j
11
12    x = 0
13    do j=1,ubound(a,2)
14       do i=1,ubound(a,1)
15          x = x + a(i,j)**2
16       end do
17    end do
18  end subroutine bar
19end module foo
20
21program main
22  use foo
23  implicit none
24  real, dimension(2,3) :: a
25  real :: x
26  integer :: i
27
28  data a /1.0, 2.0, 3.0, -1.0, -2.0, -3.0/
29
30  do i=1,2000000
31     call bar(a,x)
32  end do
33  print *,x
34end program main
35
36! { dg-final { scan-ipa-dump "Creating a specialized node of \[^\n\r\]*bar/\[0-9\]*\\." "cp" } }
37! { dg-final { scan-ipa-dump-times "Aggregate replacements\[^=\]*=\[^=\]*=\[^=\]*=\[^=\]*=\[^=\]*=\[^=\]*=\[^=\]*=\[^=\]*=\[^=\]*=" 2 "cp" } }
38! { dg-final { cleanup-ipa-dump "cp" } }
39