[clang] [llvm] Global string alignment (PR #142346)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 2 01:50:31 PDT 2025


================
@@ -52,7 +52,7 @@ GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str,
       *M, StrConstant->getType(), true, GlobalValue::PrivateLinkage,
       StrConstant, Name, nullptr, GlobalVariable::NotThreadLocal, AddressSpace);
   GV->setUnnamedAddr(GlobalValue::UnnamedAddr::Global);
-  GV->setAlignment(Align(1));
+  GV->setAlignment(M->getDataLayout().getPreferredAlign(GV));
----------------
nikic wrote:

I think this is just equivalent to not setting the alignment at all...

https://github.com/llvm/llvm-project/pull/142346


More information about the llvm-commits mailing list