[PATCH] D139278: [AArch64] Use string comparison for ArchInfo equality

Tomas Matheson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 4 12:32:57 PST 2022


tmatheson created this revision.
tmatheson added reviewers: mgorny, Hahnfeld, DavidSpickett.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
tmatheson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Tests are failing with LLVM_LINK_LLVM_DYLIB because copies of ArchInfo are
being created somehow, so using address for comparison is failing. Change
to use string comparison based on the name until I can figure out what the
issue with address comparison is.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D139278

Files:
  llvm/include/llvm/Support/AArch64TargetParser.h


Index: llvm/include/llvm/Support/AArch64TargetParser.h
===================================================================
--- llvm/include/llvm/Support/AArch64TargetParser.h
+++ llvm/include/llvm/Support/AArch64TargetParser.h
@@ -120,9 +120,12 @@
   ArchInfo &operator=(const ArchInfo &rhs) = delete;
   ArchInfo &&operator=(const ArchInfo &&rhs) = delete;
 
-  // Comparison is done by address. Copies should not exist.
-  bool operator==(const ArchInfo &Other) const { return this == &Other; }
-  bool operator!=(const ArchInfo &Other) const { return this != &Other; }
+  bool operator==(const ArchInfo &Other) const {
+    return this->Name == Other.Name;
+  }
+  bool operator!=(const ArchInfo &Other) const {
+    return this->Name != Other.Name;
+  }
 
   // Defines the following partial order, indicating when an architecture is
   // a superset of another:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139278.479942.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221204/e9b85840/attachment.bin>


More information about the llvm-commits mailing list