[llvm] [DirectX] Infrastructure to collect shader flags for each function (PR #112967)

Damyan Pepper via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 5 16:57:28 PST 2024


================
@@ -318,22 +314,38 @@ static void translateMetadata(Module &M, const DXILResourceMap &DRM,
   // See https://github.com/llvm/llvm-project/issues/57928
   MDTuple *Signatures = nullptr;
 
-  if (MMDI.ShaderProfile == Triple::EnvironmentType::Library)
+  if (MMDI.ShaderProfile == Triple::EnvironmentType::Library) {
+    // Create a consolidated shader flag mask of all functions in the library
+    // to be used as shader flags mask value associated with top-level library
+    // entry metadata.
+    uint64_t ConsolidatedMask = ShaderFlags.getModuleFlags();
+    for (const auto &FunFlags : ShaderFlags.getFunctionFlags()) {
+      ConsolidatedMask |= FunFlags.second;
+    }
----------------
damyanp wrote:

It looks like the calculation of the ConsolidatedMask should be entirely encapsulated within DXILModuleShaderFlagsInfo. It's kind of strange to have this kind of high-level DXILModuleShaderFlagsInfo that we then pull individual members out of to do calculations on.

https://github.com/llvm/llvm-project/pull/112967


More information about the llvm-commits mailing list