[all-commits] [llvm/llvm-project] 34c44f: [flang][TBAA] refine TARGET/POINTER encoding (#169...

Tom Eccles via All-commits all-commits at lists.llvm.org
Mon Dec 1 02:06:17 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 34c44f21ae9bf5532e467fa2e942fe61715d1394
      https://github.com/llvm/llvm-project/commit/34c44f21ae9bf5532e467fa2e942fe61715d1394
  Author: Tom Eccles <tom.eccles at arm.com>
  Date:   2025-12-01 (Mon, 01 Dec 2025)

  Changed paths:
    M flang/include/flang/Optimizer/Analysis/TBAAForest.h
    M flang/lib/Optimizer/Analysis/TBAAForest.cpp
    M flang/lib/Optimizer/Transforms/AddAliasTags.cpp
    M flang/test/Driver/tco-test-gen.fir
    M flang/test/Fir/tbaa-codegen2.fir
    M flang/test/Transforms/tbaa-for-common-vars.fir
    M flang/test/Transforms/tbaa-for-global-equiv-vars.fir
    M flang/test/Transforms/tbaa-for-local-vars.fir
    M flang/test/Transforms/tbaa-with-dummy-scope.fir
    M flang/test/Transforms/tbaa-with-dummy-scope2.fir
    M flang/test/Transforms/tbaa2.fir
    M flang/test/Transforms/tbaa3.fir
    M flang/test/Transforms/tbaa4.fir

  Log Message:
  -----------
  [flang][TBAA] refine TARGET/POINTER encoding (#169544)

Previously we were less specific for POINTER/TARGET: encoding that they
could alias with (almost) anything.

In the new system, the "target data" tree is now a sibling of the other
trees (e.g. "global data"). POITNTER variables go at the root of the
"target data" tree, whereas TARGET variables get their own nodes under
that tree. For example,

```
integer, pointer :: ip
real, pointer :: rp
integer, target :: it
integer, target :: it2(:)
real, target :: rt
integer :: i
real :: r
```
- `ip` and `rp` may alias with any variable except `i` and `r`.
- `it`, `it2`, and `rt` may alias only with `ip` or `rp`.
- `i` and `r` cannot alias with any other variable.

Fortran 2023 15.5.2.14 gives restrictions on entities associated with
dummy arguments. These do not allow non-target globals to be modified
through dummy arguments and therefore I don't think we need to make all
globals alias with dummy arguments.

I haven't implemented it in this patch, but I wonder whether it is ever
possible for `ip` to alias with `rt` or even `it2`.

While I was updating the tests I fixed up some tests that still assumed
that local alloc tbaa wasn't the default.

I found no functional regressions in the gfortran test suite, fujitsu
test suite, spec2017, or a selection of HPC apps we test internally.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list