[flang-commits] [flang] [flang] Create TBAA subtree for COMMON block variables. (PR #156558)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Wed Sep 3 10:44:41 PDT 2025
================
@@ -57,12 +62,131 @@ static llvm::cl::opt<unsigned> localAllocsThreshold(
namespace {
+// Return the size and alignment (in bytes) for the given type.
+// TODO: this must be combined with DebugTypeGenerator::getFieldSizeAndAlign().
+// We'd better move fir::LLVMTypeConverter out of the FIRCodeGen component.
+static std::pair<std::uint64_t, unsigned short>
+getTypeSizeAndAlignment(mlir::Type type,
+ fir::LLVMTypeConverter &llvmTypeConverter) {
+ mlir::Type llvmTy;
+ if (auto boxTy = mlir::dyn_cast_if_present<fir::BaseBoxType>(type))
+ llvmTy = llvmTypeConverter.convertBoxTypeAsStruct(boxTy, getBoxRank(boxTy));
+ else
+ llvmTy = llvmTypeConverter.convertType(type);
----------------
vzakhari wrote:
It looks like other compilers (NVHPC/gfortran/ifx) do support sequence derived types with procedure pointer components inside COMMON blocks, so it looks like it might be some useful extension of the standard.
I think I am going to try to schedule `AddAliasTags` pass after the `BoxedProcedurePass` inside `createDefaultFIRCodeGenPassPipeline`. I hope this okay with you (given that this is one of the alternatives you listed :) )
https://github.com/llvm/llvm-project/pull/156558
More information about the flang-commits
mailing list