[llvm-branch-commits] [llvm] [StructuralHash] Support Differences (PR #112638)
Kyungwoo Lee via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat Oct 19 09:37:18 PDT 2024
================
@@ -100,8 +233,20 @@ class StructuralHashImpl {
if (const auto *ComparisonInstruction = dyn_cast<CmpInst>(&Inst))
Hashes.emplace_back(ComparisonInstruction->getPredicate());
- for (const auto &Op : Inst.operands())
- Hashes.emplace_back(hashOperand(Op));
+ unsigned InstIdx = 0;
+ if (IndexInstruction) {
+ InstIdx = IndexInstruction->size();
+ IndexInstruction->insert({InstIdx, const_cast<Instruction *>(&Inst)});
----------------
kyulee-com wrote:
Instruction is inserted once by design in this pass. In fact, this map `IndexInstruction` itself can't catch the duplication as the key is `index`, not `Instruction *`. Anyhow, replaced `insert` by `trace_emplace` for efficiency.
https://github.com/llvm/llvm-project/pull/112638
More information about the llvm-branch-commits
mailing list