[llvm] [SimplifyCFG] Use hash map to continue hoisting the common instructions (PR #78615)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 06:54:05 PDT 2024
================
@@ -1582,19 +1582,29 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
}
}
+// Hash instructions based on following factors:
+// 1- Instruction Opcode
+// 2- Instruction type
+// 3- Instruction operands
+llvm::hash_code getHash(Instruction *Instr) {
+ std::vector<Value *> operands(Instr->op_begin(), Instr->op_end());
+ return llvm::hash_combine(
+ Instr->getOpcode(), Instr->getType(),
+ hash_combine_range(operands.begin(), operands.end()));
----------------
RouzbehPaktinat wrote:
That's right but I never iterate the hashmap, I just look it up using a key. It won't have that non-deterministic behavior.
https://github.com/llvm/llvm-project/pull/78615
More information about the llvm-commits
mailing list