[flang] Generate TBAA information.
authorSlava Zakharin <szakharin@nvidia.com>
Tue, 17 Jan 2023 17:08:43 +0000 (09:08 -0800)
committerSlava Zakharin <szakharin@nvidia.com>
Tue, 17 Jan 2023 18:19:11 +0000 (10:19 -0800)
commit9c84d20fa69006adcbbaf424f3ef674298045f78
tree51cbd0123cfc5057a4b3c2183aea6071b3421537
parent2449cbabddc73668abf60357d476a78692193286
[flang] Generate TBAA information.

This is initial version of TBAA information generation for Flang
generated IR. The desired behavior is that TBAA type descriptors
are generated for FIR types during FIR to LLVM types conversion,
and then TBAA access tags are attached to memory accessing operations
when they are converted to LLVM IR dialect.

In the initial version the type conversion is not producing
TBAA type descriptors, and all memory accesses are just partitioned
into two sets of box and non-box accesses, which can never alias.

The TBAA generation is enabled by default at >O0 optimization levels.
TBAA generation may also be enabled via `apply-tbaa` option of
`fir-to-llvm-ir` conversion pass. `-mllvm -disable-tbaa` engineering
option allows disabling TBAA generation to override Flang's default
(e.g. when -O1 is used).

SPEC CPU2006/437.leslie3d speeds up by more than 2x on Icelake.

Reviewed By: jeanPerier, clementval

Differential Revision: https://reviews.llvm.org/D141820
flang/include/flang/Optimizer/CodeGen/CGPasses.td
flang/include/flang/Optimizer/CodeGen/CodeGen.h
flang/include/flang/Tools/CLOptions.inc
flang/lib/Optimizer/CodeGen/CMakeLists.txt
flang/lib/Optimizer/CodeGen/CodeGen.cpp
flang/lib/Optimizer/CodeGen/DescriptorModel.h
flang/lib/Optimizer/CodeGen/TBAABuilder.cpp [new file with mode: 0644]
flang/lib/Optimizer/CodeGen/TBAABuilder.h [new file with mode: 0644]
flang/lib/Optimizer/CodeGen/TypeConverter.h
flang/test/Fir/tbaa.fir [new file with mode: 0644]