[PATCH] D156016: [Support] Change MapVector's default template parameter to SmallVector<*, 0>

Shilei Tian via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 14:35:11 PDT 2023


tianshilei1992 added a comment.

In D156016#4533187 <https://reviews.llvm.org/D156016#4533187>, @MaskRay wrote:

> In D156016#4533091 <https://reviews.llvm.org/D156016#4533091>, @tianshilei1992 wrote:
>
>> This patch causes compile error when using GCC 7.5.0.
>>
>>   [303/2700] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/FaultMaps.cpp.o
>>   FAILED: lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/FaultMaps.cpp.o
>>   ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/gpfs/jlse-fs0/users/ac.shilei.tian/build/llvm/release/lib/CodeGen -I/home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/lib/CodeGen -I/gpfs/jlse-fs0/users/ac.shilei.tian/build/llvm/release/include -I/home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++1z -MD -MT lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/FaultMaps.cpp.o -MF lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/FaultMaps.cpp.o.d -o lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/FaultMaps.cpp.o -c /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/lib/CodeGen/FaultMaps.cpp
>>   In file included from /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/Support/PointerLikeTypeTraits.h:19:0,
>>                    from /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/ADT/PointerIntPair.h:18,
>>                    from /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/MC/MCSymbol.h:16,
>>                    from /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/CodeGen/FaultMaps.h:12,
>>                    from /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/lib/CodeGen/FaultMaps.cpp:9:
>>   /usr/include/c++/7/type_traits: In substitution of ‘template<class _Tp, class> static std::true_type std::__do_is_default_constructible_impl::__test(int) [with _Tp = llvm::StackMaps::FunctionInfo; <template-parameter-1-2> = <missing>]’:
>>   /usr/include/c++/7/type_traits:889:35:   required from ‘struct std::__is_default_constructible_impl<llvm::StackMaps::FunctionInfo>’
>>   /usr/include/c++/7/type_traits:143:12:   required from ‘struct std::__and_<std::__not_<std::is_void<llvm::StackMaps::FunctionInfo> >, std::__is_default_constructible_impl<llvm::StackMaps::FunctionInfo> >’
>>   /usr/include/c++/7/type_traits:893:12:   required from ‘struct std::__is_default_constructible_atom<llvm::StackMaps::FunctionInfo>’
>>   /usr/include/c++/7/type_traits:914:12:   required from ‘struct std::__is_default_constructible_safe<llvm::StackMaps::FunctionInfo, false>’
>>   /usr/include/c++/7/type_traits:920:12:   required from ‘struct std::is_default_constructible<llvm::StackMaps::FunctionInfo>’
>>   /usr/include/c++/7/type_traits:143:12:   [ skipping 16 instantiation contexts, use -ftemplate-backtrace-limit=0 to disable ]
>>   /usr/include/c++/7/type_traits:1147:12:   required from ‘struct std::is_copy_constructible<llvm::detail::copy_construction_triviality_helper<std::pair<const llvm::MCSymbol*, llvm::StackMaps::FunctionInfo> > >’
>>   /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/Support/type_traits.h:97:8:   required from ‘struct llvm::is_trivially_copy_constructible<std::pair<const llvm::MCSymbol*, llvm::StackMaps::FunctionInfo> >’
>>   /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/ADT/SmallVector.h:329:74:   required from ‘class llvm::SmallVectorImpl<std::pair<const llvm::MCSymbol*, llvm::StackMaps::FunctionInfo> >’
>>   /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/ADT/SmallVector.h:1199:22:   required from ‘class llvm::SmallVector<std::pair<const llvm::MCSymbol*, llvm::StackMaps::FunctionInfo>, 0>’
>>   /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/ADT/MapVector.h:38:14:   required from ‘class llvm::MapVector<const llvm::MCSymbol*, llvm::StackMaps::FunctionInfo>’
>>   /home/ac.shilei.tian/Documents/vscode/llvm-project/llvm/include/llvm/CodeGen/StackMaps.h:367:13:   required from here
>>   /usr/include/c++/7/type_traits:878:48: error: constructor required before non-static data member for ‘llvm::StackMaps::FunctionInfo::StackSize’ has been parsed
>>        template<typename _Tp, typename = decltype(_Tp())>
>>                                                   ^~~~~
>>   /usr/include/c++/7/type_traits:878:48: error: constructor required before non-static data member for ‘llvm::StackMaps::FunctionInfo::RecordCount’ has been parsed
>
>
>
>   --- i/llvm/include/llvm/CodeGen/StackMaps.h
>   +++ w/llvm/include/llvm/CodeGen/StackMaps.h
>   @@ -330,7 +330,9 @@ public:
>              LiveOuts(std::move(LiveOuts)) {}
>      };
>   
>   -  using FnInfoMap = MapVector<const MCSymbol *, FunctionInfo>;
>   +  using FnInfoMap = MapVector<const MCSymbol *, FunctionInfo,
>   +                              DenseMap<const MCSymbol *, unsigned>,
>   +                              std::vector<FunctionInfo>>;
>      using CallsiteInfoList = std::vector<CallsiteInfo>;
>   
>      /// Generate a stackmap record for a stackmap instruction.
>
> can work around gcc 7.3.0, but it seems that gcc 7.3.0 has other errors unrelated to MapVector.

Are you gonna push the change? Since LLVM supports GCC 7.1.0, the code needs to be compiled with GCC 7.3.0 or 7.5.0.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156016



More information about the llvm-commits mailing list