Joel E. Denny 732353303e
[flang] AliasAnalysis: Fix pointer component logic (#94242)
This PR applies the changes discussed in [[RFC] Rationale for Flang
AliasAnalysis pointer component
logic](https://discourse.llvm.org/t/rfc-rationale-for-flang-aliasanalysis-pointer-component-logic/79252).

In summary, this PR replaces the existing pointer component logic in
Flang's AliasAnalysis implementation. That logic focuses on aliasing
between pointers and non-pointer, non-target composites that have
pointer components. However, it is more conservative than necessary, and
some existing tests expect its current results when less conservative
results seem reasonable.

This PR splits the logic into two cases:

1. Source values are the same: Return MayAlias when one value is the
address of a composite, and the other value is statically the address of
a pointer component of that composite.
2. Source values are different: Return MayAlias when one value is the
address of a composite (actual argument), and the other value is the
address of a pointer (dummy arg) that might dynamically be a component
of that composite.

In both cases, the actual implementation is still more conservative than
described above, but it can be improved further later. Details appear in
the comments.

Additionally, this PR revises the logic that reports MayAlias for a
pointer/target vs. another pointer/target. It constrains the existing
logic to handle only isData cases, and it adds less conservative
handling of !isData cases elsewhere. First, it extends case 2 listed
above to cover the case where the actual argument is the address of a
pointer rather than a composite. Second, it adds a third case: where
target attributes enable aliasing with a dummy argument.
2024-10-15 10:07:17 -04:00
..

Flang

Flang is a ground-up implementation of a Fortran front end written in modern C++. It started off as the f18 project (https://github.com/flang-compiler/f18) with an aim to replace the previous flang project (https://github.com/flang-compiler/flang) and address its various deficiencies. F18 was subsequently accepted into the LLVM project and rechristened as Flang.

Please note that flang is not ready yet for production usage.

Getting Started

Read more about flang in the docs directory. Start with the compiler overview.

To better understand Fortran as a language and the specific grammar accepted by flang, read Fortran For C Programmers and flang's specifications of the Fortran grammar and the OpenMP grammar.

Treatment of language extensions is covered in this document.

To understand the compilers handling of intrinsics, see the discussion of intrinsics.

To understand how a flang program communicates with libraries at runtime, see the discussion of runtime descriptors.

If you're interested in contributing to the compiler, read the style guide and also review how flang uses modern C++ features.

If you are interested in writing new documentation, follow LLVM's Markdown style guide.

Consult the Getting Started with Flang for information on building and running flang.