This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Fix build failure in ScopDetection
ClosedPublic

Authored by ctetreau on Sep 30 2021, 4:47 PM.

Details

Summary

In some build environments, the C++ compiler is unable to infer the
correct type for the DenseMap::insert in isErrorBlock. Typing out
std::make_pair helps.

Diff Detail

Event Timeline

ctetreau created this revision.Sep 30 2021, 4:47 PM
ctetreau requested review of this revision.Sep 30 2021, 4:47 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 30 2021, 4:47 PM

The old code works for me with visual studio 2019, but fails with clang 7 and clang 12.1.

[redacted]/polly/lib/Analysis/ScopDetection.cpp:1472:29: error: no matching member function for call to 'insert'
  auto It = ErrorBlockCache.insert({{&BB, &R}, false});
            ~~~~~~~~~~~~~~~~^~~~~~
[redacted]/llvm/include/llvm/ADT/DenseMap.h:207:29: note: candidate function not viable: cannot convert initializer list argument to 'const std::pair<tuple<const BasicBlock *, const Region *>, bool>'
  std::pair<iterator, bool> insert(const std::pair<KeyT, ValueT> &KV) {
                            ^
[redacted]/llvm/include/llvm/ADT/DenseMap.h:214:29: note: candidate function not viable: cannot convert initializer list argument to 'std::pair<tuple<const BasicBlock *, const Region *>, bool>'
  std::pair<iterator, bool> insert(std::pair<KeyT, ValueT> &&KV) {
                            ^
[redacted]/llvm/include/llvm/ADT/DenseMap.h:297:8: note: candidate function template not viable: requires 2 arguments, but 1 was provided
  void insert(InputIt I, InputIt E) {
       ^
This revision is now accepted and ready to land.Oct 2 2021, 3:58 PM
ctetreau closed this revision.Oct 5 2021, 8:59 AM