1. Oct 27, 2023
    • Louis Dionne's avatar
      [libc++] Fix incorrect length check in std::basic_filebuf · 574c5cc9
      Louis Dionne authored
      This patch fixes an ASAN-found issue in std::basic_filebuf where we'd
      check the wrong size before proceeding to set our internal buffer to
      the externally-provided buffer, leading to the library trying to read
      from the incorrect buffer in underflow().
      
      Thanks to Andrey Semin for the patch.
      
      Differential Revision: https://reviews.llvm.org/D154514
      574c5cc9
    • Louis Dionne's avatar
      [libc++] Make sure we implement and test LWG2280 properly (#67670) · cb950c9d
      Louis Dionne authored
      We did not mark std::begin/std::end as noexcept for C-style arrays, we
      did not have conditional noexcept on cbegin/cend, and we did not mark
      array cbegin/cend as constexpr in all Standard modes. Since this is a
      LWG issue, we should implement it as a DR in all Standard modes as
      usual.
      
      This patch fixes these issues and adds test coverage. Fixes #67471.
      cb950c9d
    • Igor Kirillov's avatar
      Revert "[CodeGen] Improve ExpandMemCmp for more efficient non-register aligned... · deb429e5
      Igor Kirillov authored
      Revert "[CodeGen] Improve ExpandMemCmp for more efficient non-register aligned sizes handling (#69942)"
      
      This reverts commit 9bcb30d3.
      deb429e5
    • Richard Howell's avatar
      [clang] use relative paths for builtin headers during module compilation (#68023) · 396b5621
      Richard Howell authored
      When including builtin headers as part of a system module, ensure we use
      relative paths to those headers. Otherwise the module will fail to compile 
      when specifying relative resource directories without extra search paths.
      396b5621
    • Andrzej Warzyński's avatar
      [mlir][SVE] Add more e2e test for vector.contract (#70367) · e9478b16
      Andrzej Warzyński authored
      Adds basic integration tests for `vector.contract` for the dot product
      and matvec operations. These tests exercise scalable vectors.
      
      Depends on https://github.com/llvm/llvm-project/pull/69845
      e9478b16
    • LLVM GN Syncbot's avatar
      [gn build] Port b0b88643 · c131455c
      LLVM GN Syncbot authored
      c131455c
    • Konstantin Varlamov's avatar
      [libc++] Fix flakiness in `atomic_notify_all.pass.cpp` (#70436) · b3b611fe
      Konstantin Varlamov authored
      Avoid relying on sleep for synchronization.
      b3b611fe
    • Christudasan Devadasan's avatar
      [AMDGPU] Try to fix the block prologs broken by RA inserted instructions (#69924) · a0eb6b88
      Christudasan Devadasan authored
      The insertion point determined by RA while attempting spills and liverange
      split at the beginning of a block goes wrong at times, and the newly
      inserted vector instructions are placed before the exec-mask restore
      instruction which is wrong. It occurs mainly due to the dependency on
      isBasicBlockPrologue that doesn't account early inserted instructions
      (spills and splits) during RA and causes the block prolog break.
      
      A better approach for deciding the insertion point should be worked out.
      For now, improving the helper function to consider all possible early
      insertions. This patch includes the spill instructions. The copies
      associated with liverange split should also be included in the block
      prolog.
      a0eb6b88
    • Florian Hahn's avatar
      [VPlan] Add initial anlysis to infer scalar type of VPValues. (#69013) · b0b88643
      Florian Hahn authored
      This patch adds initial type inferrence for VPValues. It infers the
      scalar type of a VPValue, by bottom-up traversing through defining
      recipes until root nodes with known types are reached (e.g. live-ins or
      load recipes). The types are then propagated top down through
      operations.
      
      This is intended as building block for a VPlan-based cost model, which
      will need access to type information for VPValues/recipes.
      
      Initial testing is done by asserting the inferred type matches the type
      of the result value generated for a widen and replicate recipes.
      b0b88643
    • Simon Pilgrim's avatar
      [X86] Add test case for Issue #66150 · 37d9dc47
      Simon Pilgrim authored
      37d9dc47
    • Florian Hahn's avatar
    • Pierre van Houtryve's avatar
      [InstSimplify] Fold (a != 0) ? abs(a) : 0 (#70305) · 4fc1e7db
      Pierre van Houtryve authored
      Solves #70204
      4fc1e7db
    • Kiran Chandramohan's avatar
      [Flang][OpenMP] Move the host-ir-flag test to the Driver directory (#70441) · 7391ad38
      Kiran Chandramohan authored
      Moving since this is almost an end to end test and covers multiple
      stages.
      7391ad38
    • Florian Hahn's avatar
      [VPlan] Handle VPValues without underlying values in getTypeForVPValue. · cff66521
      Florian Hahn authored
      Fixes a crash after 0c8e5be6.
      
      Full type inference will be added in
      https://github.com/llvm/llvm-project/pull/69013
      cff66521
    • Andrzej Warzyński's avatar
      [mlir][vector] Update v.contract -> v.outerproduct tests (1/N) (#70379) · 8e0b3a88
      Andrzej Warzyński authored
      Tests for conversions from `vector.contract` to `vector.outerproduct`
      for _matvec_ operations are updated with cases for scalable vectors.
      
      This patch updates one specific test file (there might be similar
      tests elsewhere):
      
         * vector-contract-to-outerproduct-transforms.mlir.
      
      Only the parallel dimension is made scalable. Making the reduction
      dimension scalable would lead to different patterns without
      `vector.outerproduct` (that would need to be added to some other file).
      
      One duplicate test for _matvec_ is removed.
      8e0b3a88
    • Christudasan Devadasan's avatar
      [AMDGPU] Add pseudo instructions for SGPR spill to VGPR (#69923) · f9cd7896
      Christudasan Devadasan authored
      For a future patch, is it important to keep the lowered SGPR
      spills to be recognized as spill instructions during regalloc.
      Directly lowering them into V_WRITELANE/V_READLANE won't allow
      us to attach the SPILL flag to their instructions.
      
      This patch introduces the pseudo instructions with the SGPRSpill
      flag set in their Desc. They will get lowered to equivalent
      instructions later during post RA pseudo expansion.
      f9cd7896
    • Igor Kirillov's avatar
      [CodeGen] Improve ExpandMemCmp for more efficient non-register aligned sizes handling (#69942) · 9bcb30d3
      Igor Kirillov authored
      * Enhanced the logic of ExpandMemCmp pass to merge contiguous
      subsequences
        in LoadSequence, based on sizes allowed in `AllowedTailExpansions`.
      * This enhancement seeks to minimize the number of basic blocks and
      produce optimized code when using memcmp with non-register aligned sizes.
      * Enable this feature for AArch64 with memcmp sizes modulo 8 equal to
        3, 5, and 6.
      9bcb30d3
    • David Spickett's avatar
      [lldb] Return unimplemented error from ScriptedProcessInterface::CreatePluginObject · 02ef12dd
      David Spickett authored
      After https://github.com/llvm/llvm-project/pull/68052 this function changed from returning
      a nullptr with `return {};` to returning Expected and hitting `llvm_unreachable` before it could
      do so.
      
      I gather that we're never supposed to call this function, but on Windows we actually do call
      this function because `interpreter->CreateScriptedProcessInterface()` returns
      `ScriptedProcessInterface` not `ScriptedProcessPythonInterface`. Likely because
      `target_sp->GetDebugger().GetScriptInterpreter()` also does not return a Python related class.
      
      The previously XFAILed test crashed with:
      ```
       # .---command stderr------------
       # | PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
       # | Stack dump:
       # | 0.  Program arguments: c:\\users\\tcwg\\david.spickett\\build-llvm\\bin\\lldb-test.exe ir-memory-map C:\\Users\\tcwg\\david.spickett\\build-llvm\\tools\\lldb\\test\\Shell\\Expr\\Output\\TestIRMemoryMapWindows.test.tmp C:\\Users\\tcwg\\david.spickett\\llvm-project\\lldb\\test\\Shell\\Expr/Inputs/ir-memory-map-basic
       # | 1.  HandleCommand(command = "run")
       # | Exception Code: 0xC000001D
       # | #0 0x00007ff696b5f588 lldb_private::ScriptedProcessInterface::CreatePluginObject(class llvm::StringRef, class lldb_private::ExecutionContext &, class std::shared_ptr<class lldb_private::StructuredData::Dictionary>, class lldb_private::StructuredData::Generic *) C:\Users\tcwg\david.spickett\llvm-project\lldb\include\lldb\Interpreter\Interfaces\ScriptedProcessInterface.h:28:0
       # | #1 0x00007ff696b1d808 llvm::Expected<std::shared_ptr<lldb_private::StructuredData::Generic> >::operator bool C:\Users\tcwg\david.spickett\llvm-project\llvm\include\llvm\Support\Error.h:567:0
       # | #2 0x00007ff696b1d808 lldb_private::ScriptedProcess::ScriptedProcess(class std::shared_ptr<class lldb_private::Target>, class std::shared_ptr<class lldb_private::Listener>, class lldb_private::ScriptedMetadata const &, class lldb_private::Status &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Plugins\Process\scripted\ScriptedProcess.cpp:115:0
       # | #3 0x00007ff696b1d124 std::shared_ptr<lldb_private::ScriptedProcess>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1478:0
       # | #4 0x00007ff696b1d124 lldb_private::ScriptedProcess::CreateInstance(class std::shared_ptr<class lldb_private::Target>, class std::shared_ptr<class lldb_private::Listener>, class lldb_private::FileSpec const *, bool) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Plugins\Process\scripted\ScriptedProcess.cpp:61:0
       # | #5 0x00007ff69699c8f4 std::_Ptr_base<lldb_private::Process>::_Move_construct_from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1237:0
       # | #6 0x00007ff69699c8f4 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1534:0
       # | #7 0x00007ff69699c8f4 std::shared_ptr<lldb_private::Process>::operator= C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1594:0
       # | #8 0x00007ff69699c8f4 lldb_private::Process::FindPlugin(class std::shared_ptr<class lldb_private::Target>, class llvm::StringRef, class std::shared_ptr<class lldb_private::Listener>, class lldb_private::FileSpec const *, bool) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Target\Process.cpp:396:0
       # | #9 0x00007ff6969bd708 std::_Ptr_base<lldb_private::Process>::_Move_construct_from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1237:0
       # | #10 0x00007ff6969bd708 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1534:0
       # | #11 0x00007ff6969bd708 std::shared_ptr<lldb_private::Process>::operator= C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1594:0
       # | #12 0x00007ff6969bd708 lldb_private::Target::CreateProcess(class std::shared_ptr<class lldb_private::Listener>, class llvm::StringRef, class lldb_private::FileSpec const *, bool) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Target\Target.cpp:215:0
       # | #13 0x00007ff696b13af0 std::_Ptr_base<lldb_private::Process>::_Ptr_base C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1230:0
       # | #14 0x00007ff696b13af0 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1524:0
       # | #15 0x00007ff696b13af0 lldb_private::PlatformWindows::DebugProcess(class lldb_private::ProcessLaunchInfo &, class lldb_private::Debugger &, class lldb_private::Target &, class lldb_private::Status &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Plugins\Platform\Windows\PlatformWindows.cpp:495:0
       # | #16 0x00007ff6969cf590 std::_Ptr_base<lldb_private::Process>::_Move_construct_from C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1237:0
       # | #17 0x00007ff6969cf590 std::shared_ptr<lldb_private::Process>::shared_ptr C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1534:0
       # | #18 0x00007ff6969cf590 std::shared_ptr<lldb_private::Process>::operator= C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Tools\MSVC\14.35.32124\include\memory:1594:0
       # | #19 0x00007ff6969cf590 lldb_private::Target::Launch(class lldb_private::ProcessLaunchInfo &, class lldb_private::Stream *) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Target\Target.cpp:3274:0
       # | #20 0x00007ff696fff82c CommandObjectProcessLaunch::DoExecute(class lldb_private::Args &, class lldb_private::CommandReturnObject &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Commands\CommandObjectProcess.cpp:258:0
       # | #21 0x00007ff696fab6c0 lldb_private::CommandObjectParsed::Execute(char const *, class lldb_private::CommandReturnObject &) C:\Users\tcwg\david.spickett\llvm-project\lldb\source\Interpreter\CommandObject.cpp:751:0
       # `-----------------------------
       # error: command failed with exit status: 0xc000001d
      ```
      
      That might be a bug on the Windows side, or an artifact of how our build is setup,
      but whatever it is, having `CreatePluginObject` return an error and
      the caller check it, fixes the failing test.
      
      The built lldb can run the script command to use Python, but I'm not sure if that means
      anything.
      02ef12dd
    • Luke Lau's avatar
      [RISCV] Keep same SEW/LMUL ratio if possible in forward transfer (#69788) · c8e1fbc3
      Luke Lau authored
      For instructions like vmv.s.x and friends where we don't care about LMUL
      or the
      SEW/LMUL ratio, we can change the LMUL in its state so that it has the
      same
      SEW/LMUL ratio as the previous state. This allows us to avoid more VL
      toggles
      later down the line (i.e. use vsetvli zero, zero, which requires that
      the
      SEW/LMUL ratio must be the same)
      
      This is an alternative approach to the idea in #69259, but note that
      they
      don't catch exactly the same test cases.
      c8e1fbc3
    • hassnaaHamdi's avatar
      [LLVM][AArch64][Assembly]: Add FAMINMAX assembly/disasse… (#70115) · b23426ee
      hassnaaHamdi authored
      …mbly.
      
      This patch adds the feature flag FAMINMAX and the assembly/disassembly
      for the following instructions of NEON, SVE2 and SME2:
      * NEON:
        - FAMIN
        - FAMAX
      * SVE2:
        - FAMIN_ZPmZ
        - FAMAX_ZPmZ
      * SME2:
        - FAMAX_2Z2Z
        - FAMIN_2Z2Z
        - FAMAX_4Z4Z
        - FAMIN_4Z4Z
      
      That is according to this documentation:
      https://developer.arm.com/documentation/ddi0602/2023-09
      
      
      
      Co-authored-by: default avatarCaroline Concatto <caroline.concatto@arm.com>
      b23426ee
    • Brad Smith's avatar
      7360c6ac
    • Owen Pan's avatar
    • Ivan Kosarev's avatar
      [AMDGPU] Give some of the VI V_PK_* instructions a subtarget predicate. (#70334) · f0899ede
      Ivan Kosarev authored
      This resolves AsmParser ambiguity between them and similar instructions
      for other subtargets, e.g., V_PK_SUB_U16_vi being identical to
      V_PK_SUB_U16_gfx11 on GFX11.
      
      Part of <https://github.com/llvm/llvm-project/issues/69256>.
      f0899ede
    • Andrzej Warzyński's avatar
      [mlir][SVE] Add an e2e test for vectorization of linalg.matmul (#70372) · 45e2e037
      Andrzej Warzyński authored
      Adds an end-to-end test for scalable vectorization of linalg.matmul.
      45e2e037
    • Nikita Popov's avatar
      [InstCombine] Remove redundant cast of GEP fold (NFC) · e4dc7d49
      Nikita Popov authored
      With opaque pointers, zero-index GEPs will be eliminated in
      general.
      e4dc7d49
    • tyb0807's avatar
      [mlir][Vector] Fix integration test for vector.maskedload narrow type… (#70431) · 4d4f6037
      tyb0807 authored
      … emulation
      
      Currently the expected CHECK values are not correct for
      `fcst_maskedload` from
      mlir/test/Integration/Dialect/Vector/CPU/test-rewrite-narrow-types.mlir
      4d4f6037
    • Owen Pan's avatar
      [clang-format][NFC] Remove more extraneous newlines in unit tests · 6c3bc910
      Owen Pan authored
      Also removed a duplicate test case.
      6c3bc910
    • Kunwar Grover's avatar
      Reland [mlir][tools] Introduce tblgen-to-irdl tool (#70121) · ec7c1a47
      Kunwar Grover authored
      This patch relands the reverted commit
      https://github.com/llvm/llvm-project/commit/e6e9beb977555c84fb16ffdd8dca8649c7d3091d
      after fixing the sanitizer issue.
      ec7c1a47
    • Rajveer Singh Bharadwaj's avatar
      [libc++] Fix _CopySegment helper in ranges::copy(join_view, out) when called... · dd489131
      Rajveer Singh Bharadwaj authored
      [libc++] Fix _CopySegment helper in ranges::copy(join_view, out) when called in a static assertion context (#69593)
      
      Resolves Issue #69083
      
      The `_CopySegment` helper for `ranges::copy(join_view, out)` is not
      `constexpr` causing rejection in `libc++` in a static assertion context
      as in the issue snippet.
      dd489131
    • Chuanqi Xu's avatar
      [C++20] [Modules] Chose BMI from for module m with the last · e9a7876c
      Chuanqi Xu authored
      -fmodule-file=<module-name>= option
      
      Currently if we have multiple `-fmodule-file=<module-name>=<BMI-path>`
      flags for the same `<module-name>`, we will pick the BMI-path from the
      first flag. And this is inconsistent with what users generally expect.
      e.g, we might expect the latter flags can override the former ones.
      
      This patch changes the behavior to match user's expectation.
      e9a7876c
    • Ami-zhang's avatar
    • tyb0807's avatar
    • Timm Bäder's avatar
      [clang][Interp][NFC] Rename a parameter · e64e4784
      Timm Bäder authored
      e64e4784
    • Timm Bäder's avatar
      051fade1
    • Brad Smith's avatar
    • Matt Arsenault's avatar
      AMDGPU: Add infinite looping testcase after subrange spilling change · b8b491c9
      Matt Arsenault authored
      This infinite looped after d8127b2b
      b8b491c9
    • Matthias Springer's avatar
      [mlir][vector] Fix off-by-one error in `getTransferChunkAccessed` (#70292) · e6e55e62
      Matthias Springer authored
      If a dimension does not appear in the permutation map of a vector
      transfer op, the size of the accessed slice in that dimension is `1`.
      Before this fix, `getTransferChunkAccessed` used to return `0` for such
      dimensions, which would means that `0` elements in the underlying
      tensor/memref are accessed.
      
      Note: There is no test case that fails due to this bug and because this
      interface method is currently only used in one place, it is hard to
      write a regression test. This fix is in preparation of subset hoisting
      functionality that will be added in subsequent commits.
      e6e55e62
    • Andrzej Warzyński's avatar
      [mlir][vector] Add scalable vectors to tests for vector.contract (#70039) · 5270df3d
      Andrzej Warzyński authored
      Update the remaining tests for matrix multiplication (_matmul_) in:
      
        * vector-contract-to-outerproduct-transforms.mlir
      
      with cases for scalable vectors.
      
      Note that in order for the "vector.contract -> vector.outerproduct"
      patterns to work, only the non-reduction dimension can be scalable (*).
      For Matmul operations that is set to be the N dimension (i.e. rows of
      the output matrix), which matches how matrix multiplication are normally
      implemented for e.g. Arm's SVE. However, making the M dimension scalable
      (i.e. columns of the output matrix) should work as well.
      
      Making both parellel dimensions scalable is left as a TODO for when
      support for 2-D scalable vectors is more established (this is
      work-in-progress as part of the effort to support Arm's SME in MLIR).
      
      The change in:
      
        * `UnrolledOuterProductGenerator`
      
      is a "bug fix" to make sure that the conversion pattern correctly
      propagates scalability when creating `arith.extf` operations.
      
      (*) The conversion tested in this file unrolls along the reduction
      dimension, which is not supported for scalable vectors.
      5270df3d
    • jeanPerier's avatar
      [flang] Implement legacy %VAL and %REF actual arguments (#70343) · 0a10e889
      jeanPerier authored
      Update evaluate::ActualArgument to propagate the %VAL and %REF markers
      until lowering.
      Semantic checks are added to %VAL to ensure the argument is a numerical
      or logical scalar.
      
      I did not push these markers into the characteristics because other
      compilers do not complain about inconsistent usages (e.g. using %VAL in
      a call on a procedure with an interface without VALUE dummies is not
      flagged by any compilers I tested, and it is not an issue for lowering,
      so I decided to stay simple here and minimize the footprint of these
      legacy features).
      
      Lowering retrieves these markers and does the right thing: pass %VAL in
      registers and pass %REF by address without adding any extra arguments
      for characters.
      0a10e889
    • Nikita Popov's avatar
      ea1909f8