1. Jan 13, 2023
    • Johannes Doerfert's avatar
      [Attributor] Disable breaking tests to unblock bots · 9e08b083
      Johannes Doerfert authored
      The tests will be re-enabled asap as a fix is available.
      9e08b083
    • Adrian Dole's avatar
      Add -Wreturn-local-addr, GCC alias for -Wreturn-stack-address · 8effeb44
      Adrian Dole authored
      For warning compatibility with GCC.
      
      Reviewed By: cjdb
      
      Differential Revision: https://reviews.llvm.org/D139570
      8effeb44
    • Jake Egan's avatar
      [AIX][NFC] Unsupport test when running on AIX · 824874c8
      Jake Egan authored
      Previously the test's targets were restricted to avoid the AIX target, but
      it should be marked unsupported for system-aix instead because the test
      fails to run on AIX as well.
      824874c8
    • David Green's avatar
      [AArch64] Add an error if SVE scalable vector types are used in a context without sve · 753aca0a
      David Green authored
      This adds an error message if the isSVESizelessBuiltinType like
      __SVFloat32_t / __SVInt64_t / etc, which provide the backing for the
      svfloat32_t / svint64_t / etc ACLE types, are used in a function without
      SVE. The alternative is a crash in the backend, which is not capable of
      handling scalable vector types.
      
      When SVE is available, either through a -march=..+sve option or via a
      target(sve) attribute, nothing should change. Without the sve feature,
      this patch gives an error for any function arguments, return values and
      variable declarations involving the scalable types. Struct/class members
      and global variables already give an error. As this can be based on the
      current function target attributes, the error sometimes needs to be
      handled later than would otherwise if it was just based on the global
      target.
      
      Differential Revision: https://reviews.llvm.org/D131058
      753aca0a
    • Jonas Devlieghere's avatar
      [lldb] Limit `nothreadallow` to Python in SWIG bindings · ba35c27e
      Jonas Devlieghere authored
      SWIG allows you to partially disable thread support for a given function
      in Python with `nothreadallow`. This functionality is limited to Python,
      but until SWIG 4.1, it would silently ignore this for other languages,
      such as Lua. New versions of SWIG are more strict and therefore we need
      to guard this with `SWIGPYTHON`.
      
      For more details on the functionality, I recommend reading the commit
      message from 070a1d56.
      ba35c27e
    • Slava Zakharin's avatar
      [mlir][llvmir] Cleaned up MetadataOp. · 19992b1d
      Slava Zakharin authored
      Added NoTerminator trait, and created a single builder
      that adds a block into the region at operation construction.
      Added custom assembly parser that automatically adds the body
      block, when the region appears to be empty to parseRegion().
      
      Differential Revision: https://reviews.llvm.org/D141160
      19992b1d
    • Matt Arsenault's avatar
      clang: Fix excessively strict test requirements · edbfc10b
      Matt Arsenault authored
      At most this requires x86 as it's used in the run lines, it
      doesn't require a linux host.
      edbfc10b
    • Alan Zhao's avatar
      [clang] Reland parenthesized aggregate init patches · 95a4c0c8
      Alan Zhao authored
      This commit relands the patches for implementing P0960R3 and P1975R0,
      which describe initializing aggregates via a parenthesized list.
      
      The relanded commits are:
      
      * 40c52159 - P0960R3 and P1975R0: Allow initializing aggregates from
        a parenthesized list of values
      * c77a91bb - Remove overly restrictive aggregate paren init logic
      * 32d7aae0
      
       - Fix a clang crash on invalid code in C++20 mode
      
      This patch also fixes a crash in the original implementation.
      Previously, if the input tried to call an implicitly deleted copy or
      move constructor of a union, we would then try to initialize the union
      by initializing it's first element with a reference to a union. This
      behavior is incorrect (we should fail to initialize) and if the type of
      the first element has a constructor with a single template typename
      parameter, then Clang will explode. This patch fixes that issue by
      checking that constructor overload resolution did not result in a
      deleted function before attempting parenthesized aggregate
      initialization.
      
      Additionally, this patch also includes D140159, which contains some
      minor fixes made in response to code review comments in the original
      implementation that were made after that patch was submitted.
      
      Co-authored-by: default avatarSheng <ox59616e@gmail.com>
      
      Fixes #54040, Fixes #59675
      
      Reviewed By: ilya-biryukov
      
      Differential Revision: https://reviews.llvm.org/D141546
      95a4c0c8
    • Tobias Gysi's avatar
      Revert "[mlir][llvm] Add an explicit void type debug info attribute." · 81f57b6b
      Tobias Gysi authored
      This commit broke the flang build bots
      https://lab.llvm.org/buildbot#builders/175/builds/23560.
      
      This reverts commit a960547e.
      81f57b6b
    • Nikolas Klauser's avatar
      [libc++] Make pmr::monotonic_buffer_resource bump down · 549a5fd0
      Nikolas Klauser authored
      Bumping down is significantly faster than bumping up. This is ABI breaking, but the ABI of `pmr::monotonic_buffer_resource` was only stabilized in this release cycle, so we can still change it.
      For a more detailed explanation why bumping down is better, see https://fitzgeraldnick.com/2019/11/01/always-bump-downwards.html.
      
      Reviewed By: ldionne, #libc
      
      Spies: libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D141435
      549a5fd0
    • Nikolas Klauser's avatar
      [libc++] Add [[nodiscard]] extensions in <math.h> · 633927db
      Nikolas Klauser authored
      There are quite a few functions marked `[[gnu::const]]` inside the compiler. This patch adds `[[nodiscard]]` to libc++-provided overloads of these functions to match the diagnostics produced.
      
      Reviewed By: ldionne, #libc
      
      Spies: libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D140855
      633927db
    • Fraser Cormack's avatar
      [EarlyCSE] Fix crash when optimizing masked loads/stores · d808ad82
      Fraser Cormack authored
      With opaque pointers, it is possible for EarlyCSE to encounter masked
      load/store intrinsics which access the same pointer value but with
      different incompatible types. These cannot form valid replacements
      (without explicit casting, which we don't yet do even for regular
      load/store instructions) so should be prevented.
      
      Reviewed By: nikic
      
      Differential Revision: https://reviews.llvm.org/D141613
      d808ad82
    • Nikolas Klauser's avatar
      [libc++][NFC] Rename basic_istream_view::__iterator to __basic_istream_view_iterator · 187d2cda
      Nikolas Klauser authored
      This makes it a lot easier to specialize traits types for it, like __segmented_iterator_traits.
      
      Reviewed By: Mordante, #libc
      
      Spies: libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D140714
      187d2cda
    • Nikolas Klauser's avatar
      [libc++][NFC] Qualify declval · 73e8e1ba
      Nikolas Klauser authored
      While it's not necessary to qualify calls to `declval` it makes error messages very crypric if the declaration isn't reachable anymore
      
      For example:
      ```
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:53:66: error: no type named 'type' in 'std::common_type<long, long>'
              typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_type.h:107:14: note: in instantiation of template class 'std::common_type<std::chrono::duration<long, std::ratio<3600, 1>>, std::chrono::duration<long, std::ratio<3600, 1>>>' requested here
              : public common_type<_Tp, _Tp> {};
                       ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:279:58: note: in instantiation of template class 'std::common_type<std::chrono::duration<long, std::ratio<3600, 1>>>' requested here
              _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
                                                                   ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:308:54: note: in instantiation of template class 'std::chrono::duration<long, std::ratio<3600, 1>>' requested here
          typedef duration<     int, ratio_multiply<ratio<24>, hours::period>>         days;
                                                               ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:280:81: error: no type named 'type' in 'std::common_type<std::chrono::duration<long, std::ratio<3600, 1>>>'
              _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
                                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:308:54: note: in instantiation of template class 'std::chrono::duration<long, std::ratio<3600, 1>>' requested here
          typedef duration<     int, ratio_multiply<ratio<24>, hours::period>>         days;
                                                               ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:53:66: error: no type named 'type' in 'std::common_type<int, int>'
              typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_type.h:107:14: note: in instantiation of template class 'std::common_type<std::chrono::duration<int, std::ratio<86400, 1>>, std::chrono::duration<int, std::ratio<86400, 1>>>' requested here
              : public common_type<_Tp, _Tp> {};
                       ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:279:58: note: in instantiation of template class 'std::common_type<std::chrono::duration<int, std::ratio<86400, 1>>>' requested here
              _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
                                                                   ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__chrono/duration.h:309:55: note: in instantiation of template class 'std::chrono::duration<int, std::ratio<86400, 1>>' requested here
          typedef duration<     int, ratio_multiply<ratio<7>,   days::period>>         weeks;
                                                                ^
          19 similar errors omitted
      ```
      changes with qualification added to:
      ```
          While building module 'std' imported from /home/nikolask/llvm-projects/libcxx/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp:13:
          In file included from <module-includes>:17:
          In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/math.h:309:
          In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/limits:107:
          In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/type_traits:432:
          In file included from /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_reference.h:13:
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__type_traits/common_type.h:28:43: error: declaration of 'declval' must be imported from module 'std.utility.__utility.declval' before it is required
          using __cond_type = decltype(false ? std::declval<_Tp>() : std::declval<_Up>());
                                                    ^
          /home/nikolask/llvm-projects/libcxx/build/include/c++/v1/__utility/declval.h:30:34: note: declaration here is not visible
          decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT;
                                           ^
          /home/nikolask/llvm-projects/libcxx/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp:13:10: fatal error: could not build module 'std'
          #include <functional>
           ~~~~~~~~^
          2 errors generated.
      ```
      
      Reviewed By: ldionne, Mordante, #libc
      
      Spies: libcxx-commits
      
      Differential Revision: https://reviews.llvm.org/D130854
      73e8e1ba
    • Kadir Cetinkaya's avatar
      edba5d58
    • Kadir Cetinkaya's avatar
    • Valentin Clement's avatar
      [flang] Carry the whole polymorphic box in PolymorphicValue · 9f1bb307
      Valentin Clement authored
      Until now, only the address of the type descriptor was hold in
      a PolymorphicValue. In some cases, the element size and the
      type code are also needed when creating new polymorphic
      descriptors from an element of a polymorphic entity.
      
      This patch updates PolymorphicValue to carry the source
      descriptor from which the element is extracted. The source
      descriptor is then used when emboxing the element to a new
      polymorphic descriptor.
      
      This simplify the code done in D141274 and will be used
      when creating polymorphic temporary as well.
      
      Reviewed By: jeanPerier, PeteSteinfeld
      
      Differential Revision: https://reviews.llvm.org/D141609
      9f1bb307
    • Joseph Huber's avatar
      [LinkerWrapper] Fix errors from missing files during a dry run · 77c5eac2
      Joseph Huber authored
      Summary:
      We use a dry run for testing. If we do a dry run there is no file to
      open and try to embed. Intead of erroring just create an empty one.
      77c5eac2
    • Tobias Gysi's avatar
      [mlir][llvm] Add an explicit void type debug info attribute. · a960547e
      Tobias Gysi authored
      Previously, the DISubroutineType attribute used an optional result
      parameter and an optional argument types array to model the subroutine
      signature. LLVM IR debug metadata, on the other hand, has one types
      list whose first entry maps to the result type. That entry may be
      null to model a void result type. The type list may also be entirely
      empty not specifying any type information. The latter is problematic
      since the current DISubroutineType attribute cannot express it.
      
      The revision changes DISubroutineTypeAttr to closely follow the
      LLVM metadata design. In particular, it uses a single types parameter
      array to model the subroutine signature and introduces an explicit
      DIVoidResultTypeAttr to model the null entries.
      
      Reviewed By: Dinistro
      
      Differential Revision: https://reviews.llvm.org/D141261
      a960547e
    • Steve Suzuki's avatar
      [mlir][spirv] Add support for fptoui conversion in ArithToSPIRV · e866fb86
      Steve Suzuki authored
      To enable the conversion of arith.fptoui to SPIRV OpConvertFToU
      
      Reviewed By: kuhar
      
      Differential Revision: https://reviews.llvm.org/D141582
      e866fb86
    • Andrzej Warzynski's avatar
      [mlir] Broadcast scalars when vectorising tensor.extract · a63853e6
      Andrzej Warzynski authored
      When vectorizing tensor.extract embedded within linalg.generic, the
      default option is to rewrite it as vector.gather. When doing so, we need
      to make sure that the corresponding indices are vectorized accordingly.
      However, the Linalg vectorizer will not vectorize constants like in the
      following example. This is fixed by simply broadcasting %c0 and %c1.
      
      ```
        func.func @example(%arg0: tensor<3x3xf32>, %arg2: tensor<1x1x3xf32>) -> tensor<1x1x3xf32> {
          %c0 = arith.constant 1 : index
          %c1 = arith.constant 2 : index
          %1 = linalg.generic {
            (...)
          } outs(...) {
          ^bb0(...):
            %2 = tensor.extract %arg0[%c0, %c1] : tensor<3x3xf32>
            linalg.yield %2 : f32
          } -> tensor<1x1x3xf32>
          return %1 : tensor<1x1x3xf32>
        }
      ```
      
      This patch makes sure that in the case above (and other similar cases),
      the vectorizer broadcasts %c0 and %c1.
      
      Differential Revision: https://reviews.llvm.org/D140781
      a63853e6
    • Joshua Cao's avatar
      [NFC][LoopFlatten][LoopInterchange] Do not explicitly forget subloops · b2b4d958
      Joshua Cao authored
      We don't need to explicitly forget subloops because forgetting parent
      loops will automatically forget their subloops
      
      Differential Revision: https://reviews.llvm.org/D141029
      b2b4d958
    • Shafik Yaghmour's avatar
      [Clang] Diagnose undefined behavior in a constant expression while evaluating... · a0138390
      Shafik Yaghmour authored
      [Clang] Diagnose undefined behavior in a constant expression while evaluating a compound assignment with remainder as operand
      
      Currently we don't diagnose overflow in a constant expression for the case of
      compound assignment with remainder as a operand.
      
      In handleIntIntBinOp the arguments LHS and Result can be the same source but in
      the check for remainder in this function we assigned to Result before checking
      for overflow. In all the other operations the check is done before Result is
      assigned to.
      
      Differential Revision: https://reviews.llvm.org/D140455
      a0138390
  2. Jan 12, 2023