You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Flang, variables are assigned distinct Type-Based Alias Analysis (TBAA) tags, even when they share identical types. This method, however, is insufficient for determining whether two variables from different functions are aliased. To address this, a separate metadata structure—referred to as the "type system"—is created for each function. Within this system, variables defined in a function are derived from its specific type system. For two variables to be confirmed as non-aliasing, they must originate from the same type system but possess distinct TBAA tags.
The type system metadata utilizes a simple counter assigned to functions based on their order of appearance. However, because this metadata is generated at the frontend, functions in separate modules can be assigned identical type systems. For example, the first and second functions in File A have type systems "Flang FAA 1" and "Flang FAA 2," respectively, while the first function in File B also be assigned "Flang FAA 1." This overlap can cause incorrect non-aliasing determinations between variables in the first functions of Files A and B.
In the following example, two accesses to the same element of an array are mistakenly identified as non-aliasing, which can lead to issues when the modify1 function is inlined.
program main
implicit noneinteger, parameter:: n =5real:: arr1(n)
integer:: i
i =0
arr1 =3.2
arr1(i) =4call modify1(arr1)
call modify2(arr1)
! t1.4 from type system Flang FAA 1
arr1(i) = arr1(i) +2.5call printout(arr1)
end program main
subroutinemodify1(arr1)
implicit nonereal, intent(inout) :: arr1(:)
! t1.9 from type system Flang FAA 1
arr1(0) = arr1(0) +0.5endsubroutine modify1subroutinemodify2(arr1)
implicit nonereal, intent(inout) :: arr1(:)
arr1(2) = arr1(2) +1.5endsubroutine modify2subroutineprintout(arr1)
implicit nonereal, intent(in) :: arr1(:)
integer:: i
do i =1, size(arr1)
print arr1(i), ""enddoendsubroutine printout
A simple solution is to append the hash of the module name to the type system metadata.
The text was updated successfully, but these errors were encountered:
In Flang, variables are assigned distinct Type-Based Alias Analysis (TBAA) tags, even when they share identical types. This method, however, is insufficient for determining whether two variables from different functions are aliased. To address this, a separate metadata structure—referred to as the "type system"—is created for each function. Within this system, variables defined in a function are derived from its specific type system. For two variables to be confirmed as non-aliasing, they must originate from the same type system but possess distinct TBAA tags.
The type system metadata utilizes a simple counter assigned to functions based on their order of appearance. However, because this metadata is generated at the frontend, functions in separate modules can be assigned identical type systems. For example, the first and second functions in File A have type systems "Flang FAA 1" and "Flang FAA 2," respectively, while the first function in File B also be assigned "Flang FAA 1." This overlap can cause incorrect non-aliasing determinations between variables in the first functions of Files A and B.
In the following example, two accesses to the same element of an array are mistakenly identified as non-aliasing, which can lead to issues when the modify1 function is inlined.
A simple solution is to append the hash of the module name to the type system metadata.
The text was updated successfully, but these errors were encountered: