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

Michal Paszkowski via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 06:35:03 PST 2023


================
@@ -319,15 +291,42 @@ void SPIRVModuleAnalysis::collectFuncNames(MachineInstr &MI,
   }
 }
 
+using InstrSignature = SmallVector<size_t>;
+using InstrTraces = std::set<InstrSignature>;
+
+// Returns a representation of an instruction as a vector of MachineOperand
+// hash values, see llvm::hash_value(const MachineOperand &MO) for details.
+// This creates a signature of the instruction with the same content
+// that MachineOperand::isIdenticalTo uses for comparison.
+static InstrSignature instrToSignature(MachineInstr &MI,
+                                       SPIRV::ModuleAnalysisInfo &MAI) {
+  InstrSignature ret;
----------------
michalpaszkowski wrote:

Please start variable names with a capital letter ([LLVM Coding Standards: Naming Conventions](https://llvm.org/docs/CodingStandards.html#id44))

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


More information about the llvm-commits mailing list