1. Nov 06, 2023
  2. Nov 05, 2023
    • Sam James's avatar
      [CMake] Fix __builtin_thread_pointer check with LTO · a54545ba
      Sam James authored
      With LTO, gcc's IPA passes might drop the foo() function and then the test
      will pass even on platforms where __builtin_thread_pointer is unavailable.
      
      On PPC64, we get this as a result:
      ```
      llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp:361:61: error: ‘__builtin_thread_pointer’ is not supported on this targ
      ```
      
      Just mark the function in the CMake configure test with the 'used' attribute to
      avoid it being optimised out. The test then behaves correctly with -flto.
      
      Tested with e.g. 'powerpc64le-linux-gnu-gcc -O2 -flto a.c'.
      
      Reported-by: matoro
      Reviewed-by: maskray
      Closes: https://github.com/llvm/llvm-project/pull/70968
      
      
      Signed-off-by: default avatarSam James <sam@gentoo.org>
      a54545ba
    • Louis Dionne's avatar
      [libc++] Bump the C++ Standard used to compile the dylib to C++23 (#66824) · 8a7846fe
      Louis Dionne authored
      This is necessary in order to implement some papers like P2467R1, which
      require using C++23 declarations in the dylib. It is a good habit to
      keep building the dylib with a recent standard version regardless.
      
      With this patch, we also stop strictly enforcing that the targets are
      built with C++23. Concretely, C++23 will soon be required in order to
      build the dylib, but not enforcing it strictly works around some issues
      like the documentation bots using an old and unsupported compiler. Since
      these bots do not actually build the library, not strictly enforcing the
      C++ Standard makes our CMake build more resilient to these kinds of
      situation. This is just a workaround though, the better way of going
      about would be to update the compiler on the documentation bot but we
      don't seem to have control over that.
      8a7846fe
    • Vlad Serebrennikov's avatar
      [clang][NFC] Refactor `CXXConstructExpr::ConstructionKind` · a9070f22
      Vlad Serebrennikov authored
      This patch converts `CXXConstructExpr::ConstructionKind` into a scoped enum in namespace scope, making it eligible for forward declaring. This is useful in cases like annotating bit-fields with `preferred_type`.
      a9070f22
    • Konstantin Varlamov's avatar
    • Vlad Serebrennikov's avatar
      [clang][NFC] Refactor `PredefinedExpr::IdentKind` · 6e35db06
      Vlad Serebrennikov authored
      This patch converts `PredefinedExpr::IdentKind` into a scoped enum in namespace scope, making it eligible for forward declaring. This is useful in certain contexts, such as `preferred_type` annotations on bit-fields.
      6e35db06
    • Nico Weber's avatar
      [gn] port c3a302d3 (SymbolLocator) more · 13956fd2
      Nico Weber authored
      I forgot that lldb/source/Plugins/CMakeLists.txt implicitly builds
      all enums via LLDB_ENUM_PLUGINS / Plugins.def.in.
      
      Now the GN build does this for the SymbolLocator plugins too.
      
      (Also fix some minor stuff now that they actually build.)
      13956fd2
    • Nico Weber's avatar
      [gn] port c3a302d3 (SymbolLocator) · 7c1ad51e
      Nico Weber authored
      This isn't referenced from anything yet, so no effect.
      (It's not referenced yet in CMake either from what I can tell.)
      7c1ad51e
    • Nico Weber's avatar
      [gn] port e7c61479 · 6d95c8cf
      Nico Weber authored
      6d95c8cf
    • Vlad Serebrennikov's avatar
      [clang][NFC] Refactor `CharacterLiteral::CharacterKind` · c23aaa41
      Vlad Serebrennikov authored
      This patch converts `CharacterLiteral::CharacterKind` to scoped enum in namespace scope. This enables forward declaration of this enum, which is useful in case like annotating bit-fields with `preferred_type`.
      c23aaa41
    • Vlad Serebrennikov's avatar
      [clang][NFC] Refactor `StringLiteral::StringKind` · 3e6ce587
      Vlad Serebrennikov authored
      This patch converts `StringLiteral::StringKind` to a scoped enum in namespace scope. This enabled forward-declarations of this enum where necessary, e.g. for `preferred_type` annotation for bit-fields.
      3e6ce587
    • Fangrui Song's avatar
      [ItaniumCXXABI] Add -fassume-nothrow-exception-dtor to assume that all... · c0a73918
      Fangrui Song authored
      [ItaniumCXXABI] Add -fassume-nothrow-exception-dtor to assume that all exception objects' destructors are non-throwing
      
      Link: https://lists.llvm.org/pipermail/cfe-dev/2021-August/068740.html ("[Exception Handling] Could we mark __cxa_end_catch as nounwind conditionally?"
      Link: https://github.com/llvm/llvm-project/issues/57375
      
      A catch handler calls `__cxa_begin_catch` and `__cxa_end_catch`. For a catch-all
      clause or a catch clause matching a record type, we:
      
      * assume that the exception object may have a throwing destructor
      * emit `invoke void @__cxa_end_catch` (as the call is not marked as the `nounwind` attribute).
      * emit a landing pad to destroy local variables and call `_Unwind_Resume`
      
      ```
      struct A { ~A(); };
      struct B { int x; };
      void opaque();
      void foo() {
        A a;
        try { opaque(); } catch (...) { } // the exception object has an unknown type and may throw
        try { opaque(); } catch (B b) { } // B::~B is nothrow, but we do not utilize this
      }
      ```
      
      Per C++ [dcl.fct.def.coroutine], a coroutine's function body implies a `catch (...)`.
      Our code generation pessimizes even simple code, like:
      ```
      UserFacing foo() {
        A a;
        opaque();
        co_return;
        // For `invoke void @__cxa_end_catch()`, the landing pad destroys the
        // promise_type and deletes the coro frame.
      }
      ```
      
      Throwing destructors are typically discouraged. In many environments, the
      destructors of exception objects are guaranteed to never throw, making our
      conservative code generation approach seem wasteful.
      
      Furthermore, throwing destructors tend not to work well in practice:
      
      * GCC does not emit call site records for the region containing `__cxa_end_catch`. This has been a long time, since 2000.
      * If a catch-all clause catches an exception object that throws, both GCC and Clang using libstdc++ leak the allocated exception object.
      
      To avoid code generation pessimization, add an opt-in driver option
      -fassume-nothrow-exception-dtor to assume that `__cxa_end_catch` calls have the
      `nounwind` attribute. This implies that thrown exception objects' destructors
      will never throw.
      
      To detect misuses, diagnose throw expressions with a potentially-throwing
      destructor. Technically, it is possible that a potentially-throwing destructor
      never throws when called transitively by `__cxa_end_catch`, but these cases seem
      rare enough to justify a relaxed mode.
      
      Reviewed By: ChuanqiXu
      
      Differential Revision: https://reviews.llvm.org/D108905
      c0a73918
    • Timm Baeder's avatar
      a9af8f88
    • Craig Topper's avatar
      [RISCV][GISel] Fix incorrect call to getGlobalAddress in selectGlobalValue. · 39edac23
      Craig Topper authored
      RISCVII::MO_HI was being passed to the offset argument instead of
      the flags argument.
      
      Adjust some other calls to not pass an explicit 0 to the offset argument
      since it already has a default value of 0.
      39edac23
    • Craig Topper's avatar
      [RISCV][GISel] Use ArrayRef version of buildInstr to reduce code. NFC · d0f6825d
      Craig Topper authored
      Avoids the need for explicit addDef and addReg.
      d0f6825d
    • Xiang Li's avatar
      [mlir][spirv][cf] legalize block arguments when convert cf to spirv (#71288) · c8bc72dc
      Xiang Li authored
      When converting branches, legalize target block arguments first.
      
      Fixes llvm#70813
      c8bc72dc