[flang-commits] [flang] [flang] AliasAnalysis: distinguish addr of arg vs. addr in arg (PR #87723)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Wed May 1 14:33:43 PDT 2024
================
@@ -399,19 +404,30 @@ AliasAnalysis::Source AliasAnalysis::getSource(mlir::Value v) {
if (!defOp && type == SourceKind::Unknown)
// Check if the memory source is coming through a dummy argument.
if (isDummyArgument(v)) {
- type = SourceKind::Argument;
ty = v.getType();
if (fir::valueHasFirAttribute(v, fir::getTargetAttrName()))
attributes.set(Attribute::Target);
-
if (Source::isPointerReference(ty))
attributes.set(Attribute::Pointer);
+ if (followBoxAddr && fir::isa_ref_type(ty))
----------------
vzakhari wrote:
I wonder if it will be more clear to only keep the first four source kinds and move `Direct` into the attributes. We are looking for the source entity here, so the source kind should represent this source entity. Whatever happens during the use-def chain walk should not affect the kind of the source entity that we end up finding. The `Direct`, in this case, would mean that the reference value passed to `getSource` is a result of one or more dereferences of the original source. I just find it easier to think about it this way, though, you may know cases where it can complicate the implementation.
https://github.com/llvm/llvm-project/pull/87723
More information about the flang-commits
mailing list