================ @@ -214,12 +213,12 @@ void CGHLSLRuntime::addBuffer(const HLSLBufferDecl *BufDecl) { llvm::TargetExtType *TargetTy = cast<llvm::TargetExtType>(convertHLSLSpecificType( ResHandleTy, BufDecl->hasValidPackoffset() ? &Layout : nullptr)); - llvm::GlobalVariable *BufGV = - new GlobalVariable(TargetTy, /*isConstant*/ true, - GlobalValue::LinkageTypes::ExternalLinkage, nullptr, - llvm::formatv("{0}{1}", BufDecl->getName(), - BufDecl->isCBuffer() ? ".cb" : ".tb"), - GlobalValue::NotThreadLocal); + llvm::GlobalVariable *BufGV = new GlobalVariable( + TargetTy, /*isConstant*/ false, + GlobalValue::LinkageTypes::ExternalLinkage, PoisonValue::get(TargetTy), ---------------- hekota wrote:
The global BufGV will be initialized with a resource handle based on resource bindings at the start of the entry function (or in module init function). A resource class with uninitialized handle is an error state, so poison is the right choice here. https://github.com/llvm/llvm-project/pull/130231 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits