[flang-commits] [flang] [flang] add tbaa tags to global variables (PR #68727)

Renaud Kauffmann via flang-commits flang-commits at lists.llvm.org
Tue Oct 10 10:40:26 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)
----------------
Renaud-K wrote:

We also wanted to use `SourceKind::Direct` with Allocmem and Alloca in which case global would be undefined. 
Maybe we can define the union instead in the TypeSwitch and get rid of this condition. 

I am assuming that in tbaa gen, we will be distinguishing based on the SourceKind.
A global SymbolRefAttr with a `SourceKind::Global` means that we are directly accessing global memory and we know this cannot physically alias with heap and stack.
But a global SymbolRefAttr with a `SourceKind::Direct` means we do not know much other than the target and pointer attributes.  


https://github.com/llvm/llvm-project/pull/68727


More information about the flang-commits mailing list