[llvm] [DirectX] Set whole-module flags prior to evaluating per-function flags (PR #139967)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 14:41:38 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/lib/Target/DirectX/DXILShaderFlags.cpp llvm/lib/Target/DirectX/DXILShaderFlags.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
index 18fd56e76..df1ac4deb 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.cpp
@@ -215,9 +215,8 @@ void ModuleShaderFlags::gatherGlobalModuleFlags(
   // Set DisableOptimizations flag based on the presence of OptimizeNone
   // attribute of entry functions.
   if (MMDI.EntryPropertyVec.size() > 0) {
-    CSF.DisableOptimizations =
-        MMDI.EntryPropertyVec[0].Entry->hasFnAttribute(
-            llvm::Attribute::OptimizeNone);
+    CSF.DisableOptimizations = MMDI.EntryPropertyVec[0].Entry->hasFnAttribute(
+        llvm::Attribute::OptimizeNone);
     // Ensure all entry functions have the same optimization attribute
     for (const auto &EntryFunProps : MMDI.EntryPropertyVec)
       if (CSF.DisableOptimizations !=
@@ -262,7 +261,7 @@ void ModuleShaderFlags::gatherGlobalModuleFlags(
   // are UAVs present globally.
   if (CanSetResMayNotAlias && MMDI.ValidatorVersion < VersionTuple(1, 8))
     CSF.ResMayNotAlias = !DRM.uavs().empty();
- }
+}
 
 /// Construct ModuleShaderFlags for module Module M
 void ModuleShaderFlags::initialize(Module &M, DXILResourceTypeMap &DRTM,
diff --git a/llvm/lib/Target/DirectX/DXILShaderFlags.h b/llvm/lib/Target/DirectX/DXILShaderFlags.h
index 37b822cf5..833133717 100644
--- a/llvm/lib/Target/DirectX/DXILShaderFlags.h
+++ b/llvm/lib/Target/DirectX/DXILShaderFlags.h
@@ -101,7 +101,8 @@ private:
   DenseMap<const Function *, ComputedShaderFlags> FunctionFlags;
   /// Combined Shader Flag Mask of all functions of the module
   ComputedShaderFlags CombinedSFMask{};
-  void gatherGlobalModuleFlags(ComputedShaderFlags &, const Module &M, const DXILResourceMap &,
+  void gatherGlobalModuleFlags(ComputedShaderFlags &, const Module &M,
+                               const DXILResourceMap &,
                                const ModuleMetadataInfo &);
   void updateFunctionFlags(ComputedShaderFlags &, const Instruction &,
                            DXILResourceTypeMap &, const ModuleMetadataInfo &);

``````````

</details>


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


More information about the llvm-commits mailing list