Skip to content

[llvm][clang] Allocate a new stack instead of spawning a new thread to get more stack space #133173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

Bigcheese
Copy link
Contributor

Clang spawns a new thread to avoid running out of stack space. This can make debugging and performance analysis more difficult as how the threads are connected is difficult to recover.

This patch introduces runOnNewStack and applies it in Clang. On platforms that have good support for it this allocates a new stack and moves to it using assembly. Doing split stacks like this actually runs on most platforms, but many debuggers and unwinders reject the large or backwards stack offsets that occur. Apple platforms and tools are known to support this, so this only enables it there for now.

@Bigcheese Bigcheese requested a review from rnk March 26, 2025 22:29
@llvmbot llvmbot added cmake Build system in general and CMake in particular clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" llvm:support labels Mar 26, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 26, 2025

@llvm/pr-subscribers-llvm-support

@llvm/pr-subscribers-clang

Author: Michael Spencer (Bigcheese)

Changes

Clang spawns a new thread to avoid running out of stack space. This can make debugging and performance analysis more difficult as how the threads are connected is difficult to recover.

This patch introduces runOnNewStack and applies it in Clang. On platforms that have good support for it this allocates a new stack and moves to it using assembly. Doing split stacks like this actually runs on most platforms, but many debuggers and unwinders reject the large or backwards stack offsets that occur. Apple platforms and tools are known to support this, so this only enables it there for now.


Full diff: https://github.com/llvm/llvm-project/pull/133173.diff

12 Files Affected:

  • (modified) clang/include/clang/Basic/Stack.h (+4-1)
  • (modified) clang/lib/Basic/Stack.cpp (+12-28)
  • (modified) clang/lib/Frontend/CompilerInstance.cpp (+1-1)
  • (modified) llvm/cmake/config-ix.cmake (+5)
  • (modified) llvm/include/llvm/Config/config.h.cmake (+3)
  • (modified) llvm/include/llvm/Support/CrashRecoveryContext.h (+3)
  • (added) llvm/include/llvm/Support/ProgramStack.h (+45)
  • (modified) llvm/lib/Support/CMakeLists.txt (+1)
  • (modified) llvm/lib/Support/CrashRecoveryContext.cpp (+19)
  • (added) llvm/lib/Support/ProgramStack.cpp (+115)
  • (modified) llvm/unittests/Support/CMakeLists.txt (+1)
  • (added) llvm/unittests/Support/ProgramStackTest.cpp (+29)
diff --git a/clang/include/clang/Basic/Stack.h b/clang/include/clang/Basic/Stack.h
index 30ebd94aedd1f..9674b9d9b62c3 100644
--- a/clang/include/clang/Basic/Stack.h
+++ b/clang/include/clang/Basic/Stack.h
@@ -27,7 +27,10 @@ namespace clang {
 
   /// Call this once on each thread, as soon after starting the thread as
   /// feasible, to note the approximate address of the bottom of the stack.
-  void noteBottomOfStack();
+  ///
+  /// \param ForceSet set to true if you know the call is near the bottom of a
+  ///                 new stack. Used for split stacks.
+  void noteBottomOfStack(bool ForceSet = false);
 
   /// Determine whether the stack is nearly exhausted.
   bool isStackNearlyExhausted();
diff --git a/clang/lib/Basic/Stack.cpp b/clang/lib/Basic/Stack.cpp
index aa15d8e66950f..8cbb84943f8d3 100644
--- a/clang/lib/Basic/Stack.cpp
+++ b/clang/lib/Basic/Stack.cpp
@@ -13,33 +13,13 @@
 
 #include "clang/Basic/Stack.h"
 #include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/Support/ProgramStack.h"
 
-#ifdef _MSC_VER
-#include <intrin.h>  // for _AddressOfReturnAddress
-#endif
+static LLVM_THREAD_LOCAL uintptr_t BottomOfStack = 0;
 
-static LLVM_THREAD_LOCAL void *BottomOfStack = nullptr;
-
-static void *getStackPointer() {
-#if __GNUC__ || __has_builtin(__builtin_frame_address)
-  return __builtin_frame_address(0);
-#elif defined(_MSC_VER)
-  return _AddressOfReturnAddress();
-#else
-  char CharOnStack = 0;
-  // The volatile store here is intended to escape the local variable, to
-  // prevent the compiler from optimizing CharOnStack into anything other
-  // than a char on the stack.
-  //
-  // Tested on: MSVC 2015 - 2019, GCC 4.9 - 9, Clang 3.2 - 9, ICC 13 - 19.
-  char *volatile Ptr = &CharOnStack;
-  return Ptr;
-#endif
-}
-
-void clang::noteBottomOfStack() {
-  if (!BottomOfStack)
-    BottomOfStack = getStackPointer();
+void clang::noteBottomOfStack(bool ForceSet) {
+  if (!BottomOfStack || ForceSet)
+    BottomOfStack = llvm::getStackPointer();
 }
 
 bool clang::isStackNearlyExhausted() {
@@ -51,7 +31,8 @@ bool clang::isStackNearlyExhausted() {
   if (!BottomOfStack)
     return false;
 
-  intptr_t StackDiff = (intptr_t)getStackPointer() - (intptr_t)BottomOfStack;
+  intptr_t StackDiff =
+      (intptr_t)llvm::getStackPointer() - (intptr_t)BottomOfStack;
   size_t StackUsage = (size_t)std::abs(StackDiff);
 
   // If the stack pointer has a surprising value, we do not understand this
@@ -66,9 +47,12 @@ bool clang::isStackNearlyExhausted() {
 void clang::runWithSufficientStackSpaceSlow(llvm::function_ref<void()> Diag,
                                             llvm::function_ref<void()> Fn) {
   llvm::CrashRecoveryContext CRC;
-  CRC.RunSafelyOnThread([&] {
-    noteBottomOfStack();
+  // Preserve the BottomOfStack in case RunSafelyOnNewStack uses split stacks.
+  uintptr_t PrevBottom = BottomOfStack;
+  CRC.RunSafelyOnNewStack([&] {
+    noteBottomOfStack(true);
     Diag();
     Fn();
   }, DesiredStackSize);
+  BottomOfStack = PrevBottom;
 }
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 4e13b6ced252f..0d6616a022001 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -1276,7 +1276,7 @@ compileModuleImpl(CompilerInstance &ImportingInstance, SourceLocation ImportLoc,
 
   // Execute the action to actually build the module in-place. Use a separate
   // thread so that we get a stack large enough.
-  bool Crashed = !llvm::CrashRecoveryContext().RunSafelyOnThread(
+  bool Crashed = !llvm::CrashRecoveryContext().RunSafelyOnNewStack(
       [&]() {
         GenerateModuleFromModuleMapAction Action;
         Instance.ExecuteAction(Action);
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 15ae04f5a6913..8982b75b9abeb 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -21,6 +21,7 @@ if (ANDROID OR CYGWIN OR CMAKE_SYSTEM_NAME MATCHES "AIX|DragonFly|FreeBSD|Haiku|
   set(HAVE_MACH_MACH_H 0)
   set(HAVE_MALLOC_MALLOC_H 0)
   set(HAVE_PTHREAD_H 1)
+  set(HAVE_SYS_RESOURCE_H 1)
   set(HAVE_SYS_MMAN_H 1)
   set(HAVE_SYSEXITS_H 1)
   set(HAVE_UNISTD_H 1)
@@ -28,6 +29,7 @@ elseif (APPLE)
   set(HAVE_MACH_MACH_H 1)
   set(HAVE_MALLOC_MALLOC_H 1)
   set(HAVE_PTHREAD_H 1)
+  set(HAVE_SYS_RESOURCE_H 1)
   set(HAVE_SYS_MMAN_H 1)
   set(HAVE_SYSEXITS_H 1)
   set(HAVE_UNISTD_H 1)
@@ -35,6 +37,7 @@ elseif (PURE_WINDOWS)
   set(HAVE_MACH_MACH_H 0)
   set(HAVE_MALLOC_MALLOC_H 0)
   set(HAVE_PTHREAD_H 0)
+  set(HAVE_SYS_RESOURCE_H 0)
   set(HAVE_SYS_MMAN_H 0)
   set(HAVE_SYSEXITS_H 0)
   set(HAVE_UNISTD_H 0)
@@ -44,6 +47,7 @@ elseif (ZOS)
   set(HAVE_MACH_MACH_H 0)
   set(HAVE_MALLOC_MALLOC_H 0)
   set(HAVE_PTHREAD_H 1)
+  set(HAVE_SYS_RESOURCE_H 1)
   set(HAVE_SYS_MMAN_H 1)
   set(HAVE_SYSEXITS_H 0)
   set(HAVE_UNISTD_H 1)
@@ -52,6 +56,7 @@ else()
   check_include_file(mach/mach.h HAVE_MACH_MACH_H)
   check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
   check_include_file(pthread.h HAVE_PTHREAD_H)
+  check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
   check_include_file(sys/mman.h HAVE_SYS_MMAN_H)
   check_include_file(sysexits.h HAVE_SYSEXITS_H)
   check_include_file(unistd.h HAVE_UNISTD_H)
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 835201f2a45b0..12fdd20f9901c 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -150,6 +150,9 @@
 /* Have pthread_rwlock_init */
 #cmakedefine HAVE_PTHREAD_RWLOCK_INIT ${HAVE_PTHREAD_RWLOCK_INIT}
 
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#cmakedefine HAVE_SYS_RESOURCE_H ${HAVE_SYS_RESOURCE_H}
+
 /* Define to 1 if you have the `sbrk' function. */
 #cmakedefine HAVE_SBRK ${HAVE_SBRK}
 
diff --git a/llvm/include/llvm/Support/CrashRecoveryContext.h b/llvm/include/llvm/Support/CrashRecoveryContext.h
index 26ddf97b3ef02..31293d6715757 100644
--- a/llvm/include/llvm/Support/CrashRecoveryContext.h
+++ b/llvm/include/llvm/Support/CrashRecoveryContext.h
@@ -97,6 +97,9 @@ class CrashRecoveryContext {
     return RunSafelyOnThread([&]() { Fn(UserData); }, RequestedStackSize);
   }
 
+  bool RunSafelyOnNewStack(function_ref<void()>,
+                           unsigned RequestedStackSize = 0);
+
   /// Explicitly trigger a crash recovery in the current process, and
   /// return failure from RunSafely(). This function does not return.
   [[noreturn]] void HandleExit(int RetCode);
diff --git a/llvm/include/llvm/Support/ProgramStack.h b/llvm/include/llvm/Support/ProgramStack.h
new file mode 100644
index 0000000000000..cc8fe98d7a8d1
--- /dev/null
+++ b/llvm/include/llvm/Support/ProgramStack.h
@@ -0,0 +1,45 @@
+//===--- ProgramStack.h -----------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_PROGRAMSTACK_H
+#define LLVM_SUPPORT_PROGRAMSTACK_H
+
+#include "llvm/ADT/STLFunctionalExtras.h"
+
+namespace llvm {
+
+/// \returns an address close to the current value of the stack pointer.
+///
+/// The value is not guaranteed to point to anything specific. It can be used to
+/// estimate how much stack space has been used since the previous call.
+uintptr_t getStackPointer();
+
+/// \returns the default stack size for this platform.
+///
+/// Based on \p RLIMIT_STACK or the equivalent.
+unsigned getDefaultStackSize();
+
+/// Runs Fn on a new stack of at least the given size.
+///
+/// \param StackSize requested stack size. A size of 0 uses the default stack
+///                  size of the platform.
+///
+/// The preferred implementation is split stacks on platforms that have a good
+/// debugging experience for them. On other platforms a new thread is used.
+void runOnNewStack(unsigned StackSize, function_ref<void()> Fn);
+
+template <typename R, typename... Ts>
+R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
+  std::optional<R> Ret;
+  runOnNewStack(StackSize, [&]() { Ret = Fn(std::forward<Ts>(Args)...); });
+  return std::move(*Ret);
+}
+
+} // namespace llvm
+
+#endif // LLVM_SUPPORT_PROGRAMSTACK_H
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 2754c97fce6c1..8e4503a1fc84f 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -294,6 +294,7 @@ add_llvm_component_library(LLVMSupport
   Path.cpp
   Process.cpp
   Program.cpp
+  ProgramStack.cpp
   RWMutex.cpp
   Signals.cpp
   Threading.cpp
diff --git a/llvm/lib/Support/CrashRecoveryContext.cpp b/llvm/lib/Support/CrashRecoveryContext.cpp
index f53aea177d612..ca0c8744a398c 100644
--- a/llvm/lib/Support/CrashRecoveryContext.cpp
+++ b/llvm/lib/Support/CrashRecoveryContext.cpp
@@ -10,6 +10,7 @@
 #include "llvm/Config/llvm-config.h"
 #include "llvm/Support/ErrorHandling.h"
 #include "llvm/Support/ExitCodes.h"
+#include "llvm/Support/ProgramStack.h"
 #include "llvm/Support/Signals.h"
 #include "llvm/Support/thread.h"
 #include <cassert>
@@ -523,3 +524,21 @@ bool CrashRecoveryContext::RunSafelyOnThread(function_ref<void()> Fn,
     CRC->setSwitchedThread();
   return Info.Result;
 }
+
+bool CrashRecoveryContext::RunSafelyOnNewStack(function_ref<void()> Fn,
+                                               unsigned RequestedStackSize) {
+  // If crash recovery is disabled, do nothing.
+  if (gCrashRecoveryEnabled) {
+    assert(!Impl && "Crash recovery context already initialized!");
+    CrashRecoveryContextImpl *CRCI = new CrashRecoveryContextImpl(this);
+    Impl = CRCI;
+
+    CRCI->ValidJumpBuffer = true;
+    if (setjmp(CRCI->JumpBuffer) != 0) {
+      return false;
+    }
+  }
+
+  runOnNewStack(RequestedStackSize, Fn);
+  return true;
+}
diff --git a/llvm/lib/Support/ProgramStack.cpp b/llvm/lib/Support/ProgramStack.cpp
new file mode 100644
index 0000000000000..3a48e86062133
--- /dev/null
+++ b/llvm/lib/Support/ProgramStack.cpp
@@ -0,0 +1,115 @@
+//===--- RunOnNewStack.cpp - Crash Recovery -------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/ProgramStack.h"
+#include "llvm/Config/config.h"
+#include "llvm/Support/Compiler.h"
+
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#ifdef _MSC_VER
+# include <intrin.h>  // for _AddressOfReturnAddress
+#endif
+
+// Currently only Apple AArch64 is known to support split stacks in the debugger
+// and other tooling.
+#if defined(__APPLE__) && defined(__aarch64__) &&                              \
+    LLVM_HAS_CPP_ATTRIBUTE(gnu::naked) && __has_extension(gnu_asm)
+# define LLVM_HAS_SPLIT_STACKS
+# define LLVM_HAS_SPLIT_STACKS_AARCH64
+#include <sys/mman.h>
+#endif
+
+#ifndef LLVM_HAS_SPLIT_STACKS
+# include "llvm/Support/thread.h"
+#endif
+
+using namespace llvm;
+
+uintptr_t llvm::getStackPointer() {
+#if __GNUC__ || __has_builtin(__builtin_frame_address)
+  return (uintptr_t)__builtin_frame_address(0);
+#elif defined(_MSC_VER)
+  return (uintptr_t)_AddressOfReturnAddress();
+#else
+  char CharOnStack = 0;
+  // The volatile store here is intended to escape the local variable, to
+  // prevent the compiler from optimizing CharOnStack into anything other
+  // than a char on the stack.
+  //
+  // Tested on: MSVC 2015 - 2019, GCC 4.9 - 9, Clang 3.2 - 9, ICC 13 - 19.
+  char *volatile Ptr = &CharOnStack;
+  return (uintptr_t)Ptr;
+#endif
+}
+
+unsigned llvm::getDefaultStackSize() {
+#ifdef HAVE_SYS_RESOURCE_H
+  rlimit RL;
+  getrlimit(RLIMIT_STACK, &RL);
+  return RL.rlim_cur;
+#else
+  // 8MiB seems good.
+  return 8 << 20;
+#endif
+}
+
+namespace {
+#ifdef LLVM_HAS_SPLIT_STACKS_AARCH64
+[[gnu::naked]] void runOnNewStackImpl(void *Stack, void (*Fn)(void *),
+                                      void *Ctx) {
+  __asm__ volatile(
+      "mov       x16, sp\n\t"
+      "sub       x0, x0, #0x20\n\t"            // subtract space from stack
+      "stp       xzr, x16, [x0, #0x00]\n\t"    // save old sp
+      "stp       x29, x30, [x0, #0x10]\n\t"    // save fp, lr
+      "mov       sp, x0\n\t"                   // switch to new stack
+      "add       x29, x0, #0x10\n\t"           // switch to new frame
+      ".cfi_def_cfa w29, 16\n\t"
+      ".cfi_offset w30, -8\n\t"                // lr
+      ".cfi_offset w29, -16\n\t"               // fp
+
+      "mov       x0, x2\n\t"                   // Ctx is the only argument
+      "blr       x1\n\t"                       // call Fn
+
+      "ldp       x29, x30, [sp, #0x10]\n\t"    // restore fp, lr
+      "ldp       xzr, x16, [sp, #0x00]\n\t"    // load old sp
+      "mov       sp, x16\n\t"
+      "ret"
+  );
+}
+#endif
+
+#ifdef LLVM_HAS_SPLIT_STACKS
+void callback(void *Ctx) {
+  (*reinterpret_cast<function_ref<void()> *>(Ctx))();
+}
+#endif
+} // namespace
+
+#ifdef LLVM_HAS_SPLIT_STACKS
+void llvm::runOnNewStack(unsigned StackSize, function_ref<void()> Fn) {
+  if (StackSize == 0)
+    StackSize = getDefaultStackSize();
+
+  void *Stack = malloc(StackSize);
+  void *BottomOfStack = (char *)Stack + StackSize;
+
+  runOnNewStackImpl(BottomOfStack, callback, &Fn);
+
+  free(Stack);
+}
+#else
+void llvm::runOnNewStack(unsigned StackSize, function_ref<void()> Fn) {
+  llvm::thread Thread(
+      StackSize == 0 ? std::nullopt : std::optional<unsigned>(StackSize), Fn);
+  Thread.join();
+}
+#endif
diff --git a/llvm/unittests/Support/CMakeLists.txt b/llvm/unittests/Support/CMakeLists.txt
index 6c4e7cb689b20..e5bf820fb4d1c 100644
--- a/llvm/unittests/Support/CMakeLists.txt
+++ b/llvm/unittests/Support/CMakeLists.txt
@@ -70,6 +70,7 @@ add_llvm_unittest(SupportTests
   PerThreadBumpPtrAllocatorTest.cpp
   ProcessTest.cpp
   ProgramTest.cpp
+  ProgramStackTest.cpp
   RecyclerTest.cpp
   RegexTest.cpp
   ReverseIterationTest.cpp
diff --git a/llvm/unittests/Support/ProgramStackTest.cpp b/llvm/unittests/Support/ProgramStackTest.cpp
new file mode 100644
index 0000000000000..1b4a071739139
--- /dev/null
+++ b/llvm/unittests/Support/ProgramStackTest.cpp
@@ -0,0 +1,29 @@
+//===- unittest/Support/ProgramStackTest.cpp ------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/Support/ProgramStack.h"
+#include "llvm/Support/Process.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+
+static uintptr_t func(int &A) {
+  A = 7;
+  return getStackPointer();
+}
+
+TEST(ProgramStackTest, runOnNewStack) {
+  int A = 0;
+  uintptr_t Stack = runOnNewStack(0, function_ref<uintptr_t(int &)>(func), A);
+  EXPECT_EQ(A, 7);
+  intptr_t StackDiff = (intptr_t)llvm::getStackPointer() - (intptr_t)Stack;
+  size_t StackDistance = (size_t)std::abs(StackDiff);
+  // Page size is used as it's large enough to guarantee were not on the same
+  // stack but not too large to cause spurious failures.
+  EXPECT_GT(StackDistance, llvm::sys::Process::getPageSizeEstimate());
+}

Copy link

github-actions bot commented Mar 26, 2025

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- llvm/include/llvm/Support/ProgramStack.h llvm/lib/Support/ProgramStack.cpp llvm/unittests/Support/ProgramStackTest.cpp clang/include/clang/Basic/Stack.h clang/lib/Basic/Stack.cpp clang/lib/Frontend/CompilerInstance.cpp llvm/include/llvm/Support/CrashRecoveryContext.h llvm/lib/Support/CrashRecoveryContext.cpp
View the diff from clang-format here.
diff --git a/clang/lib/Basic/Stack.cpp b/clang/lib/Basic/Stack.cpp
index 8cbb84943..aa3862a95 100644
--- a/clang/lib/Basic/Stack.cpp
+++ b/clang/lib/Basic/Stack.cpp
@@ -49,10 +49,12 @@ void clang::runWithSufficientStackSpaceSlow(llvm::function_ref<void()> Diag,
   llvm::CrashRecoveryContext CRC;
   // Preserve the BottomOfStack in case RunSafelyOnNewStack uses split stacks.
   uintptr_t PrevBottom = BottomOfStack;
-  CRC.RunSafelyOnNewStack([&] {
-    noteBottomOfStack(true);
-    Diag();
-    Fn();
-  }, DesiredStackSize);
+  CRC.RunSafelyOnNewStack(
+      [&] {
+        noteBottomOfStack(true);
+        Diag();
+        Fn();
+      },
+      DesiredStackSize);
   BottomOfStack = PrevBottom;
 }
diff --git a/llvm/include/llvm/Support/ProgramStack.h b/llvm/include/llvm/Support/ProgramStack.h
index 3ce5de1c0..478789d20 100644
--- a/llvm/include/llvm/Support/ProgramStack.h
+++ b/llvm/include/llvm/Support/ProgramStack.h
@@ -18,8 +18,8 @@
 // and other tooling.
 #if defined(__APPLE__) && defined(__aarch64__) &&                              \
     LLVM_HAS_CPP_ATTRIBUTE(gnu::naked) && __has_extension(gnu_asm)
-# define LLVM_HAS_SPLIT_STACKS
-# define LLVM_HAS_SPLIT_STACKS_AARCH64
+#define LLVM_HAS_SPLIT_STACKS
+#define LLVM_HAS_SPLIT_STACKS_AARCH64
 #endif
 
 namespace llvm {
diff --git a/llvm/lib/Support/ProgramStack.cpp b/llvm/lib/Support/ProgramStack.cpp
index 9e5a546b3..5c5f61e54 100644
--- a/llvm/lib/Support/ProgramStack.cpp
+++ b/llvm/lib/Support/ProgramStack.cpp
@@ -11,15 +11,15 @@
 #include "llvm/Support/Compiler.h"
 
 #ifdef LLVM_ON_UNIX
-# include <sys/resource.h> // for getrlimit
+#include <sys/resource.h> // for getrlimit
 #endif
 
 #ifdef _MSC_VER
-# include <intrin.h>  // for _AddressOfReturnAddress
+#include <intrin.h> // for _AddressOfReturnAddress
 #endif
 
 #ifndef LLVM_HAS_SPLIT_STACKS
-# include "llvm/Support/thread.h"
+#include "llvm/Support/thread.h"
 #endif
 
 using namespace llvm;
@@ -58,32 +58,28 @@ namespace {
 #ifdef LLVM_HAS_SPLIT_STACKS_AARCH64
 [[gnu::naked]] void runOnNewStackImpl(void *Stack, void (*Fn)(void *),
                                       void *Ctx) {
-  __asm__ volatile(
-      "mov       x16, sp\n\t"
-      "sub       x0, x0, #0x20\n\t"            // subtract space from stack
-      "stp       xzr, x16, [x0, #0x00]\n\t"    // save old sp
-      "stp       x29, x30, [x0, #0x10]\n\t"    // save fp, lr
-      "mov       sp, x0\n\t"                   // switch to new stack
-      "add       x29, x0, #0x10\n\t"           // switch to new frame
-      ".cfi_def_cfa w29, 16\n\t"
-      ".cfi_offset w30, -8\n\t"                // lr
-      ".cfi_offset w29, -16\n\t"               // fp
+  __asm__ volatile("mov       x16, sp\n\t"
+                   "sub       x0, x0, #0x20\n\t" // subtract space from stack
+                   "stp       xzr, x16, [x0, #0x00]\n\t" // save old sp
+                   "stp       x29, x30, [x0, #0x10]\n\t" // save fp, lr
+                   "mov       sp, x0\n\t"                // switch to new stack
+                   "add       x29, x0, #0x10\n\t"        // switch to new frame
+                   ".cfi_def_cfa w29, 16\n\t"
+                   ".cfi_offset w30, -8\n\t"  // lr
+                   ".cfi_offset w29, -16\n\t" // fp
 
-      "mov       x0, x2\n\t"                   // Ctx is the only argument
-      "blr       x1\n\t"                       // call Fn
+                   "mov       x0, x2\n\t" // Ctx is the only argument
+                   "blr       x1\n\t"     // call Fn
 
-      "ldp       x29, x30, [sp, #0x10]\n\t"    // restore fp, lr
-      "ldp       xzr, x16, [sp, #0x00]\n\t"    // load old sp
-      "mov       sp, x16\n\t"
-      "ret"
-  );
+                   "ldp       x29, x30, [sp, #0x10]\n\t" // restore fp, lr
+                   "ldp       xzr, x16, [sp, #0x00]\n\t" // load old sp
+                   "mov       sp, x16\n\t"
+                   "ret");
 }
 #endif
 
 #ifdef LLVM_HAS_SPLIT_STACKS
-void callback(void *Ctx) {
-  (*reinterpret_cast<function_ref<void()> *>(Ctx))();
-}
+void callback(void *Ctx) { (*reinterpret_cast<function_ref<void()> *>(Ctx))(); }
 #endif
 } // namespace
 
diff --git a/llvm/unittests/Support/ProgramStackTest.cpp b/llvm/unittests/Support/ProgramStackTest.cpp
index 31dfb3b88..f0fa47685 100644
--- a/llvm/unittests/Support/ProgramStackTest.cpp
+++ b/llvm/unittests/Support/ProgramStackTest.cpp
@@ -17,9 +17,7 @@ static uintptr_t func(int &A) {
   return getStackPointer();
 }
 
-static void func2(int &A) {
-  A = 5;
-}
+static void func2(int &A) { A = 5; }
 
 TEST(ProgramStackTest, runOnNewStack) {
   int A = 0;

Copy link
Collaborator

@rnk rnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If split stacks are negatively impacting profiling, debugging, or other compiler development tasks, I have to ask, have we considered optimizing clang stack usage?

There are multiple issues:

  • Clang is a recursive descent parser. This isn't going to change, it just means we can't ignore stack usage.
  • We use lots of needlessly nested "small" data structures on the stack, which means are stack frames are large
  • Anecdotally I am told that LLVM is not great at stack coloring

This is not a blocking concern, but we should seriously consider doing some builds with -Wframe-larger-than or -Wstack-usage in Sema and Parser. We'd all be happier for it.

I had some comments, but overall this seems reasonable.

#elif defined(_MSC_VER)
return (uintptr_t)_AddressOfReturnAddress();
#else
char CharOnStack = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This #else case breaks down in situations where the compiler moves all the user data out to the heap, like with Seperate Data And Control Stacks (SCADS) or ASan use-after-return detection mode. I think we probably don't care, since those will be handled above.

I guess I don't have any actionable suggestions, other than to make the character variable itself volatile. It seems to me like it would be semantics-preserving for a compiler to promote CharOnStack into a global constant 0, for example, since we never write through the pointer that we store into a volatile local.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part was moved from Stack.cpp in Clang. Making CharOnStack volatile seems fine though.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I noticed, but I can't unsee the code from the review. :) Adding volatile seems like a reasonable improvement.

The comments also refer to toolchains we no longer support, but that's not very important.

getrlimit(RLIMIT_STACK, &RL);
return RL.rlim_cur;
#else
// 8MiB seems good.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add more commentary that this value was chosen for Clang, which uses deep recursive stacks to parse C++.

#include "llvm/Support/Compiler.h"

#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include one of those // for getrlimit comments? I know they go stale quickly, but I find them helpful. I never know what system headers have what.

@@ -52,6 +56,7 @@ else()
check_include_file(mach/mach.h HAVE_MACH_MACH_H)
check_include_file(malloc/malloc.h HAVE_MALLOC_MALLOC_H)
check_include_file(pthread.h HAVE_PTHREAD_H)
check_include_file(sys/resource.h HAVE_SYS_RESOURCE_H)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this? We already unconditionally include sys/resource.h from llvm/Support/Unix/Program.inc. IMO it would be better to do #ifndef _WIN32 than the config check, which slows down configuration and complicates the build system, and has to be ported over to downstream build systems like gn and Bazel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find good info on if sys/resource.h is present everywhere we care about, but if we already use it on unix systems then I'm fine removing the config checks.

Copy link
Collaborator

@shafik shafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have a release note.

@AaronBallman
Copy link
Collaborator

If split stacks are negatively impacting profiling, debugging, or other compiler development tasks, I have to ask, have we considered optimizing clang stack usage?

Strong +1 to this.

Apple platforms and tools are known to support this, so this only enables it there for now.

I'm a bit concerned about this changing behavior only for Apple platforms; that's a different folks doing triage really need to understand. Doesn't Linux also support this functionality, so we'd at least get the coverage on more than one platform? (Linux could be done in a follow-up, but I'm mostly worried we'll only ever implement this for Apple at which point I question whether the extra complexity is something the community should maintain or not.)

@cor3ntin
Copy link
Contributor

If split stacks are negatively impacting profiling, debugging, or other compiler development tasks, I have to ask, have we considered optimizing clang stack usage?

Strong +1 to this.

I removed a few uses of ParsedAttributes recently, it helped #132021 (comment) - I'm sure there is a lot more room for improvement

I wish we had some way to profile whether our SmallVectors and other SSO optimizations are reasonably dimensioned.
We also store references to Sema in a ton of places where, realistically, Sema might as well be a singleton. I wonder if we do that enough to have a measurable impact on stack size.

But anyway, we still need a way to grow the stack :)

@Bigcheese
Copy link
Contributor Author

If split stacks are negatively impacting profiling, debugging, or other compiler development tasks, I have to ask, have we considered optimizing clang stack usage?

The issue is we will always have this problem with implicitly built modules. It's naturally recursive as we need a totally separate compiler instance.

I think it would be good to reduce stack usage, and there are likely some easy wins here, but I don't know if it's worth significantly changing the code to remove recursion and the need for this entirely. It's a pretty natural way to handle the recursive parts of C++.

I'm a bit concerned about this changing behavior only for Apple platforms; that's a different folks doing triage really need to understand.

I don't think it's really that big of a difference. It just changes what stack traces look like, and they will contain runOnNewStack where the stack split occurs.

Doesn't Linux also support this functionality, so we'd at least get the coverage on more than one platform? (Linux could be done in a follow-up, but I'm mostly worried we'll only ever implement this for Apple at which point I question whether the extra complexity is something the community should maintain or not.)

Linux does support running code like this, but Linux also means hundreds of distros. There is likely a combination of unwinder and debugger that support this, but I wouldn't turn it on by default unless that set is in very common use. I'm fine with adding a CMake flag that enables this on at least Linux AArch64. It will always run correctly, just not all tools will handle the back trace. Same thing for Windows, although there I have no information on if the MS tools support it. I believe this is also easy to do on x86-64, but a lot harder on 32bit x86.

@Bigcheese Bigcheese force-pushed the dev/runOnNewStack branch from bfd3672 to cc25199 Compare April 4, 2025 00:16
@Bigcheese Bigcheese requested a review from rnk April 4, 2025 00:17
Copy link
Collaborator

@rnk rnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The premerge tests failed on a modules crash recovery test case on other platforms, and those seem like true positives that need to be fixed.

Overall, I think the main risk with this approach is that it will break in-process, FP-based stack unwinders that validate that the target FP is within the thread's stack limits. Those seem like reasonable assumptions to me, since there's no good way to efficiently determine if an FP value is a legitimate stack address other than to compare against the bounds of the thread stack. That's what gives me caution and makes me want to let this be an Apple-only thing.

…o get more stack space

Clang spawns a new thread to avoid running out of stack space. This
can make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large
or backwards stack offsets that occur. Apple platforms and tools are
known to support this, so this only enables it there for now.
@Bigcheese Bigcheese requested a review from rnk April 15, 2025 02:58
Copy link
Collaborator

@rnk rnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good.

@Bigcheese Bigcheese merged commit d0c973a into llvm:main Apr 15, 2025
6 of 10 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-rel-x86-64 running on ml-opt-rel-x86-64-b2 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
3.763 [97/26/632] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV1Tests.cpp.o
3.777 [96/26/633] Linking CXX executable unittests/Testing/Support/TestingSupportTests
3.797 [95/26/634] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV2Tests.cpp.o
3.810 [94/26/635] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV3Tests.cpp.o
3.842 [93/26/636] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV4Tests.cpp.o
3.864 [92/26/637] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/TextStubV5Tests.cpp.o
3.898 [91/26/638] Building CXX object unittests/TextAPI/CMakeFiles/TextAPITests.dir/RecordTests.cpp.o
3.929 [90/26/639] Building CXX object unittests/Transforms/Instrumentation/CMakeFiles/InstrumentationTests.dir/MemProfUseTest.cpp.o
3.986 [89/26/640] Building CXX object unittests/Transforms/Coroutines/CMakeFiles/CoroTests.dir/ExtraRematTest.cpp.o
4.035 [88/26/641] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/ml-opt-rel-x86-64-b1/build/unittests/Support -I/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/Support -I/var/lib/buildbot/.local/lib/python3.7/site-packages/tensorflow/include -I/b/ml-opt-rel-x86-64-b1/build/include -I/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/include -I/b/ml-opt-rel-x86-64-b1/llvm-project/third-party/unittest/googletest/include -I/b/ml-opt-rel-x86-64-b1/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |                                                       ^
In file included from /b/ml-opt-rel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/b/ml-opt-rel-x86-64-b1/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
4.055 [88/25/642] Linking CXX executable unittests/Target/WebAssembly/WebAssemblyTests
4.064 [88/24/643] Linking CXX executable unittests/MC/AMDGPU/AMDGPUMCTests
4.077 [88/23/644] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
4.143 [88/22/645] Linking CXX executable unittests/Target/VE/VETests
4.147 [88/21/646] Linking CXX executable unittests/Target/LoongArch/LoongArchTests
4.184 [88/20/647] Linking CXX executable unittests/TextAPI/TextAPITests
4.222 [88/19/648] Linking CXX executable unittests/Target/AArch64/AArch64Tests
4.223 [88/18/649] Linking CXX executable unittests/Analysis/AnalysisTests
4.283 [88/17/650] Linking CXX executable unittests/Target/SPIRV/SPIRVTests
4.285 [88/16/651] Linking CXX executable unittests/IR/IRTests
4.323 [88/15/652] Linking CXX executable unittests/Target/RISCV/RISCVTests
4.384 [88/14/653] Linking CXX executable unittests/Target/ARM/ARMTests
4.634 [88/13/654] Linking CXX executable unittests/Passes/Plugins/PluginsTests
4.805 [88/12/655] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
4.870 [88/11/656] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
5.327 [88/10/657] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
5.370 [88/9/658] Linking CXX executable unittests/Target/X86/X86Tests
5.466 [88/8/659] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
6.231 [88/7/660] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
6.336 [88/6/661] Linking CXX executable unittests/CodeGen/CodeGenTests
6.357 [88/5/662] Linking CXX executable unittests/MIR/MIRTests
6.488 [88/4/663] Linking CXX executable unittests/MI/MITests
6.550 [88/3/664] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests
6.691 [88/2/665] Linking CXX executable unittests/DebugInfo/LogicalView/DebugInfoLogicalViewTests
7.124 [88/1/666] Linking CXX executable unittests/Target/TargetMachineCTests
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-dev-x86-64 running on ml-opt-dev-x86-64-b2 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
3.076 [116/26/614] Linking CXX executable unittests/Frontend/LLVMFrontendTests
3.130 [115/26/615] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/Host.cpp.o
3.189 [114/26/616] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/RISCVISAInfoTest.cpp.o
3.224 [113/26/617] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/RISCVTargetParserTest.cpp.o
4.356 [112/26/618] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
4.415 [111/26/619] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/TargetParserTest.cpp.o
4.437 [110/26/620] Linking CXX executable unittests/Target/LoongArch/LoongArchTests
4.451 [109/26/621] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/TripleTest.cpp.o
4.458 [108/26/622] Building CXX object unittests/Telemetry/CMakeFiles/TelemetryTests.dir/TelemetryTest.cpp.o
4.483 [107/26/623] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/ml-opt-dev-x86-64-b1/build/unittests/Support -I/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/unittests/Support -I/b/ml-opt-dev-x86-64-b1/build/include -I/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/include -I/b/ml-opt-dev-x86-64-b1/llvm-project/third-party/unittest/googletest/include -I/b/ml-opt-dev-x86-64-b1/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |                                                       ^
In file included from /b/ml-opt-dev-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/b/ml-opt-dev-x86-64-b1/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
4.613 [107/25/624] Linking CXX executable unittests/Telemetry/TelemetryTests
4.661 [107/24/625] Linking CXX executable unittests/Target/VE/VETests
4.714 [107/23/626] Linking CXX executable unittests/TargetParser/TargetParserTests
4.805 [107/22/627] Linking CXX executable unittests/MC/AMDGPU/AMDGPUMCTests
4.844 [107/21/628] Linking CXX executable unittests/Target/ARM/ARMTests
4.857 [107/20/629] Linking CXX executable unittests/IR/IRTests
4.863 [107/19/630] Linking CXX executable unittests/Target/PowerPC/PowerPCTests
4.869 [107/18/631] Linking CXX executable unittests/Target/WebAssembly/WebAssemblyTests
4.869 [107/17/632] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
4.872 [107/16/633] Linking CXX executable unittests/Target/RISCV/RISCVTests
5.035 [107/15/634] Linking CXX executable unittests/Target/AArch64/AArch64Tests
5.036 [107/14/635] Linking CXX executable unittests/Target/SPIRV/SPIRVTests
5.190 [107/13/636] Linking CXX executable unittests/Analysis/AnalysisTests
5.263 [107/12/637] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
5.322 [107/11/638] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
5.367 [107/10/639] Linking CXX executable unittests/Passes/Plugins/PluginsTests
5.988 [107/9/640] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
6.500 [107/8/641] Linking CXX executable unittests/Target/X86/X86Tests
7.168 [107/7/642] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
7.185 [107/6/643] Linking CXX executable unittests/CodeGen/CodeGenTests
7.288 [107/5/644] Linking CXX executable unittests/MIR/MIRTests
7.395 [107/4/645] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests
7.497 [107/3/646] Linking CXX executable unittests/DebugInfo/LogicalView/DebugInfoLogicalViewTests
7.627 [107/2/647] Linking CXX executable unittests/MI/MITests
7.754 [107/1/648] Linking CXX executable unittests/Target/TargetMachineCTests
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-sie-ubuntu-fast running on sie-linux-worker while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
10.743 [2/18/1043] Linking CXX executable tools/clang/unittests/Tooling/ToolingTests
10.804 [2/17/1044] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
11.016 [2/16/1045] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
11.019 [2/15/1046] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
11.019 [2/14/1047] Linking CXX executable unittests/Passes/Plugins/PluginsTests
11.019 [2/13/1048] Linking CXX executable unittests/Target/TargetMachineCTests
11.019 [2/12/1049] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
11.021 [2/11/1050] Linking CXX executable tools/clang/unittests/CodeGen/ClangCodeGenTests
11.171 [2/10/1051] Linking CXX executable unittests/Transforms/Utils/UtilsTests
11.190 [2/9/1052] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/unittests/Support -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
11.306 [2/8/1053] Linking CXX executable unittests/Target/X86/X86Tests
11.387 [2/7/1054] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
11.392 [2/6/1055] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
11.448 [2/5/1056] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
11.630 [2/4/1057] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
11.729 [2/3/1058] Linking CXX executable tools/clang/unittests/Frontend/FrontendTests
12.113 [2/2/1059] Linking CXX executable tools/clang/unittests/Interpreter/ExceptionTests/ClangReplInterpreterExceptionTests
12.904 [2/1/1060] Linking CXX executable tools/clang/unittests/Interpreter/ClangReplInterpreterTests
ninja: build stopped: subcommand failed.

@Bigcheese
Copy link
Contributor Author

I'll have a fix in a sec.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-sles-build-only running on rocm-worker-hw-04-sles while building clang,llvm at step 9 "Add check check-llvm".

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

Here is the relevant piece of the build log for the reference
Step 9 (Add check check-llvm) failure: test (failure)
...
[665/701] Building CXX object unittests/tools/llvm-mca/CMakeFiles/LLVMMCATests.dir/__/__/__/tools/llvm-mca/Views/SummaryView.cpp.o
[666/701] Linking CXX executable unittests/Frontend/LLVMFrontendTests
[667/701] Building CXX object unittests/tools/llvm-mca/CMakeFiles/LLVMMCATests.dir/X86/TestIncrementalMCA.cpp.o
[668/701] Building CXX object unittests/tools/llvm-mca/CMakeFiles/LLVMMCATests.dir/X86/X86TestBase.cpp.o
[669/701] Linking CXX executable unittests/tools/llvm-profgen/LLVMProfgenTests
[670/701] Linking CXX executable unittests/tools/llvm-profdata/LLVMProfdataTests
[671/701] Linking CXX executable unittests/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerTests
[672/701] Linking CXX executable unittests/Transforms/Vectorize/VectorizeTests
[673/701] Linking CXX executable unittests/Transforms/IPO/IPOTests
[674/701] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Iunittests/Support -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/unittests/Support -Iinclude -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/third-party/unittest/googletest/include -I/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++1z -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   runOnNewStack(0, function_ref<void(int &)>(func2), A);
                                                       ^
In file included from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp:9:0:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]
 R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
   ^~~~~~~~~~~~~
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]
 void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      ^~~~~~~~~~~~~
[675/701] Linking CXX executable unittests/tools/llvm-cfi-verify/CFIVerifyTests
[676/701] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/ExecMayBeModifiedBeforeAnyUse.cpp.o
In file included from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/CodeGen/MachineScheduler.h:87:0,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/Passes/CodeGenPassBuilder.h:61,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.h:21,
                 from /home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/unittests/Target/AMDGPU/ExecMayBeModifiedBeforeAnyUse.cpp:9:
/home/botworker/bbot/builds/openmp-offload-sles-build/llvm.src/llvm/include/llvm/CodeGen/ScheduleDAG.h:308:0: warning: ‘llvm::SUnit::SchedulingPref’ is too small to hold all values of ‘enum llvm::Sched::Preference’
     Sched::Preference SchedulingPref : 4; ///< Scheduling preference.
 
[677/701] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
[678/701] Linking CXX executable unittests/Analysis/AnalysisTests
[679/701] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
[680/701] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
[681/701] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
[682/701] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
[683/701] Linking CXX executable unittests/Transforms/Utils/UtilsTests
[684/701] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
[685/701] Linking CXX executable unittests/DebugInfo/LogicalView/DebugInfoLogicalViewTests
[686/701] Linking CXX executable unittests/MC/AMDGPU/AMDGPUMCTests
[687/701] Linking CXX executable unittests/IR/IRTests
[688/701] Linking CXX executable unittests/MIR/MIRTests
[689/701] Linking CXX executable unittests/Target/X86/X86Tests
[690/701] Linking CXX executable unittests/Passes/Plugins/PluginsTests
[691/701] Linking CXX executable unittests/MI/MITests
[692/701] Linking CXX executable unittests/CodeGen/CodeGenTests
[693/701] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests

@Bigcheese
Copy link
Contributor Author

Should be fixed in 429a84f. I'm not sure that's actually ambiguous though.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder openmp-offload-amdgpu-runtime-2 running on rocm-worker-hw-02 while building clang,llvm at step 8 "Add check check-llvm".

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

Here is the relevant piece of the build log for the reference
Step 8 (Add check check-llvm) failure: test (failure)
...
[689/701] Linking CXX executable unittests/Frontend/LLVMFrontendTests
[690/701] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
[691/701] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
[692/701] Linking CXX executable unittests/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerTests
[693/701] Linking CXX executable unittests/Transforms/Utils/UtilsTests
[694/701] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
[695/701] Linking CXX executable unittests/tools/llvm-exegesis/LLVMExegesisTests
[696/701] Linking CXX executable unittests/ADT/ADTTests
[697/701] Linking CXX executable unittests/IR/IRTests
[698/701] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/unittests/Support -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.build/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/third-party/unittest/googletest/include -I/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/botworker/builds/openmp-offload-amdgpu-runtime-2/llvm.src/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
[699/701] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu running on sie-linux-worker3 while building clang,llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
19.874 [6/3/787] Linking CXX shared library /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/lib/clang/21/lib/x86_64-unknown-linux-gnu/libclang_rt.tsan.so
22.425 [6/2/788] Building CXX object compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic.x86_64.dir/asan_interceptors.cpp.o
22.653 [6/1/789] Building CXX object compiler-rt/lib/asan/CMakeFiles/RTAsan.x86_64.dir/asan_interceptors.cpp.o
22.682 [4/2/790] Linking CXX static library compiler-rt/lib/asan/tests/libRTAsanTest.x86_64.a
22.683 [4/1/791] Linking CXX static library /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/lib/clang/21/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.a
22.771 [2/2/792] Generating version list for clang_rt.asan-dynamic-x86_64
22.773 [1/2/793] Generating exported symbols for clang_rt.asan-x86_64
22.798 [1/1/794] Building CXX object compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic_version_script_dummy.x86_64.dir/dummy.cpp.o
22.867 [0/1/795] Linking CXX shared library /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/lib/clang/21/lib/x86_64-unknown-linux-gnu/libclang_rt.asan.so
381.728 [222/34/6918] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
/opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/unittests/Support -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/unittests/Support -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |                                                       ^
In file included from /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
399.092 [222/3/6949] Building CXX object unittests/Frontend/CMakeFiles/LLVMFrontendTests.dir/OpenMPIRBuilderTest.cpp.o
408.595 [222/1/6951] Building CXX object unittests/Frontend/CMakeFiles/LLVMFrontendTests.dir/OpenMPDecompositionTest.cpp.o
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder ppc64le-lld-multistage-test running on ppc64le-lld-multistage-test while building clang,llvm at step 6 "build-stage1-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 6 (build-stage1-unified-tree) failure: build (failure)
...
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘std::vector<llvm::InstrProfValueSiteRecord>& llvm::InstrProfRecord::getOrCreateValueSitesForKind(uint32_t)’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:977:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
146.961 [3659/752/2141] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ManagedStatic.cpp.o
146.976 [3659/751/2142] Building CXX object utils/TableGen/Common/CMakeFiles/obj.LLVMTableGenCommon.dir/CodeGenDAGPatterns.cpp.o
146.985 [3659/750/2143] Building CXX object lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachineSSAContext.cpp.o
146.987 [3659/749/2144] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/lib64/ccache/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/unittests/Support -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Support -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/build/stage1/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googletest/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   runOnNewStack(0, function_ref<void(int &)>(func2), A);
                                                       ^
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
 R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
   ^~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
 void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      ^~~~~~~~~~~~~
146.990 [3659/748/2145] Building CXX object lib/ProfileData/Coverage/CMakeFiles/LLVMCoverage.dir/CoverageMappingWriter.cpp.o
In file included from /usr/include/c++/8/cassert:44,
                 from /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:39,
                 from /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h:27,
                 from /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/Coverage/CoverageMappingWriter.h:19,
                 from /home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/lib/ProfileData/Coverage/CoverageMappingWriter.cpp:14:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘llvm::ArrayRef<llvm::InstrProfValueSiteRecord> llvm::InstrProfRecord::getValueSitesForKind(uint32_t) const’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:968:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h: In member function ‘std::vector<llvm::InstrProfValueSiteRecord>& llvm::InstrProfRecord::getOrCreateValueSitesForKind(uint32_t)’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-lld-multistage-test/ppc64le-lld-multistage-test/llvm-project/llvm/include/llvm/ProfileData/InstrProf.h:977:23: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
     assert(IPVK_First <= ValueKind && ValueKind <= IPVK_Last &&
            ~~~~~~~~~~~^~~~~~~~~~~~
147.050 [3659/747/2146] Building CXX object lib/IR/CMakeFiles/LLVMCore.dir/Function.cpp.o
147.059 [3659/746/2147] Linking CXX static library lib/libLLVMTargetParser.a
147.065 [3659/745/2148] Building CXX object lib/Linker/CMakeFiles/LLVMLinker.dir/LinkModules.cpp.o
147.072 [3659/744/2149] Building CXX object lib/DebugInfo/Symbolize/CMakeFiles/LLVMSymbolize.dir/SymbolizableObjectFile.cpp.o
147.082 [3659/743/2150] Building CXX object lib/DebugInfo/DWARF/CMakeFiles/LLVMDebugInfoDWARF.dir/DWARFDebugLine.cpp.o
147.094 [3659/742/2151] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DJBTest.cpp.o
147.118 [3659/741/2152] Building CXX object unittests/Remarks/CMakeFiles/RemarksTests.dir/RemarksStrTabParsingTest.cpp.o
147.123 [3659/740/2153] Building CXX object lib/MC/CMakeFiles/LLVMMC.dir/WinCOFFObjectWriter.cpp.o
147.153 [3659/739/2154] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DebugTest.cpp.o
147.162 [3659/738/2155] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ToolOutputFileTest.cpp.o
147.170 [3659/737/2156] Building CXX object lib/Analysis/CMakeFiles/LLVMAnalysis.dir/LoopUnrollAnalyzer.cpp.o
147.173 [3659/736/2157] Building CXX object lib/CGData/CMakeFiles/LLVMCGData.dir/StableFunctionMap.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder ml-opt-devrel-x86-64 running on ml-opt-devrel-x86-64-b1 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
3.077 [108/26/622] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/TargetParserTest.cpp.o
3.118 [107/26/623] Building CXX object unittests/TargetParser/CMakeFiles/TargetParserTests.dir/TripleTest.cpp.o
3.517 [106/26/624] Linking CXX executable unittests/TargetParser/TargetParserTests
3.560 [105/26/625] Building CXX object unittests/Telemetry/CMakeFiles/TelemetryTests.dir/TelemetryTest.cpp.o
3.866 [104/26/626] Linking CXX executable unittests/Telemetry/TelemetryTests
3.905 [103/26/627] Building CXX object unittests/Testing/ADT/CMakeFiles/TestingADTTests.dir/StringMapEntryTest.cpp.o
3.944 [102/26/628] Building CXX object unittests/Testing/ADT/CMakeFiles/TestingADTTests.dir/StringMapTest.cpp.o
4.190 [101/26/629] Linking CXX executable unittests/Testing/ADT/TestingADTTests
4.247 [100/26/630] Building CXX object unittests/Testing/Annotations/CMakeFiles/TestingAnnotationTests.dir/AnnotationsTest.cpp.o
4.303 [99/26/631] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/ml-opt-devrel-x86-64-b1/build/unittests/Support -I/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/unittests/Support -I/var/lib/buildbot/.local/lib/python3.7/site-packages/tensorflow/include -I/b/ml-opt-devrel-x86-64-b1/build/include -I/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/include -I/b/ml-opt-devrel-x86-64-b1/llvm-project/third-party/unittest/googletest/include -I/b/ml-opt-devrel-x86-64-b1/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |                                                       ^
In file included from /b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/b/ml-opt-devrel-x86-64-b1/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
4.398 [99/25/632] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
4.441 [99/24/633] Linking CXX executable unittests/Testing/Annotations/TestingAnnotationTests
4.561 [99/23/634] Linking CXX executable unittests/MC/AMDGPU/AMDGPUMCTests
4.694 [99/22/635] Linking CXX executable unittests/Target/LoongArch/LoongArchTests
4.718 [99/21/636] Linking CXX executable unittests/Target/VE/VETests
4.758 [99/20/637] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
4.769 [99/19/638] Linking CXX executable unittests/Analysis/AnalysisTests
4.775 [99/18/639] Linking CXX executable unittests/Target/WebAssembly/WebAssemblyTests
4.811 [99/17/640] Linking CXX executable unittests/Target/AArch64/AArch64Tests
4.813 [99/16/641] Linking CXX executable unittests/IR/IRTests
4.848 [99/15/642] Linking CXX executable unittests/Target/ARM/ARMTests
4.961 [99/14/643] Linking CXX executable unittests/Target/SPIRV/SPIRVTests
5.173 [99/13/644] Linking CXX executable unittests/Target/RISCV/RISCVTests
5.189 [99/12/645] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
5.236 [99/11/646] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
5.385 [99/10/647] Linking CXX executable unittests/Passes/Plugins/PluginsTests
5.849 [99/9/648] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
6.023 [99/8/649] Linking CXX executable unittests/Target/X86/X86Tests
6.927 [99/7/650] Linking CXX executable unittests/CodeGen/CodeGenTests
6.929 [99/6/651] Linking CXX executable unittests/CodeGen/GlobalISel/GlobalISelTests
7.206 [99/5/652] Linking CXX executable unittests/DebugInfo/DWARF/DebugInfoDWARFTests
7.224 [99/4/653] Linking CXX executable unittests/MIR/MIRTests
7.251 [99/3/654] Linking CXX executable unittests/DebugInfo/LogicalView/DebugInfoLogicalViewTests
7.426 [99/2/655] Linking CXX executable unittests/MI/MITests
7.797 [99/1/656] Linking CXX executable unittests/Target/TargetMachineCTests
ninja: build stopped: subcommand failed.

@Bigcheese
Copy link
Contributor Author

And another fix for !LLVM_ENABLE_THREADS: 4f64c80

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder clang-m68k-linux-cross running on suse-gary-m68k-cross while building clang,llvm at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[888/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferRefTest.cpp.o
[889/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/FileCollectorTest.cpp.o
[890/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LockFileManagerTest.cpp.o
[891/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ModRefTest.cpp.o
[892/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/GlobPatternTest.cpp.o
[893/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ConvertUTFTest.cpp.o
[894/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/OptimizedStructLayoutTest.cpp.o
[895/1167] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/TrackerTest.cpp.o
[896/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/NativeFormatTests.cpp.o
[897/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/unittests/Support -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/unittests/Support -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/stage1/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googletest/include -I/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/third-party/unittest/googlemock/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-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -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 -std=c++17  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/unittests/Support/ProgramStackTest.cpp
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/unittests/Support/ProgramStackTest.cpp:9:
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/var/lib/buildbot/workers/suse-gary-m68k-cross/clang-m68k-linux-cross/llvm/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
[898/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/PerThreadBumpPtrAllocatorTest.cpp.o
[899/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RecyclerTest.cpp.o
[900/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProcessTest.cpp.o
[901/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/KnownBitsTest.cpp.o
[902/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RISCVAttributeParserTest.cpp.o
[903/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReverseIterationTest.cpp.o
[904/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReplaceFileTest.cpp.o
[905/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SHA256.cpp.o
[906/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LEB128Test.cpp.o
[907/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SignalsTest.cpp.o
[908/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SipHashTest.cpp.o
[909/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryTest.cpp.o
[910/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ParallelTest.cpp.o
[911/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RegexTest.cpp.o
[912/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferTest.cpp.o
[913/1167] Building CXX object unittests/ProfileData/CMakeFiles/ProfileDataTests.dir/MemProfTest.cpp.o
[914/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramTest.cpp.o
[915/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ScopedPrinterTest.cpp.o
[916/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/JSONTest.cpp.o
[917/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/HashBuilderTest.cpp.o
[918/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/FormatVariadicTest.cpp.o
[919/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SpecialCaseListTest.cpp.o
[920/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SourceMgrTest.cpp.o
[921/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MustacheTest.cpp.o
[922/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MathExtrasTest.cpp.o
[923/1167] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CommandLineTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-ubuntu-fast running on as-builder-4 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
2.571 [2/47/711] Linking CXX executable unittests/ObjCopy/ObjCopyTests
2.605 [2/46/712] Linking CXX executable unittests/Bitcode/BitcodeTests
2.668 [2/45/713] Linking CXX executable unittests/Object/ObjectTests
2.724 [2/44/714] Linking CXX executable unittests/ObjectYAML/ObjectYAMLTests
2.846 [2/43/715] Linking CXX executable unittests/ProfileData/ProfileDataTests
2.871 [2/42/716] Linking CXX executable unittests/SandboxIR/SandboxIRTests
3.014 [2/41/717] Linking CXX executable unittests/FuzzMutate/FuzzMutateTests
3.194 [2/40/718] Linking CXX executable unittests/Transforms/Vectorize/VectorizeTests
3.475 [2/39/719] Linking CXX executable unittests/Transforms/Vectorize/SandboxVectorizer/SandboxVectorizerTests
3.670 [2/38/720] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/unittests/Support -I/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/unittests/Support -I/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/build/include -I/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/include -I/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/worker/as-builder-4/ramdisk/lld-x86_64/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
3.718 [2/37/721] Linking CXX executable unittests/MC/MCTests
3.974 [2/36/722] Linking CXX executable unittests/Transforms/IPO/IPOTests
4.467 [2/35/723] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
5.110 [2/34/724] Linking CXX executable unittests/tools/llvm-cfi-verify/CFIVerifyTests
5.234 [2/33/725] Linking CXX executable unittests/Target/LoongArch/LoongArchTests
5.340 [2/32/726] Linking CXX executable unittests/Target/VE/VETests
5.558 [2/31/727] Linking CXX executable unittests/Target/ARM/ARMTests
5.696 [2/30/728] Linking CXX executable unittests/Target/WebAssembly/WebAssemblyTests
5.753 [2/29/729] Linking CXX executable unittests/Target/PowerPC/PowerPCTests
6.016 [2/28/730] Linking CXX executable unittests/Target/SPIRV/SPIRVTests
6.084 [2/27/731] Linking CXX executable unittests/Target/AArch64/AArch64Tests
6.237 [2/26/732] Linking CXX executable unittests/Target/RISCV/RISCVTests
6.297 [2/25/733] Linking CXX executable unittests/Transforms/Coroutines/CoroTests
6.321 [2/24/734] Linking CXX executable unittests/Frontend/LLVMFrontendTests
6.331 [2/23/735] Linking CXX executable unittests/tools/llvm-mca/LLVMMCATests
6.661 [2/22/736] Linking CXX executable unittests/Transforms/Instrumentation/InstrumentationTests
6.927 [2/21/737] Linking CXX executable unittests/Passes/PassBuilderBindings/PassesBindingsTests
7.074 [2/20/738] Linking CXX executable unittests/Transforms/Utils/UtilsTests
7.248 [2/19/739] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
7.506 [2/18/740] Linking CXX executable unittests/Target/X86/X86Tests
7.665 [2/17/741] Linking CXX executable unittests/MC/AMDGPU/AMDGPUMCTests
7.764 [2/16/742] Linking CXX executable unittests/Transforms/Scalar/ScalarTests
8.023 [2/15/743] Linking CXX executable unittests/IR/IRTests
8.194 [2/14/744] Linking CXX executable unittests/Target/AMDGPU/AMDGPUTests
8.205 [2/13/745] Linking CXX executable unittests/ExecutionEngine/MCJIT/MCJITTests
8.297 [2/12/746] Linking CXX executable unittests/Analysis/AnalysisTests

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-expensive-checks-ubuntu running on as-builder-4 while building clang,llvm at step 6 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
...
7.008 [152/66/542] Building CXX object unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/PALMetadata.cpp.o
7.017 [151/66/543] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferRefTest.cpp.o
7.105 [150/66/544] Building CXX object unittests/Target/RISCV/CMakeFiles/RISCVTests.dir/MCInstrAnalysisTest.cpp.o
7.204 [149/66/545] Building CXX object unittests/Frontend/CMakeFiles/LLVMFrontendTests.dir/OpenMPContextTest.cpp.o
7.227 [148/66/546] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugAbbrevTest.cpp.o
7.228 [147/66/547] Building CXX object unittests/Target/RISCV/CMakeFiles/RISCVTests.dir/RISCVInstrInfoTest.cpp.o
7.273 [146/66/548] Building CXX object unittests/Target/SPIRV/CMakeFiles/SPIRVTests.dir/SPIRVConvergenceRegionAnalysisTests.cpp.o
7.284 [145/66/549] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDebugArangeSetTest.cpp.o
7.327 [144/66/550] Building CXX object unittests/Target/SPIRV/CMakeFiles/SPIRVTests.dir/SPIRVSortBlocksTests.cpp.o
7.334 [143/66/551] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
CCACHE_CPP2=yes CCACHE_HASHDIR=yes /usr/bin/ccache /usr/bin/c++ -DEXPENSIVE_CHECKS -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GLIBCXX_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/unittests/Support -I/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/unittests/Support -I/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/build/include -I/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include -I/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/third-party/unittest/googlemock/include -U_GLIBCXX_DEBUG -Wno-misleading-indentation -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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -g  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -gsplit-dwarf -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/worker/as-builder-4/ramdisk/expensive-checks/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
7.335 [143/65/552] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/OptimizedStructLayoutTest.cpp.o
7.351 [143/64/553] Building CXX object unittests/Target/SPIRV/CMakeFiles/SPIRVTests.dir/SPIRVPartialOrderingVisitorTests.cpp.o
7.353 [143/63/554] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TrailingObjectsTest.cpp.o
7.364 [143/62/555] Building CXX object unittests/Target/SPIRV/CMakeFiles/SPIRVTests.dir/SPIRVAPITest.cpp.o
7.391 [143/61/556] Building CXX object unittests/DebugInfo/PDB/CMakeFiles/DebugInfoPDBTests.dir/StringTableBuilderTest.cpp.o
7.392 [143/60/557] Building CXX object unittests/CGData/CMakeFiles/CGDataTests.dir/StableFunctionMapTest.cpp.o
7.413 [143/59/558] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/SetOperationsTest.cpp.o
7.465 [143/58/559] Building CXX object unittests/Target/PowerPC/CMakeFiles/PowerPCTests.dir/AIXRelocModelTest.cpp.o
7.468 [143/57/560] Linking CXX executable unittests/SandboxIR/SandboxIRTests
7.523 [143/56/561] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CachePruningTest.cpp.o
7.590 [143/55/562] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/ConstantRangeListTest.cpp.o
7.627 [143/54/563] Building CXX object unittests/Analysis/CMakeFiles/AnalysisTests.dir/MLModelRunnerTest.cpp.o
7.677 [143/53/564] Building CXX object unittests/Object/CMakeFiles/ObjectTests.dir/SymbolicFileTest.cpp.o
7.977 [143/52/565] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/CrashRecoveryTest.cpp.o
8.045 [143/51/566] Building CXX object unittests/MC/CMakeFiles/MCTests.dir/DwarfLineTables.cpp.o
8.070 [143/50/567] Building CXX object unittests/DebugInfo/MSF/CMakeFiles/DebugInfoMSFTests.dir/MappedBlockStreamTest.cpp.o
8.279 [143/49/568] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SourceMgrTest.cpp.o
8.388 [143/48/569] Linking CXX executable unittests/Debuginfod/DebuginfodTests
/usr/bin/ld.gold: warning: lib/libLLVMMCParser.a(MCAsmParserExtension.cpp.o): top level DIE is not DW_TAG_compile_unit or DW_TAG_type_unit
/usr/bin/ld.gold: warning: lib/libLLVMMC.a(MCSectionWasm.cpp.o): top level DIE is not DW_TAG_compile_unit or DW_TAG_type_unit
8.635 [143/47/570] Linking CXX executable unittests/DebugInfo/GSYM/DebugInfoGSYMTests
/usr/bin/ld.gold: warning: lib/libLLVMDebugInfoGSYM.a(LineTable.cpp.o): top level DIE is not DW_TAG_compile_unit or DW_TAG_type_unit
/usr/bin/ld.gold: warning: lib/libLLVMMCParser.a(MCAsmParserExtension.cpp.o): top level DIE is not DW_TAG_compile_unit or DW_TAG_type_unit
/usr/bin/ld.gold: warning: lib/libLLVMMC.a(MCSectionWasm.cpp.o): top level DIE is not DW_TAG_compile_unit or DW_TAG_type_unit
8.894 [143/46/571] Building CXX object unittests/DebugInfo/DWARF/CMakeFiles/DebugInfoDWARFTests.dir/DWARFDataExtractorTest.cpp.o
8.913 [143/45/572] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LockFileManagerTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-x86_64-gcc-ubuntu-no-asserts running on doug-worker-6 while building clang,llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
-- Performing Test COMPILER_RT_TARGET_HAS_UNAME - Success
-- Performing Test HAS_THREAD_LOCAL
-- Performing Test HAS_THREAD_LOCAL - Success
-- Generated Sanitizer SUPPORTED_TOOLS list on "Linux" is "asan;lsan;hwasan;msan;tsan;ubsan"
-- sanitizer_common tests on "Linux" will run against "asan;lsan;hwasan;msan;tsan;ubsan"
-- check-shadowcallstack does nothing.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/buildbot/buildbot-root/gcc-no-asserts/build/runtimes/runtimes-bins
991.107 [160/8/7006] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
/opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/gcc-no-asserts/build/unittests/Support -I/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/unittests/Support -I/home/buildbot/buildbot-root/gcc-no-asserts/build/include -I/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/include -I/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |                                                       ^
In file included from /home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/buildbot-root/gcc-no-asserts/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
992.143 [160/2/7012] Linking CXX executable unittests/Target/TargetMachineCTests
ninja: build stopped: subcommand failed.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder clang-ppc64le-linux-multistage running on ppc64le-clang-multistage-test while building clang,llvm at step 5 "ninja check 1".

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

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
...
[8/16] Generating exported symbols for clang_rt.asan-powerpc64le
[9/16] Generating exported symbols for clang_rt.msan-powerpc64le
[10/16] Generating version list for clang_rt.asan-dynamic-powerpc64le
[11/16] Generating exported symbols for clang_rt.tsan-powerpc64le
[12/16] Building CXX object compiler-rt/lib/ubsan/CMakeFiles/RTUbsan_dynamic_version_script_dummy.powerpc64le.dir/dummy.cpp.o
[13/16] Building CXX object compiler-rt/lib/asan/CMakeFiles/RTAsan_dynamic_version_script_dummy.powerpc64le.dir/dummy.cpp.o
[14/16] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib/clang/21/lib/powerpc64le-unknown-linux-gnu/libclang_rt.ubsan_standalone.so
[15/16] Generating /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/compile_commands.json
[16/16] Linking CXX shared library /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/lib/clang/21/lib/powerpc64le-unknown-linux-gnu/libclang_rt.asan.so
[643/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
ccache /usr/lib64/ccache/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/unittests/Support -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/unittests/Support -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/stage1/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googletest/include -I/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wno-comment -Wno-misleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -std=c++17  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/unittests/Support/ProgramStackTest.cpp:33:55: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   runOnNewStack(0, function_ref<void(int &)>(func2), A);
                                                       ^
In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
 R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
   ^~~~~~~~~~~~~
/home/buildbots/llvm-external-buildbots/workers/ppc64le-clang-multistage-test/clang-ppc64le-multistage/llvm/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
 void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      ^~~~~~~~~~~~~
[665/1225] Linking CXX executable tools/clang/unittests/ASTMatchers/ASTMatchersTests
[667/1225] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/APSIntTest.cpp.o
[668/1225] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/CombinationGeneratorTest.cpp.o
[669/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/raw_fd_stream_test.cpp.o
[670/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/xxhashTest.cpp.o
[671/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TimerTest.cpp.o
[672/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferRefTest.cpp.o
[673/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RISCVAttributeParserTest.cpp.o
[674/1225] Building CXX object unittests/BinaryFormat/CMakeFiles/BinaryFormatTests.dir/TestFileMagic.cpp.o
[675/1225] Building CXX object unittests/MC/CMakeFiles/MCTests.dir/MCDisassemblerTest.cpp.o
[676/1225] Building CXX object unittests/Frontend/CMakeFiles/LLVMFrontendTests.dir/OpenMPCompositionTest.cpp.o
[677/1225] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/support/ContextTests.cpp.o
[678/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TrailingObjectsTest.cpp.o
[679/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/IndexedAccessorTest.cpp.o
[680/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReverseIterationTest.cpp.o
[681/1225] Building CXX object unittests/Target/CMakeFiles/TargetMachineCTests.dir/TargetMachineOptionsTest.cpp.o
[682/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ErrorOrTest.cpp.o
[683/1225] Building CXX object unittests/MC/CMakeFiles/MCTests.dir/TargetRegistry.cpp.o
[684/1225] Building CXX object unittests/Transforms/Utils/CMakeFiles/UtilsTests.dir/ScalarEvolutionExpanderTest.cpp.o
[685/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BlockFrequencyTest.cpp.o
[686/1225] Building CXX object tools/clang/tools/extra/clangd/unittests/CMakeFiles/ClangdTests.dir/TestFS.cpp.o
[687/1225] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/IntrusiveRefCntPtrTest.cpp.o
[688/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/PerThreadBumpPtrAllocatorTest.cpp.o
[689/1225] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DivisionByConstantTest.cpp.o
[690/1225] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/StringSetTest.cpp.o
[691/1225] Building CXX object unittests/ADT/CMakeFiles/ADTTests.dir/APFixedPointTest.cpp.o

@aeubanks
Copy link
Contributor

we're seeing the following after this patch:

/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Support/ProgramStack.cpp:67:34: error: this directive must appear between .cfi_startproc and .cfi_endproc directives
   67 |       "add       x29, x0, #0x10\n\t"           // switch to new frame
      |                                  ^
<inline asm>:7:2: note: instantiated into assembly here
    7 |         .cfi_def_cfa w29, 16
      |         ^
/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Support/ProgramStack.cpp:68:30: error: this directive must appear between .cfi_startproc and .cfi_endproc directives
   68 |       ".cfi_def_cfa w29, 16\n\t"
      |                              ^
<inline asm>:8:2: note: instantiated into assembly here
    8 |         .cfi_offset w30, -8
      |         ^
/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Support/ProgramStack.cpp:69:29: error: this directive must appear between .cfi_startproc and .cfi_endproc directives
   69 |       ".cfi_offset w30, -8\n\t"                // lr
      |                             ^
<inline asm>:9:2: note: instantiated into assembly here
    9 |         .cfi_offset w29, -16
      |         ^

@mysterymath
Copy link
Contributor

mysterymath commented Apr 15, 2025

we're seeing the following after this patch:

/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Support/ProgramStack.cpp:67:34: error: this directive must appear between .cfi_startproc and .cfi_endproc directives
   67 |       "add       x29, x0, #0x10\n\t"           // switch to new frame
      |                                  ^
<inline asm>:7:2: note: instantiated into assembly here
    7 |         .cfi_def_cfa w29, 16
      |         ^
/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Support/ProgramStack.cpp:68:30: error: this directive must appear between .cfi_startproc and .cfi_endproc directives
   68 |       ".cfi_def_cfa w29, 16\n\t"
      |                              ^
<inline asm>:8:2: note: instantiated into assembly here
    8 |         .cfi_offset w30, -8
      |         ^
/Volumes/Work/s/w/ir/cache/builder/src/third_party/llvm/llvm/lib/Support/ProgramStack.cpp:69:29: error: this directive must appear between .cfi_startproc and .cfi_endproc directives
   69 |       ".cfi_offset w30, -8\n\t"                // lr
      |                             ^
<inline asm>:9:2: note: instantiated into assembly here
    9 |         .cfi_offset w29, -16
      |         ^

+1 on the Fuchsia Clang ARM64 build. Accordingly, I'm issuing a revert.

mysterymath added a commit that referenced this pull request Apr 15, 2025
#135865)

…thread to get more stack space (#133173)"

This change breaks the Clang build on Mac AArch64.

This reverts commit d0c973a. This
reverts commit 429a84f. This reverts
commit 4f64c80.
mysterymath added a commit to mysterymath/llvm-project that referenced this pull request Apr 15, 2025
…thread to get more stack space (llvm#133173)"

This change breaks the Clang build on Mac AArch64.

This reverts commit d0c973a.
This reverts commit 429a84f.
This reverts commit 4f64c80.
@aeubanks
Copy link
Contributor

I'm guessing that a stage2 build of clang would probably repro the issue, perhaps this was tested against older clangs that didn't warn on this.

@Bigcheese
Copy link
Contributor Author

The error has been there for nearly a decade. Also looking at the assembly the .cfi_startproc/.cfi_endproc are present implicitly with naked functions. Could you provide more information about the build configuration? Maybe CFI is disabled?

@Bigcheese
Copy link
Contributor Author

Ah, -fno-asynchronous-unwind-tables -g0.

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 15, 2025

LLVM Buildbot has detected a new failure on builder clang-with-thin-lto-ubuntu running on as-worker-92 while building clang,llvm at step 6 "build-stage1-compiler".

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

Here is the relevant piece of the build log for the reference
Step 6 (build-stage1-compiler) failure: build (failure)
...
934.144 [171/72/6308] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ModRefTest.cpp.o
934.159 [170/72/6309] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferRefTest.cpp.o
934.195 [169/72/6310] Building CXX object unittests/IR/CMakeFiles/IRTests.dir/InstructionsTest.cpp.o
934.242 [168/72/6311] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/FileOutputBufferTest.cpp.o
934.277 [167/72/6312] Linking CXX executable tools/clang/unittests/AST/ASTTests
934.400 [166/72/6313] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/PassTest.cpp.o
934.554 [165/72/6314] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BalancedPartitioningTest.cpp.o
934.753 [164/72/6315] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/OptimizedStructLayoutTest.cpp.o
934.789 [163/72/6316] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RecyclerTest.cpp.o
934.810 [162/72/6317] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/unittests/Support -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/unittests/Support -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/build/stage1/include -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/as-worker-92/clang-with-thin-lto-ubuntu/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
934.852 [162/71/6318] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LineIteratorTest.cpp.o
935.275 [162/70/6319] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MatchersTest.cpp.o
935.336 [162/69/6320] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReverseIterationTest.cpp.o
935.352 [162/68/6321] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/PerThreadBumpPtrAllocatorTest.cpp.o
935.391 [162/67/6322] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SHA256.cpp.o
935.454 [162/66/6323] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProcessTest.cpp.o
935.638 [162/65/6324] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RISCVAttributeParserTest.cpp.o
935.639 [162/64/6325] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/NativeFormatTests.cpp.o
935.741 [162/63/6326] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LockFileManagerTest.cpp.o
935.849 [162/62/6327] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SipHashTest.cpp.o
935.901 [162/61/6328] Building CXX object unittests/ProfileData/CMakeFiles/ProfileDataTests.dir/SampleProfTest.cpp.o
935.998 [162/60/6329] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReplaceFileTest.cpp.o
936.191 [162/59/6330] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/RegionTest.cpp.o
936.338 [162/58/6331] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/UtilsTest.cpp.o
936.342 [162/57/6332] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/GlobPatternTest.cpp.o
936.384 [162/56/6333] Building CXX object unittests/Passes/Plugins/CMakeFiles/PluginsTests.dir/PluginsTest.cpp.o
936.534 [162/55/6334] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SignalsTest.cpp.o
936.562 [162/54/6335] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RegexTest.cpp.o
936.823 [162/53/6336] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TypeNameTest.cpp.o
936.888 [162/52/6337] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DataExtractorTest.cpp.o
937.014 [162/51/6338] Linking CXX executable unittests/ExecutionEngine/Orc/OrcJITTests
937.017 [162/50/6339] Linking CXX executable unittests/CodeGen/CodeGenTests
937.033 [162/49/6340] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SwapByteOrderTest.cpp.o
937.097 [162/48/6341] Building CXX object unittests/Object/CMakeFiles/ObjectTests.dir/ELFObjectFileTest.cpp.o
937.181 [162/47/6342] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/FileCollectorTest.cpp.o
937.200 [162/46/6343] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BinaryStreamTest.cpp.o

@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 16, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building clang,llvm at step 7 "test-build-unified-tree-check-all".

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

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/82/95' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-13168-82-95.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=95 GTEST_SHARD_INDEX=82 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 16, 2025

LLVM Buildbot has detected a new failure on builder clang-with-lto-ubuntu running on as-worker-91 while building clang,llvm at step 6 "build-stage1-compiler".

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

Here is the relevant piece of the build log for the reference
Step 6 (build-stage1-compiler) failure: build (failure)
...
941.283 [172/72/6307] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MD5Test.cpp.o
941.386 [171/72/6308] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/InstructionCostTest.cpp.o
941.545 [170/72/6309] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MemoryBufferRefTest.cpp.o
941.711 [169/72/6310] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ModRefTest.cpp.o
941.898 [168/72/6311] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/BalancedPartitioningTest.cpp.o
942.106 [167/72/6312] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/FileOutputBufferTest.cpp.o
942.430 [166/72/6313] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LineIteratorTest.cpp.o
942.486 [165/72/6314] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/OptimizedStructLayoutTest.cpp.o
942.770 [164/72/6315] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RecyclerTest.cpp.o
942.860 [163/72/6316] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o
FAILED: unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o 
/usr/bin/c++ -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/unittests/Support -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/unittests/Support -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/build/stage1/include -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/third-party/unittest/googletest/include -I/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/third-party/unittest/googlemock/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-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG  -Wno-dangling-else -Wno-variadic-macros -fno-exceptions -funwind-tables -fno-rtti -Wno-suggest-override -std=c++17 -MD -MT unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -MF unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o.d -o unittests/Support/CMakeFiles/SupportTests.dir/ProgramStackTest.cpp.o -c /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp
/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp: In member function ‘virtual void ProgramStackTest_runOnNewStack_Test::TestBody()’:
/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:33:16: error: call of overloaded ‘runOnNewStack(int, llvm::function_ref<void(int&)>, int&)’ is ambiguous
   33 |   runOnNewStack(0, function_ref<void(int &)>(func2), A);
      |   ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/unittests/Support/ProgramStackTest.cpp:9:
/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/Support/ProgramStack.h:48:3: note: candidate: ‘R llvm::runOnNewStack(unsigned int, llvm::function_ref<Ret(Params ...)>, Ts&& ...) [with R = void; Ts = {int&}]’
   48 | R runOnNewStack(unsigned StackSize, function_ref<R(Ts...)> Fn, Ts &&...Args) {
      |   ^~~~~~~~~~~~~
/home/buildbot/as-worker-91/clang-with-lto-ubuntu/llvm-project/llvm/include/llvm/Support/ProgramStack.h:55:6: note: candidate: ‘void llvm::runOnNewStack(unsigned int, llvm::function_ref<void(Ts ...)>, Ts&& ...) [with Ts = {int&}]’
   55 | void runOnNewStack(unsigned StackSize, function_ref<void(Ts...)> Fn,
      |      ^~~~~~~~~~~~~
943.043 [163/71/6317] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/MatchersTest.cpp.o
943.072 [163/70/6318] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/PerThreadBumpPtrAllocatorTest.cpp.o
943.187 [163/69/6319] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/PassTest.cpp.o
943.211 [163/68/6320] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/NativeFormatTests.cpp.o
943.214 [163/67/6321] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/LockFileManagerTest.cpp.o
943.333 [163/66/6322] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReverseIterationTest.cpp.o
943.371 [163/65/6323] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ProcessTest.cpp.o
943.476 [163/64/6324] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SHA256.cpp.o
943.510 [163/63/6325] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RISCVAttributeParserTest.cpp.o
943.629 [163/62/6326] Building CXX object unittests/ProfileData/CMakeFiles/ProfileDataTests.dir/SampleProfTest.cpp.o
943.847 [163/61/6327] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/GlobPatternTest.cpp.o
944.022 [163/60/6328] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ReplaceFileTest.cpp.o
944.127 [163/59/6329] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/RegionTest.cpp.o
944.143 [163/58/6330] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SipHashTest.cpp.o
944.269 [163/57/6331] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/DataExtractorTest.cpp.o
944.306 [163/56/6332] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TimerTest.cpp.o
944.386 [163/55/6333] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/FileCollectorTest.cpp.o
944.660 [163/54/6334] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/RegexTest.cpp.o
944.881 [163/53/6335] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TypeTraitsTest.cpp.o
944.965 [163/52/6336] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SignalsTest.cpp.o
944.999 [163/51/6337] Building CXX object unittests/Passes/Plugins/CMakeFiles/PluginsTests.dir/PluginsTest.cpp.o
945.027 [163/50/6338] Building CXX object unittests/SandboxIR/CMakeFiles/SandboxIRTests.dir/UtilsTest.cpp.o
945.136 [163/49/6339] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TypeNameTest.cpp.o
945.149 [163/48/6340] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/SuffixTreeTest.cpp.o
945.205 [163/47/6341] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/ParallelTest.cpp.o
945.209 [163/46/6342] Building CXX object unittests/Support/CMakeFiles/SupportTests.dir/TimeProfilerTest.cpp.o

var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
…o get more stack space (llvm#133173)

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
var-const pushed a commit to ldionne/llvm-project that referenced this pull request Apr 17, 2025
llvm#135865)

…thread to get more stack space (llvm#133173)"

This change breaks the Clang build on Mac AArch64.

This reverts commit d0c973a. This
reverts commit 429a84f. This reverts
commit 4f64c80.
Bigcheese added a commit that referenced this pull request May 1, 2025
…thread to get more stack space (#136046)

Reland #133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…thread to get more stack space (llvm#136046)

Reland llvm#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…thread to get more stack space (llvm#136046)

Reland llvm#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
IanWood1 pushed a commit to IanWood1/llvm-project that referenced this pull request May 6, 2025
…thread to get more stack space (llvm#136046)

Reland llvm#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 6, 2025
…ning a new thread to get more stack space (#136046)

Reland llvm/llvm-project#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
Bigcheese added a commit to Bigcheese/llvm-project that referenced this pull request May 6, 2025
…thread to get more stack space (llvm#136046)

Reland llvm#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
GeorgeARM pushed a commit to GeorgeARM/llvm-project that referenced this pull request May 7, 2025
…thread to get more stack space (llvm#136046)

Reland llvm#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
Ankur-0429 pushed a commit to Ankur-0429/llvm-project that referenced this pull request May 9, 2025
…thread to get more stack space (llvm#136046)

Reland llvm#133173

Clang spawns a new thread to avoid running out of stack space. This can
make debugging and performance analysis more difficult as how the
threads are connected is difficult to recover.

This patch introduces `runOnNewStack` and applies it in Clang. On
platforms that have good support for it this allocates a new stack and
moves to it using assembly. Doing split stacks like this actually runs
on most platforms, but many debuggers and unwinders reject the large or
backwards stack offsets that occur. Apple platforms and tools are known
to support this, so this only enables it there for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category cmake Build system in general and CMake in particular llvm:support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants