[llvm] [FunctionComparator] Differentiate instructions passing distinct MDStrings (PR #69543)
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 19 07:32:06 PDT 2023
================
@@ -160,10 +160,23 @@ int FunctionComparator::cmpAttrs(const AttributeList L,
int FunctionComparator::cmpMetadata(const Metadata *L,
const Metadata *R) const {
// TODO: the following routine coerce the metadata contents into constants
- // before comparison.
+ // or MDStrings before comparison.
// It ignores any other cases, so that the metadata nodes are considered
// equal even though this is not correct.
// We should structurally compare the metadata nodes to be perfect here.
+
+ auto *MDStringL = dyn_cast<MDString>(L);
+ auto *MDStringR = dyn_cast<MDString>(R);
+ if (MDStringL && MDStringR) {
+ if (MDStringL == MDStringR)
+ return 0;
+ return MDStringL->getString().compare(MDStringR->getString());
----------------
dexonsmith wrote:
This shouldn't be necessary. `MDString`s are guaranteed to be uniqued by content.
https://github.com/llvm/llvm-project/pull/69543
More information about the llvm-commits
mailing list