Hi Jeroen,
In working on a scheme to represent Fortran alias information precisely,
we encounter a situation in which two alias sets partially overlap. We would
like to seek any idea of representing such alias sets, particular, in the scheme of
the full restrict alias approach in D68484.
Consider the following Fortran code,
module m
implicit none
!set A: variables with the TARGET attribute
integer, allocatable, target :: tgtA01, tgtA02, tgtA03
integer, pointer :: p_1_SetA, p_2_SetA, p_3_SetA
!set B: variables without the TARGET attribute
integer :: tgtB01, tgtB02, tgtB03
contains
subroutine init_ptr()
p_1_SetA = 0 ; p_2_SetA = 0 ; p_3_SetA = 0
end subroutine init_ptr
subroutine compute(n)
integer :: idx, n
call init_var(tgtB01)
call init_var(tgtB02)
call init_var(tgtB03)
associate(assoc_tgtA01 => tgtA01, assoc_tgtA02 => tgtA02, assoc_tgtB02 => tgtB02)
do idx = 1, n
assoc_tgtA01 = assoc_tgtA01 * tgtB03 + assoc_tgtA02 * tgtA03 + tgtB01 * assoc_tgtB02
end do
end associate
end subroutine compute
end module
The alias analysis in frontend can generate the following alias sets for
“tgtA01” and “tgtA02”.
alias-sets-from-fe.txt (5.68 KB)
after-opt-without-alias-from-fe.ll (5.6 KB)
before-opt-without-alias-from-fe.ll (13.8 KB)
after-opt-with-alias-from-fe.ll (11.6 KB)
before-opt-with-alias-from-fe.ll (25.4 KB)