1. Sep 20, 2023
    • Philip Reames's avatar
      [RISCV] Expand test coverage for widening gather and strided load idioms · de37d965
      Philip Reames authored
      While I'm here, cleanup a few implemented todos.
      de37d965
    • Wolfgang Pieb's avatar
      [SSP] Accessing __stack_chk_guard when using LTO (#66535) · 47c5734e
      Wolfgang Pieb authored
      This is a pre-commit test of accessing the variable __stack_chk_guard
      when the static relocation model is imposed on a module compiled with
      pic enabled. It confirms issue
      [#64999](https://github.com/llvm/llvm-project/issues/64999).
      
      The intent is to update this test with the fix for the aforementioned
      issue.
      47c5734e
    • Craig Topper's avatar
      [RISCV] Add more instructions for the short forward branch optimization. (#66789) · bbe3ee06
      Craig Topper authored
      This adds the shifts and the immediate forms of the instructions that
      were already supported.
      
      There are still more instructions that can be predicated, but this is
      the rest of what we had in our downstream.
      bbe3ee06
    • LLVM GN Syncbot's avatar
      [gn build] Port 93fde2ea · e145bc4d
      LLVM GN Syncbot authored
      e145bc4d
    • Aart Bik's avatar
      [mlir][sparse] More allocate -> empty tensor migration (#66720) · c6472f57
      Aart Bik authored
      This also allows tensor.empty in the "conversion" path of the sparse
      compiler, further paving the way to
      deprecate the bufferization.allocated_tensor() op.
      c6472f57
    • Jakub Kuderski's avatar
      [mlir][spirv][gpu] Convert remaining wmma ops to KHR coop matrix (#66455) · bdb5c9c3
      Jakub Kuderski authored
      These do not produce extension-specific ops and are handled via common
      patterns for both the KHR and the NV coop matrix extension.
      
      Also improve match failure reporting and error handling in type
      conversion.
      bdb5c9c3
    • Yingwei Zheng's avatar
      [RISCV] Add a pass to rewrite rd to x0 for non-computational instrs whose return values are unused · 93fde2ea
      Yingwei Zheng authored
      When AMOs are used to implement parallel reduction operations, typically the return value would be discarded.
      This patch adds a peephole pass `RISCVDeadRegisterDefinitions`. It rewrites `rd` to `x0` when `rd` is marked as dead.
      It may improve the register allocation and reduce pipeline hazards on CPUs without register renaming and OOO.
      Comparison with GCC: https://godbolt.org/z/bKaxnEcec
      
      Reviewed By: craig.topper
      
      Differential Revision: https://reviews.llvm.org/D158759
      93fde2ea
    • Joel E. Denny's avatar
      [lit] Echo full RUN lines in case of external shells (#66408) · fba457d7
      Joel E. Denny authored
      Before <https://reviews.llvm.org/D154984> and
      <https://reviews.llvm.org/D156954>, lit reported full RUN lines in a
      `Script:` section. Now, in the case of lit's internal shell, it's the
      execution trace that includes them. However, if lit is configured to use
      an external shell (e.g., bash, windows `cmd`), they aren't reported at
      all.
      
      A fix was requested at the following:
      
      * <https://reviews.llvm.org/D154984#4627605>
      *
      <https://discourse.llvm.org/t/rfc-improving-lits-debug-output/72839/35?u=jdenny-ornl>
      
      This patch does not address the case when the external shell is windows
      `cmd`. As discussed at
      <https://github.com/llvm/llvm-project/pull/65242>, it's not clear
      whether that's a use case that people still care about, and it seems to
      be generally broken anyway.
      fba457d7
    • Joel E. Denny's avatar
      [lit] Improve test output from lit's internal shell · f223022a
      Joel E. Denny authored
      This patch and D154984 were discussed in
      <https://discourse.llvm.org/t/rfc-improving-lits-debug-output/72839>.
      
      Motivation
      ----------
      
      D154984 removes the "Script:" section that lit prints along with a
      test's output, and it makes -v and -a imply -vv.  For example, after
      D154984, the "Script:" section below is never shown, but -v is enough
      to produce the execution trace following it:
      
      ```
       Script:
       --
       : 'RUN: at line 1'; echo hello | FileCheck bogus.txt && echo success
       --
       Exit Code: 2
      
       Command Output (stdout):
       --
       $ ":" "RUN: at line 1"
       $ "echo" "hello"
       # command output:
       hello
      
       $ "FileCheck" "bogus.txt"
       # command stderr:
       Could not open check file 'bogus.txt': No such file or directory
      
       error: command failed with exit status: 2
      
       --
      ```
      
      In the D154984 review, some reviewers point out that they have been
      using the "Script:" section for copying and pasting a test's shell
      commands to a terminal window.  The shell commands as printed in the
      execution trace can be harder to copy and paste for the following
      reasons:
      
      - They drop redirections and break apart RUN lines at `&&`, `|`, etc.
      - They add `$` at the start of every command, which makes it hard to
        copy and paste multiple commands in bulk.
      - Command stdout, stderr, etc. are interleaved with the commands and
        are not clearly delineated.
      - They don't always use proper shell quoting.  Instead, they blindly
        enclose all command-line arguments in double quotes.
      
      Changes
      -------
      
      D154984 plus this patch converts the above example into:
      
      ```
       Exit Code: 2
      
       Command Output (stdout):
       --
       # RUN: at line 1
       echo hello | FileCheck bogus-file.txt && echo success
       # executed command: echo hello
       # .---command stdout------------
       # | hello
       # `-----------------------------
       # executed command: FileCheck bogus-file.txt
       # .---command stderr------------
       # | Could not open check file 'bogus-file.txt': No such file or directory
       # `-----------------------------
       # error: command failed with exit status: 2
      
       --
      ```
      
      Thus, this patch addresses the above issues as follows:
      
      - The entire execution trace can be copied and pasted in bulk to a
        terminal for correct execution of the RUN lines, which are printed
        intact as they appeared in the original RUN lines except lit
        substitutions are expanded.  Everything else in the execution trace
        appears in shell comments so it has no effect in a terminal.
      - Each of the RUN line's commands is repeated (in shell comments) as
        it executes to show (1) that the command actually executed (e.g.,
        `echo success` above didn't) and (2) what stdout, stderr, non-zero
        exit status, and output files are associated with the command, if
        any.  Shell quoting in the command is now correct and minimal but is
        not necessarily the original shell quoting from the RUN line.
      - The start and end of the contents of stdout, stderr, or an output
        file is now delineated clearly in the trace.
      
      To help produce some of the above output, this patch extends lit's
      internal shell with a built-in `@echo` command.  It's like `echo`
      except lit suppresses the normal execution trace for `@echo` and just
      prints its stdout directly.  For now, `@echo` isn't documented for use
      in lit tests.
      
      Without this patch, libcxx's custom lit test format tries to parse the
      stdout from `lit.TestRunner.executeScriptInternal` (which runs lit's
      internal shell) to extract the stdout and stderr produced by shell
      commands, and that parse no longer works after the above changes.
      This patch makes a small adjustment to
      `lit.TestRunner.executeScriptInternal` so libcxx can just request
      stdout and stderr without an execution trace.
      
      (As a minor drive-by fix that came up in testing: lit's internal `not`
      command now always produces a numeric exit status and never `True`.)
      
      Caveat
      ------
      
      This patch only makes the above changes for lit's internal shell.  In
      most cases, we do not know how to force external shells (e.g., bash,
      sh, window's `cmd`) to produce execution traces in the manner we want.
      
      To configure a test suite to use lit's internal shell (which is
      usually better for test portability than external shells anyway), add
      this to the test suite's `lit.cfg` or other configuration file:
      
      ```
      config.test_format = lit.formats.ShTest(execute_external=False)
      ```
      
      Reviewed By: MaskRay, awarzynski
      
      Differential Revision: https://reviews.llvm.org/D156954
      f223022a
    • Joel E. Denny's avatar
      [lit] Drop "Script:", make -v and -a imply -vv · 1495d51e
      Joel E. Denny authored
      This patch and D156954 were discussed in
      <https://discourse.llvm.org/t/rfc-improving-lits-debug-output/72839>.
      
      **Motivation**: -a shows output from all tests, and -v shows output
      from just failed tests.  Without this patch, that output from each
      test includes a section called "Script:", which includes all shell
      commands that lit has computed from RUN directives and will attempt to
      run for that test.  The effect of -vv (which also implies -v if
      neither -a or -v is specified) is to extend that output with shell
      commands as they are executing so you can easily see which one failed.
      
      For example, when using lit's internal shell and -vv:
      
      ```
      Script:
      --
      : 'RUN: at line 1'; echo hello world
      : 'RUN: at line 2'; 3c40 hello world
      : 'RUN: at line 3'; echo hello world
      --
      Exit Code: 127
      
      Command Output (stdout):
      --
      $ ":" "RUN: at line 1"
      $ "echo" "hello" "world"
      hello world
      
      $ ":" "RUN: at line 2"
      $ "3c40" "hello" "world"
      '3c40': command not found
      error: command failed with exit status: 127
      
      --
      ```
      
      Notice that all shell commands that actually execute appear in the
      output twice, once for "Script:" and once for -vv.  Especially for
      tests with many RUN directives, the result is noisy.  When searching
      through the output for a particular shell command, it is easy to get
      lost and mistake shell commands under "Script:" for shell commands
      that actually executed.
      
      **Change**: With this patch, a test's output changes in two ways.
      First, the "Script:" section is never shown.  Second, omitting -vv no
      longer disables printing of shell commands as they execute.  That is,
      -a and -v imply -vv, and so -vv is deprecated as it is just an alias
      for -v.
      
      **Secondary motivation**: We are also working to introduce a PYTHON
      directive, which can appear between RUN directives.  How should PYTHON
      directives be represented in the "Script:" section, which has
      previously been just a shell script?  We could probably think of
      something, but adding info about PYTHON directive execution in the -vv
      trace seems more straight-forward and more useful.
      
      (This patch also removes a confusing point in the -vv documentation:
      at least when using bash as an external shell, -vv echoes commands to
      the shell's stderr not stdout.)
      
      Reviewed By: awarzynski, Endill, ldionne, MaskRay
      
      Differential Revision: https://reviews.llvm.org/D154984
      1495d51e
    • Tue Ly's avatar
      [libc][math] Extract non-MPFR math tests into libc-math-smoke-tests. · 84c899b2
      Tue Ly authored
      Extract non-MPFR math tests into libc-math-smoke-tests.
      
      Reviewed By: sivachandra, jhuber6
      
      Differential Revision: https://reviews.llvm.org/D159477
      84c899b2
  2. Sep 19, 2023
    • Craig Topper's avatar
      [RISCV] Fix bad isel predicate handling for Ztso. (#66739) · 82676d49
      Craig Topper authored
      The predicates inside the AMOPat class were being overridden by the
      Predicates = [HasStdExtA] at the instantiation.
      82676d49
    • Jay Foad's avatar
      [TwoAddressInstruction] Use isPlainlyKilled in processTiedPairs (#65976) · 44e997a1
      Jay Foad authored
      Calling isPlainlyKilled instead of directly checking for a kill flag
      should make processTiedPairs behave the same with LiveIntervals
      (i.e. when compiling with -early-live-intervals) as it does with
      LiveVariables.
      44e997a1
    • Luke Lau's avatar
      [DAGCombiner] Combine vp.strided.store with unit stride to vp.store (#66774) · 22d0bd86
      Luke Lau authored
      This is the VP equivalent of #66677. If we have a strided store where
      the stride is equal to the element width, we can just use a regular VP
      store.
      22d0bd86
    • Luke Lau's avatar
      [DAGCombiner] Combine vp.strided.load with unit stride to vp.load (#66766) · 469f6b9b
      Luke Lau authored
      This is the VP equivalent of #65674. We already combine MGATHER loads
      with unit stride to MLOAD, so this extends it for
      EXPERIMENTAL_VP_STRIDED_LOAD.
      469f6b9b
    • Matthias Springer's avatar
      [mlir][Interfaces] `LoopLikeOpInterface`: Support ops with multiple regions (#66754) · 9b5ef2be
      Matthias Springer authored
      This commit implements `LoopLikeOpInterface` on `scf.while`. This
      enables LICM (and potentially other transforms) on `scf.while`.
      
      `LoopLikeOpInterface::getLoopBody()` is renamed to `getLoopRegions` and
      can now return multiple regions.
      
      Also fix a bug in the default implementation of
      `LoopLikeOpInterface::isDefinedOutsideOfLoop()`, which returned "false"
      for some values that are defined outside of the loop (in a nested op, in
      such a way that the value does not dominate the loop). This interface is
      currently only used for LICM and there is no way to trigger this bug, so
      no test is added.
      9b5ef2be
    • Matthias Springer's avatar
      [mlir][SCF] `ForOp`: Remove `getIterArgNumberForOpOperand` (#66629) · d69293c1
      Matthias Springer authored
      This function was inconsistent with the remaining API because it
      accepted `OpOperand &` that do not belong to the op. All the other
      functions assert. This helper function is also not really necessary, as
      the iter_arg number is identical to the result number.
      d69293c1
    • Erich Keane's avatar
      In ExprRequirement building, treat OverloadExpr as dependent (#66683) · 11bb5e55
      Erich Keane authored
      As reported in #66612, we aren't correctly treating the placeholder
      expression type correctly, so we ended up trying to get a reference
      version of it, and this resulted in an assertion, since the placeholder
      type cannot have a reference added.
      
      Fixes: #66612
      11bb5e55
    • Nikita Popov's avatar
      [SROA] Remove unnecessary IsStorePastEnd handling (NFCI) · ddf7cc27
      Nikita Popov authored
      Unlike the load case, stores past the end of the alloca are
      removed by SROA as undefined behavior. As such, there is no need
      to handle this case when rewriting stores.
      ddf7cc27
    • Philip Reames's avatar
      [RISCV] Add a combine to form masked.store from unit strided store · 188d5c74
      Philip Reames authored
      Add a DAG combine to form a masked.store from a masked_strided_store intrinsic
      with stride equal to element size. This is the store analogy to PR #65674.
      
      As seen in the tests, this does pickup a few cases that we'd previously missed
      due to selection ordering.  We match strided stores early without going through
      the recently added generic mscatter combines, and thus weren't recognizing the
      unit strided store.
      188d5c74
    • mgudim's avatar
      [RISCV] Recognize veyron-v1 processor in clang driver. (#66703) · 8f8f4493
      mgudim authored
      Subsequent PRs will add the scheduling model and support for macro
      fusions.
      8f8f4493
    • xingxue-ibm's avatar
      [libunwind][AIX] Fix up TOC register if unw_getcontext is called from a different module (#66549) · e25cd088
      xingxue-ibm authored
      `unw_getcontext` saves the caller's registers in the context. However,
      if the caller of `unw_getcontext` is in a different module, the glue
      code of `unw_getcontext` sets the TOC register (r2) with the new TOC
      base and saves the original TOC register value in the stack frame. This
      causes the incorrect TOC value is used when the caller steps up frames,
      which fails libunwind LIT test case `unw_resume.pass.cpp`. This PR fixes
      the problem by using the original TOC register value saved in the stack
      if the caller is in a different module and enables `unw_resume.pass.cpp`
      on AIX.
      e25cd088
    • Mircea Trofin's avatar
      [mlgo] Fix tests post PR #66334 · a21d4abc
      Mircea Trofin authored
      a21d4abc
    • Natalie Chouinard's avatar
      [SPIRV] Test basic float and int types (#66282) · 116f7a2d
      Natalie Chouinard authored
      Add Int16, Int64 and Float64 capabilities as always available for Vulkan
      (since 1.0), and add tests covering most of the basic types from
      clang/test/CodeGenHLSL/basic_types.hlsl except for half floats.
      
      Depends on D156049
      116f7a2d
    • Timm Bäder's avatar
      [clang][TSA] Thread safety cleanup functions · cf8e189a
      Timm Bäder authored
      Consider cleanup functions in thread safety analysis.
      
      Differential Revision: https://reviews.llvm.org/D152504
      cf8e189a
    • David Truby's avatar
      [flang] Add comdats to functions with linkonce linkage (#66516) · 5f476b80
      David Truby authored
      This fixes a bug where functions generated by the MLIR Math dialect, for
      example ipowi, would fail to link with link.exe on Windows due to having
      linkonce linkage but no associated comdat. Adding the comdat on ELF also
      allows linkers to perform better garbage collection in the binary.
      
      Simply adding comdats to all functions with this linkage type should
      also cover future cases where linkonce or linkonce_odr functions might
      be necessary.
      5f476b80
    • Haojian Wu's avatar
      [bazel] Port for 571df013 · 00ecef90
      Haojian Wu authored
      00ecef90
    • Natalie Chouinard's avatar
      [SPIRV] Fix bug in emitting GLSL ext inst names · 4abe3f18
      Natalie Chouinard authored
      Lookup extended instruction numbers in the given instruction set so that
      correct names are now emitted for GLSL.std.450 instructions as well as
      OpenCL.std.
      
      Add a single test to verify correct abs intrinsic names are emitted when
      targetting logical SPIR-V.
      
      Depends on D156424
      
      Differential Revision: https://reviews.llvm.org/D159227
      4abe3f18
    • Alexandros Lamprineas's avatar
      [FuncSpec] Adjust the names of specializations and promoted stack values · e15d72ad
      Alexandros Lamprineas authored
      Currently the naming scheme is a bit funky; the specializations are named
      after the original function followed by an arbitrary decimal number. This
      makes it hard to debug inlined specializations of recursive functions.
      With this patch I am adding ".specialized." in between of the original
      name and the suffix, which is now a single increment counter.
      e15d72ad
    • Andrew Gozillon's avatar
      [MLIR][OpenMP] Alterations to LLVM-IR lowering of OpenMP Dialect due to Bounds... · b05d436e
      Andrew Gozillon authored
      [MLIR][OpenMP] Alterations to LLVM-IR lowering of OpenMP Dialect due to Bounds and MapEntry operations
      
      This patch adjusts the lower to LLVM-IR inside of
      OpenMPToLLVMIRTranslation to faciliate the changes made
      to Target related operations to add the new Map related
      operations. It also includes adjustments to tests to support
      these changes, primarily modifying the MLIR as opposed to
      the LLVM-IR, the LLVM-IR should be identical after this patch.
      
      Depends on D158735
      
      Reviewers: kiranchandramohan, TIFitis, razvanlupusoru
      
      Differential Revision: https://reviews.llvm.org/D158737
      b05d436e
    • Andrew Gozillon's avatar
      [Flang][MLIR][OpenMP] Update OMPEarlyOutlining to support Bounds, MapEntry and... · eaa0d281
      Andrew Gozillon authored
      [Flang][MLIR][OpenMP] Update OMPEarlyOutlining to support Bounds, MapEntry and declare target globals
      
      This patch is a required change for the device side IR to
      maintain apporpiate links for declare target variables to
      their global variables for later lowering.
      
      It is also a requirement to clone over map bounds and
      entry operations to maintain the correct information for
      later lowering of the IR.
      
      It simply tries to clone over the relevant information
      maintaining the appropriate links they would have
      maintained prior to the pass, rather than redirecting
      them to new function arguments which causes a
      loss of information in the case of Declare Target
      and map information.
      
      Depends on D158734
      
      reviewers: TIFitis, razvanlupusoru
      
      Differential Revision: https://reviews.llvm.org/D158735
      eaa0d281
    • Andrew Gozillon's avatar
      [Flang][OpenMP] Add lowering from PFT to new MapEntry and Bounds operations... · 8fde6f41
      Andrew Gozillon authored
      [Flang][OpenMP] Add lowering from PFT to new MapEntry and Bounds operations and tie them to relevant Target operations
      
      This patch builds on top of a prior patch in review which adds a new map
      and bounds operation by modifying the OpenMP PFT lowering to support
      these operations and generate them from the PFT.
      
      A significant amount of the support for the Bounds operation is borrowed
      from OpenACC's own current implementation and lowering, just ported
      over to OpenMP.
      
      The patch also adds very preliminary/initial support for lowering to
      a new Capture attribute, which is stored on the new Map Operation,
      which helps the later lowering from OpenMP -> LLVM IR by indicating
      how a map argument should be handled. This capture type will
      influence how a map argument is accessed on device and passed by
      the host (different load/store handling etc.). It is reflective of a
      similar piece of information stored in the Clang AST which performs a
      similar role.
      
      As well as some minor adjustments to how the map type (map bitshift
      which dictates to the runtime how it should handle an argument) is
      generated to further support more use-cases for future patches that
      build on this work.
      
      Finally it adds the map entry operation creation and tying it to the relevant
      target operations as well as the addition of some new tests and alteration
      of previous tests to support the new changes.
      
      Depends on D158732
      
      reviewers: kiranchandramohan, TIFitis, clementval, razvanlupusoru
      
      Differential Revision: https://reviews.llvm.org/D158734
      8fde6f41
    • Andrew Gozillon's avatar
      [OpenMP][MLIR] Refactor and extend current map support by adding MapInfoOp and... · 571df013
      Andrew Gozillon authored
      [OpenMP][MLIR] Refactor and extend current map support by adding MapInfoOp and DataBoundsOp operations to the OpenMP Dialect
      
      This patch adds two new operations:
      
      The first is the DataBoundsOp, which is based on OpenACC's DataBoundsOp,
      which holds stride, index, extent, lower bound and upper bounds
      which will be used in future follow up patches to perform initial
      array sectioning of mapped arrays, and Fortran pointer and
      allocatable mapping. Similarly to OpenACC, this new OpenMP
      DataBoundsOp also comes with a new OpenMP type, which
      helps to restrict operations to accepting only
      DataBoundsOp as an input or output where necessary
      (or other related operations that implement this type as
      a return).
      
      The patch also adds the MapInfoOp which rolls up some of
      the old map information stored in target
      operations into this new operation, and adds new
      information that will be utilised in the lowering of mapped
      variables, e.g. the aforementioned DataBoundsOp, but also a
      new ByCapture OpenMP MLIR attribute, and isImplicit boolean
      attribute. Both the ByCapture and isImplicit arguments will
      affect the lowering from the OpenMP dialect to LLVM-IR in
      minor but important ways, such as shifting the final maptype
      or generating different load/store combinations to maintain
      semantics with the OpenMP standard and alignment with the
      current Clang OpenMP output as best as possible.
      
      This MapInfoOp operation is slightly based on OpenACC's
      DataEntryOp, the main difference other than some slightly
      different fields (e,g, isImplicit/MapType/ByCapture) is that
      OpenACC's data operations "inherit" (the MLIR ODS
      equivalent) from this operation, whereas in OpenMP operations
      that utilise MapInfoOp's are composed of/contain them.
      
      A series of these MapInfoOp (one per map clause list item) is
      now held by target operations that represent OpenMP
      directives that utilise map clauses, e.g. TargetOp. MapInfoOp's
      do not have their own specialised lowering to LLVM-IR, instead
      the lowering is dependent on the particular container of the
      MapInfoOp's, e.g. TargetOp has its own lowering to LLVM-IR
      which utilised the information stored inside of MapInfoOp's to
      affect it's lowering and the end result of the LLVM-IR generated,
      which in turn can differ for host and device.
      
      This patch contains these operations, minor changes to the
      printing and parsing to support them, changes to tests (only
      those relevant to this segment of the patch, other test
      additions and changes are in other dependent
      patches in this series) and some alterations to the OpenMPToLLVM
      rewriter to support the new OpenMP type and operations.
      
      This patch is one in a series that are dependent on each
      other:
      
      https://reviews.llvm.org/D158734
      https://reviews.llvm.org/D158735
      https://reviews.llvm.org/D158737
      
      Reviewers: kiranchandramohan, TIFitis, razvanlupusoru
      
      Differential Revision: https://reviews.llvm.org/D158732
      571df013
    • Ben Mudd's avatar
      [Dexter] Associate parser errors with correct file (#66765) · 9120e854
      Ben Mudd authored
      Currently if Dexter encounters a parser error with a command, the resulting
      error message will refer to the most recently declared file (i.e. the source
      file it is testing) rather than the file containing the command itself. This
      patch fixes this so that parser errors point towards the correct location.
      9120e854
    • Zahira Ammarguellat's avatar
      Fix math-errno issue (#66381) · a292e7ed
      Zahira Ammarguellat authored
      Update handling of math errno. This change updates the logic for
      generation of math intrinics in place of math library function calls.
      The previous logic https://reviews.llvm.org/D151834 was incorrectly
      using intrinsics when math errno handling was needed at optimization
      levels above -O0.
      This also fixes issue mentioned in https://reviews.llvm.org/D151834 by
      @uabelho
      This is joint work with @andykaylor Andy.
      a292e7ed
    • vic's avatar
      [IR] `SingleBlock::push_back` operations to the back of the block (#66655) · 6d1c6ecb
      vic authored
      
      
      Instead of checking whether the last operation might be a terminator,
      always insert operations to the end of the block.
      
      Signed-off-by: default avatarVictor Perez <victor.perez@codeplay.com>
      6d1c6ecb
    • Nikita Popov's avatar
      [InstCombine] Make flag drop during select equiv fold more generic · c41b4b63
      Nikita Popov authored
      Instead of unsetting flags on the instruction, attempting the
      fold, and the resetting the flags if it failed, add support to
      simplifyWithOpReplaced() to ignore poison-generating flags/metadata
      and collect all instructions where they may need to be dropped.
      
      This allows us to perform the fold a) with poison-generating
      metadata, which was previously not handled and b) poison-generating
      flags/metadata that are not on the root instruction.
      
      Proof for the ctpop case: https://alive2.llvm.org/ce/z/3H3HFs
      
      Fixes https://github.com/llvm/llvm-project/issues/62450.
      c41b4b63
    • Nikita Popov's avatar
      [InstCombine] Add test for #62450 (NFC) · f502ab79
      Nikita Popov authored
      f502ab79
    • David Spickett's avatar
      [lldb][AArch64] Add testing for SME's ZA and SVG registers · e96adfd0
      David Spickett authored
      An SME enabled program has the following extra state:
      * Streaming mode or non-streaming mode.
      * ZA enabled or disabled.
      * The active vector length.
      
      Covering the transition between all possible states and all other
      possible states is not viable, therefore the testing added here is a cross
      section of that, all of which found real bugs in LLDB and the Linux
      Kernel during development.
      
      Many of those transitions will not be possible via LLDB
      (e.g. disabling ZA) and many more are possible but unlikely to be
      used in normal use.
      
      Added testing:
      * TestSVEThreadedDynamic now checks for correct SVG values.
      * New test TestZAThreadedDynamic creates 3 threads with different ZA sizes
        and states and switches between them verifying the register value
        (derived from the existing threaded SVE test).
      * New test TestZARegisterSaveRestore starts in a given SME state, runs a
        set of expressions in various orders, then checks that the original
        state has been restored.
      * TestArm64DynamicRegsets has ZA and SVG checks added, including writing
        to ZA to enable it.
      
      Running these tests will as usual require QEMU as there is no
      real SME hardware available at this time, and a very recent
      kernel.
      
      Reviewed By: omjavaid
      
      Differential Revision: https://reviews.llvm.org/D159505
      e96adfd0
    • David Spickett's avatar
      [lldb][AArch64] Implement resizing of SME's ZA register · 46b961f3
      David Spickett authored
      The size of ZA depends on the streaming vector length regardless
      of the active mode. So in addition to vg (which reports the active
      mode) we must send the client svg.
      
      Otherwise the mechanics are the same as for non-streaming SVE.
      Use the svg value to update the defined size of ZA, accounting
      for the fact that ZA is not a single vector but a suqare matrix.
      
      So if svg is 8, a single streaming vector would be 8*8 = 64 bytes.
      ZA is that squared, so 64*64 = 4096 bytes.
      
      Testing is included in a later patch.
      
      Reviewed By: omjavaid
      
      Differential Revision: https://reviews.llvm.org/D159504
      46b961f3