1. Feb 16, 2024
    • Aiden Grossman's avatar
      [Github] Run documentation test build on change to the workflow · f086d80d
      Aiden Grossman authored
      This makes it so that the documentation test build workflow will run
      when the workflow itself is changed. This makes it much easier to test
      inside of PRs that modify the workflow.
      f086d80d
    • lntue's avatar
    • erman-gurses's avatar
    • Craig Topper's avatar
      [RISCV] Use APInt in useInversedSetcc to prevent crashes when mask is larger... · b57ba8ec
      Craig Topper authored
      [RISCV] Use APInt in useInversedSetcc to prevent crashes when mask is larger than UINT64_MAX. (#81888)
      
      There are no checks that the type is legal so we need to handle any
      type.
      b57ba8ec
    • LRFLEW's avatar
      linear_congruential_engine: Fixes for __lce_alg_picker (#81080) · fc027e10
      LRFLEW authored
      This fixes two major mistakes in the implementation of
      `linear_congruential_engine` that allowed it to produce incorrect
      output. Specifically, these mistakes are in `__lce_alg_picker`, which is
      used to determine whether Schrage's algorithm is valid and needed.
      
      The first mistake is in the definition of `_OverflowOK`. The code
      comment and the description of [D65041](https://reviews.llvm.org/D65041)
      both indicate that it's supposed to be true iff `m` is a power of two.
      However, the definition used does not work out to that, and instead is
      true whenever `m` is even. This could result in
      `linear_congruential_engine` using an invalid implementation, as it
      would incorrectly assume that any integer overflow can't change the
      result. I changed the implementation to one that accurately checks if
      `m` is a power of two. Technically, this implementation has an edge case
      where it considers `0` to be a power of two, but in this case this is
      actually accurate behavior, as `m = 0` indicates a modulus of 2^w where
      w is the size of `result_type` in bits, which *is* a power of two.
      
      The second mistake is in the static assert. The original static assert
      erroneously included an unnecessary `a != 0 || m != 0`. Combined with
      the `|| !_MightOverflow`, this actually resulted in the static assert
      being impossible to fail. Applying De Morgan's law and expanding
      `_MightOverflow` gives that the only way this static assert can be
      triggered is if `a == 0 && m == 0 && a != 0 && m != 0 && ...`, which
      clearly cannot be true. I simply removed the explicit checks against `a`
      and `m`, as the intended checks are already included in `_MightOverflow`
      and `_SchrageOK`, and their inclusion doesn't provide any obvious
      semantic benefit.
      
      This should fix all the current instances where
      `linear_congruential_engine` uses an invalid implementation. This
      technically isn't a complete implementation, though, since the static
      assert will cause some instantiations of `linear_congruential_engine`
      not disallowed by the standard from compiling. However, this should
      still be an improvement, as all compiling instantiations of
      `linear_congruential_engine` should use a valid implementation. Fixing
      the cases where the static assert triggers will require adding
      additional implementations, some of which will be fairly non-trivial, so
      I'd rather leave those for another PR so they don't hold up these more
      important fixes.
      
      Fixes #33554
      fc027e10
    • Craig Topper's avatar
    • Po-yao Chang's avatar
      [libc++][format] Don't treat a closing '}' as part of format-spec (#81305) · 08fe7df6
      Po-yao Chang authored
      This allows:
      ```
      std::println("{}>42", std::thread::id{});
      std::println("{}>42", std::span<int>{});
      std::println("{}>42", std::pair{42, "Hello"sv});
      std::println("{:}>42", std::thread::id{});
      std::println("{:}>42", std::span<int>{});
      std::println("{:}>42", std::pair{42, "Hello"sv});
      ```
      to compile and run.
      08fe7df6
    • Usman Nadeem's avatar
      [AArch64][SVE] Instcombine uzp1/reinterpret svbool to use vector.insert (#81069) · 267d6b5e
      Usman Nadeem authored
      Concatenating two predictes using uzp1 after converting to double length
      using sve.convert.to/from.svbool is optimized poorly in the backend,
      resulting in additional `and` instructions to zero the lanes. See
      https://github.com/llvm/llvm-project/pull/78623/
      
      Combine this pattern to use `llvm.vector.insert` to concatenate and get
      rid of convert to/from svbools.
      267d6b5e
    • Chris B's avatar
      [HLSL] Expose `half` types and intrinsics always (#81782) · e82659ff
      Chris B authored
      We previously made an implmenetation error when adding `half` overloads
      for HLSL library functionalitly. The `half` type is always defined in
      HLSL and `half` intrinsics should not be conditionally included.
      
      When native 16-bit types are disabled `half` is a unique 32-bit float
      type with lesser promotion rank than `float`.
      
      Fixes #81049
      e82659ff
    • Mehdi Amini's avatar
    • Mehdi Amini's avatar
    • Mehdi Amini's avatar
    • Mehdi Amini's avatar
    • Mehdi Amini's avatar
    • Erich Keane's avatar
      [OpenACC][NFC] Implement basic OpenACC Sema infrastructure (#81874) · 24144d72
      Erich Keane authored
      This patch is split off from #81659, and contains just the Sema
      infrastructure that we can later use to implement semantic analysis of
      OpenACC constructs.
      24144d72
    • Ellis Hoag's avatar
    • Kunwar Grover's avatar
    • Vlad Serebrennikov's avatar
      [clang][NFC] Fix buildbot failure in drs/23xx.cpp · 8bda8cfa
      Vlad Serebrennikov authored
      This is a follow-up to 630548a1, which fixed builtbot failure https://lab.llvm.org/buildbot/#/builders/188/builds/41930
      8bda8cfa
    • Alexander Yermolovich's avatar
      [LLVM][DWARF] Fix for memory leak (#81828) · f905877f
      Alexander Yermolovich authored
      This is followup to https://github.com/llvm/llvm-project/pull/8120.
      Missed a destuctor.
      f905877f
    • Derek Schuff's avatar
      [Object][Wasm] Use offset instead of index for Global address and store size (#81781) · 2eaeae7e
      Derek Schuff authored
      Currently the address reported by binutils for a global is its index;
      but its offset (in the file or section) is more useful for binary size
      attribution.
      This PR treats globals similarly to functions, and tracks their offset
      and size. It also centralizes the logic differentiating linked from object
      and dylib files (where section addresses are 0).
      2eaeae7e
    • Guillaume Chatelet's avatar
      Revert "[reland][libc][NFC] Use user defined literals to build 128 and 256 bit constants" (#81882) · a1d4c693
      Guillaume Chatelet authored
      Reverts llvm/llvm-project#81835
      This is breaking arm32 which does not support 64 bit types.
      a1d4c693
    • Jacob Lambert's avatar
      53750099
    • Craig Topper's avatar
      [TargetLowering] Emit SIGN_EXTEND_INREG instead of shift pair from... · d4853173
      Craig Topper authored
      [TargetLowering] Emit SIGN_EXTEND_INREG instead of shift pair from optimizeSetCCOfSignedTruncationCheck. (#81785)
      
      sext_inreg is our canonical form of shift pair before op legalization so
      DAG combiner will probably create it anyway. If it isn't legal
      LegalizeDAG will expand to shifts later.
      d4853173
    • Schrodinger ZHU Yifan's avatar
      [libc] add support for function level attributes (#79891) · 6cfbf8cc
      Schrodinger ZHU Yifan authored
      See discussion at
      https://discourse.llvm.org/t/rfc-support-function-attributes-in-user-interface/76624
      
      Demo macro:
      ```c++
      #if !defined(__LIBC_CONST_ATTR) && defined(__cplusplus) && defined(__GNUC__)
      #if __has_attribute(const)
      #define __LIBC_CONST_ATTR [[gnu::const]]
      #endif
      #endif
      #if !defined(__LIBC_CONST_ATTR) && defined(__GNUC__)
      #if __has_attribute(const)
      #define __LIBC_CONST_ATTR __attribute__((const))
      #endif
      #endif
      #if !defined(__LIBC_CONST_ATTR)
      #define __LIBC_CONST_ATTR
      #endif
      ```
      6cfbf8cc
    • Timm Bäder's avatar
      [clang][Interp] Emit dummy pointers for unknown static locals · 54826d49
      Timm Bäder authored
      We used to emit dummy pointers for unknown declarations in certain
      cases in C, but this is also necessary in C++.
      
      I'm limiting this to static local variables for now.
      54826d49
    • Shilei Tian's avatar
      [AMDGPU] Clean up functions for checking inline literals (#81282) · 9c6a2de2
      Shilei Tian authored
      This patch cleans up functions for checking inline literals.
      9c6a2de2
    • Timm Bäder's avatar
      c81929e9
    • Guillaume Chatelet's avatar
    • David Green's avatar
      [AArch64][GlobalISel] FNeg constant materialization (#80643) · 35640004
      David Green authored
      This is a Global ISel equivalent of #80641, creating fneg(movi) instead
      of the alternative constant pool load or gpr dup.
      35640004
    • Anton Lydike's avatar
      [mlir] Initial patch to add an MPI dialect (#68892) · 2d616ec4
      Anton Lydike authored
      This patch introduces the new MPI dialect into MLIR. The Message Passing
      Interface (MPI) is a widely-used standard for distributed programs to
      exchange data. This PR goes together with a talk later at today's LLVM
      Dev Meeting.
      
      This is just a first, small patch to get going and add the necessary
      base files, so that we can add more operations in further patches.
      
      Here's the documentation as generated by `ninja mlir-doc`:
      # 'mpi' Dialect
      
      This dialect models the Message Passing Interface (MPI), version 
      4.0. It is meant to serve as an interfacing dialect that is targeted
      by higher-level dialects. The MPI dialect itself can be lowered to 
      multiple MPI implementations and hide differences in ABI. The dialect
      models the functions of the MPI specification as close to 1:1 as
      possible
      while preserving SSA value semantics where it makes sense, and uses 
      `memref` types instead of bare pointers.
      
      This dialect is under active development, and while stability is an
      eventual goal, it is not guaranteed at this juncture. Given the early 
      state, it is recommended to inquire further prior to using this dialect.
      
      For an in-depth documentation of the MPI library interface, please refer
      to official documentation such as the 
      [OpenMPI online documentation](https://www.open-mpi.org/doc/current/).
      
      [TOC]
      
      ## Operation definition
      
      ### `mpi.comm_rank` (mpi::CommRankOp)
      
      _Get the current rank, equivalent to `MPI_Comm_rank(MPI_COMM_WORLD,
      &rank)`_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.comm_rank` attr-dict `:` type(results)
      ```
      
      Communicators other than `MPI_COMM_WORLD` are not supported for now.
      
      This operation can optionally return an `!mpi.retval` value that can be
      used
      to check for errors.
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `retval` | MPI function call return value
      | `rank` | 32-bit signless integer
      
      
      ### `mpi.error_class` (mpi::ErrorClassOp)
      
      _Get the error class from an error code, equivalent to the
      `MPI_Error_class` function_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.error_class` $val attr-dict `:` type($val)
      ```
      
      `MPI_Error_class` maps return values from MPI calls to a set of
      well-known
      MPI error classes.
      
      #### Operands:
      
      | Operand | Description |
      | :-----: | ----------- |
      | `val` | MPI function call return value
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `errclass` | MPI function call return value
      
      
      ### `mpi.finalize` (mpi::FinalizeOp)
      
      _Finalize the MPI library, equivalent to `MPI_Finalize()`_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.finalize` attr-dict (`:` type($retval)^)?
      ```
      
      This function cleans up the MPI state. Afterwards, no MPI methods may 
      be invoked (excpet for MPI_Get_version, MPI_Initialized, and
      MPI_Finalized).
      Notably, MPI_Init cannot be called again in the same program.
      
      This operation can optionally return an `!mpi.retval` value that can be
      used
      to check for errors.
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `retval` | MPI function call return value
      
      
      ### `mpi.init` (mpi::InitOp)
      
      _Initialize the MPI library, equivalent to `MPI_Init(NULL, NULL)`_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.init` attr-dict (`:` type($retval)^)?
      ```
      
      This operation must preceed most MPI calls (except for very few
      exceptions,
      please consult with the MPI specification on these).
      
      Passing &argc, &argv is not supported currently.
      
      This operation can optionally return an `!mpi.retval` value that can be
      used
      to check for errors.
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `retval` | MPI function call return value
      
      
      ### `mpi.recv` (mpi::RecvOp)
      
      _Equivalent to `MPI_Recv(ptr, size, dtype, dest, tag, MPI_COMM_WORLD,
      MPI_STATUS_IGNORE)`_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.recv` `(` $ref `,` $tag `,` $rank `)` attr-dict `:` type($ref) `,` type($tag) `,` type($rank)(`->` type($retval)^)?
      ```
      
      MPI_Recv performs a blocking receive of `size` elements of type `dtype` 
      from rank `dest`. The `tag` value and communicator enables the library
      to
      determine the matching of multiple sends and receives between the same 
      ranks.
      
      Communicators other than `MPI_COMM_WORLD` are not supprted for now.
      The MPI_Status is set to `MPI_STATUS_IGNORE`, as the status object 
      is not yet ported to MLIR.
      
      This operation can optionally return an `!mpi.retval` value that can be
      used
      to check for errors.
      
      #### Operands:
      
      | Operand | Description |
      | :-----: | ----------- |
      | `ref` | memref of any type values
      | `tag` | 32-bit signless integer
      | `rank` | 32-bit signless integer
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `retval` | MPI function call return value
      
      
      ### `mpi.retval_check` (mpi::RetvalCheckOp)
      
      _Check an MPI return value against an error class_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.retval_check` $val `=` $errclass attr-dict `:` type($res)
      ```
      
      This operation compares MPI status codes to known error class
      constants such as `MPI_SUCCESS`, or `MPI_ERR_COMM`.
      
      #### Attributes:
      
      <table>
      <tr><th>Attribute</th><th>MLIR Type</th><th>Description</th></tr>
      
      <tr><td><code>errclass</code></td><td>::mlir::mpi::MPI_ErrorClassEnumAttr</td><td><details><summary>MPI
      error class name</summary>{{% markdown %}}Enum cases:
      * MPI_SUCCESS (`MPI_SUCCESS`)
      * MPI_ERR_ACCESS (`MPI_ERR_ACCESS`)
      * MPI_ERR_AMODE (`MPI_ERR_AMODE`)
      * MPI_ERR_ARG (`MPI_ERR_ARG`)
      * MPI_ERR_ASSERT (`MPI_ERR_ASSERT`)
      * MPI_ERR_BAD_FILE (`MPI_ERR_BAD_FILE`)
      * MPI_ERR_BASE (`MPI_ERR_BASE`)
      * MPI_ERR_BUFFER (`MPI_ERR_BUFFER`)
      * MPI_ERR_COMM (`MPI_ERR_COMM`)
      * MPI_ERR_CONVERSION (`MPI_ERR_CONVERSION`)
      * MPI_ERR_COUNT (`MPI_ERR_COUNT`)
      * MPI_ERR_DIMS (`MPI_ERR_DIMS`)
      * MPI_ERR_DISP (`MPI_ERR_DISP`)
      * MPI_ERR_DUP_DATAREP (`MPI_ERR_DUP_DATAREP`)
      * MPI_ERR_ERRHANDLER (`MPI_ERR_ERRHANDLER`)
      * MPI_ERR_FILE (`MPI_ERR_FILE`)
      * MPI_ERR_FILE_EXISTS (`MPI_ERR_FILE_EXISTS`)
      * MPI_ERR_FILE_IN_USE (`MPI_ERR_FILE_IN_USE`)
      * MPI_ERR_GROUP (`MPI_ERR_GROUP`)
      * MPI_ERR_INFO (`MPI_ERR_INFO`)
      * MPI_ERR_INFO_KEY (`MPI_ERR_INFO_KEY`)
      * MPI_ERR_INFO_NOKEY (`MPI_ERR_INFO_NOKEY`)
      * MPI_ERR_INFO_VALUE (`MPI_ERR_INFO_VALUE`)
      * MPI_ERR_IN_STATUS (`MPI_ERR_IN_STATUS`)
      * MPI_ERR_INTERN (`MPI_ERR_INTERN`)
      * MPI_ERR_IO (`MPI_ERR_IO`)
      * MPI_ERR_KEYVAL (`MPI_ERR_KEYVAL`)
      * MPI_ERR_LOCKTYPE (`MPI_ERR_LOCKTYPE`)
      * MPI_ERR_NAME (`MPI_ERR_NAME`)
      * MPI_ERR_NO_MEM (`MPI_ERR_NO_MEM`)
      * MPI_ERR_NO_SPACE (`MPI_ERR_NO_SPACE`)
      * MPI_ERR_NO_SUCH_FILE (`MPI_ERR_NO_SUCH_FILE`)
      * MPI_ERR_NOT_SAME (`MPI_ERR_NOT_SAME`)
      * MPI_ERR_OP (`MPI_ERR_OP`)
      * MPI_ERR_OTHER (`MPI_ERR_OTHER`)
      * MPI_ERR_PENDING (`MPI_ERR_PENDING`)
      * MPI_ERR_PORT (`MPI_ERR_PORT`)
      * MPI_ERR_PROC_ABORTED (`MPI_ERR_PROC_ABORTED`)
      * MPI_ERR_QUOTA (`MPI_ERR_QUOTA`)
      * MPI_ERR_RANK (`MPI_ERR_RANK`)
      * MPI_ERR_READ_ONLY (`MPI_ERR_READ_ONLY`)
      * MPI_ERR_REQUEST (`MPI_ERR_REQUEST`)
      * MPI_ERR_RMA_ATTACH (`MPI_ERR_RMA_ATTACH`)
      * MPI_ERR_RMA_CONFLICT (`MPI_ERR_RMA_CONFLICT`)
      * MPI_ERR_RMA_FLAVOR (`MPI_ERR_RMA_FLAVOR`)
      * MPI_ERR_RMA_RANGE (`MPI_ERR_RMA_RANGE`)
      * MPI_ERR_RMA_SHARED (`MPI_ERR_RMA_SHARED`)
      * MPI_ERR_RMA_SYNC (`MPI_ERR_RMA_SYNC`)
      * MPI_ERR_ROOT (`MPI_ERR_ROOT`)
      * MPI_ERR_SERVICE (`MPI_ERR_SERVICE`)
      * MPI_ERR_SESSION (`MPI_ERR_SESSION`)
      * MPI_ERR_SIZE (`MPI_ERR_SIZE`)
      * MPI_ERR_SPAWN (`MPI_ERR_SPAWN`)
      * MPI_ERR_TAG (`MPI_ERR_TAG`)
      * MPI_ERR_TOPOLOGY (`MPI_ERR_TOPOLOGY`)
      * MPI_ERR_TRUNCATE (`MPI_ERR_TRUNCATE`)
      * MPI_ERR_TYPE (`MPI_ERR_TYPE`)
      * MPI_ERR_UNKNOWN (`MPI_ERR_UNKNOWN`)
      * MPI_ERR_UNSUPPORTED_DATAREP (`MPI_ERR_UNSUPPORTED_DATAREP`)
      * MPI_ERR_UNSUPPORTED_OPERATION (`MPI_ERR_UNSUPPORTED_OPERATION`)
      * MPI_ERR_VALUE_TOO_LARGE (`MPI_ERR_VALUE_TOO_LARGE`)
      * MPI_ERR_WIN (`MPI_ERR_WIN`)
      * MPI_ERR_LASTCODE (`MPI_ERR_LASTCODE`){{% /markdown
      %}}</details></td></tr>
      </table>
      
      #### Operands:
      
      | Operand | Description |
      | :-----: | ----------- |
      | `val` | MPI function call return value
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `res` | 1-bit signless integer
      
      
      ### `mpi.send` (mpi::SendOp)
      
      _Equivalent to `MPI_Send(ptr, size, dtype, dest, tag, MPI_COMM_WORLD)`_
      
      
      Syntax:
      
      ```
      operation ::= `mpi.send` `(` $ref `,` $tag `,` $rank `)` attr-dict `:` type($ref) `,` type($tag) `,` type($rank)(`->` type($retval)^)?
      ```
      
      MPI_Send performs a blocking send of `size` elements of type `dtype` to
      rank
      `dest`. The `tag` value and communicator enables the library to
      determine
      the matching of multiple sends and receives between the same ranks.
      
      Communicators other than `MPI_COMM_WORLD` are not supprted for now.
      
      This operation can optionally return an `!mpi.retval` value that can be
      used
      to check for errors.
      
      #### Operands:
      
      | Operand | Description |
      | :-----: | ----------- |
      | `ref` | memref of any type values
      | `tag` | 32-bit signless integer
      | `rank` | 32-bit signless integer
      
      #### Results:
      
      | Result | Description |
      | :----: | ----------- |
      | `retval` | MPI function call return value
      
      
      ## Attribute definition
      
      ### MPI_ErrorClassEnumAttr
      
      MPI error class name
      
      Syntax:
      
      ```
      #mpi.errclass<
        ::mlir::mpi::MPI_ErrorClassEnum   # value
      >
      ```
      
      Enum cases:
      * MPI_SUCCESS (`MPI_SUCCESS`)
      * MPI_ERR_ACCESS (`MPI_ERR_ACCESS`)
      * MPI_ERR_AMODE (`MPI_ERR_AMODE`)
      * ... *all other MPI error codes*
      
      #### Parameters:
      
      | Parameter | C++ type | Description |
      | :-------: | :-------: | ----------- |
      | value | `::mlir::mpi::MPI_ErrorClassEnum` | an enum of type
      MPI_ErrorClassEnum |
      
      ## Type definition
      
      ### RetvalType
      
      MPI function call return value
      
      Syntax: `!mpi.retval`
      
      This type represents a return value from an MPI function vall.
      This value can be MPI_SUCCESS, MPI_ERR_IN_STATUS, or any error code.
      
      This return value can be compared agains the known MPI error classes
      represented by `#mpi.errclass` using the `mpi.retval_check` operation.
      2d616ec4
  2. Feb 15, 2024