platform/upstream/llvm.git
12 months agoRevert "Do not emit a named symbol to denote the start of the debug_frame section"
Shubham Sandeep Rastogi [Mon, 26 Jun 2023 18:52:34 +0000 (11:52 -0700)]
Revert "Do not emit a named symbol to denote the start of the debug_frame section"

This reverts commit d6576add99e5ebf936f836aa3ecdc85deb33687e.

Reverted because

BUILD FAILED: failed 41960 expected passes 86 expected failures 28788 unsupported tests 1 unexpected failures (failure)

12 months ago[mlir][index] Add identity folders for add and sub
Jeff Niu [Mon, 26 Jun 2023 15:28:43 +0000 (08:28 -0700)]
[mlir][index] Add identity folders for add and sub

Depends on D153736

Reviewed By: rriddle, jpienaar

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

12 months ago[mlir][index] Add `index.mul` identity folders
Jeff Niu [Mon, 26 Jun 2023 01:18:44 +0000 (18:18 -0700)]
[mlir][index] Add `index.mul` identity folders

Fold `mul(x, 1)` and `mul(x, 0)`.

Depends on D153736

Reviewed By: rriddle

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

12 months ago[mlir][index] Fold `cmp(max/min(x, cstA), cstB)`
Jeff Niu [Mon, 26 Jun 2023 00:44:38 +0000 (17:44 -0700)]
[mlir][index] Fold `cmp(max/min(x, cstA), cstB)`

This is a case that is not picked up by integer range inference and
suggests a weakness with integer range inference on the index dialect.
The problem is that when `[1, SMAX_64]` is truncated to 32 bits, the
resulting range could be `[SMIN_32, SMAX_32]`, making the subsequent
comparison worthless. This is because integer range inference doesn't
know that the result of the max/min inference also changes based on the
bitwidth, and doing the truncation locally at the input of the
comparison op loses that information.

This also was a pattern that frequently showed up in our code, so adding
it as a folder allows dead code to be pruned more frequently.

Depends on D153731

Reviewed By: rriddle

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

12 months ago[mlir][index] Mark certain ops as Commutative
Jeff Niu [Sun, 25 Jun 2023 21:28:14 +0000 (14:28 -0700)]
[mlir][index] Mark certain ops as Commutative

Mark the relevant index dialect operations as Commutative. Specifically,
this allows the folder to move constant operands to the RHS.

Reviewed By: rriddle

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

12 months agoOpenMP: Add fma math test
Matt Arsenault [Tue, 13 Jun 2023 21:37:53 +0000 (17:37 -0400)]
OpenMP: Add fma math test

12 months ago[RISCV] Check that SEW and policy operands are immediates in verifier
Philip Reames [Mon, 26 Jun 2023 18:42:31 +0000 (11:42 -0700)]
[RISCV] Check that SEW and policy operands are immediates in verifier

This converts a crash (due an assertion inside getImm) into a verifier failure.  Much easier to debug when you have malformed instructions.

12 months agoOpenMP: Don't include stdbool.h in builtin headers
Matt Arsenault [Sun, 18 Jun 2023 13:30:37 +0000 (09:30 -0400)]
OpenMP: Don't include stdbool.h in builtin headers

Pre-C99 didn't include bool, and C99 allows you to redefine true/false
apparently.

12 months agoOpenMP: Use generated checks and pragma declare target
Matt Arsenault [Tue, 13 Jun 2023 21:31:00 +0000 (17:31 -0400)]
OpenMP: Use generated checks and pragma declare target

12 months ago[clangd][ObjC] Support ObjC class rename from implementation decls
David Goldman [Mon, 26 Jun 2023 16:25:56 +0000 (12:25 -0400)]
[clangd][ObjC] Support ObjC class rename from implementation decls

Reviewed By: kadircet

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

12 months agoDo not emit a named symbol to denote the start of the debug_frame section
Shubham Sandeep Rastogi [Wed, 21 Jun 2023 23:47:28 +0000 (16:47 -0700)]
Do not emit a named symbol to denote the start of the debug_frame section

When emitting a debug_frame section, it contains a named symbol.

> echo "void foo(void) {}" | clang -arch arm64  -ffreestanding -g -c -o \
/tmp/test.o -x c -
> nm /tmp/test.o -s __DWARF __debug_frame
0000000000000200 s ltmp1

There are no such symbols emitted in any of the other DWARF sections,
this is because when the __debug_frame section is created, it doesn't
get a `BeginSymName` and so it creates a named symbol, such as `ltmp1`
and emits it when we switch to the section in MCDwarf.cpp.

This patch fixes the above issue.

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

12 months ago[RISCV] Add support for custom instructions for Sifive S76.
Garvit Gupta [Mon, 26 Jun 2023 18:36:00 +0000 (11:36 -0700)]
[RISCV] Add support for custom instructions for Sifive S76.

Support for below instruction is added
1. CFLUSH.D.L1
2. CDISCARD.D.L1
3. CEASE

Additionally, Zihintpause extension is added to sifive s76 for pause
instruction.

Spec - https://sifive.cdn.prismic.io/sifive/767804da-53b2-4893-97d5-b7c030ae0a94_s76mc_core_complex_manual_21G3.pdf

Reviewed By: craig.topper

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

12 months ago[gn build] Port 5a63b2b3049e
LLVM GN Syncbot [Mon, 26 Jun 2023 18:22:32 +0000 (18:22 +0000)]
[gn build] Port 5a63b2b3049e

12 months ago[llvm-exegesis] Introduce SubprocessMemory Utility Class
Aiden Grossman [Sat, 20 May 2023 09:50:43 +0000 (09:50 +0000)]
[llvm-exegesis] Introduce SubprocessMemory Utility Class

This patch introduces the SubprocessMemory class to llvm-exegesis. This
class contains several utilities that are needed for managing memory to
set up an execution environment for memory annotations.

Reviewed By: courbet

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

12 months ago[clang-tidy][NFC] Repharse a lite bit documentation for misc-header-include-cycle...
Piotr Zegar [Mon, 26 Jun 2023 18:20:28 +0000 (18:20 +0000)]
[clang-tidy][NFC] Repharse a lite bit documentation for misc-header-include-cycle check

Change documentation, to avoid some duplication,
and make it sound beter.

12 months ago[LLDB] Fix 582582fb474b8cd4103e65c3e5a705b3aff61794
walter erquinigo [Mon, 26 Jun 2023 18:15:14 +0000 (13:15 -0500)]
[LLDB] Fix 582582fb474b8cd4103e65c3e5a705b3aff61794

This issue has been seen in

- https://lab.llvm.org/buildbot/#/builders/17/builds/39525
- https://lab.llvm.org/buildbot/#/builders/68/builds/55140

The reason is that a new language tag has been added for Mojo, but other recent languages need to be added to the language array so that a name lookup array doesn't have gaps.

`ninja check-lldb-shell-process` now passes.

12 months ago[lldb][NFCI] Remove ConstString from Process::ConfigureStructuredData
Alex Langford [Sat, 24 Jun 2023 01:01:26 +0000 (18:01 -0700)]
[lldb][NFCI] Remove ConstString from Process::ConfigureStructuredData

This is a follow-up to b4827a3c0a7ef121ca376713e115b04eff0f5194.

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

12 months ago[lldb][NFCI] Remove unneeded ConstString constructions for OptionValueProperties...
Alex Langford [Sat, 24 Jun 2023 00:27:09 +0000 (17:27 -0700)]
[lldb][NFCI] Remove unneeded ConstString constructions for OptionValueProperties::AppendProperty

I removed ConstString from OptionValueProperties in 643ba926c1f6, but
there are a few call sites that still create a ConstString as an
argument. I did not catch these initially because ConstString has an
implicit conversion method to StringRef.

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

12 months agoSeparateConstOffsetFromGEP: Don't use SCEV
Matt Arsenault [Thu, 22 Jun 2023 11:03:33 +0000 (07:03 -0400)]
SeparateConstOffsetFromGEP: Don't use SCEV

This was only using the SCEV expressions as a map key, which we can do
just as well with the value pointers. This also allows it to handle
vectors.

12 months agoSeparateConstOffsetForGEP: Remove some typed pointer code
Matt Arsenault [Sat, 24 Jun 2023 15:58:31 +0000 (11:58 -0400)]
SeparateConstOffsetForGEP: Remove some typed pointer code

12 months agoSeparateConstOffsetForGEP: Fill out some missing test coverage
Matt Arsenault [Sat, 24 Jun 2023 14:35:17 +0000 (10:35 -0400)]
SeparateConstOffsetForGEP: Fill out some missing test coverage

Try to test several untested paths.
 - Test the extension source type check
 - Test the programUndefinedIfPoison check
 - Test the add/sub with commuted operands
 - Test with vectors
 - Test multiple uses
 - Try to break operand map mismatches
 - Add some preparatory tests for zext+nuw support.

12 months agoSeparateConstOffsetFromGEP: Copy a test to AMDGPU
Matt Arsenault [Sat, 24 Jun 2023 10:52:51 +0000 (06:52 -0400)]
SeparateConstOffsetFromGEP: Copy a test to AMDGPU

12 months agoSeparateConstOffsetFromGEP: Reorder run lines
Matt Arsenault [Sat, 24 Jun 2023 10:56:01 +0000 (06:56 -0400)]
SeparateConstOffsetFromGEP: Reorder run lines

Testing codegen in test/Transforms is questionable to begin with, but
it's more reasonable to see failures on the IR half before ISA checks.

12 months ago[ARM] Fix codegen of unaligned volatile load/store of i64
Maurice Heumann [Mon, 26 Jun 2023 16:41:31 +0000 (09:41 -0700)]
[ARM] Fix codegen of unaligned volatile load/store of i64

Volatile loads/stores of i64 are lowered to LDRD/STRD on ARMv5TE.
However, these instructions require the addresses to be aligned.
Unaligned loads/stores therefore should be ignored by this handling.

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

12 months ago[SelectionDAG] Improve expansion of wide min/max
Eli Friedman [Wed, 24 May 2023 17:39:43 +0000 (10:39 -0700)]
[SelectionDAG] Improve expansion of wide min/max

The current implementation tries to handle the high and low halves
separately, but that's less efficient in most cases; use a wide SETCC
instead.

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

12 months ago[clang codegen] Fix ABI for HVA returns on AArch64 MSVC.
Eli Friedman [Fri, 16 Jun 2023 23:05:30 +0000 (16:05 -0700)]
[clang codegen] Fix ABI for HVA returns on AArch64 MSVC.

MSVC normally has a bunch of restrictions on returning values directly
which don't apply to passing values directly.  (This roughly corresponds
to the definition of a C++14 aggregate.)  However, these restrictions
don't apply to HVAs; make sure we check for that.

Fixes https://github.com/llvm/llvm-project/issues/62223

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

12 months ago[mlir] Convert 8-bit float types to i8
Krzysztof Drewniak [Thu, 8 Jun 2023 14:55:03 +0000 (14:55 +0000)]
[mlir] Convert 8-bit float types to i8

Whereas LLVM currently doesn't have any types for 8-bit floats, and
whereas existing 8-bit float APIs (for instance, the AMDGCN
intrinsics) take such floats as (packed) bytes, translate the MLIR
8-bit float types to i8 during LLVM lowering.

In order to not special-case arith.constant for bitcasting constants
to their integer form, amend the MLIR to LLVM translator to turn 8-bit
float constants into i8 constants with the same value (by use of
APFloat's bitcast method).

This change can be reverted once LLVM has 8-bit float types.

Reviewed By: gysit

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

12 months ago[lldb] Add `source cache dump` and `source cache clear` subcommand
Jonas Devlieghere [Mon, 26 Jun 2023 16:16:23 +0000 (09:16 -0700)]
[lldb] Add `source cache dump` and `source cache clear` subcommand

Add two new source subcommands: source cache dump and source cache
clear. As the name implies the first one dumps the source cache while
the later clears the cache.

This patch was motivated by a handful of (internal) bug reports related
to sources not being available. Right now those issues can be hard to
diagnose. The new commands give users, as well as us as developers, more
insight into and control over the source cache.

Differential revision: https://reviews.llvm.org/D153685

12 months ago[lldb][NFCI] Timer::DumpCategoryTimes should take a reference instead of a pointer
Alex Langford [Sat, 24 Jun 2023 19:33:12 +0000 (12:33 -0700)]
[lldb][NFCI] Timer::DumpCategoryTimes should take a reference instead of a pointer

We are assuming that the pointer is always valid, might as well take a
reference instead.

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

12 months ago[lldb][NFCI] UUID::Dump should take a reference instead of a pointer
Alex Langford [Sat, 24 Jun 2023 19:23:43 +0000 (12:23 -0700)]
[lldb][NFCI] UUID::Dump should take a reference instead of a pointer

We always assume the Stream pointer is valid, might as well be taking a
reference instead.

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

12 months ago[clang][WebAssembly] Support wasm32-wasi shared libraries
Joel Dice [Mon, 26 Jun 2023 17:25:45 +0000 (10:25 -0700)]
[clang][WebAssembly] Support wasm32-wasi shared libraries

This adds support for Emscripten-style shared libraries [1] to
non-emscripten targets, such as `wasm32-wasi`.  Previously, only static
linking was supported, and the `-shared` and `-fPIC` flags were simply
ignored.  Now both flags are honored.

Since WASI runtimes do not necessarily include JavaScript support, we
cannot rely on the JS-based Emscripten linker to link shared libraries.
Instead, we link them using the Component Model proposal [2].

We have prototyped shared library support in `wasi-sdk` [3] and put
together a demo [4] which uses a patched version of `wit-component` [5]
to link libraries using the Component Model.  We plan to submit the
required changes upstream to the respective repositories in the next
week or two.

[1] https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md
[2] https://github.com/WebAssembly/component-model/blob/main/design/mvp/examples/SharedEverythingDynamicLinking.md
[3] https://github.com/dicej/wasi-sdk/tree/dynamic-linking
[4] https://github.com/dicej/component-linking-demo
[5] https://github.com/bytecodealliance/wasm-tools/tree/main/crates/wit-component

Signed-off-by: Joel Dice <joel.dice@fermyon.com>
Reviewed By: sbc100

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

12 months ago[AIX][tests] XFAIL input-file-err.test
Jake Egan [Mon, 26 Jun 2023 17:22:10 +0000 (13:22 -0400)]
[AIX][tests] XFAIL input-file-err.test

The test is failing due to D153595, so XFAIL for now to get the bot green. D151567 should fix it.

12 months ago[clang/HeaderSearch] Make sure `loadSubdirectoryModuleMaps` doesn't cause loading...
Argyrios Kyrtzidis [Fri, 23 Jun 2023 22:33:39 +0000 (15:33 -0700)]
[clang/HeaderSearch] Make sure `loadSubdirectoryModuleMaps` doesn't cause loading of regular files

`HeaderSearch::loadSubdirectoryModuleMaps` `stat`s all the files in a directory which causes the dependency scanning
service to load and cache their contents. This is problematic because a file may be in the process of being generated
and could be cached by the dep-scan service while it is still incomplete.

To address this change `loadSubdirectoryModuleMaps` to ignore regular files.

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

12 months ago[NFC] Generalize llvm-profgen message to cover both AutoFDO and CSSPGO
Wenlei He [Sun, 25 Jun 2023 23:39:16 +0000 (16:39 -0700)]
[NFC] Generalize llvm-profgen message to cover both AutoFDO and CSSPGO

Update llvm-profgen profile density message to cover both AutoFDO and CSSPGO.

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

12 months ago[mlir][Transform] Add support for mma.sync m16n8k16 f16 rewrite.
Nicolas Vasilache [Wed, 21 Jun 2023 14:35:30 +0000 (14:35 +0000)]
[mlir][Transform] Add support for mma.sync m16n8k16 f16 rewrite.

This PR adds support for the m16n8k16 f16 case.
At this point, the support is mostly mechanical and could be Tablegen'd to all cases.
Until then, this can be populated as needed on a case-by-case basis.

Depends on: D153420

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

12 months ago[AArch64][PAC] Select MOVK for ptrauth.blend intrinsic.
Ahmed Bougacha [Mon, 24 Oct 2022 15:33:30 +0000 (08:33 -0700)]
[AArch64][PAC] Select MOVK for ptrauth.blend intrinsic.

Blend combines two discriminator values used by other ptrauth ops.
On AArch64 here, it does that by replacing the high 16 bits of the
LHS with the low 16 bits of the RHS.

Usually the RHS is a constant, which lets us do this efficiently in
a single MOVK.  When the RHS isn't constant, we can do a BFI.

In a sense, this is implementing an ABI decision (how to lower the
software construct of "blend"), but if there are interesting variants to
consider, this could be made object-file-format-specific in some way.

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

12 months agoRevert "[dataflow] avoid more accidental copies of Environment"
Sam McCall [Mon, 26 Jun 2023 16:35:39 +0000 (18:35 +0200)]
Revert "[dataflow] avoid more accidental copies of Environment"

This reverts commit ae54f01dd8c53d18c276420b23f0d0ab7afefff1.

Accidentally committed without review :-(

12 months ago[clang] __is_trivially_equality_comparable should return false for arrays
Nikolas Klauser [Mon, 26 Jun 2023 03:19:01 +0000 (20:19 -0700)]
[clang] __is_trivially_equality_comparable should return false for arrays

When comparing two arrays, their pointers are compared instead of their elements, which means that they are not trivially equality comparable

Fixes #63371

Reviewed By: cor3ntin

Spies: cor3ntin, cfe-commits

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

12 months ago[NFC] Add clang whitespace removal patch to .git-blame-ignore-revs
Nikolas Klauser [Mon, 26 Jun 2023 16:35:34 +0000 (09:35 -0700)]
[NFC] Add clang whitespace removal patch to .git-blame-ignore-revs

12 months ago[clang][NFC] Remove trailing whitespaces and enforce it in lib, include and docs
Nikolas Klauser [Mon, 26 Jun 2023 01:59:56 +0000 (18:59 -0700)]
[clang][NFC] Remove trailing whitespaces and enforce it in lib, include and docs

A lot of editors remove trailing whitespaces. This patch removes any trailing whitespaces and makes sure that no new ones are added.

Reviewed By: erichkeane, paulkirth, #libc, philnik

Spies: wangpc, aheejin, MaskRay, pcwang-thead, cfe-commits, libcxx-commits, dschuff, nemanjai, arichardson, kbarton, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, Jim, s.egerton, sameer.abuasal, apazos, luismarques, martong, frasercrmck, steakhal, luke

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

12 months ago[LLDB] Add DWARF definitions for the new Mojo language
walter erquinigo [Thu, 15 Jun 2023 20:57:07 +0000 (15:57 -0500)]
[LLDB] Add DWARF definitions for the new Mojo language

The new language Mojo recently received a proper DWARF code, which can be seen in https://dwarfstd.org/languages.html, and this patch adds the basic definitions for using this language in DWARF.

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

12 months ago[mlir][Transform] Introduce nvgpu transform extensions
Nicolas Vasilache [Wed, 21 Jun 2023 12:01:15 +0000 (12:01 +0000)]
[mlir][Transform] Introduce nvgpu transform extensions

Mapping to NVGPU operations such as mma.sync with mixed precision and ldmatrix with transposes and
various data types involves complex matchings from low-level IR.
This is akin to raising complex patterns after unnecessarily having lost structural information.
To avoid such unnecessary complexity, introduce a direct mapping step from a matmul on memrefs
to distributed NVGPU vector abstractions.
In this context, mapping to specific mma.sync operations is trivial and consists in simply
translating the documentation into indexing expressions.

Correctness is demonstrated with an end-to-end integration test.

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

12 months ago[flang][openacc] Support array reduction for min in lowering
Valentin Clement [Mon, 26 Jun 2023 16:19:43 +0000 (09:19 -0700)]
[flang][openacc] Support array reduction for min in lowering

Add loweirng support for array reduction with the
min operator.

Depends on D153650

Reviewed By: jeanPerier

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

12 months ago[libc++] Silences an invalid compiler diagnostic.
Mark de Wever [Mon, 26 Jun 2023 16:15:58 +0000 (18:15 +0200)]
[libc++] Silences an invalid compiler diagnostic.

When the value is not initialized it's never used. However silencing the
warning is trivial, as suggested by BlamKiwi.

Fixes https://llvm.org/PR63421

12 months ago[mlir][transform] Fix TrackingListener in regions that are isolated from above
Matthias Springer [Mon, 26 Jun 2023 16:04:23 +0000 (18:04 +0200)]
[mlir][transform] Fix TrackingListener in regions that are isolated from above

When an operation is removed/replaced, the TrackingListener updates the internal transform state mapping between handles and payload IR. All handles must be updated, even the ones that are defined in a region that is beyond the most recent region that is isolated from above.

This fixes a bug, where a payload op was erased in a named sequence. Not only handles defined inside of the named region must be updated, but also all other handles such as the ones where the sequence is included.

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

12 months ago[mlir][transform] Remove redundant handle check in `replacePayload...`
Matthias Springer [Mon, 26 Jun 2023 15:49:31 +0000 (17:49 +0200)]
[mlir][transform] Remove redundant handle check in `replacePayload...`

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

12 months ago[gn build] Port f2123af1e7d7
Arthur Eubanks [Mon, 26 Jun 2023 15:45:17 +0000 (08:45 -0700)]
[gn build] Port f2123af1e7d7

12 months ago[gn build] Port 8de9f2b558a0
Arthur Eubanks [Mon, 26 Jun 2023 15:45:15 +0000 (08:45 -0700)]
[gn build] Port 8de9f2b558a0

12 months ago[X86] combineMul - ensure getTargetConstantFromNode splat extraction is the correct...
Simon Pilgrim [Mon, 26 Jun 2023 15:50:03 +0000 (16:50 +0100)]
[X86] combineMul - ensure getTargetConstantFromNode splat extraction is the correct element width

The extracted Constant and Constant::getSplatValue can both be any bitwidth - they don't necessarily match the original ConstantSDNode type

Fixes #63507

12 months ago[X86] lowerV8I16Shuffle - use PACKSS(SEXT_INREG(X),SEXT_INREG(Y)) for pre-SSSE3 trunc...
Simon Pilgrim [Mon, 26 Jun 2023 14:31:29 +0000 (15:31 +0100)]
[X86] lowerV8I16Shuffle - use PACKSS(SEXT_INREG(X),SEXT_INREG(Y)) for pre-SSSE3 truncation shuffles

The comment about PSHUFLW+PSHUFHW+PSHUFD was outdated as that referred to a single input case, but that is now always handled earlier.

Another step towards removing premature combines to vector truncation combines to PACK.

12 months ago[Clang] Fix invalid runline in test
Corentin Jabot [Mon, 26 Jun 2023 15:42:25 +0000 (17:42 +0200)]
[Clang] Fix invalid runline in test

12 months ago[libc] Allow the RPC client to be initialized via a H2D memcpy
Joseph Huber [Fri, 23 Jun 2023 12:42:19 +0000 (07:42 -0500)]
[libc] Allow the RPC client to be initialized via a H2D memcpy

The RPC client must be initialized to set a pointer to the underlying
buffer. This is currently done with the `reset` method which may not be
ideal for the use-case. We want runtimes to be able to initialize this
without needing to call a kernel. Recent changes allowed the `Client`
type to be trivially copyable. That means we can create a client on the
server side and then copy it over. To that end we take the existing
externally visible symbol and initialize it to the client's pointer.
Therefore we can look up the symbol and copy it over once loaded.

No test currently, I tested with a demo OpenMP application but couldn't think of
how to put that in-tree.

Reviewed By: JonChesterfield

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

12 months ago[flang][openacc] Generate loop nest as column major
Valentin Clement [Mon, 26 Jun 2023 15:37:18 +0000 (08:37 -0700)]
[flang][openacc] Generate loop nest as column major

Address comment from D153455

Reviewed By: jeanPerier

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

12 months ago[mlir][transform][NFC] Store all Mappings in region stack
Matthias Springer [Mon, 26 Jun 2023 15:29:57 +0000 (17:29 +0200)]
[mlir][transform][NFC] Store all Mappings in region stack

Do not swap the Mappings when entering a region that is isolated from above. Simply push another Mappings struct to the stack and prevent invalid accesses during lookups.

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

12 months ago[RISCV] Rename all TA variants of VPseudoUnaryMask and VPatoUnaryMask [NFC]
Philip Reames [Mon, 26 Jun 2023 15:26:25 +0000 (08:26 -0700)]
[RISCV] Rename all TA variants of VPseudoUnaryMask and VPatoUnaryMask [NFC]

All of the these pseudo's take their policy from the policy operand via the normal mechanisms, and aren't "tail agnostic" in any particular sense.

Note that the existing VPatUnaryMask class was unused, and thus this is just a rename.

12 months ago[mlir][transform] Add notifyPayloadOperationReplaced to TransformRewriter
Matthias Springer [Mon, 26 Jun 2023 15:21:35 +0000 (17:21 +0200)]
[mlir][transform] Add notifyPayloadOperationReplaced to TransformRewriter

This function allows users to update payload op mappings in cases where such replacements cannot be performed automatically by the rewriter/listener interface.

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

12 months ago[RISCV] Combine VPseudoUnaryMask and VPseudoUnaryMaskTA [NFC]
Philip Reames [Mon, 26 Jun 2023 14:59:39 +0000 (07:59 -0700)]
[RISCV] Combine VPseudoUnaryMask and VPseudoUnaryMaskTA [NFC]

The only difference between these classes was the existance of a policy operand on the later.  We can use the policy operand version for the one place which used the non-TA suffixed one.  I then renamed to remove TA as these aren't tail agnostic; they take their policy from the operand.

Note that this wouldn't be strictly NFC except that the one user of the class being removed wasn't in the masked psuedo table, and thus doesn't go through mask to unmasked conversion in ISEL.  That's a missed optimization we may want to fix at some point.

12 months ago[clang][OpenMP] Fix unused var warning
David Spickett [Mon, 26 Jun 2023 15:19:06 +0000 (15:19 +0000)]
[clang][OpenMP] Fix unused var warning

This was added by 453e02ca0903c9f65529d21c513925ab0fdea1e1.Use
isa instead since we don't use the result.

Fixes:
<..>SemaOpenMP.cpp:23149:13: warning: unused variable ‘TargetVarDecl’ [-Wunused-variable]
23149 |   if (auto *TargetVarDecl = dyn_cast_or_null<VarDecl>(TargetDecl))
      |             ^~~~~~~~~~~~~

Which came up when building with GCC 9.

12 months ago[libc++][doc] Fixes a typo.
Mark de Wever [Mon, 26 Jun 2023 15:09:22 +0000 (17:09 +0200)]
[libc++][doc] Fixes a typo.

Thanks to ChuanqiXu for spotting it.

12 months ago[flang] Add PPC vec_max, vec_min, vec_madd and vec_nmsub intrinsic
Kelvin Li [Wed, 14 Jun 2023 13:50:56 +0000 (09:50 -0400)]
[flang] Add PPC vec_max, vec_min, vec_madd and vec_nmsub intrinsic

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

12 months ago[RISCV] Split usage of VPseudoUnaryNoMask with GPR destination
Philip Reames [Mon, 26 Jun 2023 14:42:08 +0000 (07:42 -0700)]
[RISCV] Split usage of VPseudoUnaryNoMask with GPR destination

These instructions don't have a passthrough operand or any of the policy behaviors, while are the other ones do. Split them out into their own class to make this separation clear, and rename the mask variant to match. (We'd already done the same for the mask variant.)

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

12 months ago[Clang] Implement P2738R1 - constexpr cast from void*
Corentin Jabot [Sat, 10 Sep 2022 21:03:05 +0000 (23:03 +0200)]
[Clang] Implement P2738R1 - constexpr cast from void*

Reviewed By: #clang-language-wg, erichkeane

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

12 months agoAdd missing dependent test dialect in a MLIR test pass
Mehdi Amini [Mon, 26 Jun 2023 14:10:31 +0000 (16:10 +0200)]
Add missing dependent test dialect in a MLIR test pass

Fix #62317

12 months ago[libc][Obvious] Fix docs warning.
Tue Ly [Mon, 26 Jun 2023 14:31:51 +0000 (14:31 +0000)]
[libc][Obvious] Fix docs warning.

12 months ago[dataflow] fix test after conflict between ae54f01dd8c53d1 & f2123af1e7d75
Sam McCall [Mon, 26 Jun 2023 14:29:47 +0000 (16:29 +0200)]
[dataflow] fix test after conflict between ae54f01dd8c53d1 & f2123af1e7d75

12 months ago[dataflow] avoid more accidental copies of Environment
Sam McCall [Thu, 22 Jun 2023 03:03:24 +0000 (05:03 +0200)]
[dataflow] avoid more accidental copies of Environment

This is clunky but greatly improves debugging of flow conditions - each
copy adds more indirections in the form of flow condition tokens.

(LatticeEffect presumably once did something here, but it's now both
unused and untested.)

For the exit flow condition of:
```
void target(base::Optional<int*> opt) {
  if (opt.value_or(nullptr) != nullptr) {
    opt.value();
  } else {
    opt.value(); // unsafe
  }
}
```

Before:
```
(B0:1 = V15)
(B1:1 = V8)
(B2:1 = V10)
(B3:1 = (V4 & (!V7 => V6)))
(V10 = (B3:1 & !V7))
(V12 = B1:1)
(V13 = B2:1)
(V15 = (V12 | V13))
(V3 = V2)
(V4 = V3)
(V8 = (B3:1 & !!V7))
B0:1
V2
```

After D153491:
```
(B0:1 = (V9 | V10))
(B1:1 = (B3:1 & !!V6))
(B2:1 = (B3:1 & !V6))
(B3:1 = (V3 & (!V6 => V5)))
(V10 = B2:1)
(V3 = V2)
(V9 = B1:1)
B0:1
V2
```

After this patch, we can finally see the relations between the flow
conditions directly:

```
(B0:1 = (B2:1 | B1:1))
(B1:1 = (B3:1 & !!V6))
(B2:1 = (B3:1 & !V6))
(B3:1 = (V3 & (!V6 => V5)))
(V3 = V2)
B0:1
V2
```

(I believe V2 is the FC for the InitEnv, and V3 is introduced when
computing the input state for B3 - not sure how to eliminate it)

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

12 months ago[clang][dataflow] Perform deep copies in copy and move operations.
Martin Braenne [Tue, 20 Jun 2023 08:00:01 +0000 (08:00 +0000)]
[clang][dataflow] Perform deep copies in copy and move operations.

This serves two purposes:

- Because, today, we only copy the `StructValue`, modifying the destination of
  the copy also modifies the source. This is demonstrated by the new checks
  added to `CopyConstructor` and `MoveConstructor`, which fail without the
  deep copy.

- It lays the groundwork for eliminating the redundancy between
  `AggregateStorageLocation` and `StructValue`, which will happen as part of the
  ongoing migration to strict handling of value categories (seeo
  https://discourse.llvm.org/t/70086 for details). This will involve turning
  `StructValue` into essentially just a wrapper for `AggregateStorageLocation`;
  under this scheme, the current "shallow" copy (copying a `StructValue` from
  one `AggregateStorageLocation` to another) will no longer be possible.

Because we now perform deep copies, tests need to perform a deep equality
comparison instead of just comparing for equal identity of the `StructValue`s.
The new function `recordsEqual()` provides such a deep equality comparison.

Reviewed By: xazax.hun

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

12 months ago[CMake][Fuchsia] Enable standalone libatomic
Alex Brachet [Mon, 26 Jun 2023 13:49:22 +0000 (13:49 +0000)]
[CMake][Fuchsia] Enable standalone libatomic

BUILTINS_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC
actually builds libatomic, and
RUNTIMES_${target}_COMPILER_RT_BUILD_STANDALONE_LIBATOMIC
tells the compiler-rt tests that we built it and it is
safe to use in tests.

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

12 months ago[compiler-rt] Stop using system ldd to detect libc version
Alex Brachet [Mon, 26 Jun 2023 13:40:22 +0000 (13:40 +0000)]
[compiler-rt] Stop using system ldd to detect libc version

The system libc may be different from the libc passed in
CMAKE_SYSROOT. Instead of using the ldd in PATH to detect
glibc version, use the features.h header file.

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

12 months ago[AArch64][CodeGen] Lower (de)interleave2 intrinsics to ld2/st2
Graham Hunter [Fri, 10 Mar 2023 11:17:04 +0000 (11:17 +0000)]
[AArch64][CodeGen] Lower (de)interleave2 intrinsics to ld2/st2

The InterleavedAccess pass currently matches (de)interleaving
shufflevector instructions with loads or stores, and calls into
target lowering to generate ldN or stN instructions.

Since we can't use shufflevector for scalable vectors (besides a
splat with zeroinitializer), we have interleave2 and deinterleave2
intrinsics. This patch extends InterleavedAccess to recognize those
intrinsics and if possible replace them with ld2/st2.

Reviewed By: paulwalker-arm

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

12 months ago[libc++][filesystem] Avoid using anonymous namespaces in support headers
Louis Dionne [Mon, 5 Jun 2023 19:27:38 +0000 (12:27 -0700)]
[libc++][filesystem] Avoid using anonymous namespaces in support headers

This avoids using anonymous namespaces in headers and ensures that
the various helper functions get deduplicated across the TUs
implementing <filesystem>. Otherwise, we'd get a definition of
these helper functions in each TU where they are used, which is
entirely unnecessary.

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

12 months ago[YAMLParser] Support block nodes when parsing YAML strings.
Zain Jaffal [Mon, 26 Jun 2023 12:07:56 +0000 (13:07 +0100)]
[YAMLParser] Support block nodes when parsing YAML strings.

Previously if a string is in the format
```
|
      val
      val2
      val3
```
Yaml parser will error out without parsing the string. The mentioned pattern is a valid yaml str and should be parsed.

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

12 months ago[SCEV] Print block dispositions on mismatch (NFC)
Nikita Popov [Mon, 26 Jun 2023 13:26:13 +0000 (15:26 +0200)]
[SCEV] Print block dispositions on mismatch (NFC)

12 months ago[dataflow] Disallow implicit copy of Environment, use fork() instead
Sam McCall [Sat, 24 Jun 2023 00:45:17 +0000 (02:45 +0200)]
[dataflow] Disallow implicit copy of Environment, use fork() instead

Environments are heavyweight, and copies are observably different from the
original: they introduce new SAT variables, which degrade performance &
debugging. Copies should only be done deliberately, where justified.

Empirically there are several places in the framework where we perform dubious
copies, sometimes entirely accidentally. (see e.g. D153491). Making these
explicit makes this mistake harder.

This patch forces copies to go through fork(), the copy-constructor is private.
This requires changes to existing callsites: some are correct and call fork(),
some are incorrect and are fixed, others are difficult and I left a FIXME.

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

12 months ago[Bazel][llvm] Fix after 8de9f2b
Christian Sigg [Mon, 26 Jun 2023 12:55:03 +0000 (14:55 +0200)]
[Bazel][llvm] Fix after 8de9f2b

12 months ago[LCSSA] Compute SCEV of LCSSA phi if original instruction had SCEV
Nikita Popov [Fri, 16 Jun 2023 15:16:52 +0000 (17:16 +0200)]
[LCSSA] Compute SCEV of LCSSA phi if original instruction had SCEV

The backstory is that the LCSSA invalidation we perform here is not
really necessary from a SCEV perspective. However, other code may
rely on the fact that invalidating only LCSSA phi nodes is sufficient
for transforms like loop peeling
(see https://reviews.llvm.org/D149331#4398582 for more details).

However, performing invalidation during LCSSA construction also
means that SCEV expansion (which may need to construct LCSSA) can
invalidate SCEV, which is somewhat unexpected and code may not be
prepared to deal with it (see the added test case, reported at
https://reviews.llvm.org/D149435#4428219).

Instead of invalidating SCEV, ensure that the LCSSA phi node also
has cached SCEV if the original instruction did. This means that
later invalidation of LCSSA phi nodes will work as expected. This
should avoid both the above issues and be more efficient.

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

12 months ago[NFC][flang] Fix PushSemantics macro
Leandro Lupori [Wed, 21 Jun 2023 19:32:48 +0000 (19:32 +0000)]
[NFC][flang] Fix PushSemantics macro

Add and use the CONCAT macro to force the expansion of __LINE__ in
PushSemantics body.

Reviewed By: clementval

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

12 months ago[flang] Fix lowering of array paths in elemental calls
Leandro Lupori [Fri, 16 Jun 2023 15:59:52 +0000 (15:59 +0000)]
[flang] Fix lowering of array paths in elemental calls

Elemental procedures may need their array arguments to be passed by
address. This is done by setting ArrayExprLowering::semant to a
value that corresponds to this semantics. Later, member functions
such as applyPathToArrayLoad() read this variable to generate FIR
instructions that match the needed behavior. The problem is that
the semant variable also affects how array paths are lowered. Thus,
if an index of the path is an array element, this will cause its
address to be used instead of its value, which usually results in a
segmentation fault at runtime.

Example: b(i:i) = elem_func(a(v(i):v(i)))

To fix this, ArrayExprLowering::nextPathSemant was added. When it's
set, the next array path is handled with the semantics specified by
it, while the elemental argument retains its original semantics.

Fixes https://github.com/llvm/llvm-project/issues/62981

Reviewed By: jeanPerier

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

12 months agoDiagnose incorrect syntax for #pragma clang diagnostic
Aaron Ballman [Mon, 26 Jun 2023 12:04:20 +0000 (08:04 -0400)]
Diagnose incorrect syntax for #pragma clang diagnostic

We would previously fail to diagnose unexpected tokens after a 'push'
or 'pop' directive.

Fixes https://github.com/llvm/llvm-project/issues/13920

12 months ago[Remarks] Make sure -fdiagnostics-hotness-threshold implies -fdiagnostics-show-hotness
serge-sans-paille [Mon, 26 Jun 2023 07:52:59 +0000 (09:52 +0200)]
[Remarks] Make sure -fdiagnostics-hotness-threshold implies -fdiagnostics-show-hotness

When asking for -fdiagnostics-hotness-threshold, we currently require
-fdiagnostics-show-hotness otherwise we silently display nothing.

I don't see a scenario where that makes sense, so have one option impy
the other.

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

12 months ago[X86] Generalize combineVectorTruncationWithPACKUS/combineVectorTruncationWithPACKSS...
Simon Pilgrim [Mon, 26 Jun 2023 11:39:43 +0000 (12:39 +0100)]
[X86] Generalize combineVectorTruncationWithPACKUS/combineVectorTruncationWithPACKSS and reuse in LowerTRUNCATE

Rename combineVectorTruncationWithPACK* to truncateVectorWithPACK* and split the operands so LowerTRUNCATE can more easily use them.

Noticed while investigating some regressions in D152928 due to us trying to truncate to PACKUS/PACKSS instructions too early

12 months ago[flang][hlfir] user defined assignment codegen
Jean Perier [Mon, 26 Jun 2023 11:23:12 +0000 (13:23 +0200)]
[flang][hlfir] user defined assignment codegen

Add codegen support for hlfir.region_assign with user defined
assignment.

It is currently a bit pessimistic, because outside of forall, it
does not use the PURE aspect, if any, of the assignment routine to
rule out that the routine can write to something else than the LHS that
could overlap with the RHS.
However, the current lowering is anyway adding parenthesis around the
RHS, so this should not cause performance regressions.

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

12 months ago[flang][hlfir] Lower user defined assignment
Jean Perier [Mon, 26 Jun 2023 11:06:43 +0000 (13:06 +0200)]
[flang][hlfir] Lower user defined assignment

Lower user defined assignment inside the hlfir.region_assign
"userDefinedAssignment" mlir region.

This is done by adding an entry point to ConvertCall.h in order
to call genUserCall with the region block arguments as arguments.

The codegen for hlfir.region_assign with user defined assignment
will be added in a later patch.

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

12 months ago[mlir][llvm] Introduce some constant folding.
Théo Degioanni [Mon, 26 Jun 2023 10:49:54 +0000 (12:49 +0200)]
[mlir][llvm] Introduce some constant folding.

This revision introduces some constant folding features to the LLVM
dialect. This specific choice of operations to cover is intended to
allow the elimination of logic generated by mem2reg with memset in the
common case of memsets of constant values.

This also introduces new verifiers for integer extension operations.
This lead to a fix in SPIRV to LLVM conversion, as it would sometimes
generate invalid ZExt and SExt operations.

Reviewed By: gysit

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

12 months ago[BasicAA] Don't short-circuit non-capturing arguments
Nikita Popov [Thu, 22 Jun 2023 07:14:08 +0000 (09:14 +0200)]
[BasicAA] Don't short-circuit non-capturing arguments

This is an alternative to D153464. BasicAA currently assumes that
an unescaped alloca cannot be read through non-nocapture arguments
of a call, based on the argument that if the argument were based on
the alloca, it would not be unescaped.

This currently fails in the case where the call is an ephemeral value
and as such does not count as a capture. It also happens for calls
that are readonly+nounwind+void, though that case tends to not matter
in practice, because such calls will get DCEd anyway.

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

12 months ago[ConstraintElim] Add extra phi use tests.
Florian Hahn [Mon, 26 Jun 2023 10:14:33 +0000 (11:14 +0100)]
[ConstraintElim] Add extra phi use tests.

Add additional tests for D153660.

12 months ago[bazel] Add TargetParser dep to tblgen after 8de9f2b558a046da15cf73191da627bdd83676ca
Benjamin Kramer [Mon, 26 Jun 2023 10:04:24 +0000 (12:04 +0200)]
[bazel] Add TargetParser dep to tblgen after 8de9f2b558a046da15cf73191da627bdd83676ca

12 months ago[Reassociation] Only form CSE expressions for local operands
Quentin Colombet [Mon, 26 Jun 2023 09:42:55 +0000 (11:42 +0200)]
[Reassociation] Only form CSE expressions for local operands

 # TL;DR #
This patch constrains how much freedom the heuristic that tries to from CSE
expressions has. The added constrain is that the CSE-able expressions must be
within the same basic block as the expressions they get moved before.

 # Details #
The reassociation pass currently tweaks the rewrite of the final expression
towards surfacing pairs of operands that would be CSE-able.

This heuristic applies after the regular ordering of the expression.
The regular ordering uses the program structure to choose in which order each
subexpression is materialized. That order follows the topological order.

Now, to expose more CSE opportunities, this heurisitc effectively bypasses the
previous ordering normally defined by the program and pushes up sub-expressions
that are arbitrary deep in the CFG.
E.g., let's say the program order (top to bottom) gives `((a*b)*c)*d)*e` and
`b*e` appears the most in the program. The expression will be reordered in
`(((b*e)*a)*c)*d`

This reordering implies that all the sub expressions (in this example `xx*a`,
then `yy*c`, etc.) will need to appear after the CSE-able expression.

This may over-constrain where the (sub) expressions may live and in particular
it may create loop-dependent expressions.

This patch only allows to move expressions up the expression chain when the
related values are definied in the same basic block as the ones they
"push-down".

This constrain is far for being perfect but at least it avoids accidentally
creating loop dependent variables.

If we really want to expose CSE-able expressions in a proper way, we would need
a profitability metric and also make the decision globally as opposed to one
chain at a time.

I've put the new constrain behind an option to make comparing the old and new
versions easy. However, I believe that even if we find cases where the old
version performs better it is probably by accident. What I am aiming for with
this change is more predictability, then we can improve if need be.

This fixes www.llvm.org/PR61458

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

12 months ago[MLIR][Linalg] Avoid generalizing `linalg.map`
Lorenzo Chelini [Wed, 21 Jun 2023 08:53:43 +0000 (10:53 +0200)]
[MLIR][Linalg] Avoid generalizing `linalg.map`

We cannot trivially generalize `linalg.map`, as it does not use the
output as a region argument in the block, while `linalg.generic` expects
many region arguments as the input/output operands.

Reviewed By: nicolasvasilache

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

12 months agoRevert "[clang-tidy] Add modernize-printf-to-std-print check"
Piotr Zegar [Mon, 26 Jun 2023 09:19:01 +0000 (09:19 +0000)]
Revert "[clang-tidy] Add modernize-printf-to-std-print check"

This reverts commit ec89cb9a81529fd41fb37b8e62203a2e9f23bd54.

12 months ago[clang-format] Preserve AmpAmpTokenType in nested parentheses
Emilia Kond [Mon, 26 Jun 2023 09:35:47 +0000 (12:35 +0300)]
[clang-format] Preserve AmpAmpTokenType in nested parentheses

When parsing a requires clause, the UnwrappedLineParser would delegate to
parseParens with an AmpAmpTokenType set to BinaryOperator. However,
parseParens would not carry this over into any nested parens, meaning it
could assign a different token type to an && in a requires clause.

This patch makes sure parseParens inherits its parameter when performing
a recursive call.

Fixes https://github.com/llvm/llvm-project/issues/63251

Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay

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

12 months ago[clangd][c++20]Consider rewritten binary operators in TargetFinder
Jens Massberg [Tue, 20 Jun 2023 11:25:56 +0000 (13:25 +0200)]
[clangd][c++20]Consider rewritten binary operators in TargetFinder

In C++20 some binary operations can be rewritten, e.g. `a != b`
can be rewritten to `!(a == b)` if `!=` is not explicitly defined.
The `TargetFinder` hasn't considered the corresponding `CXXRewrittenBinaryOperator` yet. This resulted that the definition of such operators couldn't be found
when navigating to such a `!=` operator, see https://github.com/clangd/clangd/issues/1476.

In this patch we add support of `CXXRewrittenBinaryOperator` in `FindTarget`.
In such a case we redirect to the inner binary operator of the decomposed form.
E.g. in case that `a != b` has been rewritten to `!(a == b)` we go to the
`==` operator. The `==` operator might be implicitly defined (e.g. by a `<=>`
operator), but this case is already handled, see the new test.

I'm not sure if I the hover test which is added in this patch is the right one,
but at least is passed with this patch and fails without it :)

Note, that it might be a bit missleading that hovering over a `!=` refers to
"instance method operator==".

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

12 months agoMove SubtargetFeature.h from MC to TargetParser
Job Noorman [Mon, 26 Jun 2023 08:26:56 +0000 (10:26 +0200)]
Move SubtargetFeature.h from MC to TargetParser

SubtargetFeature.h is currently part of MC while it doesn't depend on
anything in MC. Since some LLVM components might have the need to work
with target features without necessarily needing MC, it might be
worthwhile to move SubtargetFeature.h to a different location. This will
reduce the dependencies of said components.

Note that I choose TargetParser as the destination because that's where
Triple lives and SubtargetFeatures feels related to that.

This issues came up during a JITLink review (D149522). JITLink would
like to avoid a dependency on MC while still needing to store target
features.

Reviewed By: MaskRay, arsenm

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

12 months ago[clang-format][NFC] Use correct test method for new tests
Emilia Kond [Mon, 26 Jun 2023 09:26:03 +0000 (12:26 +0300)]
[clang-format][NFC] Use correct test method for new tests

7a38b3bfeb56 landed after 20b4df1ed611, which refactored how tests are
structured in FormatTest. This quick fix-up unifies the tests added in
7a38b3bfeb56 to comply with this new format.

12 months ago[clang-tidy] Add modernize-printf-to-std-print check
Mike Crowe [Mon, 26 Jun 2023 05:44:14 +0000 (05:44 +0000)]
[clang-tidy] Add modernize-printf-to-std-print check

Add FormatStringConverter utility class that is capable of converting
printf-style format strings into std::print-style format strings along
with recording a set of casts to wrap the arguments as required and
removing now-unnecessary calls to std::string::c_str() and
std::string::data()

Use FormatStringConverter to implement a new clang-tidy check that is
capable of converting calls to printf, fprintf, absl::PrintF,
absl::FPrintF, or any functions configured by an option to calls to
std::print and std::println, or other functions configured by options.

In other words, the check turns:

 fprintf(stderr, "The %s is %3d\n", description.c_str(), value);

into:

 std::println(stderr, "The {} is {:3}", description, value);

if it can.

std::print and std::println can do almost anything that standard printf
can, but the conversion has some some limitations that are described in
the documentation. If conversion is not possible then the call remains
unchanged.

Depends on D153716

Reviewed By: PiotrZSL

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

12 months ago[Clang][RISCV] Check type support for local variable declaration of RVV type
eopXD [Thu, 22 Jun 2023 08:35:34 +0000 (01:35 -0700)]
[Clang][RISCV] Check type support for local variable declaration of RVV type

Guard local variable declaration for RVV intrinsic types.

Reviewed By: craig.topper

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

12 months ago[mlir][LLVMIR] Allow !llvm.ptr<ptr> operands in atomicrmw xchg op.
Ingo Müller [Mon, 26 Jun 2023 08:22:22 +0000 (08:22 +0000)]
[mlir][LLVMIR] Allow !llvm.ptr<ptr> operands in atomicrmw xchg op.

Previously, llvm.atomicrmw only allowed operands that are pointers to
LLVM floats or integers. However, according to the LLVM IR Language
Reference, that op allows pointer to pointer operands in its `xchg`
mode. This patch allows those operands also in MLIR's LLVM dialect and
adapts the tests accordingly.

Reviewed By: gysit

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

12 months ago[RISCV] Teach doPeepholeMaskedRVV to handle vslide{up,down}
Luke Lau [Fri, 23 Jun 2023 13:56:56 +0000 (14:56 +0100)]
[RISCV] Teach doPeepholeMaskedRVV to handle vslide{up,down}

We already handle vslide1{up,down}, so this extends it to vslide{up,down}.

This was unintentionally added in https://reviews.llvm.org/D150463 and
then removed in 37cfcfcef76bb615b941d7077ca81168bd7ad080, but unless I'm
missing something this should still be ok as the mask only controls what
destination elements are written to.

Reviewed By: craig.topper

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

12 months ago[RISCV] Add test cases for vmerge peephole with vslides
Luke Lau [Fri, 23 Jun 2023 13:31:45 +0000 (14:31 +0100)]
[RISCV] Add test cases for vmerge peephole with vslides

Currently vslide1{up,down}s can have vmerges folded into them, but not
vslide{up,down}s.

Reviewed By: craig.topper

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

12 months ago[mlir][affine][doc] Fix example snippet for AffineParallelOp. (NFC)
Ingo Müller [Sun, 25 Jun 2023 09:04:49 +0000 (09:04 +0000)]
[mlir][affine][doc] Fix example snippet for AffineParallelOp. (NFC)

There were various syntax errors; all have pretty trivial fixes but
might distract novice users (like me).

Reviewed By: ingomueller-net

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