[llvm] r240415 - [BranchFolding] Document why replacing HashMachineInstr with hash_code doesn't work

Benjamin Kramer benny.kra at googlemail.com
Tue Jun 23 07:47:37 PDT 2015


Author: d0k
Date: Tue Jun 23 09:47:36 2015
New Revision: 240415

URL: http://llvm.org/viewvc/llvm-project?rev=240415&view=rev
Log:
[BranchFolding] Document why replacing HashMachineInstr with hash_code doesn't work

Modified:
    llvm/trunk/lib/CodeGen/BranchFolding.cpp

Modified: llvm/trunk/lib/CodeGen/BranchFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/BranchFolding.cpp?rev=240415&r1=240414&r2=240415&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/BranchFolding.cpp (original)
+++ llvm/trunk/lib/CodeGen/BranchFolding.cpp Tue Jun 23 09:47:36 2015
@@ -270,7 +270,9 @@ static unsigned HashMachineInstr(const M
   for (unsigned i = 0, e = MI->getNumOperands(); i != e; ++i) {
     const MachineOperand &Op = MI->getOperand(i);
 
-    // Merge in bits from the operand if easy.
+    // Merge in bits from the operand if easy. We can't use MachineOperand's
+    // hash_code here because it's not deterministic and we sort by hash value
+    // later.
     unsigned OperandHash = 0;
     switch (Op.getType()) {
     case MachineOperand::MO_Register:





More information about the llvm-commits mailing list