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

2025-06-06 Thread Dominik Steenken via cfe-commits
dominik-steenken wrote: Ok. As far as i can tell, ```C++ M->getDataLayout().getPrefTypeAlign(getInt8Ty()) ``` should be functionally equivalent to ```C++ M->getDataLayout().getPreferredAlign(GV) ``` with the exception that the latter potentially preserves a preexisting alignment on the `GV`, wh

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

2025-06-06 Thread Dominik Steenken via cfe-commits
https://github.com/dominik-steenken updated https://github.com/llvm/llvm-project/pull/142346 >From 318f0536ce71780f808ef70a1817af515f9861bd Mon Sep 17 00:00:00 2001 From: Dominik Steenken Date: Mon, 26 May 2025 14:53:41 +0200 Subject: [PATCH 1/2] Align global strings according to data layout W

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

2025-06-05 Thread Dominik Steenken via cfe-commits
dominik-steenken wrote: So i've been reading through the code and the history a bit, and there is [this commit](https://github.com/llvm/llvm-project/commit/fa806422050edba799bc4392125a0305a4bccf6b), which introduces the concept of a minimum alignment for globals to `clang`. The `clang` backend

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

2025-06-05 Thread Dominik Steenken via cfe-commits
https://github.com/dominik-steenken updated https://github.com/llvm/llvm-project/pull/142346 >From 3b5ae726c3f3170b8a524007293934f2561ad572 Mon Sep 17 00:00:00 2001 From: Dominik Steenken Date: Mon, 26 May 2025 14:53:41 +0200 Subject: [PATCH 1/3] Align global strings according to data layout W

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

2025-06-05 Thread Dominik Steenken via cfe-commits
https://github.com/dominik-steenken updated https://github.com/llvm/llvm-project/pull/142346 >From ff817c7a1b79596712d24b7cfac9212edcef9280 Mon Sep 17 00:00:00 2001 From: Dominik Steenken Date: Mon, 26 May 2025 14:53:41 +0200 Subject: [PATCH 1/3] Align global strings according to data layout W

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

2025-06-02 Thread Dominik Steenken via cfe-commits
dominik-steenken wrote: > I'm not sure this is the right fix for the issue. Just like for allocas, the > global variable alignment is a _minimum_ required alignment, which can and > should be raised by targets if it improves code generation. (The exception to > this is if the global has a sect

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

2025-06-02 Thread Dominik Steenken via cfe-commits
@@ -52,7 +52,7 @@ GlobalVariable *IRBuilderBase::CreateGlobalString(StringRef Str, *M, StrConstant->getType(), true, GlobalValue::PrivateLinkage, StrConstant, Name, nullptr, GlobalVariable::NotThreadLocal, AddressSpace); GV->setUnnamedAddr(GlobalValue::UnnamedAd

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

2025-06-02 Thread Dominik Steenken via cfe-commits
dominik-steenken wrote: @uweigand FYI https://github.com/llvm/llvm-project/pull/142346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2025-06-02 Thread Dominik Steenken via cfe-commits
https://github.com/dominik-steenken created https://github.com/llvm/llvm-project/pull/142346 When creating global strings, some targets have requirements that need to be taken into account. Previously, the global strings created by `IRBuilder::createGlobalString` had a hard-coded alignment of