[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 07:58:28 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:

> My concern is that we will continue to generate allocas that happen to work

Do you mean FE emits an alloca instead of structured.alloca, and because backend is flexible, we make it pass through and it kinda works until we reach a corner case on which type is badly resolved? Or did you meant something else?

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


More information about the cfe-commits mailing list