[llvm] [DXIL] Add support for root signature flag element in DXContainer (PR #123147)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 11 11:39:01 PST 2025
================
@@ -144,6 +150,30 @@ void DXContainerGlobals::addSignature(Module &M,
Globals.emplace_back(buildSignature(M, OutputSig, "dx.osg1", "OSG1"));
}
+void DXContainerGlobals::addRootSignature(Module &M,
+ SmallVector<GlobalValue *> &Globals) {
+
+ auto &RSA = getAnalysis<RootSignatureAnalysisWrapper>();
+ std::optional<ModuleRootSignature> MaybeRootSignature = RSA.getResult();
+
+ if (!MaybeRootSignature.has_value())
+ return;
+
+ ModuleRootSignature MRS = MaybeRootSignature.value();
----------------
bogner wrote:
I generally find it clearer to use the pointer-like API of optional rather than unwrapping into a second variable,
```c++
std::optional<ModuleRootSignature> MRS= RSA.getResult();
if (!MRS.has_value())
return;
// ...
RSH.Flags = MRS->Flags;
```
This is mostly personal preference though, so feel free to take it or leave it.
https://github.com/llvm/llvm-project/pull/123147
More information about the llvm-commits
mailing list