[llvm] [MergeFunctions] Preserve entry counts on folds (PR #202218)

LLVM Continuous Integration via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 29 20:51:12 PDT 2026


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `amdgpu-offload-ubuntu-22-cmake-build-only` running on `rocm-docker-ubu-22` while building `llvm` at step 4 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/203/builds/50788

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 4 (annotate) failure: '../llvm-zorg/zorg/buildbot/builders/annotated/amdgpu-offload-cmake.py --jobs=32' (failure)
...
[3088/8672] Building X86TransformOps.h.inc...
[3089/8672] Building XeGPUDialect.cpp.inc...
[3090/8672] Building XeGPUDialect.h.inc...
[3091/8672] Building XeGPU.cpp.inc...
[3092/8672] Building XeGPU.h.inc...
[3093/8672] Building XeGPUTypes.h.inc...
[3094/8672] Building XeGPUTypes.cpp.inc...
[3095/8672] Building WasmSSAOpsDialect.cpp.inc...
[3096/8672] Building WasmSSAOpsTypes.cpp.inc...
[3097/8672] Building CXX object lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o
FAILED: lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o 
ccache /usr/bin/c++ -DLLVM_EXPORTS -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib/Transforms/IPO -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o -MF lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o.d -o lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: In member function ‘void {anonymous}::MergeFunctions::writeThunk(llvm::Function*, llvm::Function*)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:737:27: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
  737 |   std::optional<Function::ProfileCount> GEC = G->getEntryCount();
      |                           ^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:737:39: error: template argument 1 is invalid
  737 |   std::optional<Function::ProfileCount> GEC = G->getEntryCount();
      |                                       ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:737:63: error: cannot convert ‘std::optional<long unsigned int>’ to ‘int’ in initialization
  737 |   std::optional<Function::ProfileCount> GEC = G->getEntryCount();
      |                                               ~~~~~~~~~~~~~~~~^~
      |                                                               |
      |                                                               std::optional<long unsigned int>
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:808:27: error: invalid type argument of unary ‘*’ (have ‘int’)
  808 |       NewG->setEntryCount(*GEC);
      |                           ^~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: At global scope:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:883:58: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
  883 |                                  std::optional<Function::ProfileCount> FC,
      |                                                          ^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:883:70: error: template argument 1 is invalid
  883 |                                  std::optional<Function::ProfileCount> FC,
      |                                                                      ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:884:58: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
  884 |                                  std::optional<Function::ProfileCount> GC) {
      |                                                          ^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:884:70: error: template argument 1 is invalid
  884 |                                  std::optional<Function::ProfileCount> GC) {
      |                                                                      ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: In function ‘void mergeEntryCountsInto(llvm::Function*, int, int)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:887:39: error: base operand of ‘->’ is not a pointer
  887 |   uint64_t Sum = SaturatingAdd(FC ? FC->getCount() : uint64_t{0},
      |                                       ^~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:888:39: error: base operand of ‘->’ is not a pointer
  888 |                                GC ? GC->getCount() : uint64_t{0});
      |                                       ^~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: In member function ‘void {anonymous}::MergeFunctions::mergeTwoFunctions(llvm::Function*, llvm::Function*)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:895:27: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
Step 7 (build cmake config) failure: build cmake config (failure)
...
[3088/8672] Building X86TransformOps.h.inc...
[3089/8672] Building XeGPUDialect.cpp.inc...
[3090/8672] Building XeGPUDialect.h.inc...
[3091/8672] Building XeGPU.cpp.inc...
[3092/8672] Building XeGPU.h.inc...
[3093/8672] Building XeGPUTypes.h.inc...
[3094/8672] Building XeGPUTypes.cpp.inc...
[3095/8672] Building WasmSSAOpsDialect.cpp.inc...
[3096/8672] Building WasmSSAOpsTypes.cpp.inc...
[3097/8672] Building CXX object lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o
FAILED: lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o 
ccache /usr/bin/c++ -DLLVM_EXPORTS -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_USE_CXX11_ABI=1 -D_GNU_SOURCE -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/lib/Transforms/IPO -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/build/include -I/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-array-bounds -Wno-stringop-overread -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC -UNDEBUG -fno-exceptions -funwind-tables -fno-rtti -std=c++17 -MD -MT lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o -MF lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o.d -o lib/Transforms/IPO/CMakeFiles/LLVMipo.dir/MergeFunctions.cpp.o -c /home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: In member function ‘void {anonymous}::MergeFunctions::writeThunk(llvm::Function*, llvm::Function*)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:737:27: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
  737 |   std::optional<Function::ProfileCount> GEC = G->getEntryCount();
      |                           ^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:737:39: error: template argument 1 is invalid
  737 |   std::optional<Function::ProfileCount> GEC = G->getEntryCount();
      |                                       ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:737:63: error: cannot convert ‘std::optional<long unsigned int>’ to ‘int’ in initialization
  737 |   std::optional<Function::ProfileCount> GEC = G->getEntryCount();
      |                                               ~~~~~~~~~~~~~~~~^~
      |                                                               |
      |                                                               std::optional<long unsigned int>
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:808:27: error: invalid type argument of unary ‘*’ (have ‘int’)
  808 |       NewG->setEntryCount(*GEC);
      |                           ^~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: At global scope:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:883:58: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
  883 |                                  std::optional<Function::ProfileCount> FC,
      |                                                          ^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:883:70: error: template argument 1 is invalid
  883 |                                  std::optional<Function::ProfileCount> FC,
      |                                                                      ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:884:58: error: ‘ProfileCount’ is not a member of ‘llvm::Function’
  884 |                                  std::optional<Function::ProfileCount> GC) {
      |                                                          ^~~~~~~~~~~~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:884:70: error: template argument 1 is invalid
  884 |                                  std::optional<Function::ProfileCount> GC) {
      |                                                                      ^
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: In function ‘void mergeEntryCountsInto(llvm::Function*, int, int)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:887:39: error: base operand of ‘->’ is not a pointer
  887 |   uint64_t Sum = SaturatingAdd(FC ? FC->getCount() : uint64_t{0},
      |                                       ^~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:888:39: error: base operand of ‘->’ is not a pointer
  888 |                                GC ? GC->getCount() : uint64_t{0});
      |                                       ^~
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp: In member function ‘void {anonymous}::MergeFunctions::mergeTwoFunctions(llvm::Function*, llvm::Function*)’:
/home/botworker/bbot/amdgpu-offload-ubuntu-22-cmake-build-only/llvm-project/llvm/lib/Transforms/IPO/MergeFunctions.cpp:895:27: error: ‘ProfileCount’ is not a member of ‘llvm::Function’

```

</details>

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


More information about the llvm-commits mailing list