tblah wrote:

To expand on Jean's summary, we decided to generate TBAA very late in the flang 
pipeline so that loads and stores from other passes are not missed (even then, 
we ended up generating tags in two places to account for some additional loads 
and stores only created when translating from FIR to LLVM (dialect)).

In FIR we currently have a `FirAliasTagOpInterface` for all operations which 
need to have TBAA tags added to them. The TBAA modelling then uses 
information(*) from our MLIR-based alias analysis to determine which tags 
should be applied (as Jean mentioned, our TBAA does not model types - it just 
uses the semantics of TBAA to encode Fortran aliasing semantics). 

Perhaps `FirAliasTagOpInterface` should be promoted to something in upstream 
MLIR? I imagine that Flang could support generating tbaa tags for memref if it 
implemented something like FirAliasAnalysisTagOpInterface and Slava's 
ViewLikeOpInterface (and it is representing something following Fortran 
semantics).

In Flang we are able to construct the TBAA late in the pipeline because we 
encode the information we need in `(hl)fir.declare` operations (where it isn't 
already obvious from the IR). `fir.declare` doesn't lead to any codegen 
directly - it is just an anchor point to store information about values in MLIR.

(*) this doesn't use the generic MLIR alias interface unfortunately, it is more 
similar to Slava's `ViewLikeOpInterface` but using some auxiliary fortran 
specific information on top.

https://github.com/llvm/llvm-project/pull/169226
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to