[llvm] [MemProf] Track and report profiled sizes through cloning (PR #98382)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 08:52:17 PDT 2024


================
@@ -935,6 +948,7 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
           CantBePromoted.insert(GV->getGUID());
           // Create the appropriate summary type.
           if (Function *F = dyn_cast<Function>(GV)) {
+            std::vector<AllocInfo> EmptyAllocInfo;
----------------
teresajohnson wrote:

It silenced compiler errors I got =).  Seems that with the unique_ptr in the AllocInfo it no longer liked the aggregate initialization I had previously. Here's one of the errors:

```
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_uninitialized.h:90:7: error: static assertion failed due to requirement 'is_constructible<llvm::AllocInfo, const llvm::AllocInfo &>::value': result type must be constructible from input type
      static_assert(is_constructible<_ValueType, _Tp>::value,
      ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_uninitialized.h:182:4: note: in instantiation of function template specialization 'std::__check_constructible<llvm::AllocInfo, const llvm::AllocInfo &>' requested here
        = _GLIBCXX_USE_ASSIGN_FOR_INIT(_ValueType2, _From);
          ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_uninitialized.h:101:13: note: expanded from macro '_GLIBCXX_USE_ASSIGN_FOR_INIT'
    && std::__check_constructible<T, U>()
            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_uninitialized.h:373:19: note: in instantiation of function template specialization 'std::uninitialized_copy<const llvm::AllocInfo *, llvm::AllocInfo *>' requested here
      return std::uninitialized_copy(__first, __last, __result);
                  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:1692:11: note: in instantiation of function template specialization 'std::__uninitialized_copy_a<const llvm::AllocInfo *, llvm::AllocInfo *, llvm::AllocInfo>' requested here
            std::__uninitialized_copy_a(__first, __last,
                 ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/stl_vector.h:708:4: note: in instantiation of function template specialization 'std::vector<llvm::AllocInfo>::_M_range_initialize<const llvm::AllocInfo *>' requested here
          _M_range_initialize(__first, __last,
          ^
llvm/include/llvm/ADT/ArrayRef.h:288:14: note: in instantiation of function template specialization 'std::vector<llvm::AllocInfo>::vector<const llvm::AllocInfo *, void>' requested here
      return std::vector<T>(Data, Data+Length);
             ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/unique_ptr.h:1070:38: note: in instantiation of member function 'llvm::ArrayRef<llvm::AllocInfo>::operator vector' requested here
    { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); }
                                     ^
llvm/lib/Analysis/ModuleSummaryAnalysis.cpp:953:22: note: in instantiation of function template specialization 'std::make_unique<llvm::FunctionSummary, llvm::GlobalValueSummary::GVFlags &, int, llvm::FunctionSummary::FFlags, int, llvm::ArrayRef<llvm::ValueInfo>, llvm::ArrayRef<std::pair<llvm::ValueInfo, llvm::CalleeInfo>>, llvm::ArrayRef<unsigned long>, llvm::ArrayRef<llvm::FunctionSummary::VFuncId>, llvm::ArrayRef<llvm::FunctionSummary::VFuncId>, llvm::ArrayRef<llvm::FunctionSummary::ConstVCall>, llvm::ArrayRef<llvm::FunctionSummary::ConstVCall>, llvm::ArrayRef<llvm::FunctionSummary::ParamAccess>, llvm::ArrayRef<llvm::CallsiteInfo>, llvm::ArrayRef<llvm::AllocInfo>>' requested here
                std::make_unique<FunctionSummary>(
```



https://github.com/llvm/llvm-project/pull/98382


More information about the llvm-commits mailing list