[PATCH] D82295: [IR] Short-circuit comparison with itself for Attributes

Danila Malyutin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 08:02:13 PDT 2020


danilaml updated this revision to Diff 272428.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D82295/new/

https://reviews.llvm.org/D82295

Files:
  llvm/lib/IR/Attributes.cpp


Index: llvm/lib/IR/Attributes.cpp
===================================================================
--- llvm/lib/IR/Attributes.cpp
+++ llvm/lib/IR/Attributes.cpp
@@ -597,6 +597,8 @@
 }
 
 bool AttributeImpl::operator<(const AttributeImpl &AI) const {
+  if (this == &AI)
+    return false;
   // This sorts the attributes with Attribute::AttrKinds coming first (sorted
   // relative to their enum value) and then strings.
   if (isEnumAttribute()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D82295.272428.patch
Type: text/x-patch
Size: 453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200622/b5df29ae/attachment-0001.bin>


More information about the llvm-commits mailing list