This is an archive of the discontinued LLVM Phabricator instance.

Consider reference, pointer, and pointer-to-membber TemplateArguments to be different if they have different types.
ClosedPublic

Authored by rsmith on Nov 14 2020, 6:41 PM.

Details

Summary

For the Itanium ABI, this implements the mangling rule suggested in
https://github.com/itanium-cxx-abi/cxx-abi/issues/47, namely mangling
such template arguments as being cast to the parameter type in the case
where the template name is overloadable. This can cause a mangling
change for rare cases, where

  • the template argument declaration is converted from its declared type to the type of the template parameter, and
  • the template parameter either has a deduced type, is a parameter of a function template.

However, such changes are necessary to avoid mangling collisions. The
ABI changes can be reversed with -fclang-abi-compat=11 or earlier.

Diff Detail

Event Timeline

rsmith created this revision.Nov 14 2020, 6:41 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2020, 6:41 PM
Herald added a subscriber: dexonsmith. · View Herald Transcript
rsmith requested review of this revision.Nov 14 2020, 6:41 PM
Quuxplusone added inline comments.
clang/lib/AST/ItaniumMangle.cpp
4849

And from the PR summary:

namely mangling such template arguments as being cast to the parameter type in the case where the template name is unresolved or overloaded

This phrasing worries me a little bit. Are you saying that you might mangle the name of foo<SomeT> in one way, when there's also a foo<Some, Other, Args> in scope, and in a different way, when there's not? That doesn't seem conforming. So I imagine it's more likely that I'm misunderstanding what you mean by "might be overloaded" / "is overloaded". Could you explain for my information, and perhaps also adjust the wording of these code comments to make the explanation less needed?

Specifically, I think it would be non-conforming if the TU

// https://godbolt.org/z/YjPqMd
template<char *> void foo();
char arr[6];
extern template void foo<arr>();  // #1
int main() { foo<arr>(); }

could not be linked against the TU

template<int> int foo();
template<char *> void foo();  // is this "overloading"?
extern char arr[6];
template<> void foo<arr>() {}  // #2

because lines #1 and #2 disagreed about the way to mangle foo<arr>. (Again, I'm pretty sure you haven't made them disagree... but I remain unclear on what's meant by "overloading" in this PR, if it's not this.)

rsmith updated this revision to Diff 305392.Nov 15 2020, 3:05 PM

Improve commit message.

rsmith updated this revision to Diff 305393.Nov 15 2020, 3:11 PM

Tweak wording of comment.

clang/lib/AST/ItaniumMangle.cpp
4849

Well, technically, a single function template is considered overloaded all by itself :) ... but no, this is a typo in the change description. I meant "overloadable", not "overloaded". The proposed Itanium ABI rule applies to function templates (other than the call operator or conversion function of a generic lambda).

The "might be overloaded" here means "might be overloaded by some other (earlier or later or in a different TU) declaration", so I don't think that's wrong, but I'll rephrase it for the avoidance of any doubt.

(In principle the ABI rule also applies to cases where the template-name is unresolved, but it only makes a difference if the type of the template parameter is known and the template argument is not (eg, if it's the argument of a template template parameter). I suspect that's actually impossible, because the expression or type would need to be instantiation-dependent in that case, so we'd mangle the original syntax for the template argument not the result of converting it to the parameter type.)

rsmith edited the summary of this revision. (Show Details)Nov 15 2020, 3:12 PM
rsmith updated this revision to Diff 310741.Dec 9 2020, 6:26 PM

Rebase.

rjmccall added inline comments.Dec 9 2020, 7:28 PM
clang/lib/AST/ItaniumMangle.cpp
3758

Passing a null TemplateName here causes these to get the unresolved treatment, which means mangling the exact type, right? I guess it just never matters for integer arguments?

4847

This comment should probably say explicitly that I is the parameter index. Do we need to worry about packs that haven't yet been packed? Is it true that if we have a resolved template then we should always have packed the matching arguments?

4963

Could you /*comment*/ the false here?

rsmith updated this revision to Diff 311008.Dec 10 2020, 1:29 PM
  • Handle @rjmccall's review feedback.
  • Properly handle the case of a pack expansion into a non-pack and add tests for that.
rsmith marked an inline comment as done.Dec 10 2020, 1:30 PM
rsmith added inline comments.
clang/lib/AST/ItaniumMangle.cpp
3758

Yes, it never matters for expressions (this function), nor for evaluated integer constants (the previous function).

4847

Parameter renamed to ParamIdx.

Regarding packs, yes, that was my expectation (and it holds for all current examples in Clang's test suite), but it doesn't appear to be true in full generality. Here's a counterexample:

template<int A, int ...B> struct X {};

// Everyone agrees that the template arguments here are I (D) J (C...) E E
template<int D, int ...C> void h(X<D, C...>) {}
void i() { h<1, 2, 3, 4>(X<1, 2, 3, 4>()); }

// But everyone agrees that the template arguments here are I (C...) (D) E, with no J...E in sight
template<int D, int ...C> void f(X<C..., D>) {}
void g() { f<4, 1, 2, 3>(X<1, 2, 3, 4>()); }

I think the above example demonstrates a pre-existing hole in the ABI rule, which I would imagine we fix by following the implementations: if a left-to-right traversal of the parameters and arguments results in a pack expansion corresponding to a non-pack, then from that point onwards we don't form any J...E manglings and template arguments in an unresolved form (in particular, mangle non-type arguments as expressions).

I've added a test for that case. We don't strictly need to do anything special here to handle that, because it doesn't matter what needExactType returns when mangling an unresolved template argument, but it seems better to more precisely track whether we expect to see matching arguments and parameters or not, so we now track that here too.

Thanks for catching this!

rjmccall accepted this revision.Dec 10 2020, 6:07 PM

Seems fine to me.

clang/lib/AST/ItaniumMangle.cpp
4847

Ugh. I think the right rule in the abstract would be to always mangle template arguments in a dependent template argument list using their written structure, even when we can immediately resolve the target template and check arguments against parameters. That would certainly include not trying to collect arguments into template parameter packs. But that ship probably sailed a long time ago, and your left-to-right rule is presumably what we're left with. We should document that in the ABI, though; mind opening a PR?

This revision is now accepted and ready to land.Dec 10 2020, 6:07 PM
rsmith added inline comments.Dec 10 2020, 6:22 PM
clang/lib/AST/ItaniumMangle.cpp
4847

Not sure if PR in this context is problem report or pull request, but: https://github.com/itanium-cxx-abi/cxx-abi/issues/113

This revision was landed with ongoing or failed builds.Dec 11 2020, 1:33 PM
This revision was automatically updated to reflect the committed changes.

Clang is crashing after this change when bootstrapping and building lib/Support/CMakeFiles/LLVMSupport.dir/Hashing.cpp.o
(our log if it helps: https://buildkite.com/mlir/mlir-core/builds/10003#80a5b6a9-d8d9-4420-ab2a-c24f398bc5d4 )

nikic added a subscriber: nikic.Dec 11 2020, 3:11 PM

This also crashes test-suite, so I've reverted the change for now. (Stack trace for tramp3d-v4 crash: https://llvm-compile-time-tracker.com/show_error.php?commit=7b3470baf8bab1919e3ad4c18e2b776c1f7be2d5)

This change is causing second stage build failures on Fedora 33 (x86-64). I'll probably revert this soon, but in the mean time, here is a snippet of the build output:

FAILED: lib/ExecutionEngine/JITLink/CMakeFiles/LLVMJITLink.dir/JITLinkGeneric.cpp.o
/p/tllvm/bin/clang++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/ExecutionEngine/JITLink -I/home/dave/ro_s/lp/llvm/lib/ExecutionEngine/JITLink -Iinclude -I/home/dave/ro_s/lp/llvm/include -Werror=switch -Wno-deprecated-copy -stdlib=libc++ -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -O2   -march=skylake -fno-vectorize -fno-slp-vectorize -fno-tree-slp-vectorize -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT lib/ExecutionEngine/JITLink/CMakeFiles/LLVMJITLink.dir/JITLinkGeneric.cpp.o -MF lib/ExecutionEngine/JITLink/CMakeFiles/LLVMJITLink.dir/JITLinkGeneric.cpp.o.d -o lib/ExecutionEngine/JITLink/CMakeFiles/LLVMJITLink.dir/JITLinkGeneric.cpp.o -c /home/dave/ro_s/lp/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp
In file included from /home/dave/ro_s/lp/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp:13:
/home/dave/ro_s/lp/llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h:150:18: error: invalid operands to binary expression ('llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' and 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>')
    for (auto *B : G.blocks()) {
                 ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/APInt.h:2037:13: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'uint64_t' (aka 'unsigned long') for 1st argument
inline bool operator!=(uint64_t V1, const APInt &V2) { return V2 != V1; }
            ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/APSInt.h:340:13: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'int64_t' (aka 'long') for 1st argument
inline bool operator!=(int64_t V1, const APSInt &V2) { return V2 != V1; }
            ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/StringRef.h:904:15: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'llvm::StringRef' for 1st argument
  inline bool operator!=(StringRef LHS, StringRef RHS) { return !(LHS == RHS); }
              ^
/p/tllvm/bin/../include/c++/v1/system_error:419:1: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'const std::error_code' for 1st argument
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/system_error:424:1: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'const std::error_code' for 1st argument
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/system_error:429:1: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'const std::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/system_error:434:1: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'const std::error_condition' for 1st argument
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
^
/home/dave/ro_s/lp/llvm/include/llvm/Support/Alignment.h:262:13: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'llvm::Align' for 1st argument
inline bool operator!=(Align Lhs, uint64_t Rhs) {
            ^
/home/dave/ro_s/lp/llvm/include/llvm/Support/Alignment.h:287:13: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'llvm::MaybeAlign' for 1st argument
inline bool operator!=(MaybeAlign Lhs, uint64_t Rhs) {
            ^
/home/dave/ro_s/lp/llvm/include/llvm/Support/Alignment.h:295:13: note: candidate function not viable: no known conversion from 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>' to 'llvm::Align' for 1st argument
inline bool operator!=(Align Lhs, Align Rhs) {
            ^
/p/tllvm/bin/../include/c++/v1/utility:584:1: note: candidate template ignored: could not match 'pair' against 'nested_collection_iterator'
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
^
/p/tllvm/bin/../include/c++/v1/iterator:818:1: note: candidate template ignored: could not match 'reverse_iterator' against 'nested_collection_iterator'
operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y)
^
/p/tllvm/bin/../include/c++/v1/iterator:1040:1: note: candidate template ignored: could not match 'istream_iterator' against 'nested_collection_iterator'
operator!=(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x,
^
/p/tllvm/bin/../include/c++/v1/iterator:1151:6: note: candidate template ignored: could not match 'istreambuf_iterator' against 'nested_collection_iterator'
bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
     ^
/p/tllvm/bin/../include/c++/v1/iterator:1274:1: note: candidate template ignored: could not match 'move_iterator' against 'nested_collection_iterator'
operator!=(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y)
^
/p/tllvm/bin/../include/c++/v1/iterator:1650:1: note: candidate template ignored: could not match '__wrap_iter' against 'nested_collection_iterator'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/iterator:1682:1: note: candidate template ignored: could not match '__wrap_iter' against 'nested_collection_iterator'
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/tuple:1185:1: note: candidate template ignored: could not match 'tuple' against 'nested_collection_iterator'
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
^
/p/tllvm/bin/../include/c++/v1/memory:1713:6: note: candidate template ignored: could not match 'allocator' against 'nested_collection_iterator'
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
     ^
/p/tllvm/bin/../include/c++/v1/memory:2642:1: note: candidate template ignored: could not match 'unique_ptr' against 'nested_collection_iterator'
operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);}
^
/p/tllvm/bin/../include/c++/v1/memory:2689:1: note: candidate template ignored: could not match 'unique_ptr' against 'nested_collection_iterator'
operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/memory:2697:1: note: candidate template ignored: could not match 'unique_ptr' against 'nested_collection_iterator'
operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/memory:4082:1: note: candidate template ignored: could not match 'shared_ptr' against 'nested_collection_iterator'
operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/memory:4144:1: note: candidate template ignored: could not match 'shared_ptr' against 'nested_collection_iterator'
operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/memory:4152:1: note: candidate template ignored: could not match 'shared_ptr' against 'nested_collection_iterator'
operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
^
/p/tllvm/bin/../include/c++/v1/functional:2599:1: note: candidate template ignored: could not match 'function' against 'nested_collection_iterator'
operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
^
/p/tllvm/bin/../include/c++/v1/functional:2604:1: note: candidate template ignored: could not match 'function' against 'nested_collection_iterator'
operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
^
/p/tllvm/bin/../include/c++/v1/string_view:664:6: note: candidate template ignored: could not match 'basic_string_view' against 'nested_collection_iterator'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs, basic_string_view<_CharT, _Traits> __rhs) _NOEXCEPT
     ^
/p/tllvm/bin/../include/c++/v1/string_view:673:6: note: candidate template ignored: could not match 'basic_string_view' against 'nested_collection_iterator'
bool operator!=(basic_string_view<_CharT, _Traits> __lhs,
     ^
/p/tllvm/bin/../include/c++/v1/string_view:683:6: note: candidate template ignored: could not match 'basic_string_view' against 'nested_collection_iterator'
bool operator!=(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs,
     ^
/p/tllvm/bin/../include/c++/v1/string:571:6: note: candidate template ignored: could not match 'fpos' against 'nested_collection_iterator'
bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
     ^
/p/tllvm/bin/../include/c++/v1/string:4072:1: note: candidate template ignored: could not match 'basic_string' against 'nested_collection_iterator'
operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
^
/p/tllvm/bin/../include/c++/v1/string:4081:1: note: candidate template ignored: could not match 'const _CharT *' against 'llvm::jitlink::LinkGraph::nested_collection_iterator<llvm::pointee_iterator<std::__wrap_iter<const std::unique_ptr<llvm::jitlink::Section> *>, llvm::jitlink::Section>, llvm::detail::DenseSetImpl<llvm::jitlink::Block *, llvm::DenseMap<llvm::jitlink::Block *, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::jitlink::Block *>, llvm::detail::DenseSetPair<llvm::jitlink::Block *>>, llvm::DenseMapInfo<llvm::jitlink::Block *>>::Iterator, llvm::jitlink::Block *, &llvm::jitlink::LinkGraph::getSectionBlocks>'
operator!=(const _CharT* __lhs,
^
/p/tllvm/bin/../include/c++/v1/string:4090:1: note: candidate template ignored: could not match 'basic_string' against 'nested_collection_iterator'
operator!=(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/Optional.h:315:16: note: candidate template ignored: could not match 'Optional' against 'nested_collection_iterator'
constexpr bool operator!=(const Optional<T> &X, const Optional<U> &Y) {
               ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/Optional.h:352:16: note: candidate template ignored: could not match 'Optional' against 'nested_collection_iterator'
constexpr bool operator!=(const Optional<T> &X, NoneType) {
               ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/Optional.h:357:16: note: candidate template ignored: could not match 'Optional' against 'nested_collection_iterator'
constexpr bool operator!=(NoneType, const Optional<T> &X) {
               ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/Optional.h:408:16: note: candidate template ignored: could not match 'Optional' against 'nested_collection_iterator'
constexpr bool operator!=(const Optional<T> &X, const T &Y) {
               ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/Optional.h:413:16: note: candidate template ignored: could not match 'Optional' against 'nested_collection_iterator'
constexpr bool operator!=(const T &X, const Optional<T> &Y) {
               ^
/p/tllvm/bin/../include/c++/v1/array:381:1: note: candidate template ignored: could not match 'array' against 'nested_collection_iterator'
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
^
/p/tllvm/bin/../include/c++/v1/vector:3346:1: note: candidate template ignored: could not match 'vector' against 'nested_collection_iterator'
operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/ArrayRef.h:541:15: note: candidate template ignored: could not match 'ArrayRef' against 'nested_collection_iterator'
  inline bool operator!=(ArrayRef<T> LHS, ArrayRef<T> RHS) {
              ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/ArrayRef.h:546:15: note: candidate template ignored: could not match 'SmallVectorImpl' against 'nested_collection_iterator'
  inline bool operator!=(SmallVectorImpl<T> &LHS, ArrayRef<T> RHS) {
              ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/DenseMap.h:704:6: note: candidate template ignored: could not match 'DenseMapBase' against 'nested_collection_iterator'
bool operator!=(
     ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/DenseSet.h:251:6: note: candidate template ignored: could not match 'DenseSetImpl' against 'nested_collection_iterator'
bool operator!=(const DenseSetImpl<ValueT, MapTy, ValueInfoT> &LHS,
     ^
/p/tllvm/bin/../include/c++/v1/map:1614:1: note: candidate template ignored: could not match 'map' against 'nested_collection_iterator'
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
^
/p/tllvm/bin/../include/c++/v1/map:2199:1: note: candidate template ignored: could not match 'multimap' against 'nested_collection_iterator'
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
^
/p/tllvm/bin/../include/c++/v1/set:918:1: note: candidate template ignored: could not match 'set' against 'nested_collection_iterator'
operator!=(const set<_Key, _Compare, _Allocator>& __x,
^
/p/tllvm/bin/../include/c++/v1/set:1445:1: note: candidate template ignored: could not match 'multiset' against 'nested_collection_iterator'
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/PointerUnion.h:241:6: note: candidate template ignored: could not match 'PointerUnion' against 'nested_collection_iterator'
bool operator!=(PointerUnion<PTs...> lhs, PointerUnion<PTs...> rhs) {
     ^
/home/dave/ro_s/lp/llvm/include/llvm/ADT/iterator.h:145:8: note: candidate function not viable: no known conversion from 'nested_collection_iterator<...>' to 'const nested_collection_iterator<...>' for 1st argument
  bool operator!=(const DerivedT &RHS) const {
       ^

I believe rsmith is in GMT-8, so I assume this won't get a fix soon and I went ahead and reverted in 22ccdb787024e954318e35fcf904fd4fa36f5679

Thanks. I just verified that reverting this change fixes the second stage regression and was about to commit the revert.

@rsmith – If you need help testing a fix, please let me know.

dblaikie added a subscriber: dblaikie.

I believe rsmith is in GMT-8, so I assume this won't get a fix soon and I went ahead and reverted in 22ccdb787024e954318e35fcf904fd4fa36f5679

Thanks. I just verified that reverting this change fixes the second stage regression and was about to commit the revert.

Thanks for the revert and verification. I saw these failures yesterday, but I incorrectly thought I saw the same failures in stage1, so they couldn't possibly be due to my change because they were compilation failures in LLVM. Oops!