Skip to content

Revert "Reapply "[ORC] Enable JIT support for the compact-unwind frame..." with fixes." #125098

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 1 commit into from
Jan 30, 2025

Conversation

benlangmuir
Copy link
Collaborator

This reverts commit d6524c8. This reverts commit b1bd737.

This was causing bot failures on Darwin

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-incremental/7315/
Clang.Interpreter.simple-exception.cpp
Clang-Unit.Interpreter/ExceptionTests/_/ClangReplInterpreterExceptionTests/0.1
LLVM.ExecutionEngine/OrcLazy.minimal-throw-catch.ll

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/3415/
ORC-x86_64-darwin.TestCases/Darwin/Generic.exceptions.cpp
ORC-x86_64-darwin.TestCases/Darwin/x86-64.lljit-ehframe.cpp

…e..." with fixes."

This reverts commit d6524c8.
This reverts commit b1bd737.

This was causing bot failures on Darwin

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-incremental/7315/
  Clang.Interpreter.simple-exception.cpp
  Clang-Unit.Interpreter/ExceptionTests/_/ClangReplInterpreterExceptionTests/0.1
  LLVM.ExecutionEngine/OrcLazy.minimal-throw-catch.ll

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/3415/
  ORC-x86_64-darwin.TestCases/Darwin/Generic.exceptions.cpp
  ORC-x86_64-darwin.TestCases/Darwin/x86-64.lljit-ehframe.cpp
@llvmbot llvmbot added clang Clang issues not falling into any other category compiler-rt labels Jan 30, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/pr-subscribers-clang

Author: Ben Langmuir (benlangmuir)

Changes

This reverts commit d6524c8. This reverts commit b1bd737.

This was causing bot failures on Darwin

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-cmake-RA-incremental/7315/
Clang.Interpreter.simple-exception.cpp
Clang-Unit.Interpreter/ExceptionTests/_/ClangReplInterpreterExceptionTests/0.1
LLVM.ExecutionEngine/OrcLazy.minimal-throw-catch.ll

https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/3415/
ORC-x86_64-darwin.TestCases/Darwin/Generic.exceptions.cpp
ORC-x86_64-darwin.TestCases/Darwin/x86-64.lljit-ehframe.cpp


Patch is 78.81 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/125098.diff

24 Files Affected:

  • (modified) clang/test/Interpreter/simple-exception.cpp (+2-2)
  • (modified) compiler-rt/lib/orc/macho_platform.cpp (-6)
  • (removed) compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp (-13)
  • (modified) llvm/include/llvm/ExecutionEngine/Orc/Core.h (+2-7)
  • (modified) llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h (-4)
  • (modified) llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h (-9)
  • (removed) llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h (-78)
  • (removed) llvm/include/llvm/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.h (-70)
  • (modified) llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt (-1)
  • (removed) llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.cpp (-103)
  • (removed) llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h (-653)
  • (modified) llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp (+116)
  • (modified) llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h (+11)
  • (modified) llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp (+6-43)
  • (modified) llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp (+8-49)
  • (modified) llvm/lib/ExecutionEngine/Orc/CMakeLists.txt (-1)
  • (modified) llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp (-3)
  • (modified) llvm/lib/ExecutionEngine/Orc/Core.cpp (+13-21)
  • (modified) llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp (-7)
  • (modified) llvm/lib/ExecutionEngine/Orc/LLJIT.cpp (+6-23)
  • (modified) llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp (-14)
  • (modified) llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt (-1)
  • (removed) llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp (-188)
  • (removed) llvm/lib/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.cpp (-238)
diff --git a/clang/test/Interpreter/simple-exception.cpp b/clang/test/Interpreter/simple-exception.cpp
index 651e8d9402f89e..6749acd6e6bd23 100644
--- a/clang/test/Interpreter/simple-exception.cpp
+++ b/clang/test/Interpreter/simple-exception.cpp
@@ -1,7 +1,7 @@
 // clang-format off
 // UNSUPPORTED: system-aix
-// XFAIL for arm, or running on Windows.
-// XFAIL: target=arm-{{.*}}, target=armv{{.*}}, system-windows
+// XFAIL for arm and arm64, or running on Windows.
+// XFAIL: target=arm{{.*}}, system-windows
 // RUN: cat %s | clang-repl | FileCheck %s
 
 // Incompatible with msan. It passes with -O3 but fail -Oz. Interpreter
diff --git a/compiler-rt/lib/orc/macho_platform.cpp b/compiler-rt/lib/orc/macho_platform.cpp
index 4b603fd95e3163..8ca68587aeb363 100644
--- a/compiler-rt/lib/orc/macho_platform.cpp
+++ b/compiler-rt/lib/orc/macho_platform.cpp
@@ -557,12 +557,6 @@ Error MachOPlatformRuntimeState::registerObjectPlatformSections(
     return make_error<StringError>(ErrStream.str());
   }
 
-  ORC_RT_DEBUG({
-    printdbg("  UnwindInfo: %s, UseCallbackStyleUnwindInfo: %s\n",
-             UnwindInfo ? "true" : "false",
-             UseCallbackStyleUnwindInfo ? "true" : "false");
-  });
-
   if (UnwindInfo && UseCallbackStyleUnwindInfo) {
     ORC_RT_DEBUG({
       printdbg("  Registering new-style unwind info for:\n"
diff --git a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp
deleted file mode 100644
index 7e9c40c724aec6..00000000000000
--- a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
-// RUN: %clangxx -c -o %t %s
-// RUN: %llvm_jitlink -slab-allocate=20Mb %t
-//
-// REQUIRES: system-darwin && host-arch-compatible
-
-int main(int argc, char *argv[]) {
-  try {
-    throw 42;
-  } catch (int E) {
-    return 42 - E;
-  }
-  return 1;
-}
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h
index 3eddaf4c9c59ff..db853362f65733 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h
@@ -1204,13 +1204,8 @@ class JITDylib : public ThreadSafeRefCountedBase<JITDylib>,
 
   JITDylib(ExecutionSession &ES, std::string Name);
 
-  struct RemoveTrackerResult {
-    AsynchronousSymbolQuerySet QueriesToFail;
-    std::shared_ptr<SymbolDependenceMap> FailedSymbols;
-    std::vector<std::unique_ptr<MaterializationUnit>> DefunctMUs;
-  };
-
-  RemoveTrackerResult IL_removeTracker(ResourceTracker &RT);
+  std::pair<AsynchronousSymbolQuerySet, std::shared_ptr<SymbolDependenceMap>>
+  IL_removeTracker(ResourceTracker &RT);
 
   void transferTracker(ResourceTracker &DstRT, ResourceTracker &SrcRT);
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
index 86e98e74b7055b..dcf5592f1717c2 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h
@@ -20,7 +20,6 @@
 #include "llvm/ExecutionEngine/Orc/Shared/TargetProcessControlTypes.h"
 #include "llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h"
 #include "llvm/ExecutionEngine/Orc/SymbolStringPool.h"
-#include "llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h"
 #include "llvm/ExecutionEngine/Orc/TaskDispatch.h"
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/MSVCErrorWorkarounds.h"
@@ -508,9 +507,6 @@ class SelfExecutorProcessControl : public ExecutorProcessControl,
                           SymbolLookupCompleteFn F) override;
 
   std::unique_ptr<jitlink::JITLinkMemoryManager> OwnedMemMgr;
-#ifdef __APPLE__
-  std::unique_ptr<UnwindInfoManager> UnwindInfoMgr;
-#endif // __APPLE__
   char GlobalManglingPrefix = 0;
 };
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
index db5ff135a7164c..aed43f6308cbaa 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h
@@ -88,15 +88,6 @@ using SPSRunAsMainSignature = int64_t(shared::SPSExecutorAddr,
 using SPSRunAsVoidFunctionSignature = int32_t(shared::SPSExecutorAddr);
 using SPSRunAsIntFunctionSignature = int32_t(shared::SPSExecutorAddr, int32_t);
 } // end namespace rt
-
-namespace rt_alt {
-extern const char *UnwindInfoManagerInstanceName;
-extern const char *UnwindInfoManagerFindSectionsHelperName;
-extern const char *UnwindInfoManagerEnableWrapperName;
-extern const char *UnwindInfoManagerDisableWrapperName;
-extern const char *UnwindInfoManagerRegisterActionName;
-extern const char *UnwindInfoManagerDeregisterActionName;
-} // end namespace rt_alt
 } // end namespace orc
 } // end namespace llvm
 
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h
deleted file mode 100644
index fc7719f2821222..00000000000000
--- a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h
+++ /dev/null
@@ -1,78 +0,0 @@
-//===--- UnwindInfoManager.h -- Register unwind info sections ---*- 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
-//
-//===----------------------------------------------------------------------===//
-//
-// Utilities for managing eh-frame and compact-unwind registration and lookup
-// through libunwind's find_dynamic_unwind_sections mechanism.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_UNWINDINFOMANAGER_H
-#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_UNWINDINFOMANAGER_H
-
-#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h"
-#include "llvm/ExecutionEngine/Orc/TargetProcess/ExecutorBootstrapService.h"
-#include "llvm/Support/Error.h"
-#include <map>
-#include <mutex>
-
-namespace llvm::orc {
-
-class UnwindInfoManager : public ExecutorBootstrapService {
-public:
-  // This struct's layout should match the unw_dynamic_unwind_sections struct
-  // from libunwind/src/libunwid_ext.h.
-  struct UnwindSections {
-    uintptr_t dso_base;
-    uintptr_t dwarf_section;
-    size_t dwarf_section_length;
-    uintptr_t compact_unwind_section;
-    size_t compact_unwind_section_length;
-  };
-
-  /// If the libunwind find-dynamic-unwind-info callback registration APIs are
-  /// available then this method will return an UnwindInfoManager instance,
-  /// otherwise it will return nullptr.
-  static std::unique_ptr<UnwindInfoManager> TryCreate();
-
-  Error shutdown() override;
-  void addBootstrapSymbols(StringMap<ExecutorAddr> &M) override;
-
-  Error enable(void *FindDynamicUnwindSections);
-  Error disable(void);
-
-  Error registerSections(ArrayRef<orc::ExecutorAddrRange> CodeRanges,
-                         orc::ExecutorAddr DSOBase,
-                         orc::ExecutorAddrRange DWARFEHFrame,
-                         orc::ExecutorAddrRange CompactUnwind);
-
-  Error deregisterSections(ArrayRef<orc::ExecutorAddrRange> CodeRanges);
-
-  int findSections(uintptr_t Addr, UnwindSections *Info);
-
-private:
-  UnwindInfoManager(int (*AddFindDynamicUnwindSections)(void *),
-                    int (*RemoveFindDynamicUnwindSections)(void *))
-      : AddFindDynamicUnwindSections(AddFindDynamicUnwindSections),
-        RemoveFindDynamicUnwindSections(RemoveFindDynamicUnwindSections) {}
-
-  static int findSectionsHelper(UnwindInfoManager *Instance, uintptr_t Addr,
-                                UnwindSections *Info);
-
-  std::mutex M;
-  std::map<uintptr_t, UnwindSections> UWSecs;
-
-  int (*AddFindDynamicUnwindSections)(void *) = nullptr;
-  int (*RemoveFindDynamicUnwindSections)(void *) = nullptr;
-  void *FindDynamicUnwindSections = nullptr;
-
-  static const char *AddFnName, *RemoveFnName;
-};
-
-} // namespace llvm::orc
-
-#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_UNWINDINFOMANAGER_H
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.h b/llvm/include/llvm/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.h
deleted file mode 100644
index eb883a79a93d87..00000000000000
--- a/llvm/include/llvm/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.h
+++ /dev/null
@@ -1,70 +0,0 @@
-//===- UnwindInfoRegistrationPlugin.h -- libunwind registration -*- 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
-//
-//===----------------------------------------------------------------------===//
-//
-// Register eh-frame and compact-unwind sections with libunwind
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_EXECUTIONENGINE_ORC_UNWINDINFOREGISTRATIONPLUGIN_H
-#define LLVM_EXECUTIONENGINE_ORC_UNWINDINFOREGISTRATIONPLUGIN_H
-
-#include "llvm/ExecutionEngine/Orc/LinkGraphLinkingLayer.h"
-
-namespace llvm::orc {
-
-class UnwindInfoRegistrationPlugin : public LinkGraphLinkingLayer::Plugin {
-public:
-  static Expected<std::shared_ptr<UnwindInfoRegistrationPlugin>>
-  Create(IRLayer &IRL, JITDylib &PlatformJD, ExecutorAddr Instance,
-         ExecutorAddr FindHelper, ExecutorAddr Enable, ExecutorAddr Disable,
-         ExecutorAddr Register, ExecutorAddr Deregister);
-
-  static Expected<std::shared_ptr<UnwindInfoRegistrationPlugin>>
-  Create(IRLayer &IRL, JITDylib &PlatformJD);
-
-  ~UnwindInfoRegistrationPlugin();
-
-  void modifyPassConfig(MaterializationResponsibility &MR,
-                        jitlink::LinkGraph &G,
-                        jitlink::PassConfiguration &PassConfig) override;
-
-  Error notifyEmitted(MaterializationResponsibility &MR) override {
-    return Error::success();
-  }
-
-  Error notifyFailed(MaterializationResponsibility &MR) override {
-    return Error::success();
-  }
-
-  Error notifyRemovingResources(JITDylib &JD, ResourceKey K) override {
-    return Error::success();
-  }
-
-  void notifyTransferringResources(JITDylib &JD, ResourceKey DstKey,
-                                   ResourceKey SrcKey) override {}
-
-private:
-  UnwindInfoRegistrationPlugin(ExecutionSession &ES, ExecutorAddr Instance,
-                               ExecutorAddr Disable, ExecutorAddr Register,
-                               ExecutorAddr Deregister)
-      : ES(ES), Instance(Instance), Disable(Disable), Register(Register),
-        Deregister(Deregister) {
-    DSOBaseName = ES.intern("__jitlink$libunwind_dso_base");
-  }
-
-  static Expected<ThreadSafeModule> makeBouncerModule(ExecutionSession &ES);
-  Error addUnwindInfoRegistrationActions(jitlink::LinkGraph &G);
-
-  ExecutionSession &ES;
-  SymbolStringPtr DSOBaseName;
-  ExecutorAddr Instance, Disable, Register, Deregister;
-};
-
-} // namespace llvm::orc
-
-#endif // LLVM_EXECUTIONENGINE_ORC_UNWINDINFOREGISTRATIONPLUGIN_H
diff --git a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
index 65dd0c7468ae1d..e5f5a99c39bc00 100644
--- a/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
+++ b/llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt
@@ -3,7 +3,6 @@ tablegen(LLVM COFFOptions.inc -gen-opt-parser-defs)
 add_public_tablegen_target(JITLinkTableGen)
 
 add_llvm_component_library(LLVMJITLink
-  CompactUnwindSupport.cpp
   DWARFRecordSectionSplitter.cpp
   EHFrameSupport.cpp
   JITLink.cpp
diff --git a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.cpp b/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.cpp
deleted file mode 100644
index 51e3d26479ffdf..00000000000000
--- a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-//=------- CompactUnwindSupport.cpp - Compact Unwind format support -------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-//
-// Compact Unwind support.
-//
-//===----------------------------------------------------------------------===//
-
-#include "CompactUnwindSupport.h"
-
-#include "llvm/ADT/Sequence.h"
-
-#define DEBUG_TYPE "jitlink"
-
-namespace llvm {
-namespace jitlink {
-
-Error splitCompactUnwindBlocks(LinkGraph &G, Section &CompactUnwindSection,
-                               size_t RecordSize) {
-
-  std::vector<Block *> OriginalBlocks(CompactUnwindSection.blocks().begin(),
-                                      CompactUnwindSection.blocks().end());
-  LLVM_DEBUG({
-    dbgs() << "In " << G.getName() << " splitting compact unwind section "
-           << CompactUnwindSection.getName() << " containing "
-           << OriginalBlocks.size() << " initial blocks...\n";
-  });
-
-  while (!OriginalBlocks.empty()) {
-    auto *B = OriginalBlocks.back();
-    OriginalBlocks.pop_back();
-
-    if (B->getSize() == 0) {
-      LLVM_DEBUG({
-        dbgs() << "  Skipping empty block at "
-               << formatv("{0:x16}", B->getAddress()) << "\n";
-      });
-      continue;
-    }
-
-    unsigned NumBlocks = B->getSize() / RecordSize;
-
-    LLVM_DEBUG({
-      dbgs() << "  Splitting block at " << formatv("{0:x16}", B->getAddress())
-             << " into " << NumBlocks << " compact unwind record(s)\n";
-    });
-
-    if (B->getSize() % RecordSize)
-      return make_error<JITLinkError>(
-          "Error splitting compact unwind record in " + G.getName() +
-          ": block at " + formatv("{0:x}", B->getAddress()) + " has size " +
-          formatv("{0:x}", B->getSize()) +
-          " (not a multiple of CU record size of " +
-          formatv("{0:x}", RecordSize) + ")");
-
-    auto Blocks =
-        G.splitBlock(*B, map_range(seq(1U, NumBlocks), [=](Edge::OffsetT Idx) {
-          return Idx * RecordSize;
-        }));
-
-    for (auto *CURec : Blocks) {
-      bool AddedKeepAlive = false;
-
-      for (auto &E : CURec->edges()) {
-        if (E.getOffset() == 0) {
-          LLVM_DEBUG({
-            dbgs() << "    Updating compact unwind record at "
-                   << CURec->getAddress() << " to point to "
-                   << (E.getTarget().hasName() ? *E.getTarget().getName()
-                                               : StringRef())
-                   << " (at " << E.getTarget().getAddress() << ")\n";
-          });
-
-          if (E.getTarget().isExternal())
-            return make_error<JITLinkError>(
-                "Error adding keep-alive edge for compact unwind record at " +
-                formatv("{0:x}", CURec->getAddress()) + ": target " +
-                *E.getTarget().getName() + " is an external symbol");
-          auto &TgtBlock = E.getTarget().getBlock();
-          auto &CURecSym =
-              G.addAnonymousSymbol(*CURec, 0, RecordSize, false, false);
-          TgtBlock.addEdge(Edge::KeepAlive, 0, CURecSym, 0);
-          AddedKeepAlive = true;
-        }
-      }
-
-      if (!AddedKeepAlive)
-        return make_error<JITLinkError>(
-            "Error adding keep-alive edge for compact unwind record at " +
-            formatv("{0:x}", CURec->getAddress()) +
-            ": no outgoing target edge at offset 0");
-    }
-  }
-
-  return Error::success();
-}
-
-} // end namespace jitlink
-} // end namespace llvm
diff --git a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h b/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h
deleted file mode 100644
index dc3ed942aa8ac8..00000000000000
--- a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h
+++ /dev/null
@@ -1,653 +0,0 @@
-//===- CompactUnwindSupportImpl.h - Compact Unwind format impl --*- 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
-//
-//===----------------------------------------------------------------------===//
-//
-// Compact Unwind format support implementation details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LIB_EXECUTIONENGINE_JITLINK_COMPACTUNWINDSUPPORTIMPL_H
-#define LIB_EXECUTIONENGINE_JITLINK_COMPACTUNWINDSUPPORTIMPL_H
-
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ExecutionEngine/JITLink/MachO.h"
-#include "llvm/Support/Debug.h"
-#include "llvm/Support/Endian.h"
-
-#define DEBUG_TYPE "jitlink_cu"
-
-namespace llvm {
-namespace jitlink {
-
-/// Split blocks in an __LD,__compact_unwind section on record boundaries.
-/// When this function returns edges within each record are guaranteed to be
-/// sorted by offset.
-Error splitCompactUnwindBlocks(LinkGraph &G, Section &CompactUnwindSection,
-                               size_t RecordSize);
-
-/// CRTP base for compact unwind traits classes. Automatically provides derived
-/// constants.
-///
-/// FIXME: Passing PtrSize as a template parameter is a hack to work around a
-///        bug in older MSVC compilers (until at least MSVC 15) where constexpr
-///        fields in the CRTP impl class were not visible to the base class.
-///        Once we no longer need to support these compilers the PtrSize
-///        template argument should be removed and PointerSize should be
-///        defined as a member in the CRTP Impl classes.
-template <typename CRTPImpl, size_t PtrSize> struct CompactUnwindTraits {
-  static constexpr size_t PointerSize = PtrSize;
-  static constexpr size_t Size = 3 * PointerSize + 2 * 4;
-  static constexpr size_t FnFieldOffset = 0;
-  static constexpr size_t SizeFieldOffset = FnFieldOffset + PointerSize;
-  static constexpr size_t EncodingFieldOffset = SizeFieldOffset + 4;
-  static constexpr size_t PersonalityFieldOffset = EncodingFieldOffset + 4;
-  static constexpr size_t LSDAFieldOffset =
-      PersonalityFieldOffset + PointerSize;
-
-  static uint32_t readPCRangeSize(ArrayRef<char> RecordContent) {
-    assert(SizeFieldOffset + 4 <= RecordContent.size() &&
-           "Truncated CU record?");
-    return support::endian::read32<CRTPImpl::Endianness>(RecordContent.data() +
-                                                         SizeFieldOffset);
-  }
-
-  static uint32_t readEncoding(ArrayRef<char> RecordContent) {
-    assert(EncodingFieldOffset + 4 <= RecordContent.size() &&
-           "Truncated CU record?");
-    return support::endian::read32<CRTPImpl::Endianness>(RecordContent.data() +
-                                                         EncodingFieldOffset);
-  }
-};
-
-/// Architecture specific implementation of CompactUnwindManager.
-template <typename CURecTraits> class CompactUnwindManager {
-public:
-  CompactUnwindManager(StringRef CompactUnwindSectionName,
-                       StringRef UnwindInfoSectionName,
-                       StringRef EHFrameSectionName)
-      : CompactUnwindSectionName(CompactUnwindSectionName),
-        UnwindInfoSectionName(UnwindInfoSectionName),
-        EHFrameSectionName(EHFrameSectionName) {}
-
-  // Split compact unwind records, add keep-alive edges from functions to
-  // compact unwind records, and from compact unwind records to FDEs where
-  // needed.
-  //
-  // This method must be called *after* __eh_frame has been processed: it
-  // assumes that eh-frame records have been split up and keep-alive edges have
-  // been inserted.
-  Error prepareForPrune(LinkGraph &G) {
-    Section *CUSec = G.findSectionByName(CompactUnwindSectionName);
-    if (!CUSec || CUSec->empty()) {
-      LLVM_DEBUG({
-        dbgs() << "Compact unwind: No compact unwind info for " << G.getName()
-               << "\n";
-      });
-      return Error::success();
-    }
-
-    LLVM_DEBUG({
-      dbgs() << "Compact unwind: preparing " << G.getName() << " for prune\n";
-    });
-
-    Section *EHFrameSec = G.findSectionByName(EHFrameSectionName);
-
-    if (auto Err = splitCompactUnwindBlocks(G, *CUSec, CURecTraits::Size))
-      return Err;
-
-    LLVM_DEBUG({
-      dbgs() << "  Preparing " << CUSec->blocks_size() << " blocks in "
-             << CompactUnwindSectionName << "...
[truncated]

@benlangmuir benlangmuir merged commit b04847b into llvm:main Jan 30, 2025
8 of 10 checks passed
@benlangmuir
Copy link
Collaborator Author

Failure looks unrelated. Merging.

@benlangmuir benlangmuir deleted the revert-orc-compact-unwind branch January 30, 2025 19:27
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jan 30, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-dylib running on linaro-flang-aarch64-dylib while building clang,compiler-rt,llvm at step 5 "build-unified-tree".

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

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
870.521 [978/8/5814] Linking CXX static library lib/libMLIRFuncToSPIRV.a
870.570 [978/7/5815] Linking CXX static library lib/libMLIRIndexToSPIRV.a
870.584 [976/8/5816] Linking CXX static library lib/libMLIRMathToSPIRV.a
870.600 [975/8/5817] Linking CXX static library lib/libMLIRMemRefToSPIRV.a
870.603 [975/7/5818] Linking CXX static library lib/libMLIRUBToSPIRV.a
870.635 [975/6/5819] Linking CXX static library lib/libMLIRArithToSPIRV.a
870.667 [975/5/5820] Linking CXX static library lib/libMLIRVectorToSPIRV.a
870.744 [972/7/5821] Linking CXX static library lib/libMLIRLinalgTransforms.a
870.779 [972/6/5822] Linking CXX static library lib/libMLIRSCFToSPIRV.a
870.836 [972/5/5823] Building CXX object tools/mlir/test/lib/IR/CMakeFiles/MLIRTestIR.dir/TestSymbolUses.cpp.o
FAILED: tools/mlir/test/lib/IR/CMakeFiles/MLIRTestIR.dir/TestSymbolUses.cpp.o 
/usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -DMLIR_INCLUDE_TESTS -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/mlir/test/lib/IR -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/IR -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/mlir/include -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/include -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/include -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/llvm/include -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/IR/../Dialect/Test -I/home/tcwg-buildbot/worker/flang-aarch64-dylib/build/tools/mlir/test/lib/IR/../Dialect/Test -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wundef -Werror=mismatched-tags -O3 -DNDEBUG -std=c++17  -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -MD -MT tools/mlir/test/lib/IR/CMakeFiles/MLIRTestIR.dir/TestSymbolUses.cpp.o -MF tools/mlir/test/lib/IR/CMakeFiles/MLIRTestIR.dir/TestSymbolUses.cpp.o.d -o tools/mlir/test/lib/IR/CMakeFiles/MLIRTestIR.dir/TestSymbolUses.cpp.o -c /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/IR/TestSymbolUses.cpp
In file included from /home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/IR/TestSymbolUses.cpp:9:
/home/tcwg-buildbot/worker/flang-aarch64-dylib/llvm-project/mlir/test/lib/IR/../Dialect/Test/TestOps.h:148:10: fatal error: 'TestOps.h.inc' file not found
  148 | #include "TestOps.h.inc"
      |          ^~~~~~~~~~~~~~~
1 error generated.
870.852 [972/4/5824] Linking CXX static library lib/libMLIRSPIRVTransforms.a
870.876 [972/3/5825] Linking CXX static library lib/libMLIRTensorToSPIRV.a
873.470 [972/2/5826] Building CXX object tools/mlir/tools/mlir-runner/CMakeFiles/mlir-runner.dir/mlir-runner.cpp.o
891.104 [972/1/5827] Building CXX object tools/mlir/lib/ExecutionEngine/CMakeFiles/MLIRExecutionEngineShared.dir/ExecutionEngine.cpp.o
ninja: build stopped: subcommand failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category compiler-rt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants