[llvm] [HLSL] Allow completely unused cbuffers (PR #164557)
    Helena Kotas via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Oct 22 12:01:43 PDT 2025
    
    
  
================
@@ -43,8 +43,13 @@ std::optional<CBufferMetadata> CBufferMetadata::get(Module &M) {
   for (const MDNode *MD : CBufMD->operands()) {
     assert(MD->getNumOperands() && "Invalid cbuffer metadata");
 
-    auto *Handle = cast<GlobalVariable>(
-        cast<ValueAsMetadata>(MD->getOperand(0))->getValue());
+    // For an unused cbuffer, the handle may have been optimizzd out
----------------
hekota wrote:
```suggestion
    // For an unused cbuffer, the handle may have been optimized out
```
https://github.com/llvm/llvm-project/pull/164557
    
    
More information about the llvm-commits
mailing list