[flang-commits] [flang] [flang] AliasAnalysis: distinguish addr of arg vs. addr in arg (PR #87723)
Joel E. Denny via flang-commits
flang-commits at lists.llvm.org
Fri Apr 26 10:04:33 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))
----------------
jdenny-ornl wrote:
After further thought, maybe there is a cleaner way to write this check:
- Declare a new `followBoxAddrLoad` variable local to `AliasAnalysis::getSource`, and set it to true right before the `return` in the `fir::LoadOp` case.
- For the dummy arg check above, replace `followBoxAddr && fir::isa_ref_type(ty)` with `followBoxAddrLoad`.
- For the `fir::AddrOfOp` check, replace `followBoxAddr && mlir::isa<fir::BaseBoxType>(fir::unwrapRefType(ty))` with `followBoxAddrLoad`.
I tried that, and check-flang still succeeded. What do you think?
https://github.com/llvm/llvm-project/pull/87723
More information about the flang-commits
mailing list