<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 16, 2020, at 09:07, Stephan Bergmann via libcxx-dev <<a href="mailto:libcxx-dev@lists.llvm.org" class="">libcxx-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">About the code originally introduced into libcxx/include/typeinfo as<br class=""><br class=""><blockquote type="cite" class="">    _LIBCPP_INLINE_VISIBILITY<br class="">    bool operator==(const type_info& __arg) const _NOEXCEPT<br class="">#ifndef _LIBCPP_NONUNIQUE_RTTI_BIT<br class="">        {return __type_name == __arg.__type_name;}<br class="">#else<br class="">        {if (__type_name == __arg.__type_name) return true;<br class="">         if (!((__type_name & __arg.__type_name) & _LIBCPP_NONUNIQUE_RTTI_BIT))<br class="">           return false;<br class="">         return __compare_nonunique_names(__arg) == 0;}<br class="">#endif<br class=""></blockquote><br class="">in <<a href="https://github.com/llvm/llvm-project/commit/0090e657cb3a477ace4db59a6b5ae80baffec4c5" class="">https://github.com/llvm/llvm-project/commit/0090e657cb3a477ace4db59a6b5ae80baffec4c5</a>> "ARM64: compare RTTI names as strings", and then factored out to<br class=""><br class=""><blockquote type="cite" class="">    _LIBCPP_INLINE_VISIBILITY<br class="">    static bool __is_type_name_unique(__type_name_t __lhs, __type_name_t __rhs) _NOEXCEPT {<br class="">      return !((__lhs & __rhs) & __non_unique_rtti_bit::value);<br class="">    }<br class=""></blockquote><br class="">in <<a href="https://github.com/llvm/llvm-project/commit/2405bd6898151e0a7ffede78b0d0c7c85c0b66d3" class="">https://github.com/llvm/llvm-project/commit/2405bd6898151e0a7ffede78b0d0c7c85c0b66d3</a>> "Rework std::type_info definition to support systems without fully merged type info names":<br class=""><br class="">I wonder if it is correct to compute `__lhs & __rhs` rather than `__lhs | __rhs`?  The documentation of NonUniqueARMRTTIBit (also in libcxx/include/typeinfo) states that "we check whether BOTH type_infos are guaranteed unique, and if so, we simply compare the addresses of their type names instead of doing a deep string comparison, which is faster.  If at least one of the type_infos can't guarantee uniqueness, we have no choice but to fall back to a deep string comparison."<br class=""><br class="">So my understanding is that __is_type_name_unique should return false (and comparison fall back to deep string comparison) when at least one of __lhs and __rhs has the __non_unique_rtti_bit set, not only when both have it set.<br class=""></div></div></blockquote></div><br class=""><div class="">Hi,</div><div class=""><br class=""></div><div class="">Yes, I do follow your thinking and I think you’re right. I went ahead and created a review (<a href="https://reviews.llvm.org/D97802" class="">https://reviews.llvm.org/D97802</a>) to avoid forgetting about this. I’ll need to investigate some more to make sure your interpretation is correct.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Louis</div><div class=""><br class=""></div></body></html>