diff options
author | 2023-11-09 10:23:10 +0100 | |
---|---|---|
committer | 2023-11-14 09:22:39 +0100 | |
commit | 98bfdac5ce82d1679f8af9a57501471812ab68d7 (patch) | |
tree | 35c47da3874fee2de0ecb1da1a7acef08710924b | |
parent | [GlobalOpt] Cache whether CC is changeable (#71381) (diff) | |
download | llvm-project-98bfdac5ce82d1679f8af9a57501471812ab68d7.tar.gz llvm-project-98bfdac5ce82d1679f8af9a57501471812ab68d7.tar.bz2 llvm-project-98bfdac5ce82d1679f8af9a57501471812ab68d7.zip |
[BranchFolding] Remove dubious assert from operator< (#71639)llvmorg-17.0.5
`MergePotentialElts::operator<` asserts that the two elements being
compared are not equal. However, sorting functions are allowed to invoke
the comparison function with equal arguments (though they usually don't
for efficiency reasons).
There is an existing special-case that disables the assert if
_GLIBCXX_DEBUG is used, which may invoke the comparator with equal args
to verify strict weak ordering. I believe libc++ also has strict weak
ordering checks under some options nowadays.
Recently, #71312 was reported, where a change to glibc's qsort_r
implementation can also result in comparison between equal elements.
From what I understood, this is an inefficiency that will be fixed on
the glibc side as well, but I think at this point we should just remove
this assertion.
Fixes https://github.com/llvm/llvm-project/issues/71312.
(cherry picked from commit 74a76a288562c486f377121855ef7db0386e0e43)
-rw-r--r-- | llvm/lib/CodeGen/BranchFolding.cpp | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp index 3830f25debaf..0801296cab49 100644 --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -485,13 +485,7 @@ BranchFolder::MergePotentialsElt::operator<(const MergePotentialsElt &o) const { return true; if (getBlock()->getNumber() > o.getBlock()->getNumber()) return false; - // _GLIBCXX_DEBUG checks strict weak ordering, which involves comparing - // an object with itself. -#ifndef _GLIBCXX_DEBUG - llvm_unreachable("Predecessor appears twice"); -#else return false; -#endif } /// CountTerminators - Count the number of terminators in the given |