Commit Graph

475211 Commits

Author SHA1 Message Date
kstoimenov
c133fe141f
Addressed review comments to use ThreadSafe instead of !ThreadSafe 2023-09-19 11:05:42 -07:00
Philip Reames
fc95de38d9 [RISCV] Require alignment when forming gather with larger element type
This fixes a bug in my 928564caa5 that didn't get noticed in review.  I found it when looking at the strided load case (upcoming patch), and realized the previous commit was buggy too.

p.s. Sorry for the slightly confusing test diff.  I'd apparently used the wrong mask for the aligned positive test; it was actually unaligned.  Didn't seem worthy of a separate precommit.
2023-09-19 11:00:42 -07:00
Slava Zakharin
a9a1f849a9
[flang][hlfir] Fixed assignment/finalization order for user-defined assignments. (#66736)
This patch places the finalization code for the RHS of a user-defined
assignment after the assignment code. The change only affects
standalone RegionAssignOp operations.
2023-09-19 10:57:40 -07:00
Alex Langford
f1097e88d2 [lldb] Fix build after d5a62b78b8
I renamed something but forgot to update the uses of it. Minor thinko.
2023-09-19 10:56:13 -07:00
Zequan Wu
6bab400835 [Profile] Delete coverage-debug-info-correlate.cpp test on mac as debug info correlation not working on mac for unkown reasons. 2023-09-19 13:55:47 -04:00
Alex Langford
d5a62b78b8
[lldb][NFCI] Remove unneccessary allocation in ScriptInterpreterPythonImpl::GetSyntheticTypeName (#66724)
Instead of copying memory out of the PythonString (via a std::string)
and then using that to create a ConstString, it would make more sense to
just create the ConstString from the original StringRef in the first
place.
2023-09-19 10:49:53 -07:00
Alex Langford
45e6e4d70e
[lldb][NFCI] Remove unneeded ConstString from intel-pt plugin (#66721)
This is a follow-up to 14d95b26ae. I would
have changed it in that commit, but I don't build the intel-pt plugin so
I didn't see this until later.
2023-09-19 10:49:38 -07:00
Philip Reames
de37d965da [RISCV] Expand test coverage for widening gather and strided load idioms
While I'm here, cleanup a few implemented todos.
2023-09-19 10:43:40 -07:00
Wolfgang Pieb
47c5734e54
[SSP] Accessing __stack_chk_guard when using LTO (#66535)
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.
2023-09-19 10:34:37 -07:00
Craig Topper
bbe3ee061f
[RISCV] Add more instructions for the short forward branch optimization. (#66789)
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.
2023-09-19 10:21:39 -07:00
LLVM GN Syncbot
e145bc4d7d [gn build] Port 93fde2ea1b 2023-09-19 17:10:08 +00:00
Aart Bik
c6472f5715
[mlir][sparse] More allocate -> empty tensor migration (#66720)
This also allows tensor.empty in the "conversion" path of the sparse
compiler, further paving the way to
deprecate the bufferization.allocated_tensor() op.
2023-09-19 10:05:40 -07:00
Jakub Kuderski
bdb5c9c3fa
[mlir][spirv][gpu] Convert remaining wmma ops to KHR coop matrix (#66455)
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.
2023-09-19 13:04:34 -04:00
Yingwei Zheng
93fde2ea1b
[RISCV] Add a pass to rewrite rd to x0 for non-computational instrs whose return values are unused
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
2023-09-20 01:02:19 +08:00
Joel E. Denny
fba457d77e
[lit] Echo full RUN lines in case of external shells (#66408)
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.
2023-09-19 12:46:37 -04:00
Joel E. Denny
f223022a4c [lit] Improve test output from lit's internal shell
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
2023-09-19 12:38:38 -04:00
Joel E. Denny
1495d51ee9 [lit] Drop "Script:", make -v and -a imply -vv
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
2023-09-19 12:36:52 -04:00
Tue Ly
84c899b235 [libc][math] Extract non-MPFR math tests into libc-math-smoke-tests.
Extract non-MPFR math tests into libc-math-smoke-tests.

Reviewed By: sivachandra, jhuber6

Differential Revision: https://reviews.llvm.org/D159477
2023-09-19 12:10:21 -04:00
Craig Topper
82676d49d3
[RISCV] Fix bad isel predicate handling for Ztso. (#66739)
The predicates inside the AMOPat class were being overridden by the
Predicates = [HasStdExtA] at the instantiation.
2023-09-19 08:57:49 -07:00
Jay Foad
44e997a158
[TwoAddressInstruction] Use isPlainlyKilled in processTiedPairs (#65976)
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.
2023-09-19 16:44:20 +01:00
Luke Lau
22d0bd8632
[DAGCombiner] Combine vp.strided.store with unit stride to vp.store (#66774)
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.
2023-09-19 16:43:50 +01:00
Luke Lau
469f6b9b4c
[DAGCombiner] Combine vp.strided.load with unit stride to vp.load (#66766)
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.
2023-09-19 16:39:28 +01:00
Matthias Springer
9b5ef2bea8
[mlir][Interfaces] LoopLikeOpInterface: Support ops with multiple regions (#66754)
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.
2023-09-19 17:35:38 +02:00
Matthias Springer
d69293c1c8
[mlir][SCF] ForOp: Remove getIterArgNumberForOpOperand (#66629)
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.
2023-09-19 17:33:40 +02:00
Erich Keane
11bb5e55dc
In ExprRequirement building, treat OverloadExpr as dependent (#66683)
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
2023-09-19 08:31:18 -07:00
Nikita Popov
ddf7cc27f7 [SROA] Remove unnecessary IsStorePastEnd handling (NFCI)
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.
2023-09-19 16:53:24 +02:00
Philip Reames
188d5c7442 [RISCV] Add a combine to form masked.store from unit strided store
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.
2023-09-19 07:45:35 -07:00
mgudim
8f8f4493d5
[RISCV] Recognize veyron-v1 processor in clang driver. (#66703)
Subsequent PRs will add the scheduling model and support for macro
fusions.
2023-09-19 10:39:43 -04:00
xingxue-ibm
e25cd088a6
[libunwind][AIX] Fix up TOC register if unw_getcontext is called from a different module (#66549)
`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.
2023-09-19 10:37:30 -04:00
Mircea Trofin
a21d4abc89 [mlgo] Fix tests post PR #66334 2023-09-19 07:34:20 -07:00
Natalie Chouinard
116f7a2dcb
[SPIRV] Test basic float and int types (#66282)
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
2023-09-19 10:24:53 -04:00
Timm Bäder
cf8e189a99 [clang][TSA] Thread safety cleanup functions
Consider cleanup functions in thread safety analysis.

Differential Revision: https://reviews.llvm.org/D152504
2023-09-19 16:00:33 +02:00
David Truby
5f476b80e3
[flang] Add comdats to functions with linkonce linkage (#66516)
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.
2023-09-19 15:00:04 +01:00
Haojian Wu
00ecef906b [bazel] Port for 571df0132d 2023-09-19 15:46:41 +02:00
Natalie Chouinard
4abe3f18e2 [SPIRV] Fix bug in emitting GLSL ext inst names
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
2023-09-19 13:44:13 +00:00
Alexandros Lamprineas
e15d72adac
[FuncSpec] Adjust the names of specializations and promoted stack values
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.
2023-09-19 14:40:31 +01:00
Andrew Gozillon
b05d436ec6 [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
2023-09-19 08:26:47 -05:00
Andrew Gozillon
eaa0d281b6 [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
2023-09-19 08:26:46 -05:00
Andrew Gozillon
8fde6f41a0 [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
2023-09-19 08:26:46 -05:00
Andrew Gozillon
571df0132d [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
2023-09-19 08:26:46 -05:00
Ben Mudd
9120e85448 [Dexter] Associate parser errors with correct file (#66765)
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.
2023-09-19 14:16:17 +01:00
Zahira Ammarguellat
a292e7edf8
Fix math-errno issue (#66381)
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.
2023-09-19 09:13:02 -04:00
vic
6d1c6ecbdc
[IR] SingleBlock::push_back operations to the back of the block (#66655)
Instead of checking whether the last operation might be a terminator,
always insert operations to the end of the block.

Signed-off-by: Victor Perez <victor.perez@codeplay.com>
2023-09-19 15:06:22 +02:00
Nikita Popov
c41b4b6397 [InstCombine] Make flag drop during select equiv fold more generic
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.
2023-09-19 14:54:25 +02:00
Nikita Popov
f502ab7961 [InstCombine] Add test for #62450 (NFC) 2023-09-19 14:47:02 +02:00
David Spickett
e96adfd0db [lldb][AArch64] Add testing for SME's ZA and SVG registers
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
2023-09-19 12:18:23 +00:00
David Spickett
46b961f36b [lldb][AArch64] Implement resizing of SME's ZA register
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
2023-09-19 12:05:22 +00:00
wangpc
61d819dd52 [RISCV] Add tests for memory constraint A
We should not optimize it in D158062. This adds the test coverage.

And unneeded attributes `nonnull` and `inbounds` are removed.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D159530
2023-09-19 19:51:04 +08:00
Haojian Wu
71c83fb8b6 [LLD] Improve the lit tests added by 272bd6f9cc
The `cp` command will copy the permission bits from the original file to
the new one, which will cause permission denied (no written access) for the
following "echo" command in some system.

Switch to use `cat` which is more robust.
2023-09-19 13:47:08 +02:00
Oleksandr "Alex" Zinenko
a2a1dbb518
[mlir] avoid crash in transform.sequence verifier (#66756)
The verifier was unconditionally accessing the body block terminator,
but it's not guaranteed that the block has one in general.
2023-09-19 13:28:53 +02:00