[clang] [llvm] [HLSL][Clang] Start emitting @llvm.structured.alloca (PR #190157)

Nathan Gauër via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 14 05:22:49 PDT 2026


================
@@ -107,7 +107,12 @@ RawAddress
 CodeGenFunction::CreateTempAllocaWithoutCast(llvm::Type *Ty, CharUnits Align,
                                              const Twine &Name,
                                              llvm::Value *ArraySize) {
-  auto Alloca = CreateTempAlloca(Ty, Name, ArraySize);
+  if (getLangOpts().EmitLogicalPointer) {
+    auto Alloca = Builder.CreateStructuredAlloca(Ty, Name);
+    return RawAddress(Alloca, Ty, Align, KnownNonNull);
+  }
----------------
Keenuts wrote:

Moving this further means changing the API of CodeGenFunction, which exploded the impacted scope of this PR (as many placed do expect an AllocaInst and rely on feature expose by this specific instruction).
We'll probably have to get to those at some point, but we might want to understand those parts before blindly changing them all. Hence this localized change.

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


More information about the cfe-commits mailing list