[llvm] [DXIL] Consume Metadata Analysis information in passes (PR #108034)

Damyan Pepper via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 16 16:49:34 PDT 2024


================
@@ -21,20 +21,20 @@ class Function;
 namespace dxil {
 
 struct EntryProperties {
-  const Function *Entry;
+  const Function *Entry{nullptr};
   // Specific target shader stage may be specified for entry functions
   Triple::EnvironmentType ShaderStage = Triple::UnknownEnvironment;
   unsigned NumThreadsX{0}; // X component
   unsigned NumThreadsY{0}; // Y component
   unsigned NumThreadsZ{0}; // Z component
 
-  EntryProperties(const Function &Fn) : Entry(&Fn) {};
+  EntryProperties(const Function *Fn = nullptr) : Entry(Fn) {};
 };
 
 struct ModuleMetadataInfo {
   VersionTuple DXILVersion{};
   VersionTuple ShaderModelVersion{};
-  Triple::EnvironmentType ShaderStage = Triple::UnknownEnvironment;
+  Triple::EnvironmentType ShaderProfile = Triple::UnknownEnvironment;
----------------
damyanp wrote:

I'm wondering why we're happy with default initialization for all the other members, but not this one.

These two suggestions I think are equivalent, but more consistent with the style used in rest of the struct:

```suggestion
  Triple::EnvironmentType ShaderProfile{};
```

```suggestion
  Triple::EnvironmentType ShaderProfile{Triple::UnknownEnvironment};
```

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


More information about the llvm-commits mailing list