[flang-commits] [flang] [llvm] [Flang][Fir] Set default alignment of array globals to 64 bytes (PR #194969)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Wed Apr 29 18:55:19 PDT 2026
================
@@ -480,6 +486,12 @@ fir::GlobalOp fir::FirOpBuilder::createGlobal(
setInsertionPoint(module.getBody(), module.getBody()->end());
auto glob = fir::GlobalOp::create(*this, loc, name, isConst, isTarget, type,
mlir::Attribute{}, linkage);
+ // Set default alignment for array globals.
+ if (mlir::isa<fir::SequenceType>(type)) {
+ unsigned currentAlign = glob.getAlignment().value_or(0);
+ if (currentAlign < 64)
----------------
eugeneepshteyn wrote:
If flang/include/flang/Common/Fortran-consts.h is accessible from here, then perhaps we could add "default global array alignment" constant there.
On the other hand, one could argue that alignment is not a Fortran language thing, so perhaps it should go to a header file common to Lowering...
https://github.com/llvm/llvm-project/pull/194969
More information about the flang-commits
mailing list