================ @@ -406,7 +406,7 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v) { attributes.set(Attribute::Pointer); } - if (type == SourceKind::Global) + if (type == SourceKind::Global || type == SourceKind::Direct) ---------------- tblah wrote:
So `SourceKind::Direct` isn't necessarily a global? The use case for the tbaa alias analysis is we want to be able to add tags to global arrays. These can be boxed. The specific case I care about is ``` module mod real, dimension(:), allocatable :: glbl subroutine func(arg) real, intent(in), dimension(:) :: arg ! glbl can't alias with arg end subroutine end module ``` The generated code looks something like ``` fir.global @_QMmodEglbl : !fir.box<!fir.heap<!fir.array<?xf32>>> { [...]} func.func @_QMmodPfunc([...]) { [...] %glbl_addr = fir.address_of(@_QmodEa) : !fir.ref<!fir.box<!fir.heap<!fir.array<?xf32>>>> %decl = fir.declare %glbl_addr [...] [...] %box = fir.load %decl %addr = fir.box_addr %box : (!fir.box<!fir.heap<!fir.array<?xf32>>>) -> !fir.heap<!fir.array<?xf32>> [...] %element = fir.array_coor %addr(%shape) %index %val = fir.array_coor %element ``` What I want to happen here is to notice that `%val` comes from a global variable and to tag that load as such. This is a lot clearer from the fortran source than the FIR so maybe we need to store more information somewhere. As I understand it, you're saying that we can't know much about this variable because the global variable is boxed. Why is the box special? https://github.com/llvm/llvm-project/pull/68727 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits