[flang-commits] [flang] [flang] add tbaa tags to global variables (PR #68727)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed Oct 11 13:06:14 PDT 2023
================
@@ -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, if I understand correctly, it *is* safe for me to proceed treating these `Direct` source kinds as globals (I already handle pointer/target elsewhere)?
The information I am encoding in TBAA is roughly "if it is a pointer, target, or if I don't know what it is then assume it could alias with any other data access". I think this covers both the reflective and non-reflective cases:
1. `rhsSrc.isTargetOrPointer()` -> rhs may alias with any data access and so it would alias with lhsSrc no matter what lhsSrc is
2. `lhsSrc.isTargetOrPointer()` -> lhs will alias with rhs, no matter what rhs is.
This is less precise than `fir::AliasAnalysis::alias` but it shouldn't produce incorrect results.
https://github.com/llvm/llvm-project/pull/68727
More information about the flang-commits
mailing list