platform/upstream/llvm.git
2 years ago[InstCombine] Look through more casts when folding memchr and memcmp
Martin Sebor [Tue, 28 Jun 2022 21:04:26 +0000 (15:04 -0600)]
[InstCombine] Look through more casts when folding memchr and memcmp

Enhance getConstantDataArrayInfo to let the memchr and memcmp library
call folders look through arbitrarily long sequences of bitcast and
GEP instructions.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D128364

2 years agobuild_symbolizer: Set LLVM_DEFAULT_TARGET_TRIPLE in llvm builds
Matthias Braun [Tue, 28 Jun 2022 05:03:25 +0000 (22:03 -0700)]
build_symbolizer: Set LLVM_DEFAULT_TARGET_TRIPLE in llvm builds

Pass on the default target triple of the host clang to the LLVM builds
within the `build_symbolizer.sh` script.

Differential Revision: https://reviews.llvm.org/D128731

2 years agoAvoid ar_to_bc.sh script in symbolizer build; add -ignore-non-bitcode flag to llvm...
Matthias Braun [Tue, 28 Jun 2022 04:38:45 +0000 (21:38 -0700)]
Avoid ar_to_bc.sh script in symbolizer build; add -ignore-non-bitcode flag to llvm-link

Remove the `ar_to_bc.sh` helper script in the compiler-rt symbolizer
build. Instead use `llvm-link` directly as D81109 introduced the
capability to read archives. I just needed to add a new flag
`-ignore-non-bitcode` to avoid `llvm-link` aborting when it found a
non-bitcode file in the archive.

Differential Revision: https://reviews.llvm.org/D128729

2 years ago[MachineCombiner, AArch64] Add a new pattern A-(B+C) => (A-B)-C to reduce latency
Guozhi Wei [Tue, 28 Jun 2022 21:42:51 +0000 (21:42 +0000)]
[MachineCombiner, AArch64] Add a new pattern A-(B+C) => (A-B)-C to reduce latency

Add a new pattern A - (B + C) ==> (A - B) - C to give machine combiner a chance
to evaluate which instruction sequence has lower latency.

Differential Revision: https://reviews.llvm.org/D124564

2 years ago[gn build] Port 77df3be0dee4
LLVM GN Syncbot [Tue, 28 Jun 2022 21:25:13 +0000 (21:25 +0000)]
[gn build] Port 77df3be0dee4

2 years ago[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef.
Alexey Lapshin [Tue, 28 Jun 2022 16:52:12 +0000 (19:52 +0300)]
[Debuginfo][DWARF][NFC] Refactor DwarfStringPoolEntryRef.

This review is extracted from D96035.

This patch adds possibility to keep not only DwarfStringPoolEntry, but also
pointer to it. The DwarfStringPoolEntryRef keeps reference to the string map entry.
String map keeps string data and corresponding DwarfStringPoolEntry
info. Not all string map entries may be included into the result,
and then not all string entries should have DwarfStringPoolEntry
info. Currently StringMap keeps DwarfStringPoolEntry for all entries.
It leads to extra memory usage. This patch allows to keep
DwarfStringPoolEntry info only for entries which really need it.

Reviewed By: JDevlieghere

Differential Revision: https://reviews.llvm.org/D126883

2 years ago[libc] add integer writing to printf
Michael Jones [Fri, 10 Jun 2022 18:12:40 +0000 (11:12 -0700)]
[libc] add integer writing to printf

This patch adds %n to printf, as well as a compiler flag to disable it.
This is due to it having serious security issues when misused.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D127517

2 years ago[RISCV] Pin two tests to fixed length vectorization to preserve test intent
Philip Reames [Tue, 28 Jun 2022 20:53:22 +0000 (13:53 -0700)]
[RISCV] Pin two tests to fixed length vectorization to preserve test intent

2 years ago[SLP]Fix PR56251: Do not remove the reordering from the root node, being used as...
Alexey Bataev [Mon, 27 Jun 2022 20:20:50 +0000 (13:20 -0700)]
[SLP]Fix PR56251: Do not remove the reordering from the root node, being used as an operand.

If the root order itself does not require reordering, we can just
remove its reorder mask safely (e.g., if the root node is a vector of
phis). But if this node is used as an operand in the graph, we cannot
delete the reordering, need to keep it. Otherwise the graph nodes are
not synchronized with the operands. It may cause an extra gather
instruction(s) or a compiler crash.
Also, need to be very careful when selecting the gather nodes for
reordering since there might several gather nodes with the same scalars
and we can try to reorder just the same node many times instead of
different nodes.

Differential Revision: https://reviews.llvm.org/D128680

2 years ago[flang] Lower Fortran math intrinsic operations into MLIR ops or libm calls.
Slava Zakharin [Wed, 22 Jun 2022 21:41:02 +0000 (14:41 -0700)]
[flang] Lower Fortran math intrinsic operations into MLIR ops or libm calls.

Added new -lower-math-early option that defaults to 'true' that matches
the current math lowering scheme. If set to 'false', the intrinsic math
operations will be lowered to MLIR operations, which should potentially
enable more MLIR optimizations, or libm calls, if there is no corresponding
MLIR operation exists or if "precise" mode is requested.
The generated math MLIR operations are then converted to LLVM dialect
during codegen phase.

The -lower-math-early option is not exposed to users currently. I plan to
get rid of the "early" lowering completely, when "late" lowering
is robust enough to support all math intrinsics that are currently
supported via pgmath. So "late" mode will become default and -lower-math-early
option will not be needed. This will effectively eliminate the mandatory
dependency on pgmath in Fortran lowering, but this is WIP.

Differential Revision: https://reviews.llvm.org/D128385

2 years agoImprove handling of static assert messages.
Corentin Jabot [Fri, 20 Aug 2021 15:52:28 +0000 (17:52 +0200)]
Improve handling of static assert messages.

Instead of dumping the string literal (which
quotes it and escape every non-ascii symbol),
we can use the content of the string when it is a
8 byte string.

Wide, UTF-8/UTF-16/32 strings are still completely
escaped, until we clarify how these entities should
behave (cf https://wg21.link/p2361).

`FormatDiagnostic` is modified to escape
non printable characters and invalid UTF-8.

This ensures that unicode characters, spaces and new
lines are properly rendered in static messages.
This make clang more consistent with other implementation
and fixes this tweet
https://twitter.com/jfbastien/status/1298307325443231744 :)

Of note, `PaddingChecker` did print out new lines that were
later removed by the diagnostic printing code.
To be consistent with its tests, the new lines are removed
from the diagnostic.

Unicode tables updated to both use the Unicode definitions
and the Unicode 14.0 data.

U+00AD SOFT HYPHEN is still considered a print character
to match existing practices in terminals, in addition of
being considered a formatting character as per Unicode.

Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D108469

2 years ago[mlir] Update flipped accessors (NFC)
Jacques Pienaar [Tue, 28 Jun 2022 20:11:25 +0000 (13:11 -0700)]
[mlir] Update flipped accessors (NFC)

Follow up with memref flipped and flipping any intermediate changes
made.

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param in VectorDistribute...
Mehdi Amini [Sun, 12 Jun 2022 18:05:22 +0000 (18:05 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in VectorDistribute.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr in SPIRVOps.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:56:43 +0000 (17:56 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in SPIRVOps.cpp (NFC)

2 years ago[lldb] [llgs] Fix premature server exit if multiprocess+nonstop
Michał Górny [Mon, 27 Jun 2022 12:22:38 +0000 (14:22 +0200)]
[lldb] [llgs] Fix premature server exit if multiprocess+nonstop

Fix lldb-server in the non-stop + multiprocess mode to exit on vStopped
only if all processes have exited, rather than when the first one exits.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128639

2 years ago[lldb] [llgs] Add base nonstop fork/vfork tests
Michał Górny [Wed, 22 Jun 2022 18:04:08 +0000 (20:04 +0200)]
[lldb] [llgs] Add base nonstop fork/vfork tests

Extend the most of baseline fork tests to run in nonstop mode as well.
For more cases, we're just testing one example scenario to save time.
This patch does not cover tests that rely on correct exit handling,
as fixing that is addressed in a followup patch.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128638

2 years ago[lldb] Add a NativeProcessProtocol::Threads() iterable
Michał Górny [Tue, 28 Jun 2022 06:24:24 +0000 (08:24 +0200)]
[lldb] Add a NativeProcessProtocol::Threads() iterable

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.llvm.org/D128698

2 years ago[libc++] Fix signature of main() in tests
Louis Dionne [Tue, 28 Jun 2022 19:36:52 +0000 (15:36 -0400)]
[libc++] Fix signature of main() in tests

Otherwise, this breaks freestanding builds, where `main()` isn't mangled
specially and we need to assume that we have a `int main(int, char**)`
entry point in each test for things to work.

2 years ago[MLIR][Presburger] subtract: support non-div locals
Arjun P [Tue, 28 Jun 2022 19:35:05 +0000 (20:35 +0100)]
[MLIR][Presburger] subtract: support non-div locals

Also added test cases. Also extend support for `computeReprWithOnlyDivLocals` from `IntegerPolyhedron` to `IntegerRelation` and `PresburgerRelation`.

Depends on D128736.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D128737

2 years ago[OpenMP][CUDA] Fix the issue that P2P memcpy doesn't work
Shilei Tian [Tue, 28 Jun 2022 19:31:41 +0000 (15:31 -0400)]
[OpenMP][CUDA] Fix the issue that P2P memcpy doesn't work

This patch fixes the issue that P2P memcpy doesn't work. The root cause is we didn't set current context when calling the API function. In addition, a matrix to track the states of each pair of devices is also added such that we only need to query and configure the device once.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D122764

2 years ago[MLIR][Presburger] subtract: fix support for divs defined by equalities
Arjun P [Tue, 28 Jun 2022 19:23:39 +0000 (20:23 +0100)]
[MLIR][Presburger] subtract: fix support for divs defined by equalities

Also added test cases to test this. Both IntegerRelation::addLocalFloorDiv and the fixed implementation of subtraction need to compute division inequalities from dividend and divisor, so this also adds helper util functions to avoid duplicating this logic.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D128736

2 years agoRevert "[pseudo] Add error-recovery framework & brace-based recovery"
Sam McCall [Tue, 28 Jun 2022 19:09:15 +0000 (21:09 +0200)]
Revert "[pseudo] Add error-recovery framework & brace-based recovery"

This reverts commit a0f4c10ae227a62c2a63611e64eba83f0ff0f577.
This commit hadn't been reviewed yet, and was unintentionally included
on another branch.

2 years ago[NFC][HWASan] Refactor hwasan pass
Leonard Chan [Tue, 28 Jun 2022 19:08:12 +0000 (12:08 -0700)]
[NFC][HWASan] Refactor hwasan pass

This moves some code for getting PC and SP into their own functions. Since SP
is also retrieved in the prologue and getting the stack tag, we can cache the
SP if we get it once in the prologue. This caching will really only be relevant
in D128387 where StackBaseTag may not be set in the prologue if __hwasan_tls
is not used.

Differential Revision: https://reviews.llvm.org/D128551

2 years ago[pseudo] Move ellipsis into initializer-list-item. NFC
Sam McCall [Tue, 28 Jun 2022 19:08:21 +0000 (21:08 +0200)]
[pseudo] Move ellipsis into initializer-list-item. NFC

This makes the list formation a bit simpler.

2 years ago[pseudo] Add error-recovery framework & brace-based recovery
Sam McCall [Wed, 8 Jun 2022 21:27:23 +0000 (23:27 +0200)]
[pseudo] Add error-recovery framework & brace-based recovery

The idea is:
 - a parse failure is detected when all heads die when trying to shift
   the next token
 - we can recover by choosing a nonterminal we're partway through parsing,
   and determining where it ends through nonlocal means (e.g. matching brackets)
 - we can find candidates by walking up the stack from the (ex-)heads
 - the token range is defined using heuristics attached to grammar rules
 - the unparsed region is represented in the forest by an Opaque node

This patch has the core GLR functionality.
It does not allow recovery heuristics to be attached as extensions to
the grammar, but rather infers a brace-based heuristic.

Expected followups:
 - make recovery heuristics grammar extensions (depends on D127448)
 - add recover to our grammar for bracketed constructs and sequence nodes
 - change the structure of our augmented `_ := start` rules to eliminate
   some special-cases in glrParse.
 - (if I can work out how): avoid some spurious recovery cases described
   in comments
 - grammar changes to eliminate the hard distinction between init-list
   and designated-init-list shown in the recovery-init-list.cpp testcase

Differential Revision: https://reviews.llvm.org/D128486

2 years ago[libc++][ranges] Finish LWG issues directly related to the One Ranges Proposal.
Konstantin Varlamov [Tue, 28 Jun 2022 18:59:59 +0000 (11:59 -0700)]
[libc++][ranges] Finish LWG issues directly related to the One Ranges Proposal.

- P1252 ("Ranges Design Cleanup") -- deprecate
  `move_iterator::operator->` starting from C++20; add range comparisons
  to the `<functional>` synopsis. This restores
  `move_iterator::operator->` that was incorrectly deleted in D117656;
  it's still defined in the latest draft, see
  http://eel.is/c++draft/depr.move.iter.elem. Note that changes to
  `*_result` types from 6.1 in the paper are no longer relevant now that
  these types are aliases;
- P2106 ("Alternative wording for GB315 and GB316") -- add a few
  `*_result` types to the synopsis in `<algorithm>` (some algorithms are
  not implemented yet and thus some of the proposal still cannot be
  marked as done);

Also mark already done issues as done (or as nothing to do):
- P2091 ("Fixing Issues With Range Access CPOs") was already implemented
  (this patch adds tests for some ill-formed cases);
- LWG 3247 ("`ranges::iter_move` should perform ADL-only lookup of
  `iter_move`") was already implemented;
- LWG 3300 ("Non-array ssize overload is underconstrained") doesn't
  affect the implementation;
- LWG 3335 ("Resolve C++20 NB comments US 273 and GB 274") was already
  implemented;
- LWG 3355 ("The memory algorithms should support move-only input
  iterators introduced by P1207") was already implemented (except for
  testing).

Differential Revision: https://reviews.llvm.org/D126053

2 years agoTestIgnoredExceptions.py needs support from debugserver, so it
Jim Ingham [Tue, 28 Jun 2022 18:48:28 +0000 (11:48 -0700)]
TestIgnoredExceptions.py needs support from debugserver, so it
needs to be marked skip if out of tree debugserver.

2 years ago[RISCV] Teach RISCVMergeBaseOffset to handle read-modify-write of a global.
Craig Topper [Tue, 28 Jun 2022 18:34:39 +0000 (11:34 -0700)]
[RISCV] Teach RISCVMergeBaseOffset to handle read-modify-write of a global.

The pass was previously limited to LUI+ADDI being used by a single
instruction.

This patch allows the pass to optimize multiple memory operations
that use the same offset. Each of them will receive a separate %lo
relocation. My main motivation is to handle a read-modify-write
where we have a load and store to the same address, but I didn't
restrict it to that case.

Reviewed By: asb

Differential Revision: https://reviews.llvm.org/D128599

2 years ago[MLIR][Affine][NFC] Fix affine utlities docs using "identifiers" instead of "variables"
Groverkss [Tue, 28 Jun 2022 18:33:58 +0000 (19:33 +0100)]
[MLIR][Affine][NFC] Fix affine utlities docs using "identifiers" instead of "variables"

2 years ago[libc] disable algorithm_test.cpp temporarily
Michael Jones [Tue, 28 Jun 2022 18:17:14 +0000 (11:17 -0700)]
[libc] disable algorithm_test.cpp temporarily

The unit tests introduced in patch D128335 are causing build failures,
and the fix is non-trivial. This patch disables these tests temporarily
until a proper fix can be implemented.

Reviewed By: lntue

Differential Revision: https://reviews.llvm.org/D128746

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr in Shape.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:51:08 +0000 (17:51 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in Shape.cpp (NFC)

2 years agoApply clang-tidy fixes for modernize-use-emplace in SCFTransformOps.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:46:52 +0000 (17:46 +0000)]
Apply clang-tidy fixes for modernize-use-emplace in SCFTransformOps.cpp (NFC)

2 years ago[MLIR][Presburger] Rename variable/identifier -> variable
Groverkss [Tue, 28 Jun 2022 17:50:11 +0000 (18:50 +0100)]
[MLIR][Presburger] Rename variable/identifier -> variable

Currently, in the Presburger library, we use the words "variables" and
"identifiers" interchangeably. This patch changes this to only use "variables" to
refer to the variables of PresburgerSpace.

The reasoning behind this change is that the current usage of the word "identifier"
is misleading. variables do not "identify" anything. The information attached to them is the
actual "identifier" for the variable. The word "identifier", will later be used
to refer to the information attached to each variable in space.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D128585

2 years ago[SystemZ][z/OS] Modify cxxabi to be compatible with existing z/OS runtime
Muiez Ahmed [Tue, 28 Jun 2022 17:59:49 +0000 (20:59 +0300)]
[SystemZ][z/OS] Modify cxxabi to be compatible with existing z/OS runtime

This patch is to enable exception handling on the z/OS platform that is compatible with the existing z/OS runtime. No functionality of libcxxabi has been changed for other platforms. With this patch the hope is we can add z/OS as a platform to perform testing on any C++ ABI changes.

There is a primary difference for the z/OS implementation. On z/OS the thrown object is added to a linked list of caught and uncaught exceptions. The unwinder uses the top one as the current exception it is trying to find the landing pad for. We have to pop the top exception after we get it’s landing pad for our unwinder to correctly get any subsequent rethrows or nested exception calls.

Differential Revision: https://reviews.llvm.org/D99913

2 years ago[flang] Enforce C1552, no binding labels allowed for internal procedures
Peter Klausler [Wed, 15 Jun 2022 16:18:25 +0000 (09:18 -0700)]
[flang] Enforce C1552, no binding labels allowed for internal procedures

If BIND(C) appears on an internal procedure, it must have a null binding
label, i.e. BIND(C,NAME="").

Also address conflicts with D127725 which was merged during development.

Differential Revision: https://reviews.llvm.org/D128676

2 years agoRevert "Reland "[X86] Support `_Float16` on SSE2 and up""
Ben Langmuir [Tue, 28 Jun 2022 17:51:55 +0000 (10:51 -0700)]
Revert "Reland "[X86] Support `_Float16` on SSE2 and up""

Broke compiler-rt on Darwin: https://green.lab.llvm.org/green/job/clang-stage1-RA/29920/

This reverts commit 527ef8ca981e88a35758c0e4143be6853ea26dfc.

2 years ago[mlir] Leverage CMake interface libraries for mlir python
Stella Stamenova [Tue, 28 Jun 2022 17:39:13 +0000 (10:39 -0700)]
[mlir] Leverage CMake interface libraries for mlir python

This is already partially the case, but we can rely more heavily on interface libraries and how they are imported/exported in other to simplify the implementation of the mlir python functions in Cmake.

This change also makes a couple of other changes:
1) Add a new CMake function which handles "pure" sources. This was done inline previously
2) Moves the headers associated with CAPI libraries to the libraries themselves. These were previously managed in a separate source target. They can now be added directly to the CAPI libraries using DECLARED_HEADERS.
3) Cleanup some dependencies that showed up as an issue during the refactor

This is a big CMake change that should produce no impact on the build of mlir and on the produced *build tree*. However, this change fixes an issue with the *install tree* of mlir which was previously unusable for projects like torch-mlir because both the "pure" and "extension" targets were pointing to either the build or source trees.

Reviewed By: stellaraccident

Differential Revision: https://reviews.llvm.org/D128230

2 years agoFix printing for ArrayRef attributes/types in declarative assembly format
Mehdi Amini [Tue, 28 Jun 2022 17:32:00 +0000 (17:32 +0000)]
Fix printing for ArrayRef attributes/types in declarative assembly format

These were abbreviated when parsing, but not when printing.

Reviewed By: Mogball, rriddle

Differential Revision: https://reviews.llvm.org/D128720

2 years ago[lit][test] relaxed GTEST_TOTAL_SHARDS checking for some googletests (2)
Yuanfang Chen [Tue, 28 Jun 2022 17:29:20 +0000 (10:29 -0700)]
[lit][test] relaxed GTEST_TOTAL_SHARDS checking for some googletests (2)

Missed this in 14d3021c10d08

2 years agoApply clang-tidy fixes for performance-unnecessary-value-param in LinalgStrategyPasse...
Mehdi Amini [Sun, 12 Jun 2022 17:35:07 +0000 (17:35 +0000)]
Apply clang-tidy fixes for performance-unnecessary-value-param in LinalgStrategyPasses.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-identifier-naming in ArithmeticOps.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 17:19:15 +0000 (17:19 +0000)]
Apply clang-tidy fixes for readability-identifier-naming in ArithmeticOps.cpp (NFC)

2 years ago[libc] Fix compile options for algorithm test
Michael Jones [Tue, 28 Jun 2022 17:20:13 +0000 (10:20 -0700)]
[libc] Fix compile options for algorithm test

This patch fixes the problem the bots were having with the algorithm
test not including pthreads correctly. They will likely need a manual
forced clean build for this to take effect.

Differential Revision: https://reviews.llvm.org/D128742

2 years ago[RISCV] Add test coverage for high known bits for vscale
Philip Reames [Tue, 28 Jun 2022 16:58:52 +0000 (09:58 -0700)]
[RISCV] Add test coverage for high known bits for vscale

2 years agoq[mlir][Vector] Add a ShapeCastOp(BroadcastOp) canonicalization pattern
Nicolas Vasilache [Tue, 28 Jun 2022 15:29:46 +0000 (08:29 -0700)]
q[mlir][Vector] Add a ShapeCastOp(BroadcastOp) canonicalization pattern

This pattern can kick in when the source of the broadcast has a shape
that is a prefix/suffix of the result of the shape_cast.

Differential Revision: https://reviews.llvm.org/D128734

2 years ago[DWARFLinker] mark odr candidates inside the same object file.
Alexey Lapshin [Mon, 27 Jun 2022 15:40:10 +0000 (18:40 +0300)]
[DWARFLinker] mark odr candidates inside the same object file.

This patch is extracted from D86539.

Current implementation of lookForDIEsToKeep() function skips types
duplications basing on the getCanonicalDIEOffset() data:

```
if (AttrSpec.Form != dwarf::DW_FORM_ref_addr && (UseOdr || IsModuleRef) &&
    Info.Ctxt &&
    Info.Ctxt != ReferencedCU->getInfo(Info.ParentIdx).Ctxt &&
    Info.Ctxt->getCanonicalDIEOffset() && isODRAttribute(AttrSpec.Attr))  <<<<<
  continue;
```

But that field is set after all compile units inside object file are processed:

```
for (auto &CurrentUnit : OptContext.CompileUnits)
  lookForDIEsToKeep(.., &CurrentUnit, ..);  // check CanonicalDIEOffset

DIECloner.cloneAllCompileUnits(); // set CanonicalDIEOffset
```

Thus, if the object file contains several compilation units - types would
not be deduplicated. The above solution works well for the case when the object file
contains only one compilation unit. But if the object file contains several compilation
units then types would not be deduplicated between these compilation units.

This patch changes the algorithm so that types were deduplicated between
compilation units from the same object file.

It produces binary incompatible output for the cases when several compilation units
are located inside the same object file.

Reviewed By: aprantl

Differential Revision: https://reviews.llvm.org/D125469

2 years agoFix build with some GCC version: `global qualification of class name is invalid befor...
Mehdi Amini [Tue, 28 Jun 2022 16:47:41 +0000 (16:47 +0000)]
Fix build with some GCC version: `global qualification of class name is invalid before '{' token`

2 years ago[llvm-lib] Ignore /SUBSYSTEM flag
Pengxuan Zheng [Thu, 23 Jun 2022 19:25:54 +0000 (12:25 -0700)]
[llvm-lib] Ignore /SUBSYSTEM flag

It's not clear what Microsoft's LIB.exe actually does based on the official
description of the flag (link below). We can probably ignore it for now.

https://docs.microsoft.com/en-us/cpp/build/reference/managing-a-library?view=msvc-170

Reviewed By: thieta

Differential Revision: https://reviews.llvm.org/D128458

2 years ago[mlir][sparse][bufferization] refine bufferization assumption enforcement
Aart Bik [Mon, 27 Jun 2022 23:51:27 +0000 (16:51 -0700)]
[mlir][sparse][bufferization] refine bufferization assumption enforcement

Enforce the assumption made on tensor buffers explicitly. When in-place,
reuse the buffer, but fill with all zeroes for the non-update case, since
the kernel assumes all elements are written to. When not in-place, zero
out the new buffer when materializing or when no-updates occur. Copy the
original tensor value when updates occur. This prepares migrating to the
new bufferization strategy, where these assumptions must be made explicit.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D128691

2 years ago[X86] Remove unnecessary COPY from EmitLoweredCascadedSelect.
Craig Topper [Tue, 28 Jun 2022 16:07:23 +0000 (09:07 -0700)]
[X86] Remove unnecessary COPY from EmitLoweredCascadedSelect.

I believe we already checked that the destination of the first
CMOV is only used by the second CMOV so I don't think there is any
reason we need the PHI to write the register that was used by the
first CMOV. We can directly use the second CMOV destination and
avoid the copy.

This may be a left over from when the cascaded select handling
was part of the main algorithm before it was refactored in D35685.

Reviewed By: pengfei

Differential Revision: https://reviews.llvm.org/D128124

2 years agoAllow mangled names in sanitizer clang IR gen tests.
Mitch Phillips [Tue, 28 Jun 2022 16:26:36 +0000 (09:26 -0700)]
Allow mangled names in sanitizer clang IR gen tests.

Looks like with https://reviews.llvm.org/D127911, Windows emits more
globals with mangled names into the IR. Relax the tests in order to
allow these mangled names.

2 years ago[flang] Fix couple of issue with user defined assignment in FORALL and WHERE
Valentin Clement [Tue, 28 Jun 2022 16:26:26 +0000 (18:26 +0200)]
[flang] Fix couple of issue with user defined assignment in FORALL and WHERE

This patch fixes a couple of issues with the lowering of user defined assignment.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: klausler

Differential Revision: https://reviews.llvm.org/D128730

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[mlir][spirv] Support more comparisons on boolean values
Lei Zhang [Tue, 28 Jun 2022 15:58:42 +0000 (11:58 -0400)]
[mlir][spirv] Support more comparisons on boolean values

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D128692

2 years ago[MLIR][Presburger] getDivRepr: fix bug where dividend was negated
Arjun P [Tue, 28 Jun 2022 10:34:57 +0000 (11:34 +0100)]
[MLIR][Presburger] getDivRepr: fix bug where dividend was negated

Also updated the tests, which were asserting the wrong behaviour.

Reviewed By: Groverkss

Differential Revision: https://reviews.llvm.org/D128735

2 years ago[lldb] [test] XFAIL llgs tests failing on arm
Michał Górny [Tue, 28 Jun 2022 15:02:44 +0000 (17:02 +0200)]
[lldb] [test] XFAIL llgs tests failing on arm

Sponsored by: The FreeBSD Foundation

2 years ago[Propeller] Encode address offsets of basic blocks relative to the end of the previou...
Rahman Lavaee [Tue, 28 Jun 2022 14:41:40 +0000 (07:41 -0700)]
[Propeller] Encode address offsets of basic blocks relative to the end of the previous basic blocks.

This is a resurrection of D106421 with the change that it keeps backward-compatibility. This means decoding the previous version of `LLVM_BB_ADDR_MAP` will work. This is required as the profile mapping tool is not released with LLVM (AutoFDO). As suggested by @jhenderson we rename the original  section type value to `SHT_LLVM_BB_ADDR_MAP_V0` and assign a new value to the `SHT_LLVM_BB_ADDR_MAP` section type. The new encoding adds a version byte to each function entry to specify the encoding version for that function.  This patch also adds a feature byte to be used with more flexibility in the future. An use-case example for the feature field is encoding multi-section functions more concisely using a different format.

Conceptually, the new encoding emits basic block offsets and sizes as label differences between each two consecutive basic block begin and end label. When decoding, offsets must be aggregated along with basic block sizes to calculate the final offsets of basic blocks relative to the function address.

This encoding uses smaller values compared to the existing one (offsets relative to function symbol).
Smaller values tend to occupy fewer bytes in ULEB128 encoding. As a result, we get about 17% total reduction in the size of the bb-address-map section (from about 11MB to 9MB for the clang PGO binary).
The extra two bytes (version and feature fields) incur a small 3% size overhead to the `LLVM_BB_ADDR_MAP` section size.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D121346

2 years ago[pseudo] Grammar::parseBNF returns Grammar not unique_ptr. NFC
Sam McCall [Tue, 28 Jun 2022 14:24:38 +0000 (16:24 +0200)]
[pseudo] Grammar::parseBNF returns Grammar not unique_ptr. NFC

2 years agoUpdate statuses and add tests for C89 DRs
Aaron Ballman [Tue, 28 Jun 2022 14:27:26 +0000 (10:27 -0400)]
Update statuses and add tests for C89 DRs

This mostly finishes the DRs for C89, though there are still a few
outliers which remain. It also corrects some of the statuses of DRs
where it's not clear if it was fully resolved by the committee or not.

As a drive-by, it also adds -fsyntax-only to the tests which are
verifying diagnostic results. This was previously missed by accident.

2 years ago[lldb] [test] Skip llgs tests broken due to #56268 on aarch64
Michał Górny [Tue, 28 Jun 2022 14:21:56 +0000 (16:21 +0200)]
[lldb] [test] Skip llgs tests broken due to #56268 on aarch64

Sponsored by: The FreeBSD Foundation

2 years ago[MC] Allow annotating custom sections as zerofill
Egor Zhdan [Mon, 27 Jun 2022 15:09:56 +0000 (16:09 +0100)]
[MC] Allow annotating custom sections as zerofill

This is already possible for e.g. `cstring_literals`, but the entry for zerofill was unnamed.

rdar://90336380

Differential Revision: https://reviews.llvm.org/D128654

2 years ago[pseudo] Move cxx grammar into the cxx/ directory. NFC
Sam McCall [Tue, 28 Jun 2022 14:02:10 +0000 (16:02 +0200)]
[pseudo] Move cxx grammar into the cxx/ directory. NFC

2 years ago[pseudo] Simplify/loosen the grammar around lambda captures.
Sam McCall [Tue, 28 Jun 2022 08:18:45 +0000 (10:18 +0200)]
[pseudo] Simplify/loosen the grammar around lambda captures.

Treat captures as a uniform list, rather than default-captures being special
snowflakes that may only appear at the start.

This accepts a larger set of (incorrect) code, and simplifies error-handling
by making this fit into the usual homogeneous-list pattern.

Differential Revision: https://reviews.llvm.org/D128708

2 years ago[AMDGPU] llvm.amdgcn.exp.compr is not supported on GFX11
Jay Foad [Fri, 6 Nov 2020 16:52:33 +0000 (16:52 +0000)]
[AMDGPU] llvm.amdgcn.exp.compr is not supported on GFX11

Differential Revision: https://reviews.llvm.org/D128259

2 years ago[pseudo] Allow mixed designated/undesignated init lists.
Sam McCall [Mon, 27 Jun 2022 23:13:04 +0000 (01:13 +0200)]
[pseudo] Allow mixed designated/undesignated init lists.

This isn't allowed by the standard grammar but is allowed in C, and clang/GCC
permit it as an extension.
It avoids the need to determine which type of list we have in error-recovery.

While here, also support array index designators `{ [4]=1 }` which are
also legal in C, and common extensions in C++.

Differential Revision: https://reviews.llvm.org/D128687

2 years ago[AMDGPU] Use GFX11 S_PACK_HL instruction in more cases
Joe Nash [Mon, 20 Jun 2022 13:51:10 +0000 (09:51 -0400)]
[AMDGPU] Use GFX11 S_PACK_HL instruction in more cases

Differential Revision: https://reviews.llvm.org/D128527

2 years ago[flang] Fix bugs relating to support for characters of different kinds
Valentin Clement [Tue, 28 Jun 2022 13:28:25 +0000 (15:28 +0200)]
[flang] Fix bugs relating to support for characters of different kinds

Fix bugs relating to support for characters of different kinds. Lowering
was creating bad FIR and MLIR that crashed in conversion to LLVM IR.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128723

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years agoIntroduce a new Dense Array attribute
Mehdi Amini [Tue, 28 Jun 2022 11:29:27 +0000 (11:29 +0000)]
Introduce a new Dense Array attribute

This attribute is similar to DenseElementsAttr but does not support
splat. As such it has a much simpler API and does not need any smart
iterator: it exposes direct ArrayRef access.

A new syntax is introduced so that the generic printing/parsing looks
like:

  [:i64 1, -2, 3]

This attribute beings like an ArrayAttr but has a `:` token after the
opening square brace to introduce the element type (supported are I8,
I16, I32, I64, F32, F64) and the comma separated list for the data.

This is particularly convenient for attributes intended to be small,
like those referring to shapes.
For example a `transpose` operation with a `dims` attribute could be
defined as such:

  let arguments = (ins AnyTensor:$input, DenseI64ArrayAttr:$dims);
  let assemblyFormat = "$input `dims` `=` $dims attr-dict : type($input)";

And printed this way (the element type is elided in this case):

  transpose %input dims = [0, 2, 1] : tensor<2x3x4xf32>

The C++ API for dims would just directly return an ArrayRef<int64>

RFC: https://discourse.llvm.org/t/rfc-introduce-a-new-dense-array-attribute/63279

Recommit with a custom DenseArrayBaseAttrStorage class to ensure
over-alignment of the storage to the largest type.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D123774

2 years ago[flang] Make sure that conversions are applied in FORALL degenerate contexts
Valentin Clement [Tue, 28 Jun 2022 13:24:21 +0000 (15:24 +0200)]
[flang] Make sure that conversions are applied in FORALL degenerate contexts

For the rapid triage push, just add a TODO for the degenerate POINTER
assignment case. The LHD ought to be a variable of type !fir.box, but it
is currently returning a shadow variable for the raw data pointer. More
investigation is needed there.
Make sure that conversions are applied in FORALL degenerate contexts.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128724

Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[flang] Add lowering tests
Valentin Clement [Tue, 28 Jun 2022 13:21:44 +0000 (15:21 +0200)]
[flang] Add lowering tests

Add lowering tests left behind during the upstreaming.

This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

Differential Revision: https://reviews.llvm.org/D128721

Co-authored-by: Jean Perier <jperier@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
2 years ago[BOLT][AArch64] Handle gold linker veneers
Vladislav Khmelevsky [Wed, 15 Jun 2022 22:53:20 +0000 (01:53 +0300)]
[BOLT][AArch64] Handle gold linker veneers

The gold linker veneers are written between functions without symbols,
so we to handle it specially in BOLT.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

Differential Revision: https://reviews.llvm.org/D128082

2 years ago[IRBuilder] Migrate vector operations to fold infrastructure
Nikita Popov [Tue, 28 Jun 2022 13:09:01 +0000 (15:09 +0200)]
[IRBuilder] Migrate vector operations to fold infrastructure

Migrate extractelement, insertelement and shufflevector to use the
FoldXYZ rather than CreateXYZ APIs.

This is probably NFC in practice, because the places using
InstSimplifyFolder probably aren't using vector operations.

2 years agoRevert "Introduce a new Dense Array attribute"
Mehdi Amini [Tue, 28 Jun 2022 12:46:49 +0000 (12:46 +0000)]
Revert "Introduce a new Dense Array attribute"

This reverts commit 508eb41d82ca956c30950d9a16b522a29aeeb333.

UBSAN indicates some pointer mis-alignment I need to investigate

2 years ago[lldb] Fix build on older Linux kernel versions
Yi Kong [Tue, 28 Jun 2022 07:29:38 +0000 (15:29 +0800)]
[lldb] Fix build on older Linux kernel versions

PERF_COUNT_SW_DUMMY is introduced in Linux 3.12.

Differential Revision: https://reviews.llvm.org/D128707

2 years ago[ArgPromotion] Unify byval promotion with non-byval
Pavel Samolysov [Wed, 4 May 2022 08:38:21 +0000 (11:38 +0300)]
[ArgPromotion] Unify byval promotion with non-byval

It makes sense to handle byval promotion in the same way as non-byval
but also allowing `store` instructions. However, these should
use the same checks as the `load` instructions do, i.e. be part of the
`ArgsToPromote` collection. For these instructions, the check for
interfering modifications can be disabled, though. The promotion
algorithm itself has been modified a lot: all the accesses (i.e. loads
and stores) are rewritten to the emitted `alloca` instructions. To
optimize these new `alloca`s out, the `PromoteMemToReg` function from
`Transforms/Utils/PromoteMemoryToRegister.cpp` file is invoked after
promotion.

In order to let the `PromoteMemToReg` promote as many `alloca`s as it
is possible, there should be no `GEP`s from the `alloca`s. To
eliminate the `GEP`s, its own `alloca` is generated for every argument
part because a single `alloca` for the whole argument (that
significantly simplifies the code of the pass though) unfortunately
cannot be used.

The idea comes from the following discussion:
https://reviews.llvm.org/D124514#3479676

Differential Revision: https://reviews.llvm.org/D125485

2 years agoIntroduce a new Dense Array attribute
Mehdi Amini [Tue, 28 Jun 2022 11:29:27 +0000 (11:29 +0000)]
Introduce a new Dense Array attribute

This attribute is similar to DenseElementsAttr but does not support
splat. As such it has a much simpler API and does not need any smart
iterator: it exposes direct ArrayRef access.

A new syntax is introduced so that the generic printing/parsing looks
like:

  [:i64 1, -2, 3]

This attribute beings like an ArrayAttr but has a `:` token after the
opening square brace to introduce the element type (supported are I8,
I16, I32, I64, F32, F64) and the comma separated list for the data.

This is particularly convenient for attributes intended to be small,
like those referring to shapes.
For example a `transpose` operation with a `dims` attribute could be
defined as such:

  let arguments = (ins AnyTensor:$input, DenseI64ArrayAttr:$dims);
  let assemblyFormat = "$input `dims` `=` $dims attr-dict : type($input)";

And printed this way (the element type is elided in this case):

  transpose %input dims = [0, 2, 1] : tensor<2x3x4xf32>

The C++ API for dims would just directly return an ArrayRef<int64>

RFC: https://discourse.llvm.org/t/rfc-introduce-a-new-dense-array-attribute/63279

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D123774

2 years ago[PowerPC] Improve getNormalLoadInput to reach more splat load
Ting Wang [Tue, 28 Jun 2022 12:02:49 +0000 (08:02 -0400)]
[PowerPC] Improve getNormalLoadInput to reach more splat load
opportunities

There are straight forward splat load opportunities blocked by
getNormalLoadInput(), since those cases involve consecutive bitcasts.
Improve by looking through bitcasts.

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D128703

2 years ago[RISCV] Implement support for the Zicbop extension
Alex Bradbury [Tue, 28 Jun 2022 10:24:21 +0000 (11:24 +0100)]
[RISCV] Implement support for the Zicbop extension

Implements the ratified RISC-V Base Cache Management Operation ISA
Extension: Zicbop, as described in
https://github.com/riscv/riscv-CMOs/blob/master/specifications/cmobase-v1.0.pdf.

This is implemented in a separate patch to Zicbom and Zicboz due to it
requiring a new ASM operand type to be defined.

Differential Revision: https://reviews.llvm.org/D117433

2 years ago[RISCV] Implement support for the Zicbom and Zicboz extensions
Alex Bradbury [Tue, 28 Jun 2022 10:22:36 +0000 (11:22 +0100)]
[RISCV] Implement support for the Zicbom and Zicboz extensions

Implements the ratified RISC-V Base Cache Management Operation ISA
Extensions: Zicbom and Zicboz, as described in
https://github.com/riscv/riscv-CMOs/blob/master/specifications/cmobase-v1.0.pdf.

Zicbop is implemented in a separate patch due to it requiring a new ASM
operand type to be defined.

As discussed in the relevant issue in the upstream spec
https://github.com/riscv/riscv-CMOs/issues/47, the cbo.* instructions
use the format (rs1) or 0(rs1) for their operand, similar to the AMOs.

Differential Revision: https://reviews.llvm.org/D117432

2 years ago[ValueList] Include Error.h (NFC)
Nikita Popov [Tue, 28 Jun 2022 11:25:16 +0000 (13:25 +0200)]
[ValueList] Include Error.h (NFC)

Hopefully fixes clang-ppc64-aix. Apparently std::function can't
be instantiated with a forward declared type in some environments.

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr in TosaToLinalg.cpp...
Mehdi Amini [Sun, 12 Jun 2022 17:09:09 +0000 (17:09 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in TosaToLinalg.cpp (NFC)

2 years agoApply clang-tidy fixes for readability-simplify-boolean-expr in Utils.cpp (NFC)
Mehdi Amini [Sun, 12 Jun 2022 16:42:42 +0000 (16:42 +0000)]
Apply clang-tidy fixes for readability-simplify-boolean-expr in Utils.cpp (NFC)

2 years agoSelectionDAG: allow FP extensions when folding extract/insert.
Tim Northover [Tue, 28 Jun 2022 10:02:02 +0000 (11:02 +0100)]
SelectionDAG: allow FP extensions when folding extract/insert.

Before, we were trying to sign extend half -> float, and asserted in getNode.

2 years ago[PowerPC] Add base test case for load splat opportunity
Ting Wang [Tue, 28 Jun 2022 10:55:23 +0000 (06:55 -0400)]
[PowerPC] Add base test case for load splat opportunity

Reviewed By: shchenz

Differential Revision: https://reviews.llvm.org/D128718

2 years ago[mlir][SCF][bufferize][NFC] Implement resolveConflicts for ParallelInsertSliceOp
Matthias Springer [Tue, 28 Jun 2022 10:02:28 +0000 (12:02 +0200)]
[mlir][SCF][bufferize][NFC] Implement resolveConflicts for ParallelInsertSliceOp

This was previous implemented as part of the BufferizableOpInterface of ForEachThreadOp. Moving the implementation to ParallelInsertSliceOp to be consistent with the remaining ops and to have a nice example op that can serve as a blueprint for other ops.

Differential Revision: https://reviews.llvm.org/D128666

2 years ago[libc] Disable use of inlined builtins for tests
Guillaume Chatelet [Tue, 28 Jun 2022 10:17:18 +0000 (10:17 +0000)]
[libc] Disable use of inlined builtins for tests

2 years ago[gn build] Port 03975b7f0e5a
LLVM GN Syncbot [Tue, 28 Jun 2022 09:52:16 +0000 (09:52 +0000)]
[gn build] Port 03975b7f0e5a

2 years ago[libc] Fix missing static_cast
Guillaume Chatelet [Tue, 28 Jun 2022 09:50:32 +0000 (09:50 +0000)]
[libc] Fix missing static_cast

2 years agoFixed unused variable warning.
Mikhail Goncharov [Tue, 28 Jun 2022 09:44:16 +0000 (11:44 +0200)]
Fixed unused variable warning.

2 years ago[mlir][complex] Canonicalization for consecutive complex.add and sub
lewuathe [Tue, 28 Jun 2022 09:33:02 +0000 (11:33 +0200)]
[mlir][complex] Canonicalization for consecutive complex.add and sub

Add basic canonicalization for consecutive complex.add and sub operations.

Reviewed By: pifon2a

Differential Revision: https://reviews.llvm.org/D128702

2 years ago[libc] Use ASSERT_ instead of EXPECT_ in memcmp tests
Guillaume Chatelet [Tue, 28 Jun 2022 09:35:51 +0000 (09:35 +0000)]
[libc] Use ASSERT_ instead of EXPECT_ in memcmp tests

2 years ago[VPlan] Move recipe implementations to separate file (NFC).
Florian Hahn [Tue, 28 Jun 2022 09:34:30 +0000 (10:34 +0100)]
[VPlan] Move recipe implementations to separate file (NFC).

This patch moves the code for recipe implementations to a separate file.

The benefits are:
 * Keep VPlan.cpp smaller => faster compile-time during parallel builds.
 * Keep code for logical units together

As a follow-up I am also planning on moving all ::execute
implemetnations from LoopVectorize.cpp over to the new file, which
should help to reduce the size of the file a bit.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D127965

2 years ago[AArch64][SME] Sink tile offset operands into the loop for load/store instructions.
Sander de Smalen [Tue, 28 Jun 2022 08:53:47 +0000 (09:53 +0100)]
[AArch64][SME] Sink tile offset operands into the loop for load/store instructions.

This helps ISel decompose the generic offset for the tile into a base + offset.

Reviewed By: dmgreen

Differential Revision: https://reviews.llvm.org/D128508

2 years ago[AArch64][SME] Add SVE2 psel, uclamp, sclamp and revd IR intrinsics
David Sherwood [Tue, 21 Jun 2022 16:00:40 +0000 (17:00 +0100)]
[AArch64][SME] Add SVE2 psel, uclamp, sclamp and revd IR intrinsics

When the SME feature is enabled we also gain access to a few extra
SVE2 instructions. This patch adds LLVM IR intrinsics to make use
of these new instructions:

  @llvm.aarch64.sve.psel
  @llvm.aarch64.sve.revd
  @llvm.aarch64.sve.sclamp
  @llvm.aarch64.sve.uclamp

Differential Revision: https://reviews.llvm.org/D128332

2 years ago[libc][mem*] Introduce Algorithms for new mem framework
Guillaume Chatelet [Wed, 22 Jun 2022 11:34:51 +0000 (11:34 +0000)]
[libc][mem*] Introduce Algorithms for new mem framework

This patch is a subpart of D125768 intented to make the review easier.

This patch introduces the same algorithms as in `libc/src/string/memory_utils/elements.h` but using the new API.

Differential Revision: https://reviews.llvm.org/D128335

2 years ago[Bitcode] Support expanding constant expressions into instructions
Nikita Popov [Wed, 8 Jun 2022 15:29:42 +0000 (17:29 +0200)]
[Bitcode] Support expanding constant expressions into instructions

This implements an autoupgrade from constant expressions to
instructions, which is needed for
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.

The basic approach is that constant expressions (CST_CODE_CE_*
records) now initially only create a BitcodeConstant value that
holds opcode, flags and operands IDs. Then, when the value actually
gets used, it can be converted either into a constant expression
(if that expression type is still supported) or into a sequence of
instructions. As currently all expressions are still supported,
-expand-constant-exprs is added for testing purposes, to force
expansion.

PHI nodes require special handling, because the constant expression
needs to be evaluated on the incoming edge. We do this by putting
it into a temporary block and then wiring it up appropriately
afterwards (for non-critical edges, we could also move the
instructions into the predecessor).

This also removes the need for the forward referenced constants
machinery, as the BitcodeConstants only hold value IDs. At the
point where the value is actually materialized, no forward
references are needed anymore.

Differential Revision: https://reviews.llvm.org/D127729

2 years ago[AArch64] Update SME load/store intrinsics to work on opaque pointers.
Sander de Smalen [Tue, 28 Jun 2022 08:21:54 +0000 (09:21 +0100)]
[AArch64] Update SME load/store intrinsics to work on opaque pointers.

These intrinsics should be able to use opaque pointers, because the
load/store type is already encoded in their names and return/operand type.

Reviewed By: c-rhodes

Differential Revision: https://reviews.llvm.org/D128505

2 years ago[AArch64][SME] Add SME outer product intrinsics
David Sherwood [Thu, 16 Jun 2022 08:39:40 +0000 (09:39 +0100)]
[AArch64][SME] Add SME outer product intrinsics

This patch adds the following intrinsics to support the SME ACLE:

  * @llvm.aarch64.sme.mopa: Non-widening outer product + accumulate
  * @llvm.aarch64.sme.mops: Non-widening outer product + subtract
  * @llvm.aarch64.sme.mopa.wide: Widening outer product + accumulate
  * @llvm.aarch64.sme.mops.wide: Widening outer product + subtract
  * @llvm.aarch64.sme.smopa.wide: Widening signed sum of outer product + accumulate
  * @llvm.aarch64.sme.smops.wide: Widening signed sum of outer product + subtract
  * @llvm.aarch64.sme.umopa.wide: Widening unsigned sum of outer product + accumulate
  * @llvm.aarch64.sme.umops.wide: Widening unsigned sum of outer product + subtract
  * @llvm.aarch64.sme.sumopa.wide: Widening signed by unsigned sum of outer product + accumulate
  * @llvm.aarch64.sme.sumops.wide: Widening signed by unsigned sum of outer product + subtract
  * @llvm.aarch64.sme.usmopa.wide: Widening unsigned by signed sum of outer product + accumulate
  * @llvm.aarch64.sme.usmops.wide: Widening unsigned by signed sum of outer product + subtract

Differential Revision: https://reviews.llvm.org/D127956

2 years ago[IR] Remove support for extractvalue constant expression
Nikita Popov [Tue, 17 May 2022 13:45:52 +0000 (15:45 +0200)]
[IR] Remove support for extractvalue constant expression

This removes the extractvalue constant expression, as part of
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
extractvalue is already not supported in bitcode, so we do not need
to worry about bitcode auto-upgrade.

Uses of ConstantExpr::getExtractValue() should be replaced with
IRBuilder::CreateExtractValue() (if the fact that the result is
constant is not important) or ConstantFoldExtractValueInstruction()
(if it is). Though for this particular case, it is also possible
and usually preferable to use getAggregateElement() instead.

The C API function LLVMConstExtractValue() is removed, as the
underlying constant expression no longer exists. Instead,
LLVMBuildExtractValue() should be used (which will constant fold
or create an instruction). Depending on the use-case,
LLVMGetAggregateElement() may also be used instead.

Differential Revision: https://reviews.llvm.org/D125795

2 years ago[AArch64][SME] NFC: Extend tile_slice ComplexPattern to match default case.
Sander de Smalen [Tue, 28 Jun 2022 07:43:43 +0000 (08:43 +0100)]
[AArch64][SME] NFC: Extend tile_slice ComplexPattern to match default case.

A tile slice offset of '0' is the default and by moving this into
SelectSMETileSlice we can remove some redundant patterns.

Reviewed By: kmclaughlin

Differential Revision: https://reviews.llvm.org/D128506

2 years ago[RISCV] Support VECTOR_REVERSE mask operation.
Lian Wang [Mon, 27 Jun 2022 08:57:20 +0000 (08:57 +0000)]
[RISCV] Support VECTOR_REVERSE mask operation.

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D128627

2 years ago[Alignment] Replace commonAlignment with std::min
Guillaume Chatelet [Wed, 22 Jun 2022 15:02:48 +0000 (15:02 +0000)]
[Alignment] Replace commonAlignment with std::min

`commonAlignment` is a shortcut to pick the smallest of two `Align`
objects. As-is it doesn't bring much value compared to `std::min`.

Differential Revision: https://reviews.llvm.org/D128345