[clang] [llvm] [HLSL][Clang] Start emitting @llvm.structured.alloca (PR #190157)
Steven Perron via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 14 07:41:50 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);
+ }
----------------
s-perron wrote:
> I'm not saying we shouldn't, but I'm saying it may not be just a mater of sinking the call slightly further, hence why I want to deccorelate this.
My concern is that we will continue to generate allocas that happen to work, until we get a complicated case that won't work. That will be harder to debug. We have to have a plan to make sure that we always generate the structured allocas.
Since this is an experimental option not everything has to work, especially features that are not part of HLSL. If something expects an alloca and get an structured alloca, we will get an assert or some other noticable failure. We can iteration on fixing the failures.
I'm fine with this for now, but make sure we have a documented plan with all of the step you intend to take. I'm concerned you will not be done before you go on leave, and we won't be able to easily pass this off to someone else.
https://github.com/llvm/llvm-project/pull/190157
More information about the cfe-commits
mailing list