[llvm-branch-commits] [llvm] [AVR] Backport #118015 and #121498 (PR #125081)
Patryk27 wrote: Not sure what's the next step (can't merge it myself here :-P) - cc @nikic? https://github.com/llvm/llvm-project/pull/125081 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [Mips] Use getSignedConstant() in or combine (PR #126083)
https://github.com/topperc approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/126083 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [libc] release/20.x: [Clang] Fix test after new argument was added (PR #125912)
tstellar wrote: @jhuber6 Does this need an extra patch to fix the build failures? https://github.com/llvm/llvm-project/pull/125912 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [libc] release/20.x: [Clang] Fix test after new argument was added (PR #125912)
jhuber6 wrote: Should just be the two commits, it just unfortunately took the name of the latest one. I would've squashed them if I knew how. https://github.com/llvm/llvm-project/pull/125912 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [benchmark] Get number of CPUs with sysconf() on Linux (#125603) (PR #125669)
nikic wrote: Duplicate of https://github.com/llvm/llvm-project/pull/125624. https://github.com/llvm/llvm-project/pull/125669 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [benchmark] Get number of CPUs with sysconf() on Linux (#125603) (PR #125669)
https://github.com/nikic closed https://github.com/llvm/llvm-project/pull/125669 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [mlir] release/20.x: [mlir][cmake] Fix build race condition in Pass Manager tests (PR #125834)
https://github.com/nikic edited https://github.com/llvm/llvm-project/pull/125834 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [flang] [Flang] Remove FLANG_INCLUDE_RUNTIME (PR #124126)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/124126 >From c515d13f0ad684763e6d76a87a610801482c15f4 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:52:46 +0100 Subject: [PATCH 1/2] [Flang] Remove FLANG_INCLUDE_RUNTIME --- flang/CMakeLists.txt | 25 +- .../modules/AddFlangOffloadRuntime.cmake | 146 flang/runtime/CMakeLists.txt | 350 -- flang/runtime/CUDA/CMakeLists.txt | 41 -- flang/runtime/Float128Math/CMakeLists.txt | 133 --- flang/test/CMakeLists.txt | 10 - flang/test/lit.cfg.py | 3 - flang/test/lit.site.cfg.py.in | 1 - flang/tools/f18/CMakeLists.txt| 17 +- flang/unittests/CMakeLists.txt| 43 +-- flang/unittests/Evaluate/CMakeLists.txt | 16 - 11 files changed, 5 insertions(+), 780 deletions(-) delete mode 100644 flang/cmake/modules/AddFlangOffloadRuntime.cmake delete mode 100644 flang/runtime/CMakeLists.txt delete mode 100644 flang/runtime/CUDA/CMakeLists.txt delete mode 100644 flang/runtime/Float128Math/CMakeLists.txt diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index 38004c149b7835a..aceb2d09c543884 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -23,7 +23,6 @@ if (LLVM_ENABLE_EH) endif() set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) -set(FLANG_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../flang-rt") if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE) message(FATAL_ERROR "In-source builds are not allowed. \ @@ -237,24 +236,8 @@ else() include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR}) endif() -set(FLANG_INCLUDE_RUNTIME_default ON) -if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) - set(FLANG_INCLUDE_RUNTIME_default OFF) -endif () -option(FLANG_INCLUDE_RUNTIME "Build the runtime in-tree (deprecated; to be replaced with LLVM_ENABLE_RUNTIMES=flang-rt)" FLANG_INCLUDE_RUNTIME_default) -if (FLANG_INCLUDE_RUNTIME) - if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) -message(WARNING "Building Flang-RT using LLVM_ENABLE_RUNTIMES. FLANG_INCLUDE_RUNTIME=${FLANG_INCLUDE_RUNTIME} ignored.") -set(FLANG_INCLUDE_RUNTIME OFF) - else () - message(STATUS "Building flang_rt in-tree") - endif () -else () - if ("flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) -message(STATUS "Building Flang-RT using LLVM_ENABLE_RUNTIMES.") - else () -message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, compile a standalone Flang-RT") - endif () +if (NOT "flang-rt" IN_LIST LLVM_ENABLE_RUNTIMES) + message(STATUS "Not building Flang-RT. For a usable Fortran toolchain, compile a standalone Flang-RT") endif () set(FLANG_TOOLS_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}" CACHE PATH @@ -484,10 +467,6 @@ if (FLANG_CUF_RUNTIME) find_package(CUDAToolkit REQUIRED) endif() -if (FLANG_INCLUDE_RUNTIME) - add_subdirectory(runtime) -endif () - if (LLVM_INCLUDE_EXAMPLES) add_subdirectory(examples) endif() diff --git a/flang/cmake/modules/AddFlangOffloadRuntime.cmake b/flang/cmake/modules/AddFlangOffloadRuntime.cmake deleted file mode 100644 index 8e4f47d18535dcb..000 --- a/flang/cmake/modules/AddFlangOffloadRuntime.cmake +++ /dev/null @@ -1,146 +0,0 @@ -option(FLANG_EXPERIMENTAL_CUDA_RUNTIME - "Compile Fortran runtime as CUDA sources (experimental)" OFF - ) - -option(FLANG_CUDA_RUNTIME_PTX_WITHOUT_GLOBAL_VARS - "Do not compile global variables' definitions when producing PTX library" OFF - ) - -set(FLANG_LIBCUDACXX_PATH "" CACHE PATH "Path to libcu++ package installation") - -set(FLANG_EXPERIMENTAL_OMP_OFFLOAD_BUILD "off" CACHE STRING - "Compile Fortran runtime as OpenMP target offload sources (experimental). Valid options are 'off', 'host_device', 'nohost'") - -set(FLANG_OMP_DEVICE_ARCHITECTURES "all" CACHE STRING - "List of OpenMP device architectures to be used to compile the Fortran runtime (e.g. 'gfx1103;sm_90')") - -macro(enable_cuda_compilation name files) - if (FLANG_EXPERIMENTAL_CUDA_RUNTIME) -if (BUILD_SHARED_LIBS) - message(FATAL_ERROR -"BUILD_SHARED_LIBS is not supported for CUDA build of Fortran runtime" -) -endif() - -enable_language(CUDA) - -# TODO: figure out how to make target property CUDA_SEPARABLE_COMPILATION -# work, and avoid setting CMAKE_CUDA_SEPARABLE_COMPILATION. -set(CMAKE_CUDA_SEPARABLE_COMPILATION ON) - -# Treat all supported sources as CUDA files. -set_source_files_properties(${files} PROPERTIES LANGUAGE CUDA) -set(CUDA_COMPILE_OPTIONS) -if ("${CMAKE_CUDA_COMPILER_ID}" MATCHES "Clang") - # Allow varargs. - set(CUDA_COMPILE_OPTIONS --Xclang -fcuda-allow-variadic-functions -) -endif() -if ("${CMAKE_CUDA_COMPILER_ID}" MATCHES "NVIDIA") - set(CUDA_COMPILE_OPTIONS ---expt-relaxed-constexpr -# Disable these warnings: -
[llvm-branch-commits] [llvm] [Flang-RT] Build libflang_rt.so (PR #121782)
https://github.com/Meinersbur updated https://github.com/llvm/llvm-project/pull/121782 >From b05c9a033158aea459d51ff34b8ec47e72f85740 Mon Sep 17 00:00:00 2001 From: Michael Kruse Date: Fri, 24 Jan 2025 16:51:27 +0100 Subject: [PATCH 1/2] [Flang-RT] Build libflang_rt.so --- flang-rt/CMakeLists.txt | 30 ++ flang-rt/cmake/modules/AddFlangRT.cmake | 324 -- .../cmake/modules/AddFlangRTOffload.cmake | 18 +- flang-rt/lib/flang_rt/CMakeLists.txt | 9 +- flang-rt/lib/flang_rt/CUDA/CMakeLists.txt | 26 +- flang-rt/test/CMakeLists.txt | 2 +- flang-rt/test/lit.cfg.py | 2 +- 7 files changed, 283 insertions(+), 128 deletions(-) diff --git a/flang-rt/CMakeLists.txt b/flang-rt/CMakeLists.txt index 655d0a55b400446..0b91b6ae7eea783 100644 --- a/flang-rt/CMakeLists.txt +++ b/flang-rt/CMakeLists.txt @@ -115,6 +115,15 @@ endif () extend_path(FLANG_RT_INSTALL_RESOURCE_LIB_PATH "${FLANG_RT_INSTALL_RESOURCE_PATH}" "${toolchain_lib_subdir}") cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_DIR) cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_PATH) +# FIXME: For the libflang_rt.so, the toolchain resource lib dir is not a good +#destination because it is not a ld.so default search path. +#The machine where the executable is eventually executed may not be the +#machine where the Flang compiler and its resource dir is installed, so +#setting RPath by the driver is not an solution. It should belong into +#/usr/lib//libflang_rt.so, like e.g. libgcc_s.so. +#But the linker as invoked by the Flang driver also requires +#libflang_rt.so to be found when linking and the resource lib dir is +#the only reliable location. cmake_path(NORMAL_PATH FLANG_RT_OUTPUT_RESOURCE_LIB_DIR) cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_LIB_PATH) @@ -129,6 +138,27 @@ cmake_path(NORMAL_PATH FLANG_RT_INSTALL_RESOURCE_LIB_PATH) option(FLANG_RT_INCLUDE_TESTS "Generate build targets for the flang-rt unit and regression-tests." "${LLVM_INCLUDE_TESTS}") +option(FLANG_RT_ENABLE_STATIC "Build Flang-RT as a static library." ON) +if (WIN32) + # Windows DLL currently not implemented. + set(FLANG_RT_ENABLE_SHARED OFF) +else () + # TODO: Enable by default to increase test coverage, and which version of the + # library should be the user's choice anyway. + # Currently, the Flang driver adds `-L"libdir" -lflang_rt` as linker + # argument, which leaves the choice which library to use to the linker. + # Since most linkers prefer the shared library, this would constitute a + # breaking change unless the driver is changed. + option(FLANG_RT_ENABLE_SHARED "Build Flang-RT as a shared library." OFF) +endif () +if (NOT FLANG_RT_ENABLE_STATIC AND NOT FLANG_RT_ENABLE_SHARED) + message(FATAL_ERROR " + Must build at least one type of library + (FLANG_RT_ENABLE_STATIC=ON, FLANG_RT_ENABLE_SHARED=ON, or both) +") +endif () + + set(FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT "" CACHE STRING "Compile Flang-RT with GPU support (CUDA or OpenMP)") set_property(CACHE FLANG_RT_EXPERIMENTAL_OFFLOAD_SUPPORT PROPERTY STRINGS "" diff --git a/flang-rt/cmake/modules/AddFlangRT.cmake b/flang-rt/cmake/modules/AddFlangRT.cmake index aa8adedf61752ad..87ec58b2e854eb7 100644 --- a/flang-rt/cmake/modules/AddFlangRT.cmake +++ b/flang-rt/cmake/modules/AddFlangRT.cmake @@ -16,7 +16,8 @@ # STATIC # Build a static (.a/.lib) library # OBJECT -# Create only object files without static/dynamic library +# Always create an object library. +# Without SHARED/STATIC, build only the object library. # INSTALL_WITH_TOOLCHAIN # Install library into Clang's resource directory so it can be found by the # Flang driver during compilation, including tests @@ -48,17 +49,73 @@ function (add_flangrt_library name) ") endif () - # Forward libtype to add_library - set(extra_args "") - if (ARG_SHARED) -list(APPEND extra_args SHARED) + # Internal names of libraries. If called with just single type option, use + # the default name for it. Name of targets must only depend on function + # arguments to be predictable for callers. + set(name_static "${name}.static") + set(name_shared "${name}.shared") + set(name_object "obj.${name}") + if (ARG_STATIC AND NOT ARG_SHARED) +set(name_static "${name}") + elseif (NOT ARG_STATIC AND ARG_SHARED) +set(name_shared "${name}") + elseif (NOT ARG_STATIC AND NOT ARG_SHARED AND ARG_OBJECT) +set(name_object "${name}") + elseif (NOT ARG_STATIC AND NOT ARG_SHARED AND NOT ARG_OBJECT) +# Only one of them will actually be built. +set(name_static "${name}") +set(name_shared "${name}") endif () - if (ARG_STATIC) -list(APPEND extra_args STATIC) + + # Determine what to build. If not explicitly specified, honor + # BUILD_SHARED_LIBS (e.g. for unittest libraries). If can
[llvm-branch-commits] [llvm] bf2828f - [ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT.
Author: Lang Hames Date: 2025-02-08T16:19:55Z New Revision: bf2828f65823264f46e9cca60f0f4e9988ce2f57 URL: https://github.com/llvm/llvm-project/commit/bf2828f65823264f46e9cca60f0f4e9988ce2f57 DIFF: https://github.com/llvm/llvm-project/commit/bf2828f65823264f46e9cca60f0f4e9988ce2f57.diff LOG: [ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT. The system libunwind on older Darwins does not support JIT registration of compact-unwind. Since the CompactUnwindManager utility discards redundant eh-frame FDEs by default we need to remove the compact-unwind section first when targeting older libunwinds in order to preserve eh-frames. While LLJIT was already doing this as of eae6d6d18bd, MachOPlatform was not. This was causing buildbot failures in the ORC runtime (e.g. in https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/3479/). This patch updates both LLJIT and MachOPlatform to check a bootstrap value, "darwin-use-ehframes-only", to determine whether to forcibly preserve eh-frame sections. If this value is present and set to true then compact-unwind sections will be discarded, causing eh-frames to be preserved. If the value is absent or set to false then compact-unwind will be used and redundant FDEs in eh-frames discarded (FDEs that are needed by the compact-unwind section are always preserved). rdar://143895614 (cherry picked from commit e2eaf8ded78507100513a17e8193e2c4b094f8da) Added: llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h llvm/lib/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.cpp Modified: llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp llvm/lib/ExecutionEngine/Orc/LLJIT.cpp llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt llvm/lib/ExecutionEngine/Orc/TargetProcess/OrcRTBootstrap.cpp llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h index 6e99f6c03a7c676..91842714f6c4c38 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/MachOPlatform.h @@ -368,6 +368,7 @@ class MachOPlatform : public Platform { DenseMap RegisteredInitSymbols; std::mutex PlatformMutex; + bool ForceEHFrames = false; BootstrapInfo *Bootstrap = nullptr; DenseMap JITDylibToHeaderAddr; DenseMap HeaderAddrToJITDylib; diff --git a/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h new file mode 100644 index 000..d3277e61eeb7b12 --- /dev/null +++ b/llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h @@ -0,0 +1,28 @@ +//===- DefaultHostBootstrapValues.h - Defaults for host process -*- 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 +// +//===--===// +// +// Set sensible default bootstrap values for JIT execution in the host process. +// +//===--===// + +#ifndef LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_DEFAULTHOSTBOOTSTRAPVALUES_H +#define LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_DEFAULTHOSTBOOTSTRAPVALUES_H + +#include "llvm/ADT/StringMap.h" +#include "llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h" +#include + +namespace llvm::orc { + +void addDefaultBootstrapValuesForHostProcess( +StringMap> &BootstrapMap, +StringMap &BootstrapSymbols); + +} // namespace llvm::orc + +#endif // LLVM_EXECUTIONENGINE_ORC_TARGETPROCESS_DEFAULTHOSTBOOTSTRAPVALUES_H diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp index a9dbcd166117b0c..7b38150ab4b650b 100644 --- a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp @@ -9,8 +9,7 @@ #include "llvm/ExecutionEngine/Orc/ExecutorProcessControl.h" #include "llvm/ExecutionEngine/Orc/Core.h" -#include "llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h" -#include "llvm/ExecutionEngine/Orc/TargetProcess/RegisterEHFrames.h" +#include "llvm/ExecutionEngine/Orc/TargetProcess/DefaultHostBootstrapValues.h" #include "llvm/ExecutionEngine/Orc/TargetProcess/TargetExecutionUtils.h" #include "llvm/Support/Process.h" #include "llvm/TargetParser/Host.h" @@ -49,10 +48,7 @@ SelfExecutorProcessControl::SelfExecutorProcessControl( if (this->TargetTriple.i
[llvm-branch-commits] [llvm] 72b67d9 - Revert "Remove dependence on (#73273)"
Author: Jonas Devlieghere Date: 2025-02-08T20:22:04-08:00 New Revision: 72b67d9e808f56f835329fda8660f263c28c5b0c URL: https://github.com/llvm/llvm-project/commit/72b67d9e808f56f835329fda8660f263c28c5b0c DIFF: https://github.com/llvm/llvm-project/commit/72b67d9e808f56f835329fda8660f263c28c5b0c.diff LOG: Revert "Remove dependence on (#73273)" This reverts commit c89735d289f341985ca2ea74486b96bc611b3c64. Added: Modified: llvm/include/llvm/Support/Threading.h Removed: diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h index 9972f4ad31dadb5..01e26ad9b858ea3 100644 --- a/llvm/include/llvm/Support/Threading.h +++ b/llvm/include/llvm/Support/Threading.h @@ -19,7 +19,6 @@ #include "llvm/Config/llvm-config.h" // for LLVM_ON_UNIX #include "llvm/Support/Compiler.h" #include -#include #if defined(_MSC_VER) // MSVC's call_once implementation worked since VS 2015, which is the minimum ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 1244803 - [ORC] Add minimal-throw-catch.ll regression test for lli -jit-mode=orc.
Author: Lang Hames Date: 2025-02-08T16:19:51Z New Revision: 124480368687dd518254b482707988fe152429ac URL: https://github.com/llvm/llvm-project/commit/124480368687dd518254b482707988fe152429ac DIFF: https://github.com/llvm/llvm-project/commit/124480368687dd518254b482707988fe152429ac.diff LOG: [ORC] Add minimal-throw-catch.ll regression test for lli -jit-mode=orc. We already had a -jit-mode=orc-lazy regression test for this, but it should work equally well in non-lazy mode. (cherry picked from commit b46211bbf683b30b88e41a684633fc63436e5edf) Added: llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll Modified: llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll Removed: diff --git a/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll b/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll new file mode 100644 index 000..cd22ec65ed9996e --- /dev/null +++ b/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll @@ -0,0 +1,52 @@ +; REQUIRES: x86_64-apple +; RUN: lli -jit-kind=orc-lazy %s +; +; Basic correctness testing for eh-frame processing and registration. + +@_ZTIi = external constant ptr + +declare ptr @__cxa_allocate_exception(i64) +declare void @__cxa_throw(ptr, ptr, ptr) + +declare i32 @__gxx_personality_v0(...) +declare i32 @llvm.eh.typeid.for(ptr) +declare ptr @__cxa_begin_catch(ptr) +declare void @__cxa_end_catch() + +define void @explode() { +entry: + %exception = tail call ptr @__cxa_allocate_exception(i64 4) + store i32 42, ptr %exception, align 16 + tail call void @__cxa_throw(ptr %exception, ptr @_ZTIi, ptr null) + unreachable +} + +define i32 @main(i32 %argc, ptr %argv) personality ptr @__gxx_personality_v0 { +entry: + invoke void @explode() + to label %return unwind label %lpad + +lpad: + %0 = landingpad { ptr, i32 } + catch ptr @_ZTIi + %1 = extractvalue { ptr, i32 } %0, 1 + %2 = tail call i32 @llvm.eh.typeid.for(ptr @_ZTIi) + %matches = icmp eq i32 %1, %2 + br i1 %matches, label %catch, label %eh.resume + +catch: + %3 = extractvalue { ptr, i32 } %0, 0 + %4 = tail call ptr @__cxa_begin_catch(ptr %3) + %5 = load i32, ptr %4, align 4 + %cmp = icmp ne i32 %5, 42 + %cond = zext i1 %cmp to i32 + tail call void @__cxa_end_catch() + br label %return + +return: + %retval.0 = phi i32 [ %cond, %catch ], [ 2, %entry ] + ret i32 %retval.0 + +eh.resume: + resume { ptr, i32 } %0 +} diff --git a/llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll b/llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll index 5bc5769a2c0d2f8..cd22ec65ed9996e 100644 --- a/llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll +++ b/llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll @@ -3,10 +3,6 @@ ; ; Basic correctness testing for eh-frame processing and registration. -source_filename = "minimal-throw-catch.cpp" -target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128" -target triple = "x86_64-apple-macosx10.14.0" - @_ZTIi = external constant ptr declare ptr @__cxa_allocate_exception(i64) ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] c5f8508 - [ORC] Rename MachOCompactUnwindSectionName to MachOUnwindInfoSectionName.
Author: Lang Hames Date: 2025-02-08T16:19:51Z New Revision: c5f8508dd3649fffdff2cfcae9335612f38abea9 URL: https://github.com/llvm/llvm-project/commit/c5f8508dd3649fffdff2cfcae9335612f38abea9 DIFF: https://github.com/llvm/llvm-project/commit/c5f8508dd3649fffdff2cfcae9335612f38abea9.diff LOG: [ORC] Rename MachOCompactUnwindSectionName to MachOUnwindInfoSectionName. a1ff2d18466 should have disambiguated MachOCompactUnwindInfoSectionName to MachOUnwindInfoSectionName, given how it's used in MachOPlatform and its value. A MachOCompactUnwindSectionName variable with an appropriate value will be added in an upcoming patch to re-enable compact-unwind support in JITLink. (cherry picked from commit b84ac58dce65ea94994c24f40a14208c47f8119f) Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h index 31d0ecca2080595..5de85a4f8674e1d 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h @@ -25,7 +25,6 @@ namespace orc { extern StringRef MachODataCommonSectionName; extern StringRef MachODataDataSectionName; extern StringRef MachOEHFrameSectionName; -extern StringRef MachOCompactUnwindSectionName; extern StringRef MachOCStringSectionName; extern StringRef MachOModInitFuncSectionName; extern StringRef MachOObjCCatListSectionName; @@ -53,6 +52,7 @@ extern StringRef MachOTextTextSectionName; extern StringRef MachOThreadBSSSectionName; extern StringRef MachOThreadDataSectionName; extern StringRef MachOThreadVarsSectionName; +extern StringRef MachOUnwindInfoSectionName; extern StringRef MachOInitSectionNames[22]; diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp index 9479a69d4f0ba05..43d38c81fb8a67c 100644 --- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp @@ -1278,7 +1278,7 @@ MachOPlatform::MachOPlatformPlugin::findUnwindSectionInfo( if (Section *EHFrameSec = G.findSectionByName(MachOEHFrameSectionName)) ScanUnwindInfoSection(*EHFrameSec, US.DwarfSection); - if (Section *CUInfoSec = G.findSectionByName(MachOCompactUnwindSectionName)) + if (Section *CUInfoSec = G.findSectionByName(MachOUnwindInfoSectionName)) ScanUnwindInfoSection(*CUInfoSec, US.CompactUnwindSection); // If we didn't find any pointed-to code-blocks then there's no need to diff --git a/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp b/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp index be92acd37aa8de3..d94acf276881771 100644 --- a/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp @@ -18,7 +18,6 @@ namespace orc { StringRef MachODataCommonSectionName = "__DATA,__common"; StringRef MachODataDataSectionName = "__DATA,__data"; StringRef MachOEHFrameSectionName = "__TEXT,__eh_frame"; -StringRef MachOCompactUnwindSectionName = "__TEXT,__unwind_info"; StringRef MachOCStringSectionName = "__TEXT,__cstring"; StringRef MachOModInitFuncSectionName = "__DATA,__mod_init_func"; StringRef MachOObjCCatListSectionName = "__DATA,__objc_catlist"; @@ -46,6 +45,7 @@ StringRef MachOTextTextSectionName = "__TEXT,__text"; StringRef MachOThreadBSSSectionName = "__DATA,__thread_bss"; StringRef MachOThreadDataSectionName = "__DATA,__thread_data"; StringRef MachOThreadVarsSectionName = "__DATA,__thread_vars"; +StringRef MachOUnwindInfoSectionName = "__TEXT,__unwind_info"; StringRef MachOInitSectionNames[22] = { MachOModInitFuncSectionName, MachOObjCCatListSectionName, ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 3a474e7 - [ORC] Actually use -jit-kind=orc for the new minimal-throw-catch.ll test.
Author: Lang Hames Date: 2025-02-08T16:19:51Z New Revision: 3a474e70939a4c68a9598ad15c268621f6c33911 URL: https://github.com/llvm/llvm-project/commit/3a474e70939a4c68a9598ad15c268621f6c33911 DIFF: https://github.com/llvm/llvm-project/commit/3a474e70939a4c68a9598ad15c268621f6c33911.diff LOG: [ORC] Actually use -jit-kind=orc for the new minimal-throw-catch.ll test. b46211bbf68, which introduced a new copy of the minimal-throw-catch.ll test, failed to update the run line. (cherry picked from commit c0f7ebe715dbe706224389a3022e6a3880fef0a1) Added: Modified: llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll Removed: diff --git a/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll b/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll index cd22ec65ed9996e..1b8f45184833ffe 100644 --- a/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll +++ b/llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll @@ -1,5 +1,5 @@ ; REQUIRES: x86_64-apple -; RUN: lli -jit-kind=orc-lazy %s +; RUN: lli -jit-kind=orc %s ; ; Basic correctness testing for eh-frame processing and registration. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 1bcbc68 - [ORC] Fix eh-frame record target finding in MachOPlatform.
Author: Lang Hames Date: 2025-02-08T16:19:52Z New Revision: 1bcbc68e98b07cdef6b03377bb7cfc0d53787577 URL: https://github.com/llvm/llvm-project/commit/1bcbc68e98b07cdef6b03377bb7cfc0d53787577 DIFF: https://github.com/llvm/llvm-project/commit/1bcbc68e98b07cdef6b03377bb7cfc0d53787577.diff LOG: [ORC] Fix eh-frame record target finding in MachOPlatform. Unwind-info records only have one keep-alive edge to their target function, but eh-frame records may have multiple edges (to the CIE, function, personality, and lsda). We need to identify the target-function edge differently for each section type. (cherry picked from commit 52b5e3638a39e977bebb491312a6f7c53314efec) Added: Modified: llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp index 43d38c81fb8a67c..cea0e984718f2a0 100644 --- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp @@ -1256,7 +1256,8 @@ MachOPlatform::MachOPlatformPlugin::findUnwindSectionInfo( // ScanSection records a section range and adds any executable blocks that // that section points to to the CodeBlocks vector. SmallVector CodeBlocks; - auto ScanUnwindInfoSection = [&](Section &Sec, ExecutorAddrRange &SecRange) { + auto ScanUnwindInfoSection = [&](Section &Sec, ExecutorAddrRange &SecRange, + auto GetCodeForRecord) { if (Sec.blocks().empty()) return; SecRange = (*Sec.blocks().begin())->getRange(); @@ -1264,22 +1265,52 @@ MachOPlatform::MachOPlatformPlugin::findUnwindSectionInfo( auto R = B->getRange(); SecRange.Start = std::min(SecRange.Start, R.Start); SecRange.End = std::max(SecRange.End, R.End); - for (auto &E : B->edges()) { -if (E.getKind() != Edge::KeepAlive || !E.getTarget().isDefined()) - continue; -auto &TargetBlock = E.getTarget().getBlock(); -auto &TargetSection = TargetBlock.getSection(); -if ((TargetSection.getMemProt() & MemProt::Exec) == MemProt::Exec) - CodeBlocks.push_back(&TargetBlock); - } + if (auto *CodeBlock = GetCodeForRecord(*B)) +CodeBlocks.push_back(CodeBlock); } }; - if (Section *EHFrameSec = G.findSectionByName(MachOEHFrameSectionName)) -ScanUnwindInfoSection(*EHFrameSec, US.DwarfSection); + if (Section *EHFrameSec = G.findSectionByName(MachOEHFrameSectionName)) { +ScanUnwindInfoSection( +*EHFrameSec, US.DwarfSection, [&](Block &B) -> Block * { + // Filter out CIE, personality, etc. edges. + SmallVector BEdges; + for (auto &E : B.edges()) +BEdges.push_back(&E); + llvm::sort(BEdges, [](const Edge *LHS, const Edge *RHS) { +return LHS->getOffset() < RHS->getOffset(); + }); + if (BEdges.size() < 2) +return nullptr; + auto &TargetBlock = BEdges[1]->getTarget().getBlock(); +#ifndef NDEBUG + auto &TargetSection = TargetBlock.getSection(); + assert(&TargetSection != EHFrameSec && + (TargetSection.getMemProt() & MemProt::Exec) == + MemProt::Exec && + "Invalid eh-frame function target"); +#endif // NDEBUG + return &TargetBlock; +}); + } - if (Section *CUInfoSec = G.findSectionByName(MachOUnwindInfoSectionName)) -ScanUnwindInfoSection(*CUInfoSec, US.CompactUnwindSection); + if (Section *CUInfoSec = G.findSectionByName(MachOUnwindInfoSectionName)) { +ScanUnwindInfoSection( +*CUInfoSec, US.CompactUnwindSection, [&](Block &B) -> Block * { + // Compact unwind records should just have a keep-alive pointing to + // the target function. + assert(B.edges_size() == 1 && + "unwind-info record should only have one edge"); + for (auto &E : B.edges()) { +assert(E.getTarget().isDefined() && + "unwind-info record edge has external target"); +assert(E.getKind() == Edge::KeepAlive && + "unwind-info record has unexpected edge kind"); +return &E.getTarget().getBlock(); + } + return nullptr; +}); + } // If we didn't find any pointed-to code-blocks then there's no need to // register any info. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 74d53f7 - [ORC] Moch MachOPlatform unwind-info fixes.
Author: Lang Hames Date: 2025-02-08T16:19:52Z New Revision: 74d53f73bdf81bf72b949e41058398d610612e6b URL: https://github.com/llvm/llvm-project/commit/74d53f73bdf81bf72b949e41058398d610612e6b DIFF: https://github.com/llvm/llvm-project/commit/74d53f73bdf81bf72b949e41058398d610612e6b.diff LOG: [ORC] Moch MachOPlatform unwind-info fixes. Some eh-frame records are CIEs, which don't point to functions. We need to skip these records. This patch reuses EHFrameCFIBlockInspector to identify function targets, rather than a custom loop. Any performance impact will be minimal, and essentially irrelevant once compact-unwind support re-lands (since at that point we'll discard most eh-frame records). For unwind-info sections: don't assume one block per record: the unwind-info section packs all records into a single block. (cherry picked from commit 9de581b206eceac331aa26e13b62a9a35bfd406f) Added: Modified: llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp index cea0e984718f2a0..44ae73671f5b15a 100644 --- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp @@ -9,6 +9,7 @@ #include "llvm/ExecutionEngine/Orc/MachOPlatform.h" #include "llvm/BinaryFormat/MachO.h" +#include "llvm/ExecutionEngine/JITLink/EHFrameSupport.h" #include "llvm/ExecutionEngine/JITLink/MachO.h" #include "llvm/ExecutionEngine/JITLink/aarch64.h" #include "llvm/ExecutionEngine/JITLink/x86_64.h" @@ -1257,7 +1258,7 @@ MachOPlatform::MachOPlatformPlugin::findUnwindSectionInfo( // that section points to to the CodeBlocks vector. SmallVector CodeBlocks; auto ScanUnwindInfoSection = [&](Section &Sec, ExecutorAddrRange &SecRange, - auto GetCodeForRecord) { + auto AddCodeBlocks) { if (Sec.blocks().empty()) return; SecRange = (*Sec.blocks().begin())->getRange(); @@ -1265,50 +1266,29 @@ MachOPlatform::MachOPlatformPlugin::findUnwindSectionInfo( auto R = B->getRange(); SecRange.Start = std::min(SecRange.Start, R.Start); SecRange.End = std::max(SecRange.End, R.End); - if (auto *CodeBlock = GetCodeForRecord(*B)) -CodeBlocks.push_back(CodeBlock); + AddCodeBlocks(*B); } }; if (Section *EHFrameSec = G.findSectionByName(MachOEHFrameSectionName)) { -ScanUnwindInfoSection( -*EHFrameSec, US.DwarfSection, [&](Block &B) -> Block * { - // Filter out CIE, personality, etc. edges. - SmallVector BEdges; - for (auto &E : B.edges()) -BEdges.push_back(&E); - llvm::sort(BEdges, [](const Edge *LHS, const Edge *RHS) { -return LHS->getOffset() < RHS->getOffset(); - }); - if (BEdges.size() < 2) -return nullptr; - auto &TargetBlock = BEdges[1]->getTarget().getBlock(); -#ifndef NDEBUG - auto &TargetSection = TargetBlock.getSection(); - assert(&TargetSection != EHFrameSec && - (TargetSection.getMemProt() & MemProt::Exec) == - MemProt::Exec && - "Invalid eh-frame function target"); -#endif // NDEBUG - return &TargetBlock; -}); +ScanUnwindInfoSection(*EHFrameSec, US.DwarfSection, [&](Block &B) { + if (auto *Fn = jitlink::EHFrameCFIBlockInspector::FromEdgeScan(B) + .getPCBeginEdge()) +if (Fn->getTarget().isDefined()) + CodeBlocks.push_back(&Fn->getTarget().getBlock()); +}); } if (Section *CUInfoSec = G.findSectionByName(MachOUnwindInfoSectionName)) { ScanUnwindInfoSection( -*CUInfoSec, US.CompactUnwindSection, [&](Block &B) -> Block * { - // Compact unwind records should just have a keep-alive pointing to - // the target function. - assert(B.edges_size() == 1 && - "unwind-info record should only have one edge"); +*CUInfoSec, US.CompactUnwindSection, [&](Block &B) { for (auto &E : B.edges()) { assert(E.getTarget().isDefined() && "unwind-info record edge has external target"); assert(E.getKind() == Edge::KeepAlive && "unwind-info record has unexpected edge kind"); -return &E.getTarget().getBlock(); +CodeBlocks.push_back(&E.getTarget().getBlock()); } - return nullptr; }); } ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT. (PR #126361)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/126361 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 749bebc - [JITLink] Handle compact-unwind records that depend on DWARF FDEs.
Author: Lang Hames Date: 2025-02-08T16:19:54Z New Revision: 749bebc5dab440377bc8365ee0d278423d19cd92 URL: https://github.com/llvm/llvm-project/commit/749bebc5dab440377bc8365ee0d278423d19cd92 DIFF: https://github.com/llvm/llvm-project/commit/749bebc5dab440377bc8365ee0d278423d19cd92.diff LOG: [JITLink] Handle compact-unwind records that depend on DWARF FDEs. Compact-unwind encodings are more limited than DWARF frame descriptions. For functions whose frame layout cannot be described by a compact unwind encoding, the encoding for the function will specify "use DWARF", and the corresponding unwind-info record will use the low bits of the encoding to point to the FDE for the function. We test this with a frame-pointer=none function, since these frame layouts always triger a fall-back to DWARF on arm64. (cherry picked from commit 9d88ffe7f7b4a46d3bcb7bbdf0d7eb037ab5ba04) Added: llvm/test/ExecutionEngine/Orc/throw-catch-minimal.ll Modified: llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp Removed: llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll diff --git a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h b/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h index c306264b6da5d26..c3f883494933562 100644 --- a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h +++ b/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h @@ -61,6 +61,14 @@ template struct CompactUnwindTraits { return support::endian::read32(RecordContent.data() + EncodingFieldOffset); } + + static std::optional encodeDWARFOffset(size_t Delta) { +uint32_t Encoded = +static_cast(Delta) & CRTPImpl::DWARFSectionOffsetMask; +if (Encoded != Delta) + return std::nullopt; +return Encoded; + } }; /// Architecture specific implementation of CompactUnwindManager. @@ -133,19 +141,22 @@ template class CompactUnwindManager { << Fn.getName() << "\n"; }); continue; - } else { -LLVM_DEBUG({ - dbgs() << "Found record for function "; - if (Fn.hasName()) -dbgs() << Fn.getName(); - else -dbgs() << "'; - dbgs() << '\n'; -}); } - bool NeedsDWARF = CURecTraits::encodingSpecifiesDWARF( - CURecTraits::readEncoding(B->getContent())); + uint32_t Encoding = CURecTraits::readEncoding(B->getContent()); + bool NeedsDWARF = CURecTraits::encodingSpecifiesDWARF(Encoding); + + LLVM_DEBUG({ +dbgs() << "Found record for function "; +if (Fn.hasName()) + dbgs() << Fn.getName(); +else + dbgs() << "'; +dbgs() << ": encoding = " << formatv("{0:x}", Encoding); +if (NeedsDWARF) + dbgs() << " (needs DWARF)"; +dbgs() << "\n"; + }); auto &CURecSym = G.addAnonymousSymbol(*B, 0, CURecTraits::Size, false, false); @@ -170,7 +181,7 @@ template class CompactUnwindManager { KeepAliveAlreadyPresent = true; if (NeedsDWARF) { LLVM_DEBUG({ - dbgs() << " Needs DWARF: adding keep-alive edge to FDE at " + dbgs() << " Adding keep-alive edge to FDE at " << FDE.getAddress() << "\n"; }); B->addEdge(Edge::KeepAlive, 0, FDE, 0); @@ -595,8 +606,24 @@ template class CompactUnwindManager { ", delta to function at " + formatv("{0:x}", R.Fn->getAddress()) + " exceeds 32 bits"); + auto Encoding = R.Encoding; + + if (LLVM_UNLIKELY(CURecTraits::encodingSpecifiesDWARF(R.Encoding))) { +if (!EHFrameBase) + EHFrameBase = SectionRange(R.FDE->getSection()).getStart(); +auto FDEDelta = R.FDE->getAddress() - EHFrameBase; + +if (auto EncodedFDEDelta = CURecTraits::encodeDWARFOffset(FDEDelta)) + Encoding |= *EncodedFDEDelta; +else + return make_error( + "In " + G.getName() + " " + UnwindInfoSectionName + + ", cannot encode delta " + formatv("{0:x}", FDEDelta) + + " to FDE at " + formatv("{0:x}", R.FDE->getAddress())); + } + cantFail(W.writeInteger(FnDelta)); - cantFail(W.writeInteger(R.Encoding)); + cantFail(W.writeInteger(Encoding)); ++RecordIdx; } @@ -639,6 +666,7 @@ template class CompactUnwindManager { StringRef UnwindInfoSectionName; StringRef EHFrameSectionName; Symbol *CompactUnwindBase = nullptr; + orc::ExecutorAddr EHFrameBase; size_t NumLSDAs = 0; size_t NumSecondLevelPages = 0; diff --git a/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp b/llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp index 4860db4f5eb37c6..3a
[llvm-branch-commits] [compiler-rt] 7782b83 - [ORC-RT] Add a comment explaining the purpose of this testcase. NFC.
Author: Lang Hames Date: 2025-02-08T16:19:53Z New Revision: 7782b8310d49d7b3751ecc7ce7511c0c34f62efb URL: https://github.com/llvm/llvm-project/commit/7782b8310d49d7b3751ecc7ce7511c0c34f62efb DIFF: https://github.com/llvm/llvm-project/commit/7782b8310d49d7b3751ecc7ce7511c0c34f62efb.diff LOG: [ORC-RT] Add a comment explaining the purpose of this testcase. NFC. (cherry picked from commit aefa30e2301f155d4f4737d6f6c55c66eac58b2d) Added: Modified: compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp Removed: diff --git a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp index 7e9c40c724aec6c..304588a32738604 100644 --- a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp +++ b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp @@ -3,6 +3,7 @@ // // REQUIRES: system-darwin && host-arch-compatible +// Test that trivial throw / catch works. int main(int argc, char *argv[]) { try { throw 42; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] b05e3a7 - [ORC] Fix file comment formatting. NFC.
Author: Lang Hames Date: 2025-02-08T16:19:50Z New Revision: b05e3a7d5e2285b545510f01ea7c599502e582d8 URL: https://github.com/llvm/llvm-project/commit/b05e3a7d5e2285b545510f01ea7c599502e582d8 DIFF: https://github.com/llvm/llvm-project/commit/b05e3a7d5e2285b545510f01ea7c599502e582d8.diff LOG: [ORC] Fix file comment formatting. NFC. (cherry picked from commit 7fb233f549dee0346332562de050ef2ab3654329) Added: Modified: llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp index aae7369fc29c4c8..7f0a45941cf9bc7 100644 --- a/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp @@ -1,5 +1,4 @@ -//===-- ELFNixPlatform.cpp - Utilities for executing ELFNix in Orc -//-===// +//===- ELFNixPlatform.cpp - Utilities for executing ELFNix in Orc -===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT. (PR #126361)
github-actions[bot] wrote: @lhames (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR. https://github.com/llvm/llvm-project/pull/126361 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC-RT] Use templates to express deeply nested function calls in testcase. (PR #126015)
https://github.com/lhames closed https://github.com/llvm/llvm-project/pull/126015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC-RT] Use templates to express deeply nested function calls in testcase. (PR #126015)
lhames wrote: Abandoning this pull request: It will be superseded by the one for https://github.com/llvm/llvm-project/issues/126360. https://github.com/llvm/llvm-project/pull/126015 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [clang] [compiler-rt] [llvm] release/20.x: [ORC] Force eh-frame use for older Darwins on x86-64 in MachOPlatform, LLJIT. (PR #126361)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/126361 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) (PR #126367)
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/126367 Backport 66bea0df75ccdd5ffed41d06c7301a116d11abcb Requested by: @AmrDeveloper >From cf88498c0523133c43aa3055a9a24250b893a9ca Mon Sep 17 00:00:00 2001 From: Amr Hesham Date: Sat, 8 Feb 2025 14:14:16 +0100 Subject: [PATCH] [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) Fix printing the correct file path in the error message when the output file specified by `--dump-section` cannot be opened Fixes: #125113 on ELF, MachO, Wasm (cherry picked from commit 66bea0df75ccdd5ffed41d06c7301a116d11abcb) --- llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp | 59 ++- llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp | 27 + llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp | 15 ++--- .../tools/llvm-objcopy/ELF/dump-section.test | 4 ++ .../llvm-objcopy/MachO/dump-section.test | 4 ++ .../tools/llvm-objcopy/wasm/dump-section.test | 4 ++ 6 files changed, 64 insertions(+), 49 deletions(-) diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp index 5aa0079f3fbc7a7..9c78f7433ad3390 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp @@ -186,27 +186,28 @@ static std::unique_ptr createWriter(const CommonConfig &Config, } static Error dumpSectionToFile(StringRef SecName, StringRef Filename, - Object &Obj) { + StringRef InputFilename, Object &Obj) { for (auto &Sec : Obj.sections()) { if (Sec.Name == SecName) { if (Sec.Type == SHT_NOBITS) -return createStringError(object_error::parse_failed, - "cannot dump section '%s': it has no contents", - SecName.str().c_str()); +return createFileError(InputFilename, object_error::parse_failed, + "cannot dump section '%s': it has no contents", + SecName.str().c_str()); Expected> BufferOrErr = FileOutputBuffer::create(Filename, Sec.OriginalData.size()); if (!BufferOrErr) -return BufferOrErr.takeError(); +return createFileError(Filename, BufferOrErr.takeError()); std::unique_ptr Buf = std::move(*BufferOrErr); std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), Buf->getBufferStart()); if (Error E = Buf->commit()) -return E; +return createFileError(Filename, std::move(E)); return Error::success(); } } - return createStringError(object_error::parse_failed, "section '%s' not found", - SecName.str().c_str()); + + return createFileError(InputFilename, object_error::parse_failed, + "section '%s' not found", SecName.str().c_str()); } Error Object::compressOrDecompressSections(const CommonConfig &Config) { @@ -798,7 +799,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, StringRef SectionName; StringRef FileName; std::tie(SectionName, FileName) = Flag.split('='); -if (Error E = dumpSectionToFile(SectionName, FileName, Obj)) +if (Error E = +dumpSectionToFile(SectionName, FileName, Config.InputFilename, Obj)) return E; } @@ -807,10 +809,10 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, // us to avoid reporting the inappropriate errors about removing symbols // named in relocations. if (Error E = replaceAndRemoveSections(Config, ELFConfig, Obj)) -return E; +return createFileError(Config.InputFilename, std::move(E)); if (Error E = updateAndRemoveSymbols(Config, ELFConfig, Obj)) -return E; +return createFileError(Config.InputFilename, std::move(E)); if (!Config.SetSectionAlignment.empty()) { for (SectionBase &Sec : Obj.sections()) { @@ -826,8 +828,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, if (Config.ChangeSectionLMAValAll > 0 && Seg.PAddr > std::numeric_limits::max() - Config.ChangeSectionLMAValAll) { - return createStringError( - errc::invalid_argument, + return createFileError( + Config.InputFilename, errc::invalid_argument, "address 0x" + Twine::utohexstr(Seg.PAddr) + " cannot be increased by 0x" + Twine::utohexstr(Config.ChangeSectionLMAValAll) + @@ -835,8 +837,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, } else if (Config.ChangeSectionLMAValAll < 0 && Seg.PAddr < std::numeric_limits::min() - Config.ChangeSectionLMAValAll) { - return createStringError( - errc::invalid_argument, + return createFileError( +
[llvm-branch-commits] [llvm] release/20.x: [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) (PR #126367)
llvmbot wrote: @llvm/pr-subscribers-llvm-binary-utilities Author: None (llvmbot) Changes Backport 66bea0df75ccdd5ffed41d06c7301a116d11abcb Requested by: @AmrDeveloper --- Full diff: https://github.com/llvm/llvm-project/pull/126367.diff 6 Files Affected: - (modified) llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp (+30-29) - (modified) llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp (+14-13) - (modified) llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp (+8-7) - (modified) llvm/test/tools/llvm-objcopy/ELF/dump-section.test (+4) - (modified) llvm/test/tools/llvm-objcopy/MachO/dump-section.test (+4) - (modified) llvm/test/tools/llvm-objcopy/wasm/dump-section.test (+4) ``diff diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp index 5aa0079f3fbc7a7..9c78f7433ad3390 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp @@ -186,27 +186,28 @@ static std::unique_ptr createWriter(const CommonConfig &Config, } static Error dumpSectionToFile(StringRef SecName, StringRef Filename, - Object &Obj) { + StringRef InputFilename, Object &Obj) { for (auto &Sec : Obj.sections()) { if (Sec.Name == SecName) { if (Sec.Type == SHT_NOBITS) -return createStringError(object_error::parse_failed, - "cannot dump section '%s': it has no contents", - SecName.str().c_str()); +return createFileError(InputFilename, object_error::parse_failed, + "cannot dump section '%s': it has no contents", + SecName.str().c_str()); Expected> BufferOrErr = FileOutputBuffer::create(Filename, Sec.OriginalData.size()); if (!BufferOrErr) -return BufferOrErr.takeError(); +return createFileError(Filename, BufferOrErr.takeError()); std::unique_ptr Buf = std::move(*BufferOrErr); std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), Buf->getBufferStart()); if (Error E = Buf->commit()) -return E; +return createFileError(Filename, std::move(E)); return Error::success(); } } - return createStringError(object_error::parse_failed, "section '%s' not found", - SecName.str().c_str()); + + return createFileError(InputFilename, object_error::parse_failed, + "section '%s' not found", SecName.str().c_str()); } Error Object::compressOrDecompressSections(const CommonConfig &Config) { @@ -798,7 +799,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, StringRef SectionName; StringRef FileName; std::tie(SectionName, FileName) = Flag.split('='); -if (Error E = dumpSectionToFile(SectionName, FileName, Obj)) +if (Error E = +dumpSectionToFile(SectionName, FileName, Config.InputFilename, Obj)) return E; } @@ -807,10 +809,10 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, // us to avoid reporting the inappropriate errors about removing symbols // named in relocations. if (Error E = replaceAndRemoveSections(Config, ELFConfig, Obj)) -return E; +return createFileError(Config.InputFilename, std::move(E)); if (Error E = updateAndRemoveSymbols(Config, ELFConfig, Obj)) -return E; +return createFileError(Config.InputFilename, std::move(E)); if (!Config.SetSectionAlignment.empty()) { for (SectionBase &Sec : Obj.sections()) { @@ -826,8 +828,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, if (Config.ChangeSectionLMAValAll > 0 && Seg.PAddr > std::numeric_limits::max() - Config.ChangeSectionLMAValAll) { - return createStringError( - errc::invalid_argument, + return createFileError( + Config.InputFilename, errc::invalid_argument, "address 0x" + Twine::utohexstr(Seg.PAddr) + " cannot be increased by 0x" + Twine::utohexstr(Config.ChangeSectionLMAValAll) + @@ -835,8 +837,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, } else if (Config.ChangeSectionLMAValAll < 0 && Seg.PAddr < std::numeric_limits::min() - Config.ChangeSectionLMAValAll) { - return createStringError( - errc::invalid_argument, + return createFileError( + Config.InputFilename, errc::invalid_argument, "address 0x" + Twine::utohexstr(Seg.PAddr) + " cannot be decreased by 0x" + Twine::utohexstr(std::abs(Config.ChangeSectionLMAValAll)) + @@ -849,10 +851,9 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, if (!Config.C
[llvm-branch-commits] [llvm] release/20.x: [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) (PR #126367)
https://github.com/llvmbot milestoned https://github.com/llvm/llvm-project/pull/126367 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) (PR #126367)
llvmbot wrote: @AmrDeveloper What do you think about merging this PR to the release branch? https://github.com/llvm/llvm-project/pull/126367 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) (PR #126367)
https://github.com/llvmbot updated https://github.com/llvm/llvm-project/pull/126367 >From a9c178bbcbfb827dc4a0207a0ae0e3c73aaf6490 Mon Sep 17 00:00:00 2001 From: Amr Hesham Date: Sat, 8 Feb 2025 14:14:16 +0100 Subject: [PATCH] [llvm-objcopy] Fix prints wrong path when dump-section output path doesn't exist (#125345) Fix printing the correct file path in the error message when the output file specified by `--dump-section` cannot be opened Fixes: #125113 on ELF, MachO, Wasm (cherry picked from commit 66bea0df75ccdd5ffed41d06c7301a116d11abcb) --- llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp | 59 ++- llvm/lib/ObjCopy/MachO/MachOObjcopy.cpp | 27 + llvm/lib/ObjCopy/wasm/WasmObjcopy.cpp | 15 ++--- .../tools/llvm-objcopy/ELF/dump-section.test | 4 ++ .../llvm-objcopy/MachO/dump-section.test | 4 ++ .../tools/llvm-objcopy/wasm/dump-section.test | 4 ++ 6 files changed, 64 insertions(+), 49 deletions(-) diff --git a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp index 5aa0079f3fbc7a7..9c78f7433ad3390 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObjcopy.cpp @@ -186,27 +186,28 @@ static std::unique_ptr createWriter(const CommonConfig &Config, } static Error dumpSectionToFile(StringRef SecName, StringRef Filename, - Object &Obj) { + StringRef InputFilename, Object &Obj) { for (auto &Sec : Obj.sections()) { if (Sec.Name == SecName) { if (Sec.Type == SHT_NOBITS) -return createStringError(object_error::parse_failed, - "cannot dump section '%s': it has no contents", - SecName.str().c_str()); +return createFileError(InputFilename, object_error::parse_failed, + "cannot dump section '%s': it has no contents", + SecName.str().c_str()); Expected> BufferOrErr = FileOutputBuffer::create(Filename, Sec.OriginalData.size()); if (!BufferOrErr) -return BufferOrErr.takeError(); +return createFileError(Filename, BufferOrErr.takeError()); std::unique_ptr Buf = std::move(*BufferOrErr); std::copy(Sec.OriginalData.begin(), Sec.OriginalData.end(), Buf->getBufferStart()); if (Error E = Buf->commit()) -return E; +return createFileError(Filename, std::move(E)); return Error::success(); } } - return createStringError(object_error::parse_failed, "section '%s' not found", - SecName.str().c_str()); + + return createFileError(InputFilename, object_error::parse_failed, + "section '%s' not found", SecName.str().c_str()); } Error Object::compressOrDecompressSections(const CommonConfig &Config) { @@ -798,7 +799,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, StringRef SectionName; StringRef FileName; std::tie(SectionName, FileName) = Flag.split('='); -if (Error E = dumpSectionToFile(SectionName, FileName, Obj)) +if (Error E = +dumpSectionToFile(SectionName, FileName, Config.InputFilename, Obj)) return E; } @@ -807,10 +809,10 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, // us to avoid reporting the inappropriate errors about removing symbols // named in relocations. if (Error E = replaceAndRemoveSections(Config, ELFConfig, Obj)) -return E; +return createFileError(Config.InputFilename, std::move(E)); if (Error E = updateAndRemoveSymbols(Config, ELFConfig, Obj)) -return E; +return createFileError(Config.InputFilename, std::move(E)); if (!Config.SetSectionAlignment.empty()) { for (SectionBase &Sec : Obj.sections()) { @@ -826,8 +828,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, if (Config.ChangeSectionLMAValAll > 0 && Seg.PAddr > std::numeric_limits::max() - Config.ChangeSectionLMAValAll) { - return createStringError( - errc::invalid_argument, + return createFileError( + Config.InputFilename, errc::invalid_argument, "address 0x" + Twine::utohexstr(Seg.PAddr) + " cannot be increased by 0x" + Twine::utohexstr(Config.ChangeSectionLMAValAll) + @@ -835,8 +837,8 @@ static Error handleArgs(const CommonConfig &Config, const ELFConfig &ELFConfig, } else if (Config.ChangeSectionLMAValAll < 0 && Seg.PAddr < std::numeric_limits::min() - Config.ChangeSectionLMAValAll) { - return createStringError( - errc::invalid_argument, + return createFileError( + Config.InputFilename, errc::invalid_argument, "addre
[llvm-branch-commits] [llvm] 0c23bde - [ORC] Fix buggy calculation of second-level-page offset in unwind-info.
Author: Lang Hames Date: 2025-02-08T16:19:53Z New Revision: 0c23bde7176d17f37923e0d8c847e48ebb700a91 URL: https://github.com/llvm/llvm-project/commit/0c23bde7176d17f37923e0d8c847e48ebb700a91 DIFF: https://github.com/llvm/llvm-project/commit/0c23bde7176d17f37923e0d8c847e48ebb700a91.diff LOG: [ORC] Fix buggy calculation of second-level-page offset in unwind-info. SecondLevelPageOffset should be incremented by SecondLevelPageSize bytes, not one byte. Failure to calculate the offset correctly leads to corrupted unwind-info (and consequently broken exceptions / unwinding) when more than one second level page is needed. Since JITLink's unwind support only produces UNWIND_SECOND_LEVEL_REGULAR-style pages this would trigger for any file containing more than 511 functions with unwind info. The included test-case contains 1022 functions (sufficient for both the current format and any future implementation that supports UNWIND_SECOND_LEVEL_COMPRESSED pages). Thanks to @edoardo on discord for spotting this bug! (cherry picked from commit 88f55d16c4c247a9eef326961a1445dee3f2e30c) Added: compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp Modified: llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h Removed: diff --git a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp new file mode 100644 index 000..f7a39a9dccd6fcb --- /dev/null +++ b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp @@ -0,0 +1,1039 @@ +// RUN: %clangxx -c -o %t %s +// RUN: %llvm_jitlink -slab-allocate=20Mb %t +// +// REQUIRES: system-darwin && host-arch-compatible + +// Test that we can throw and catch an exception through a large number of +// stack frames. The number (1022) is chosen to force emission of multiple +// unwind info second-level pages. + +static void f_0() { throw 42; } +static void f_1() { try { f_0(); } catch (...) { throw; } } +static void f_2() { try { f_1(); } catch (...) { throw; } } +static void f_3() { try { f_2(); } catch (...) { throw; } } +static void f_4() { try { f_3(); } catch (...) { throw; } } +static void f_5() { try { f_4(); } catch (...) { throw; } } +static void f_6() { try { f_5(); } catch (...) { throw; } } +static void f_7() { try { f_6(); } catch (...) { throw; } } +static void f_8() { try { f_7(); } catch (...) { throw; } } +static void f_9() { try { f_8(); } catch (...) { throw; } } +static void f_10() { try { f_9(); } catch (...) { throw; } } +static void f_11() { try { f_10(); } catch (...) { throw; } } +static void f_12() { try { f_11(); } catch (...) { throw; } } +static void f_13() { try { f_12(); } catch (...) { throw; } } +static void f_14() { try { f_13(); } catch (...) { throw; } } +static void f_15() { try { f_14(); } catch (...) { throw; } } +static void f_16() { try { f_15(); } catch (...) { throw; } } +static void f_17() { try { f_16(); } catch (...) { throw; } } +static void f_18() { try { f_17(); } catch (...) { throw; } } +static void f_19() { try { f_18(); } catch (...) { throw; } } +static void f_20() { try { f_19(); } catch (...) { throw; } } +static void f_21() { try { f_20(); } catch (...) { throw; } } +static void f_22() { try { f_21(); } catch (...) { throw; } } +static void f_23() { try { f_22(); } catch (...) { throw; } } +static void f_24() { try { f_23(); } catch (...) { throw; } } +static void f_25() { try { f_24(); } catch (...) { throw; } } +static void f_26() { try { f_25(); } catch (...) { throw; } } +static void f_27() { try { f_26(); } catch (...) { throw; } } +static void f_28() { try { f_27(); } catch (...) { throw; } } +static void f_29() { try { f_28(); } catch (...) { throw; } } +static void f_30() { try { f_29(); } catch (...) { throw; } } +static void f_31() { try { f_30(); } catch (...) { throw; } } +static void f_32() { try { f_31(); } catch (...) { throw; } } +static void f_33() { try { f_32(); } catch (...) { throw; } } +static void f_34() { try { f_33(); } catch (...) { throw; } } +static void f_35() { try { f_34(); } catch (...) { throw; } } +static void f_36() { try { f_35(); } catch (...) { throw; } } +static void f_37() { try { f_36(); } catch (...) { throw; } } +static void f_38() { try { f_37(); } catch (...) { throw; } } +static void f_39() { try { f_38(); } catch (...) { throw; } } +static void f_40() { try { f_39(); } catch (...) { throw; } } +static void f_41() { try { f_40(); } catch (...) { throw; } } +static void f_42() { try { f_41(); } catch (...) { throw; } } +static void f_43() { try { f_42(); } catch (...) { throw; } } +static void f_44() { try { f_43(); } catch (...) { throw; } } +static void f_45() { try { f_44(); } catch (...) { throw; } } +static void f_46() { try { f_45(); } catch (...) { throw; } } +static void f_47() { try { f_46(); } catch (...)
[llvm-branch-commits] [compiler-rt] 50c4c2b - Re-reapply "[ORC] Enable JIT support for the compact-unwind..." with fixes.
Author: Lang Hames Date: 2025-02-08T16:19:52Z New Revision: 50c4c2bf6802da5eb47606de1cea89ddc60bf14b URL: https://github.com/llvm/llvm-project/commit/50c4c2bf6802da5eb47606de1cea89ddc60bf14b DIFF: https://github.com/llvm/llvm-project/commit/50c4c2bf6802da5eb47606de1cea89ddc60bf14b.diff LOG: Re-reapply "[ORC] Enable JIT support for the compact-unwind..." with fixes. Re-enables compact-unwind support in JITLink, which was reverted in b04847b427d due to buildbot failures. The underlying cause for the failures on the buildbots was the lack of compact-unwind registration support on older Darwin OSes. Since the CompactUnwindManager pass now removes eh-frames by default we were left with unwind-info that could not be registered. On x86-64, where eh-frame info is produced by default the solution is to fall back to using eh-frames. On arm64 we simply can't support exceptions on older OSes. This patch updates the EHFrameRegistrationPlugin to remove the compact-unwind section (__LD,__compact_unwind) when installed, forcing use of eh-frames when the EHFrameRegistrationPlugin is used. In LLJIT, the EHFrameRegistrationPlugin continues to be used for all non-Darwin platform, and will be added on Darwin platforms when the a CompactUnwindRegistrationPlugin instance can't be created (e.g. due to missing support for compact-unwind info registration). The lit.cfg.py script is updated to check whether the host OSes default unwind info supports JIT registration, allowing tests to be disabled for older Darwin OSes on arm64. (cherry picked from commit eae6d6d18bd4d9e7dfe5fc1206d23d8ef663c8c7) Added: compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions.cpp llvm/include/llvm/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.h llvm/include/llvm/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.h llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.cpp llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h llvm/lib/ExecutionEngine/Orc/TargetProcess/UnwindInfoManager.cpp llvm/lib/ExecutionEngine/Orc/UnwindInfoRegistrationPlugin.cpp Modified: clang/test/Interpreter/simple-exception.cpp compiler-rt/lib/orc/macho_platform.cpp llvm/include/llvm/ExecutionEngine/Orc/Core.h llvm/include/llvm/ExecutionEngine/Orc/ExecutorProcessControl.h llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h llvm/include/llvm/ExecutionEngine/Orc/Shared/OrcRTBridge.h llvm/lib/ExecutionEngine/JITLink/CMakeLists.txt llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp llvm/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h llvm/lib/ExecutionEngine/JITLink/MachO_arm64.cpp llvm/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp llvm/lib/ExecutionEngine/Orc/CMakeLists.txt llvm/lib/ExecutionEngine/Orc/CompileUtils.cpp llvm/lib/ExecutionEngine/Orc/Core.cpp llvm/lib/ExecutionEngine/Orc/EHFrameRegistrationPlugin.cpp llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp llvm/lib/ExecutionEngine/Orc/LLJIT.cpp llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp llvm/lib/ExecutionEngine/Orc/Shared/OrcRTBridge.cpp llvm/lib/ExecutionEngine/Orc/TargetProcess/CMakeLists.txt llvm/test/ExecutionEngine/Orc/minimal-throw-catch.ll llvm/test/ExecutionEngine/OrcLazy/minimal-throw-catch.ll llvm/test/lit.cfg.py Removed: diff --git a/clang/test/Interpreter/simple-exception.cpp b/clang/test/Interpreter/simple-exception.cpp index 6749acd6e6bd23b..651e8d9402f89ee 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 and arm64, or running on Windows. -// XFAIL: target=arm{{.*}}, system-windows +// XFAIL for arm, or running on Windows. +// XFAIL: target=arm-{{.*}}, target=armv{{.*}}, 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 8ca68587aeb363f..4b603fd95e3163d 100644 --- a/compiler-rt/lib/orc/macho_platform.cpp +++ b/compiler-rt/lib/orc/macho_platform.cpp @@ -557,6 +557,12 @@ Error MachOPlatformRuntimeState::registerObjectPlatformSections( return make_error(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 new file mode 100644 index 000..7e9c40c724aec6c --- /dev/null
[llvm-branch-commits] [llvm] c7e085c - [ORC] Add ExecutionSession convenience methods to access bootstrap values.
Author: Lang Hames Date: 2025-02-08T16:19:55Z New Revision: c7e085c5d32def57fffd292174a052bff6d6a241 URL: https://github.com/llvm/llvm-project/commit/c7e085c5d32def57fffd292174a052bff6d6a241 DIFF: https://github.com/llvm/llvm-project/commit/c7e085c5d32def57fffd292174a052bff6d6a241.diff LOG: [ORC] Add ExecutionSession convenience methods to access bootstrap values. The getBootstrapMap, getBootstrapMapValue, getBootstrapSymbolsMap, and getBootstrapSymbols methods forward to their respective counterparts in ExecutorProcessControl, similar to the callWrapper functions. These methods will be used to simplify an upcoming patch that accesses the bootstrap values. (cherry picked from commit 63bb4ba84a22279c1cdd4953f0c19269b23a9d32) Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/Core.h Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Core.h b/llvm/include/llvm/ExecutionEngine/Orc/Core.h index 3eddaf4c9c59ff4..cecb4094c9a5717 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Core.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Core.h @@ -1556,6 +1556,30 @@ class ExecutionSession { EPC->getDispatcher().dispatch(std::move(T)); } + /// Returns the bootstrap map. + const StringMap> &getBootstrapMap() const { +return EPC->getBootstrapMap(); + } + + /// Look up and SPS-deserialize a bootstrap map value. + template + Error getBootstrapMapValue(StringRef Key, std::optional &Val) const { +return EPC->getBootstrapMapValue(Key, Val); + } + + /// Returns the bootstrap symbol map. + const StringMap &getBootstrapSymbolsMap() const { +return EPC->getBootstrapSymbolsMap(); + } + + /// For each (ExecutorAddr&, StringRef) pair, looks up the string in the + /// bootstrap symbols map and writes its address to the ExecutorAddr if + /// found. If any symbol is not found then the function returns an error. + Error getBootstrapSymbols( + ArrayRef> Pairs) const { +return EPC->getBootstrapSymbols(Pairs); + } + /// Run a wrapper function in the executor. /// /// The wrapper function should be callable as: ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [compiler-rt] a9b4976 - [ORC-RT] Use templates to express deeply nested function calls in testcase.
Author: Lang Hames Date: 2025-02-08T16:19:54Z New Revision: a9b497606405d6f88fc7949f27c275f0cec486aa URL: https://github.com/llvm/llvm-project/commit/a9b497606405d6f88fc7949f27c275f0cec486aa DIFF: https://github.com/llvm/llvm-project/commit/a9b497606405d6f88fc7949f27c275f0cec486aa.diff LOG: [ORC-RT] Use templates to express deeply nested function calls in testcase. Makes this test smaller and more readable. (cherry picked from commit e00f824e9a5ea73830bd346115968fa9ace84cbf) Added: Modified: compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp Removed: diff --git a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp index f7a39a9dccd6fcb..245afa084f5c0ea 100644 --- a/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp +++ b/compiler-rt/test/orc/TestCases/Darwin/Generic/exceptions-stress-test-tower.cpp @@ -7,1030 +7,15 @@ // stack frames. The number (1022) is chosen to force emission of multiple // unwind info second-level pages. -static void f_0() { throw 42; } -static void f_1() { try { f_0(); } catch (...) { throw; } } -static void f_2() { try { f_1(); } catch (...) { throw; } } -static void f_3() { try { f_2(); } catch (...) { throw; } } -static void f_4() { try { f_3(); } catch (...) { throw; } } -static void f_5() { try { f_4(); } catch (...) { throw; } } -static void f_6() { try { f_5(); } catch (...) { throw; } } -static void f_7() { try { f_6(); } catch (...) { throw; } } -static void f_8() { try { f_7(); } catch (...) { throw; } } -static void f_9() { try { f_8(); } catch (...) { throw; } } -static void f_10() { try { f_9(); } catch (...) { throw; } } -static void f_11() { try { f_10(); } catch (...) { throw; } } -static void f_12() { try { f_11(); } catch (...) { throw; } } -static void f_13() { try { f_12(); } catch (...) { throw; } } -static void f_14() { try { f_13(); } catch (...) { throw; } } -static void f_15() { try { f_14(); } catch (...) { throw; } } -static void f_16() { try { f_15(); } catch (...) { throw; } } -static void f_17() { try { f_16(); } catch (...) { throw; } } -static void f_18() { try { f_17(); } catch (...) { throw; } } -static void f_19() { try { f_18(); } catch (...) { throw; } } -static void f_20() { try { f_19(); } catch (...) { throw; } } -static void f_21() { try { f_20(); } catch (...) { throw; } } -static void f_22() { try { f_21(); } catch (...) { throw; } } -static void f_23() { try { f_22(); } catch (...) { throw; } } -static void f_24() { try { f_23(); } catch (...) { throw; } } -static void f_25() { try { f_24(); } catch (...) { throw; } } -static void f_26() { try { f_25(); } catch (...) { throw; } } -static void f_27() { try { f_26(); } catch (...) { throw; } } -static void f_28() { try { f_27(); } catch (...) { throw; } } -static void f_29() { try { f_28(); } catch (...) { throw; } } -static void f_30() { try { f_29(); } catch (...) { throw; } } -static void f_31() { try { f_30(); } catch (...) { throw; } } -static void f_32() { try { f_31(); } catch (...) { throw; } } -static void f_33() { try { f_32(); } catch (...) { throw; } } -static void f_34() { try { f_33(); } catch (...) { throw; } } -static void f_35() { try { f_34(); } catch (...) { throw; } } -static void f_36() { try { f_35(); } catch (...) { throw; } } -static void f_37() { try { f_36(); } catch (...) { throw; } } -static void f_38() { try { f_37(); } catch (...) { throw; } } -static void f_39() { try { f_38(); } catch (...) { throw; } } -static void f_40() { try { f_39(); } catch (...) { throw; } } -static void f_41() { try { f_40(); } catch (...) { throw; } } -static void f_42() { try { f_41(); } catch (...) { throw; } } -static void f_43() { try { f_42(); } catch (...) { throw; } } -static void f_44() { try { f_43(); } catch (...) { throw; } } -static void f_45() { try { f_44(); } catch (...) { throw; } } -static void f_46() { try { f_45(); } catch (...) { throw; } } -static void f_47() { try { f_46(); } catch (...) { throw; } } -static void f_48() { try { f_47(); } catch (...) { throw; } } -static void f_49() { try { f_48(); } catch (...) { throw; } } -static void f_50() { try { f_49(); } catch (...) { throw; } } -static void f_51() { try { f_50(); } catch (...) { throw; } } -static void f_52() { try { f_51(); } catch (...) { throw; } } -static void f_53() { try { f_52(); } catch (...) { throw; } } -static void f_54() { try { f_53(); } catch (...) { throw; } } -static void f_55() { try { f_54(); } catch (...) { throw; } } -static void f_56() { try { f_55(); } catch (...) { throw; } } -static void f_57() { try { f_56(); } catch (...) { throw; } } -static void f_58() { try { f_57(); } catch (...) { throw; } } -static void f_59() { try { f_58(); } catch (...) { throw; } } -static void f_60() { try { f_59(); } catch
[llvm-branch-commits] [llvm] 975fa93 - [JITLink] Add a jitlink::Symbol::getSection() convenience method.
Author: Lang Hames Date: 2025-02-08T16:19:53Z New Revision: 975fa93b5f3715215ac2c4c74e86f466349bc0de URL: https://github.com/llvm/llvm-project/commit/975fa93b5f3715215ac2c4c74e86f466349bc0de DIFF: https://github.com/llvm/llvm-project/commit/975fa93b5f3715215ac2c4c74e86f466349bc0de.diff LOG: [JITLink] Add a jitlink::Symbol::getSection() convenience method. `Sym.getSection()` is equivalent to `Sym.getBlock().getSection()`. (cherry picked from commit 4a2a8ed70da7ec44f0aa9092595e5b0f81a7e841) Added: Modified: llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h llvm/lib/ExecutionEngine/JITLink/JITLink.cpp llvm/lib/ExecutionEngine/JITLink/JITLinkGeneric.h llvm/lib/ExecutionEngine/JITLink/aarch32.cpp llvm/lib/ExecutionEngine/Orc/Debugging/PerfSupportPlugin.cpp llvm/lib/ExecutionEngine/Orc/Debugging/VTuneSupportPlugin.cpp llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp llvm/unittests/ExecutionEngine/JITLink/LinkGraphTests.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index 297e603164b2440..8f0dfea0c97ac0d 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -587,6 +587,9 @@ class Symbol { return static_cast(*Base); } + /// Return the Section for this Symbol (Symbol must be defined). + Section &getSection() const { return getBlock().getSection(); } + /// Returns the offset for this symbol within the underlying addressable. orc::ExecutorAddrDiff getOffset() const { return Offset; } @@ -1460,7 +1463,7 @@ class LinkGraph { A.setAddress(orc::ExecutorAddr()); } else { assert(Sym.isDefined() && "Sym is not a defined symbol"); - Section &Sec = Sym.getBlock().getSection(); + Section &Sec = Sym.getSection(); Sec.removeSymbol(Sym); Sym.makeExternal(createAddressable(orc::ExecutorAddr(), false)); } @@ -1488,7 +1491,7 @@ class LinkGraph { Sym.setScope(Scope::Local); } else { assert(Sym.isDefined() && "Sym is not a defined symbol"); - Section &Sec = Sym.getBlock().getSection(); + Section &Sec = Sym.getSection(); Sec.removeSymbol(Sym); Sym.makeAbsolute(createAddressable(Address)); } @@ -1534,7 +1537,7 @@ class LinkGraph { transferDefinedSymbol(Symbol &Sym, Block &DestBlock, orc::ExecutorAddrDiff NewOffset, std::optional ExplicitNewSize) { -auto &OldSection = Sym.getBlock().getSection(); +auto &OldSection = Sym.getSection(); Sym.setBlock(DestBlock); Sym.setOffset(NewOffset); if (ExplicitNewSize) @@ -1622,7 +1625,7 @@ class LinkGraph { /// Removes defined symbols. Does not remove the underlying block. void removeDefinedSymbol(Symbol &Sym) { assert(Sym.isDefined() && "Sym is not a defined symbol"); -Sym.getBlock().getSection().removeSymbol(Sym); +Sym.getSection().removeSymbol(Sym); destroySymbol(Sym); } diff --git a/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp b/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp index 151f1b337087d12..8ceb08051e423e1 100644 --- a/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/COFF_x86_64.cpp @@ -221,8 +221,7 @@ class COFFLinkGraphLowering_x86_64 { } case EdgeKind_coff_x86_64::SecRel32: { E.setAddend(E.getAddend() - - getSectionStart(E.getTarget().getBlock().getSection()) - .getValue()); + getSectionStart(E.getTarget().getSection()).getValue()); E.setKind(x86_64::Pointer32); break; } diff --git a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h b/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h index a2c0c13cdbf66b9..c306264b6da5d26 100644 --- a/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h +++ b/llvm/lib/ExecutionEngine/JITLink/CompactUnwindSupport.h @@ -155,7 +155,7 @@ template class CompactUnwindManager { Edge *KeepAliveEdge = nullptr; for (auto &E : Fn.getBlock().edges_at(0)) { if (E.getKind() == Edge::KeepAlive && E.getTarget().isDefined() && - &E.getTarget().getBlock().getSection() == EHFrameSec) { + &E.getTarget().getSection() == EHFrameSec) { KeepAliveEdge = &E; break; } diff --git a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp index 6b77330bb764b34..e8ce9b2b9527d45 100644 --- a/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp +++ b/llvm/lib/ExecutionEngine/JITLink/JITLink.cpp @@ -424,7 +424,7 @@ Error makeTargetOutOfRangeError(const LinkG
[llvm-branch-commits] [llvm] 1ba8799 - [ORC] Add a FIXME. NFC.
Author: Lang Hames Date: 2025-02-08T16:19:54Z New Revision: 1ba879965ff84ed4ef13b98b4144e23681a04d79 URL: https://github.com/llvm/llvm-project/commit/1ba879965ff84ed4ef13b98b4144e23681a04d79 DIFF: https://github.com/llvm/llvm-project/commit/1ba879965ff84ed4ef13b98b4144e23681a04d79.diff LOG: [ORC] Add a FIXME. NFC. (cherry picked from commit 7811c20bcd9d5b117a9543d74c71448fe9970fe6) Added: Modified: llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp Removed: diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp index b51fa24be76d1a1..a9dbcd166117b0c 100644 --- a/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ExecutorProcessControl.cpp @@ -55,6 +55,9 @@ SelfExecutorProcessControl::SelfExecutorProcessControl( ExecutorAddr::fromPtr(&llvm_orc_deregisterEHFrameSectionWrapper); #ifdef __APPLE__ + // FIXME: Don't add an UnwindInfoManager by default -- it's redundant when + //the ORC runtime is loaded. We'll need a way to document this and + //allow clients to choose. this->UnwindInfoMgr = UnwindInfoManager::TryCreate(); if (this->UnwindInfoMgr) this->UnwindInfoMgr->addBootstrapSymbols(this->BootstrapSymbols); ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] b3876b6 - [JITLink] Add missing testcase for compact-unwind-needs-dwarf.
Author: Lang Hames Date: 2025-02-08T16:19:54Z New Revision: b3876b698d0a7b4c2c61f94fc2d0877a7dfd8e20 URL: https://github.com/llvm/llvm-project/commit/b3876b698d0a7b4c2c61f94fc2d0877a7dfd8e20 DIFF: https://github.com/llvm/llvm-project/commit/b3876b698d0a7b4c2c61f94fc2d0877a7dfd8e20.diff LOG: [JITLink] Add missing testcase for compact-unwind-needs-dwarf. This testcase was accidentally left out of 9d88ffe7f7b. (cherry picked from commit 7a213e70eb24e621042f2fda043622048cb1f1df) Added: llvm/test/ExecutionEngine/Orc/throw-catch-no-frame-pointer.ll Modified: Removed: diff --git a/llvm/test/ExecutionEngine/Orc/throw-catch-no-frame-pointer.ll b/llvm/test/ExecutionEngine/Orc/throw-catch-no-frame-pointer.ll new file mode 100644 index 000..8032e71ad2f35c3 --- /dev/null +++ b/llvm/test/ExecutionEngine/Orc/throw-catch-no-frame-pointer.ll @@ -0,0 +1,51 @@ +; REQUIRES: system-darwin && host-unwind-supports-jit +; RUN: lli -jit-kind=orc %s +; +; Check that we can throw exceptions from no-fp functions. On systems that +; support compact-unwind this implicitly tests that we correctly handle +; unwind-info records that depend on DWARF FDEs. + +@_ZTIi = external constant ptr + +declare ptr @__cxa_allocate_exception(i64) +declare void @__cxa_throw(ptr, ptr, ptr) +declare ptr @__cxa_begin_catch(ptr) +declare void @__cxa_end_catch() +declare i32 @__gxx_personality_v0(...) +declare i32 @llvm.eh.typeid.for.p0(ptr) + +define void @_Z3foov() "frame-pointer"="none" { +entry: + %exception = tail call ptr @__cxa_allocate_exception(i64 4) + store i32 42, ptr %exception + tail call void @__cxa_throw(ptr %exception, ptr nonnull @_ZTIi, ptr null) + unreachable +} + +define i32 @main(i32 %argc, ptr %argv) "frame-pointer"="all" personality ptr @__gxx_personality_v0 { +entry: + invoke void @_Z3foov() + to label %return.unreachable unwind label %lpad + +lpad: + %0 = landingpad { ptr, i32 } + catch ptr @_ZTIi + %1 = extractvalue { ptr, i32 } %0, 1 + %2 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTIi) + %matches = icmp eq i32 %1, %2 + br i1 %matches, label %catch, label %eh.resume + +catch: + %3 = extractvalue { ptr, i32 } %0, 0 + %4 = tail call ptr @__cxa_begin_catch(ptr %3) + %5 = load i32, ptr %4 + %sub = sub nsw i32 42, %5 + tail call void @__cxa_end_catch() + ret i32 %sub + +return.unreachable: + unreachable + +eh.resume: + resume { ptr, i32 } %0 +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [ELF] Refine isExported/isPreemptible condition (PR #125334)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/125334 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [lld] release/20.x: [ELF] Refine isExported/isPreemptible condition (PR #125334)
tstellar wrote: I'm going to close this PR for now. We can open a new one when it's re-applied to main. https://github.com/llvm/llvm-project/pull/125334 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [Mips] Use getSignedConstant() in or combine (PR #126083)
github-actions[bot] wrote: @nikic (or anyone else). If you would like to add a note about this fix in the release notes (completely optional). Please reply to this comment with a one or two sentence description of the fix. When you are done, please add the release:note label to this PR. https://github.com/llvm/llvm-project/pull/126083 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [Mips] Use getSignedConstant() in or combine (PR #126083)
https://github.com/llvmbot updated https://github.com/llvm/llvm-project/pull/126083 >From 75e20e0b801ef754c17eec8d0231d23cf8f17aed Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 6 Feb 2025 16:27:10 +0100 Subject: [PATCH] [Mips] Use getSignedConstant() in or combine Fixes https://github.com/llvm/llvm-project/issues/125954. (cherry picked from commit 88b1d16c4a040cc3d919be13f0baf44f30a5aa13) --- llvm/lib/Target/Mips/MipsISelLowering.cpp | 2 +- llvm/test/CodeGen/Mips/dins.ll| 53 +++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 7c4257c222c0baa..85e05bc1b129a72 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -1004,7 +1004,7 @@ static SDValue performORCombine(SDNode *N, SelectionDAG &DAG, return DAG.getNode( MipsISD::Ins, DL, N->getValueType(0), isConstCase - ? DAG.getConstant(CN1->getSExtValue() >> SMPos0, DL, ValTy) + ? DAG.getSignedConstant(CN1->getSExtValue() >> SMPos0, DL, ValTy) : SrlX, DAG.getConstant(SMPos0, DL, MVT::i32), DAG.getConstant(ValTy.getSizeInBits() / 8 < 8 ? SMSize0 & 31 diff --git a/llvm/test/CodeGen/Mips/dins.ll b/llvm/test/CodeGen/Mips/dins.ll index cdb8f419eb2be12..2e9816e7d364253 100644 --- a/llvm/test/CodeGen/Mips/dins.ll +++ b/llvm/test/CodeGen/Mips/dins.ll @@ -304,3 +304,56 @@ entry: store volatile i32 %or, ptr %x.addr, align 4 ret i32 %and } + +define i32 @pr125954(i32 %arg, i1 %c) { +; MIPS64R2-LABEL: pr125954: +; MIPS64R2: # %bb.0: +; MIPS64R2-NEXT:sll $1, $4, 0 +; MIPS64R2-NEXT:addiu $2, $zero, -1 +; MIPS64R2-NEXT:move $3, $1 +; MIPS64R2-NEXT:ins $3, $2, 8, 24 +; MIPS64R2-NEXT:andi $2, $1, 255 +; MIPS64R2-NEXT:sll $1, $5, 0 +; MIPS64R2-NEXT:andi $1, $1, 1 +; MIPS64R2-NEXT:jr $ra +; MIPS64R2-NEXT:movn $2, $3, $1 +; +; MIPS32R2-LABEL: pr125954: +; MIPS32R2: # %bb.0: +; MIPS32R2-NEXT:andi $2, $4, 255 +; MIPS32R2-NEXT:addiu $1, $zero, -256 +; MIPS32R2-NEXT:or $1, $2, $1 +; MIPS32R2-NEXT:andi $3, $5, 1 +; MIPS32R2-NEXT:jr $ra +; MIPS32R2-NEXT:movn $2, $1, $3 +; +; MIPS16-LABEL: pr125954: +; MIPS16: # %bb.0: +; MIPS16-NEXT:li $6, 1 +; MIPS16-NEXT:and $6, $5 +; MIPS16-NEXT:li $2, 255 +; MIPS16-NEXT:and $2, $4 +; MIPS16-NEXT:move $3, $zero +; MIPS16-NEXT:beqz $6, $BB2_2 # 16 bit inst +; MIPS16-NEXT: # %bb.1: +; MIPS16-NEXT:addiu $3, -256 +; MIPS16-NEXT:or $2, $3 +; MIPS16-NEXT: $BB2_2: +; MIPS16-NEXT:jrc $ra +; +; MIPS64R2N32-LABEL: pr125954: +; MIPS64R2N32: # %bb.0: +; MIPS64R2N32-NEXT:sll $1, $4, 0 +; MIPS64R2N32-NEXT:addiu $2, $zero, -1 +; MIPS64R2N32-NEXT:move $3, $1 +; MIPS64R2N32-NEXT:ins $3, $2, 8, 24 +; MIPS64R2N32-NEXT:andi $2, $1, 255 +; MIPS64R2N32-NEXT:sll $1, $5, 0 +; MIPS64R2N32-NEXT:andi $1, $1, 1 +; MIPS64R2N32-NEXT:jr $ra +; MIPS64R2N32-NEXT:movn $2, $3, $1 + %and = and i32 %arg, 255 + %or = or i32 %and, -256 + %sel = select i1 %c, i32 %or, i32 %and + ret i32 %sel +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 75e20e0 - [Mips] Use getSignedConstant() in or combine
Author: Nikita Popov Date: 2025-02-08T14:01:40-08:00 New Revision: 75e20e0b801ef754c17eec8d0231d23cf8f17aed URL: https://github.com/llvm/llvm-project/commit/75e20e0b801ef754c17eec8d0231d23cf8f17aed DIFF: https://github.com/llvm/llvm-project/commit/75e20e0b801ef754c17eec8d0231d23cf8f17aed.diff LOG: [Mips] Use getSignedConstant() in or combine Fixes https://github.com/llvm/llvm-project/issues/125954. (cherry picked from commit 88b1d16c4a040cc3d919be13f0baf44f30a5aa13) Added: Modified: llvm/lib/Target/Mips/MipsISelLowering.cpp llvm/test/CodeGen/Mips/dins.ll Removed: diff --git a/llvm/lib/Target/Mips/MipsISelLowering.cpp b/llvm/lib/Target/Mips/MipsISelLowering.cpp index 7c4257c222c0baa..85e05bc1b129a72 100644 --- a/llvm/lib/Target/Mips/MipsISelLowering.cpp +++ b/llvm/lib/Target/Mips/MipsISelLowering.cpp @@ -1004,7 +1004,7 @@ static SDValue performORCombine(SDNode *N, SelectionDAG &DAG, return DAG.getNode( MipsISD::Ins, DL, N->getValueType(0), isConstCase - ? DAG.getConstant(CN1->getSExtValue() >> SMPos0, DL, ValTy) + ? DAG.getSignedConstant(CN1->getSExtValue() >> SMPos0, DL, ValTy) : SrlX, DAG.getConstant(SMPos0, DL, MVT::i32), DAG.getConstant(ValTy.getSizeInBits() / 8 < 8 ? SMSize0 & 31 diff --git a/llvm/test/CodeGen/Mips/dins.ll b/llvm/test/CodeGen/Mips/dins.ll index cdb8f419eb2be12..2e9816e7d364253 100644 --- a/llvm/test/CodeGen/Mips/dins.ll +++ b/llvm/test/CodeGen/Mips/dins.ll @@ -304,3 +304,56 @@ entry: store volatile i32 %or, ptr %x.addr, align 4 ret i32 %and } + +define i32 @pr125954(i32 %arg, i1 %c) { +; MIPS64R2-LABEL: pr125954: +; MIPS64R2: # %bb.0: +; MIPS64R2-NEXT:sll $1, $4, 0 +; MIPS64R2-NEXT:addiu $2, $zero, -1 +; MIPS64R2-NEXT:move $3, $1 +; MIPS64R2-NEXT:ins $3, $2, 8, 24 +; MIPS64R2-NEXT:andi $2, $1, 255 +; MIPS64R2-NEXT:sll $1, $5, 0 +; MIPS64R2-NEXT:andi $1, $1, 1 +; MIPS64R2-NEXT:jr $ra +; MIPS64R2-NEXT:movn $2, $3, $1 +; +; MIPS32R2-LABEL: pr125954: +; MIPS32R2: # %bb.0: +; MIPS32R2-NEXT:andi $2, $4, 255 +; MIPS32R2-NEXT:addiu $1, $zero, -256 +; MIPS32R2-NEXT:or $1, $2, $1 +; MIPS32R2-NEXT:andi $3, $5, 1 +; MIPS32R2-NEXT:jr $ra +; MIPS32R2-NEXT:movn $2, $1, $3 +; +; MIPS16-LABEL: pr125954: +; MIPS16: # %bb.0: +; MIPS16-NEXT:li $6, 1 +; MIPS16-NEXT:and $6, $5 +; MIPS16-NEXT:li $2, 255 +; MIPS16-NEXT:and $2, $4 +; MIPS16-NEXT:move $3, $zero +; MIPS16-NEXT:beqz $6, $BB2_2 # 16 bit inst +; MIPS16-NEXT: # %bb.1: +; MIPS16-NEXT:addiu $3, -256 +; MIPS16-NEXT:or $2, $3 +; MIPS16-NEXT: $BB2_2: +; MIPS16-NEXT:jrc $ra +; +; MIPS64R2N32-LABEL: pr125954: +; MIPS64R2N32: # %bb.0: +; MIPS64R2N32-NEXT:sll $1, $4, 0 +; MIPS64R2N32-NEXT:addiu $2, $zero, -1 +; MIPS64R2N32-NEXT:move $3, $1 +; MIPS64R2N32-NEXT:ins $3, $2, 8, 24 +; MIPS64R2N32-NEXT:andi $2, $1, 255 +; MIPS64R2N32-NEXT:sll $1, $5, 0 +; MIPS64R2N32-NEXT:andi $1, $1, 1 +; MIPS64R2N32-NEXT:jr $ra +; MIPS64R2N32-NEXT:movn $2, $3, $1 + %and = and i32 %arg, 255 + %or = or i32 %and, -256 + %sel = select i1 %c, i32 %or, i32 %and + ret i32 %sel +} ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] release/20.x: [Mips] Use getSignedConstant() in or combine (PR #126083)
https://github.com/tstellar closed https://github.com/llvm/llvm-project/pull/126083 ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
[llvm-branch-commits] [llvm] 4abac9f - [ORC] Drop 'Info' from MachOCompactUnwindInfoSectionName.
Author: Lang Hames Date: 2025-02-08T16:19:50Z New Revision: 4abac9fbfdcdf63c221ecdd83eadaa8f578b5d1e URL: https://github.com/llvm/llvm-project/commit/4abac9fbfdcdf63c221ecdd83eadaa8f578b5d1e DIFF: https://github.com/llvm/llvm-project/commit/4abac9fbfdcdf63c221ecdd83eadaa8f578b5d1e.diff LOG: [ORC] Drop 'Info' from MachOCompactUnwindInfoSectionName. Rename MachOCompactUnwindInfoSectionName to MachOCompactUnwindSectionName. Background: There are two related sections used for compact-unwind info processing: __LD,__compact_unwind -- the input table stored in relocatable object formats, and __TEXT,__unwind_info -- the compressed table produced by the linker and consumed by libunwind. To keep the distinction clear we'll use *CompactUnwind* for names that refer to the __LD,__compact_unwind input tables and *UnwindInfo* for names that refer to the __TEXT,__unwind_info output tables. Dropping 'Info' from the variable above clarifies which section it refers to. (cherry picked from commit a1ff2d18466bc27d3dc9b8bba688454e2a1cf196) Added: Modified: llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp Removed: diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h index b927dfbce992a0d..31d0ecca2080595 100644 --- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h +++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/MachOObjectFormat.h @@ -25,7 +25,7 @@ namespace orc { extern StringRef MachODataCommonSectionName; extern StringRef MachODataDataSectionName; extern StringRef MachOEHFrameSectionName; -extern StringRef MachOCompactUnwindInfoSectionName; +extern StringRef MachOCompactUnwindSectionName; extern StringRef MachOCStringSectionName; extern StringRef MachOModInitFuncSectionName; extern StringRef MachOObjCCatListSectionName; diff --git a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp index 48d54190fafb6ae..9479a69d4f0ba05 100644 --- a/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp +++ b/llvm/lib/ExecutionEngine/Orc/MachOPlatform.cpp @@ -1278,8 +1278,7 @@ MachOPlatform::MachOPlatformPlugin::findUnwindSectionInfo( if (Section *EHFrameSec = G.findSectionByName(MachOEHFrameSectionName)) ScanUnwindInfoSection(*EHFrameSec, US.DwarfSection); - if (Section *CUInfoSec = - G.findSectionByName(MachOCompactUnwindInfoSectionName)) + if (Section *CUInfoSec = G.findSectionByName(MachOCompactUnwindSectionName)) ScanUnwindInfoSection(*CUInfoSec, US.CompactUnwindSection); // If we didn't find any pointed-to code-blocks then there's no need to diff --git a/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp b/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp index 11e8eb7bc3a19b1..be92acd37aa8de3 100644 --- a/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp +++ b/llvm/lib/ExecutionEngine/Orc/Shared/MachOObjectFormat.cpp @@ -18,7 +18,7 @@ namespace orc { StringRef MachODataCommonSectionName = "__DATA,__common"; StringRef MachODataDataSectionName = "__DATA,__data"; StringRef MachOEHFrameSectionName = "__TEXT,__eh_frame"; -StringRef MachOCompactUnwindInfoSectionName = "__TEXT,__unwind_info"; +StringRef MachOCompactUnwindSectionName = "__TEXT,__unwind_info"; StringRef MachOCStringSectionName = "__TEXT,__cstring"; StringRef MachOModInitFuncSectionName = "__DATA,__mod_init_func"; StringRef MachOObjCCatListSectionName = "__DATA,__objc_catlist"; ___ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits