[llvm] [HLSL] Adding support for root descriptors in root signature metadata representation (PR #139781)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 09:35:51 PDT 2025
================
@@ -55,6 +55,14 @@ static std::optional<uint32_t> extractMdIntValue(MDNode *Node,
return std::nullopt;
}
+static std::optional<StringRef> extractMdStringValue(MDNode *Node,
+ unsigned int OpId) {
+ MDString *NodeText = cast<MDString>(Node->getOperand(OpId));
+ if (NodeText == nullptr)
+ return std::nullopt;
----------------
bogner wrote:
This doesn't look correct. `cast<>` will assert if the type is wrong, not return null, so this condition is unreachable (except maybe if `Node` itself is null?). I think you meant to use `dyn_cast` here.
I suspect this is why a test case like the following currently crashes:
```llvm
!dx.rootsignatures = !{!0}
!0 = !{ ptr @main, !1 }
!1 = !{ !2 }
!2 = !{ i32 0 }
```
https://github.com/llvm/llvm-project/pull/139781
More information about the llvm-commits
mailing list