[PATCH] D61975: [CodeGen] Fix hashing for MO_ExternalSymbol MachineOperands.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 31 17:06:38 PDT 2019
This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rL362281: [CodeGen] Fix hashing for MO_ExternalSymbol MachineOperands. (authored by efriedma, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D61975?vs=199714&id=202513#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61975/new/
https://reviews.llvm.org/D61975
Files:
llvm/trunk/lib/CodeGen/MachineOperand.cpp
llvm/trunk/unittests/CodeGen/MachineOperandTest.cpp
Index: llvm/trunk/lib/CodeGen/MachineOperand.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/MachineOperand.cpp
+++ llvm/trunk/lib/CodeGen/MachineOperand.cpp
@@ -361,7 +361,7 @@
return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getIndex());
case MachineOperand::MO_ExternalSymbol:
return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getOffset(),
- MO.getSymbolName());
+ StringRef(MO.getSymbolName()));
case MachineOperand::MO_GlobalAddress:
return hash_combine(MO.getType(), MO.getTargetFlags(), MO.getGlobal(),
MO.getOffset());
Index: llvm/trunk/unittests/CodeGen/MachineOperandTest.cpp
===================================================================
--- llvm/trunk/unittests/CodeGen/MachineOperandTest.cpp
+++ llvm/trunk/unittests/CodeGen/MachineOperandTest.cpp
@@ -398,4 +398,14 @@
ASSERT_TRUE(OS.str() == "intpred(eq)");
}
+TEST(MachineOperandTest, HashValue) {
+ char SymName1[] = "test";
+ char SymName2[] = "test";
+ MachineOperand MO1 = MachineOperand::CreateES(SymName1);
+ MachineOperand MO2 = MachineOperand::CreateES(SymName2);
+ ASSERT_NE(SymName1, SymName2);
+ ASSERT_EQ(hash_value(MO1), hash_value(MO2));
+ ASSERT_TRUE(MO1.isIdenticalTo(MO2));
+}
+
} // end namespace
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61975.202513.patch
Type: text/x-patch
Size: 1359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190601/fee24041/attachment.bin>
More information about the llvm-commits
mailing list