[flang-commits] [flang] [flang] Add an alignment attribute to fir.alloca (PR #234897)
Eugene Epshteyn via flang-commits
flang-commits at lists.llvm.org
Fri Oct 23 06:55:02 PDT 2026
================
@@ -3848,8 +3856,11 @@ struct GlobalOpConversion : public fir::FIROpConversion<fir::GlobalOp> {
0, getGlobalAddressSpace(rewriter), false,
mlir::LLVM::ThreadLocalMode::NotThreadLocal, comdat, attrs, dbgExprs);
+ // A requested alignment is a minimum: never go below the ABI alignment of
+ // the global's type.
if (global.getAlignment() && *global.getAlignment() > 0)
- g.setAlignment(*global.getAlignment());
+ g.setAlignment(std::max<std::uint64_t>(
----------------
eugeneepshteyn wrote:
Done: added @g_aligned (64 kept) and @g_underaligned (2 raised to 4) to convert-to-llvm.fir.
https://github.com/llvm/llvm-project/pull/234897
More information about the flang-commits
mailing list