[llvm] improve performance of Module Analysis stage in the part of processing "other instructions" (PR #76047)

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 04:55:31 PST 2023


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 98e20e15ba22e9fed1ff912b8c77645c85aff9ad 68677f4f8a5432d2da21cc5b48e77dc3cca8e4b8 -- llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
index 9d0c01363f..1a98d4369e 100644
--- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp
@@ -307,10 +307,9 @@ static InstrSignature instrToSignature(MachineInstr &MI,
     if (MO.isReg()) {
       Register RegAlias = MAI.getRegisterAlias(MI.getMF(), MO.getReg());
       // mimic llvm::hash_value(const MachineOperand &MO)
-      h = hash_combine(MO.getType(), (unsigned)RegAlias,
-                       MO.getSubReg(), MO.isDef());
-    }
-    else
+      h = hash_combine(MO.getType(), (unsigned)RegAlias, MO.getSubReg(),
+                       MO.isDef());
+    } else
       h = hash_value(MO);
     ret.push_back(h);
   }
@@ -321,7 +320,7 @@ static InstrSignature instrToSignature(MachineInstr &MI,
 // numbering has already occurred by this point. We can directly compare reg
 // arguments when detecting duplicates.
 static void collectOtherInstr(MachineInstr &MI, SPIRV::ModuleAnalysisInfo &MAI,
-                              SPIRV::ModuleSectionType MSType, InstrTraces& IS,
+                              SPIRV::ModuleSectionType MSType, InstrTraces &IS,
                               bool Append = true) {
   MAI.setSkipEmission(&MI);
   InstrSignature MISign = instrToSignature(MI, MAI);

``````````

</details>


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


More information about the llvm-commits mailing list