platform/upstream/llvm.git
13 months ago[Flang][OpenMP][Parser] Resolve Declare Target Directive Symbols
Andrew Gozillon [Fri, 2 Jun 2023 19:18:50 +0000 (14:18 -0500)]
[Flang][OpenMP][Parser] Resolve Declare Target Directive Symbols

Currently symbols are not resolved for declare target
after they've been modified by prior passes. This can
lead to missing or incorrect symbols in subsequent
compiler phases when declare target is used with
more complex types e.g. common block.

This patch should allow these symbols to be
resolved appropriately.

Reviewers: kiranchandramohan

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

13 months ago[libc] Implement 'errno' on the GPU as a global integer internally
Joseph Huber [Fri, 2 Jun 2023 17:48:05 +0000 (12:48 -0500)]
[libc] Implement 'errno' on the GPU as a global integer internally

The C standard asserts that the `errno` value is an l-value thread local
integer. We cannot provide a generic thread local integer on the GPU
currently without some workarounds. Previously, we worked around this by
implementing the `errno` value as a special consumer class that made all
the writes disappear. However, this is problematic for internal tests.
Currently there are build failures because of this handling and it's
only likely to cause more problems the more we do this.

This patch instead makes the internal target used for testing export the
`errno` value as a simple global integer. This allows us to use and test
the `errno` interface correctly assuming we run with a single thread.
Because this is only used for the non-exported target we still do not
provide this feature in the version that users will use so we do not
need to worrk about it being incorrect in general.

Reviewed By: lntue

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

13 months agoConstexprify all eligible functions in MCRegister and Register
Krzysztof Parzyszek [Thu, 1 Jun 2023 18:57:55 +0000 (11:57 -0700)]
Constexprify all eligible functions in MCRegister and Register

13 months ago[test] Add -Wno-msvc-not-found to fix linker-opts.c on *-windows-msvc
Fangrui Song [Fri, 2 Jun 2023 18:59:22 +0000 (11:59 -0700)]
[test] Add -Wno-msvc-not-found to fix linker-opts.c on *-windows-msvc

13 months ago[RISCV] Simplify vector instruction multiclasses. NFC
Craig Topper [Fri, 2 Jun 2023 18:27:31 +0000 (11:27 -0700)]
[RISCV] Simplify vector instruction multiclasses. NFC

Remove 'string vw' template parameter from classes where it always
has a one value.

For the 2 classes that need it, make it required instead of having a
default.

13 months ago[Clang] Fix missing libraries for the include cleaner check
Joseph Huber [Fri, 2 Jun 2023 17:42:15 +0000 (12:42 -0500)]
[Clang] Fix missing libraries for the include cleaner check

Summary:
Recently, the changes in https://reviews.llvm.org/D148793 introduced
some extra dependencies that caused link failured on my machine. This
patch adds the necessary libraries to resolve the link failures and
allow me to build again.

13 months agoRevert rG2f9a4d308d4517eee85e373bc09920f85f91fdcd "[GlobalISel][X86] Add G_CTLZ_ZERO_...
Simon Pilgrim [Fri, 2 Jun 2023 17:43:02 +0000 (18:43 +0100)]
Revert rG2f9a4d308d4517eee85e373bc09920f85f91fdcd "[GlobalISel][X86] Add G_CTLZ_ZERO_UNDEF legalization handling"

Unintentional commit - G_CTLZ_ZERO_UNDEF will have to be custom handled as BSR needs the bits flipping (and we don't have a pattern for that yet).

13 months ago[bazel] Add include-cleaner targets, fix clang-tidy build for c28506ba4b6961950849f8f...
Haojian Wu [Fri, 2 Jun 2023 17:36:13 +0000 (19:36 +0200)]
[bazel] Add include-cleaner targets, fix clang-tidy build for c28506ba4b6961950849f8fdecd0cf7e503a14f9

13 months ago[mlir][sparse] fix various bug to support sparse pooling
Peiming Liu [Wed, 31 May 2023 04:53:46 +0000 (04:53 +0000)]
[mlir][sparse] fix various bug to support sparse pooling

Reviewed By: aartbik

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

13 months ago[GlobalISel][X86] Add G_CTLZ_ZERO_UNDEF legalization handling
Simon Pilgrim [Fri, 2 Jun 2023 16:31:19 +0000 (17:31 +0100)]
[GlobalISel][X86] Add G_CTLZ_ZERO_UNDEF legalization handling

13 months ago[gn build] Port c28506ba4b69 more
Nico Weber [Fri, 2 Jun 2023 17:24:33 +0000 (13:24 -0400)]
[gn build] Port c28506ba4b69 more

13 months ago[gn build] Port c28506ba4b69
Nico Weber [Fri, 2 Jun 2023 17:16:05 +0000 (13:16 -0400)]
[gn build] Port c28506ba4b69

13 months ago[libc++] Remove min_max_macros test
Louis Dionne [Wed, 31 May 2023 14:30:32 +0000 (07:30 -0700)]
[libc++] Remove min_max_macros test

This test is redundant since we already test the same thing in our
nasty_macros test.

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

13 months ago[libc++] Transition several remaining generated tests to the new .gen format
Louis Dionne [Wed, 31 May 2023 20:35:12 +0000 (13:35 -0700)]
[libc++] Transition several remaining generated tests to the new .gen format

In addition to reducing the amount of boilerplate we need to generate
whenever a new header is added, this also improves the existing tests
by running them in separate Lit tests (so they can be parallelized).
This also creates separate translation units for most header tests,
which is what we really should have done from the start since it
isolates each header we're testing.

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

13 months ago[PowerPC] Add DFP compare instructions.
Stefan Pintilie [Fri, 2 Jun 2023 16:09:14 +0000 (12:09 -0400)]
[PowerPC] Add DFP compare instructions.

This patch adds the DFP compare instructions:
dcmpu, dcmpuq, dcmpo, dcmpoq

Reviewed By: amyk

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

13 months ago[Driver] Move -nostdinc like options into IncludePath_Group
Fangrui Song [Fri, 2 Jun 2023 16:33:08 +0000 (09:33 -0700)]
[Driver] Move -nostdinc like options into IncludePath_Group

With only a link action, we claim all CompileOnly_Group options (including -f*,
-m*, -i*, etc). It makes sense to claim -nostdinc family options as well.
We can achieve this by placing these options into IncludePath_Group, a derivative of
CompileOnly_Group.

Reviewed By: theuni

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

13 months ago[scudo] Support importing custom configuration
Chia-hung Duan [Fri, 2 Jun 2023 16:27:49 +0000 (16:27 +0000)]
[scudo] Support importing custom configuration

To define custom allocation, you only need to put the configuration in
custom_scudo_config.h and define two required aliases, then you will be
switched to the customized config and the tests will also run with your
configuration.

In this CL, we also have a minor refactor the structure of
configuration. Now the essential fields are put under the associated
hierarchy and which will make the defining new configuration easier.

Reviewed By: cferris

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

13 months ago[CodeGen] Use llvm::LLVMContext::MD_invariant_load (NFC)
Kazu Hirata [Fri, 2 Jun 2023 16:25:00 +0000 (09:25 -0700)]
[CodeGen] Use llvm::LLVMContext::MD_invariant_load (NFC)

13 months ago[OpenMP] Fix transformed loop's var privacy
Joel E. Denny [Fri, 2 Jun 2023 16:18:13 +0000 (12:18 -0400)]
[OpenMP] Fix transformed loop's var privacy

Without this patch, the following example crashes Clang:

```
 #pragma omp target map(i)
 #pragma omp tile sizes(2)
 for (i = 0; i < N; ++i)
   ;
```

This patch fixes the crash by changing `Sema::isOpenMPPrivateDecl` not
to identify `i` as private just because it's the loop variable of a
`tile` construct.

While OpenMP TR11 and earlier do specify privacy for loop variables of
loops *generated* from a `tile` construct, I haven't found text
stating that the original loop variable must be private in the above
example, so this patch leaves it shared.  Even so, it is a bit
unexpected that value of `i` after the loop is `N - 1` instead of `N`.

Reviewed By: ABataev

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

13 months ago[mlir] Update how scalable indices are printed
Andrzej Warzynski [Thu, 1 Jun 2023 08:30:46 +0000 (09:30 +0100)]
[mlir] Update how scalable indices are printed

This patch makes sure that scalable indices (that would normally
represent scalable tile or vector sizes) are printed correctly, i.e.
with additional square brackets:
```
%1, %loop = transform.structured.tile %0 [2, 8, [4]]
```

This change complements https://reviews.llvm.org/D150944 and is a part
of a larger effort to enable scalable vectorisation in Linalg. See this
RFC for more context:
  * https://discourse.llvm.org/t/rfc-scalable-vectorisation-in-linalg/

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

13 months ago[clang-tidy] Fix docs.
Viktoriia Bakalova [Fri, 2 Jun 2023 15:31:55 +0000 (15:31 +0000)]
[clang-tidy] Fix docs.

13 months ago[GlobalIsel][X86] Merge LZCNT 32-bit and 64-bit test coverage
Simon Pilgrim [Fri, 2 Jun 2023 15:26:25 +0000 (16:26 +0100)]
[GlobalIsel][X86] Merge LZCNT 32-bit and 64-bit test coverage

13 months ago[clang-tidy] Implement an include-cleaner check.
Viktoriia Bakalova [Wed, 19 Apr 2023 07:16:51 +0000 (07:16 +0000)]
[clang-tidy] Implement an include-cleaner check.

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

13 months ago[libc][Obvious] Fix a typo in setting FMA control option for RISCV64.
Tue Ly [Fri, 2 Jun 2023 15:15:29 +0000 (11:15 -0400)]
[libc][Obvious] Fix a typo in setting FMA control option for RISCV64.

13 months ago[Clang][Parser] Accept GNU attributes preceding C++ attributes on templates
Elizabeth Andrews [Thu, 1 Jun 2023 21:18:40 +0000 (14:18 -0700)]
[Clang][Parser] Accept GNU attributes preceding C++ attributes on templates

Clang was rejecting valid code where GNU style attributes preceded C++ style
attributes in template declarations as follows:

template<int a>
__attribute__((deprecated("oh no!"))) [[deprecated("oh no!")]] void foo();

This PR fixes the bug.

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

13 months ago[GlobalIsel][X86] Move G_SHL/G_LSHR/G_ASHR legalization before legacy handling and...
Simon Pilgrim [Fri, 2 Jun 2023 14:55:47 +0000 (15:55 +0100)]
[GlobalIsel][X86] Move G_SHL/G_LSHR/G_ASHR legalization before legacy handling and merge 32-bit/64-bit handling

13 months ago[GlobalIsel][X86] Move G_SDIV/G_SREM/G_UDIV/G_UREM legalization before legacy handlin...
Simon Pilgrim [Fri, 2 Jun 2023 14:46:24 +0000 (15:46 +0100)]
[GlobalIsel][X86] Move G_SDIV/G_SREM/G_UDIV/G_UREM legalization before legacy handling and merge 32-bit/64-bit handling

13 months ago[flang] Relax ALLOCATABLE/POINTER actual argument checks under INTENT(IN)
Peter Klausler [Wed, 31 May 2023 21:06:22 +0000 (14:06 -0700)]
[flang] Relax ALLOCATABLE/POINTER actual argument checks under INTENT(IN)

Per 15.5.2.5 p2, when both a dummy data object and its associated
actual argument are ALLOCATABLE or POINTER, there are rules requiring
that both be unlimited polymorphic if either is, and that both be
polymorphic if either is.  The justifications for the first restriction
is that the called procedure might change the type of an unlimited
polymorphic dummy argument, but as this cannot occur for a dummy
argument with INTENT(IN), we can relax the check to an optional
portability warning.  The justification for the second restriction
is that some implementations would have to create a type descriptor
to associate a monomorphic allocatable/pointer actual argument with
a polymorphic dummy argument, and that doesn't apply to f18 since we
use descriptors for them anyways.

Relaxing these needless checks allows more library procedures to
use "class(*), dimension(..), pointer, intent(in)" dummy arguments
in explicit interfaces.

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

13 months ago[clang-format] Parse the Verilog language option in configuration
sstwcw [Fri, 2 Jun 2023 14:52:34 +0000 (14:52 +0000)]
[clang-format] Parse the Verilog language option in configuration

Reviewed By: HazardyKnusperkeks, MyDeveloperDay

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

13 months agoRevert "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"
Marco Elver [Fri, 2 Jun 2023 14:36:45 +0000 (16:36 +0200)]
Revert "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"

This reverts commit fc011a72881cdddc95bfa61f3f38916c29b7e362.
This reverts commit 4ad6a0c9a409b19b950a6a2a90d5405cea2e9b89.
This reverts commit 4b1eb4cf0e8eff5f68410720167b4986da597010.

Still causes Windows build bots to fail.

13 months agoFix "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"
Marco Elver [Fri, 2 Jun 2023 14:15:31 +0000 (16:15 +0200)]
Fix "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"

The tests already depend on libc through various dependencies. In
addition, including C++STL inline functions may lead to ODR violations
where one version uses sanitizer_common's internal_mem*() functions, and
the other the normal memintrinsics.

13 months ago[libc++] Fix broken transitive includes test
Louis Dionne [Fri, 2 Jun 2023 14:23:36 +0000 (07:23 -0700)]
[libc++] Fix broken transitive includes test

13 months ago[MLIR][Docs] Unwrap video link in Rationale
J. Ryan Stinnett [Fri, 2 Jun 2023 14:22:26 +0000 (15:22 +0100)]
[MLIR][Docs] Unwrap video link in Rationale

13 months ago[AArch64] Add SVE predicated operations tests. NFC
David Green [Fri, 2 Jun 2023 14:08:04 +0000 (15:08 +0100)]
[AArch64] Add SVE predicated operations tests. NFC

Originally from the MVE tests, this adds tests for various operations which can
often be converted to predicated instructions under SVE. Additionally some tests
for commutativity and extra uses of the existing smin/smax operations. See the
patches D149969/ D151084 / D151080 / D149967 / etc.

13 months ago[mlir] Fix unqualified call to 'std::move' in TransformOps.cpp
Jie Fu [Fri, 2 Jun 2023 14:06:46 +0000 (22:06 +0800)]
[mlir] Fix unqualified call to 'std::move' in TransformOps.cpp

/data/llvm-project/mlir/lib/Dialect/Transform/IR/TransformOps.cpp:230:35: error: unqualified call to 'std::move' [-Werror,-Wunqualified-std-cast-call]
  patterns.try_emplace(attr, [f = move(fn)](RewritePatternSet &patternSet) {
                                  ^
                                  std::
1 error generated.

13 months ago[mlir][vector][transform] Register vector dialect patterns
Matthias Springer [Fri, 2 Jun 2023 13:39:04 +0000 (15:39 +0200)]
[mlir][vector][transform] Register vector dialect patterns

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

13 months agoFix "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"
Marco Elver [Fri, 2 Jun 2023 13:47:21 +0000 (15:47 +0200)]
Fix "[compiler-rt] Avoid memintrinsic calls inserted by the compiler"

Add interface attribute to __sanitizer_internal_mem* declarations as
well, as otherwise some compilers (MSVC) will complain.

13 months ago[GlobalIsel][X86] Add G_ADD/G_SUB i8/i16 and promotion legalization tests
Simon Pilgrim [Fri, 2 Jun 2023 13:41:15 +0000 (14:41 +0100)]
[GlobalIsel][X86] Add G_ADD/G_SUB i8/i16 and promotion legalization tests

Add i8/i16/i24/i42 ADD/SUB test coverage

13 months ago[GlobalIsel][X86] Regenerate G_ADD/G_SUB vector legalization tests
Simon Pilgrim [Fri, 2 Jun 2023 13:40:03 +0000 (14:40 +0100)]
[GlobalIsel][X86] Regenerate G_ADD/G_SUB vector legalization tests

13 months ago[mlir][tensor] Implement getBufferType for ReshapeOp.
Ingo Müller [Fri, 26 May 2023 09:43:16 +0000 (09:43 +0000)]
[mlir][tensor] Implement getBufferType for ReshapeOp.

This function should be implemented for ops that work in one-shot
bufferization.

Reviewed By: springerm

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

13 months ago[compiler-rt] Avoid memintrinsic calls inserted by the compiler
Marco Elver [Tue, 30 May 2023 09:59:22 +0000 (11:59 +0200)]
[compiler-rt] Avoid memintrinsic calls inserted by the compiler

D135716 introduced -ftrivial-auto-var-init=pattern where supported.
Unfortunately this introduces unwanted memset() for large stack arrays,
as shown by the new tests added for asan and msan (tsan already had this
test).

In general, the problem of compiler-inserted memintrinsic calls
(memset/memcpy/memmove) is not new to compiler-rt, and has been a
problem before.

To avoid introducing unwanted memintrinsic calls, we redefine
memintrinsics as __sanitizer_internal_mem* at the assembly level for
most source files automatically (where sanitizer_common_internal_defs.h
is included).

In few cases, redefining a symbol in this way causes issues for
interceptors, namely the memintrinsic interceptor themselves. For such
source files we have to selectively disable the redefinition.

Other alternatives have been considered, but simply do not work well in
the context of compiler-rt:

1. Linker --wrap:  this does not work because --wrap only
   applies to the final link, and would not apply when building
   sanitizer static libraries.

2. Changing references to memset() via objcopy:  this may work,
   but due to the complexities of the build system, introducing
   such a post-processing step for the right object files (in
   particular object files defining memset cannot be touched)
   seems infeasible.

The chosen solution works well (as shown by the tests). Other libraries
have chosen the same solution where nothing else works (see e.g. glibc's
"symbol-hacks.h").

v3:
- Don't use ALIAS() to alias internal_mem*() functions to
  __sanitizer_internal_mem*() functions, but just define them as
  ALWAYS_INLINE functions instead. This will work on darwin and windows.

v2:
- Fix ubsan_minimal build where compiler decides to insert
  memset/memcpy: ubsan_minimal has work without RTSanitizerCommonLibc,
  therefore do not redefine the builtins.
- Fix definition of internal_mem* functions with compilers that want the
  aliased function to already be defined before.
- Fix definition of __sanitizer_internal_mem* functions with compilers
  more pedantic about attribute placement around extern "C".

Reviewed By: vitalybuka, dvyukov

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

13 months ago[mlir][tensor][transform] Register tensor dialect patterns
Matthias Springer [Fri, 2 Jun 2023 13:27:55 +0000 (15:27 +0200)]
[mlir][tensor][transform] Register tensor dialect patterns

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

13 months ago[GlobalIsel][X86] Move G_BSWAP/G_CTPOP/G_CTLZ legalization before legacy handling
Simon Pilgrim [Fri, 2 Jun 2023 13:05:06 +0000 (14:05 +0100)]
[GlobalIsel][X86] Move G_BSWAP/G_CTPOP/G_CTLZ legalization before legacy handling

Also merge 32-bit/64-bit handling of G_CTPOP/G_CTLZ using legalIf()

13 months ago[mlir][transform] Add ApplyPatternsOp and PatternRegistry
Matthias Springer [Fri, 2 Jun 2023 12:57:22 +0000 (14:57 +0200)]
[mlir][transform] Add ApplyPatternsOp and PatternRegistry

Add a new transform op that applies patterns to a targeted payload op. Patterns can be registered by transform dialect extensions in a pattern registry.

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

13 months ago[mlir][transform] Utilize op interface instead of tensor::TrackingListener
Matthias Springer [Fri, 2 Jun 2023 12:42:56 +0000 (14:42 +0200)]
[mlir][transform] Utilize op interface instead of tensor::TrackingListener

Add a new interface `FindPayloadReplacementOpInterface` to specify ops that should be skipped when looking for payload replacement ops. Such ops are typically metadata-only ops.

With this change, we no longer need to maintain a custom TrackingListener in the tensor dialect.

Note: `CastOpInterface` by itself is not sufficient. Some metadata-only ops such as "tensor.reshape" are not casts, and it would be incorrect for them to implement the `CastOpInterface`.

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

13 months ago[Clang][RISCV] Add test coverage for `_mu` overloaded variant for the load intrinsics...
eopXD [Fri, 2 Jun 2023 12:35:56 +0000 (05:35 -0700)]
[Clang][RISCV] Add test coverage for `_mu` overloaded variant for the load intrinsics. NFC

Maps to amendment in under specification:
riscv-non-isa/rvv-intrinsic-doc#233

Signed-off-by: eop Chen <eop.chen@sifive.com>
13 months ago[ValueTracking] Use correct struct kind for forward declaration (NFC)
Nikita Popov [Fri, 2 Jun 2023 12:33:54 +0000 (14:33 +0200)]
[ValueTracking] Use correct struct kind for forward declaration (NFC)

13 months agoSimpleLoopUnswitch: Add missing test coverage for divergent target check
Matt Arsenault [Fri, 2 Jun 2023 10:18:21 +0000 (06:18 -0400)]
SimpleLoopUnswitch: Add missing test coverage for divergent target check

No tests failed when I removed the hasBranchDivergence check, so
add one.

13 months ago[InstCombine] Handle assumes in multi-use demanded bits simplification
Nikita Popov [Fri, 2 Jun 2023 10:52:27 +0000 (12:52 +0200)]
[InstCombine] Handle assumes in multi-use demanded bits simplification

This fixes the largest remaining discrepancy between results of
computeKnownBits() and SimplifyDemandedBits(). We only care about
the multi-use case here, because the assume necessarily introduces
an extra use.

13 months ago[SVE ACLE] Extend IR combines for fmul, fsub, fadd to cover _u variants
Jolanta Jensen [Wed, 17 May 2023 09:21:40 +0000 (09:21 +0000)]
[SVE ACLE] Extend IR combines for fmul, fsub, fadd to cover _u variants

This patch extends existing IR combines for: fmul, fsub and fadd,
relying on all active predicate to also apply to their equivalent
undef (_u) intrinsics.

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

13 months ago[clangd] Use FileManager for getCanonicalPath, NFC
Haojian Wu [Fri, 2 Jun 2023 10:12:54 +0000 (12:12 +0200)]
[clangd] Use FileManager for getCanonicalPath, NFC

get rid of the SourceManager dependency -- getCanonicalPath doesn't use
other SourceManager fields.

13 months ago[AArch64] Don't use tbl lowering if ZExt can be folded into user.
Florian Hahn [Fri, 2 Jun 2023 10:53:03 +0000 (11:53 +0100)]
[AArch64] Don't use tbl lowering if ZExt can be folded into user.

If the ZExt can be lowered to a single ZExt to the next power-of-2 and
the remaining ZExt folded into the user, don't use tbl lowering.

Fixes #62620.

Reviewed By: efriedma

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

13 months ago[GlobalIsel][X86] Update legalization of G_ADD/G_SUB
Simon Pilgrim [Fri, 2 Jun 2023 10:33:51 +0000 (11:33 +0100)]
[GlobalIsel][X86] Update legalization of G_ADD/G_SUB

Replace the legacy legalizers for G_ADD/G_SUB with a pattern that should work for the full mixture of scalar/vector types we need to support for most opcodes.

If we can decide on this as a suitable pattern we can reuse it for the other op types, but G_ADD/G_SUB are the only ones that have decent legalizer test coverage at this stage.

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

13 months ago[MLIR][Bufferization] Improve documentation of introduction and `summary`s
rikhuijzer [Fri, 2 Jun 2023 09:46:46 +0000 (11:46 +0200)]
[MLIR][Bufferization] Improve documentation of introduction and `summary`s

This patch suggests to add a sentence in the introduction which clarifies
the aim of the dialect in one sentence. I hope that I understood it correctly.

For the `summary` fields, I have scrolled through the Bufferization page
(<https://mlir.llvm.org/docs/Bufferization>) and added missing summaries
or standardized existing ones to make the summaries easier to read.

Reviewed By: springerm

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

13 months ago[GlobalIsel][X86] Legalize G_BSWAP III
Thorsten Schütt [Fri, 2 Jun 2023 09:18:38 +0000 (11:18 +0200)]
[GlobalIsel][X86] Legalize G_BSWAP III

Reviewed By: RKSimon

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

13 months ago[ValueTracking] Replace Query with SimplifyQuery (NFC)
Nikita Popov [Fri, 2 Jun 2023 09:05:55 +0000 (11:05 +0200)]
[ValueTracking] Replace Query with SimplifyQuery (NFC)

These implement essentially the same thing, so normalize
ValueTracking to use SimplifyQuery. In the future we can directly
expose the SimplifyQuery-based APIs.

13 months ago[LoongArch] Use Subtarget consistently during LoongArchISelLowering init. NFC
Weining Lu [Fri, 2 Jun 2023 08:20:32 +0000 (16:20 +0800)]
[LoongArch] Use Subtarget consistently during LoongArchISelLowering init. NFC

13 months ago[AArch64] Add additional zext/mull tests.
Florian Hahn [Fri, 2 Jun 2023 08:16:30 +0000 (09:16 +0100)]
[AArch64] Add additional zext/mull tests.

Extra test coverage for D150482.

13 months ago[MI] Don't use std::function for all_uses/all_defs iterators (NFC)
Nikita Popov [Fri, 2 Jun 2023 07:17:48 +0000 (09:17 +0200)]
[MI] Don't use std::function for all_uses/all_defs iterators (NFC)

This mitigates the compile-time regression from D151424. The use
of std::function is not necessary here, as we're passing in a
static function.

13 months agoFix isKnownNeverInfOrNaN() call in AMDGPU after ORE removal 97b5cc214aee48e30391bfcd2...
Haojian Wu [Fri, 2 Jun 2023 07:32:46 +0000 (09:32 +0200)]
Fix isKnownNeverInfOrNaN() call in AMDGPU after ORE removal 97b5cc214aee48e30391bfcd2cde4252163d7406

13 months ago[X86] Add schedule module for SapphireRapids
Haohai Wen [Fri, 2 Jun 2023 07:10:24 +0000 (15:10 +0800)]
[X86] Add schedule module for SapphireRapids

The X86SchedSapphireRapids.td file is automatically generated by
schedtool (D130897). Most of instruction's scheduling information
is from SapphireRapids tpt/lat data provided by intel doc. Some data
is from measured ADL-P data in uops.info. The rest instruction's
scheduling information is from skylake server schedule model in order
to get a relative complete model.

Reviewed By: LuoYuanke

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

13 months ago[SimplifyLibCalls] Fix isKnownNeverInfinity() call after ORE removal
Nikita Popov [Fri, 2 Jun 2023 07:20:57 +0000 (09:20 +0200)]
[SimplifyLibCalls] Fix isKnownNeverInfinity() call after ORE removal

Missed this in 97b5cc214aee48e30391bfcd2cde4252163d7406.

13 months ago[ValueTracking] Remove ORE argument (NFC-ish)
Nikita Popov [Fri, 26 May 2023 13:14:31 +0000 (15:14 +0200)]
[ValueTracking] Remove ORE argument (NFC-ish)

The ORE argument threaded through ValueTracking is used only in a
single, untested place. It is also essentially never passed: The
only places that do so have been added very recently as part of the
KnownFPClass migration, which is vanishingly unlikely to hit this
code path. Remove this effectively dead argument.

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

13 months ago[cuda, NVPTX] Signed char and (unsigned)long builtins of ldg and ldu
Jakub Chlanda [Thu, 1 Jun 2023 10:41:06 +0000 (12:41 +0200)]
[cuda, NVPTX] Signed char and (unsigned)long builtins of ldg and ldu

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

13 months agoRevert "[clang][Diagnostics] Split source ranges into line ranges before..."
Timm Bäder [Fri, 2 Jun 2023 07:02:04 +0000 (09:02 +0200)]
Revert "[clang][Diagnostics] Split source ranges into line ranges before..."

This reverts commit fc1262bd58ac54ad0a0bfa9750254b81c742bbb5.

This causes build bot failures because of a parser test case:
https://lab.llvm.org/buildbot/#/builders/139/builds/41961

13 months ago[clang][Diagnostics] Split source ranges into line ranges before...
Timm Bäder [Tue, 23 May 2023 14:33:59 +0000 (16:33 +0200)]
[clang][Diagnostics] Split source ranges into line ranges before...

... emitting them.

This makes later code easier to understand, since we emit the code
snippets line by line anyway.
It also fixes the weird underlinig of multi-line source ranges.

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

13 months ago[mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces
Matthias Springer [Fri, 2 Jun 2023 06:32:01 +0000 (08:32 +0200)]
[mlir][IR][NFC] Move CastOpInterface helpers to mlir/Interfaces

These helpers should not be part of the IR build unit.

The interface is now implemented on `builtin.unrealized_conversion_cast` with an external model.

Also rename the CastOpInterfaces Bazel target name to CastInterfaces to be consistent with the CMake target name.

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

13 months ago[clang][Interp][NFC] Print Function name in unreachable type failures
Timm Bäder [Fri, 19 May 2023 07:30:24 +0000 (09:30 +0200)]
[clang][Interp][NFC] Print Function name in unreachable type failures

and pass Record* pointers around as const.

13 months ago[clang][Interp][NFC] Add FunctionPointer.h header comment
Timm Bäder [Fri, 19 May 2023 06:57:52 +0000 (08:57 +0200)]
[clang][Interp][NFC] Add FunctionPointer.h header comment

13 months ago[RISCV] Modify a tablegen multiclass for a future patch. NFC
Craig Topper [Fri, 2 Jun 2023 05:38:00 +0000 (22:38 -0700)]
[RISCV] Modify a tablegen multiclass for a future patch. NFC

Split the vop_type parameter to VPatBinaryVL_VF into vop1_type
and vop2_type. This will allows to be used for vfwadd.wf in
a future patch.

13 months ago[AMDGPU] WQM: Allow insertion of exact mode transition as terminator
Carl Ritson [Fri, 2 Jun 2023 01:34:37 +0000 (10:34 +0900)]
[AMDGPU] WQM: Allow insertion of exact mode transition as terminator

Allow WQM pass to insert transitions to exact mode among block
terminators, instead of forcing them to occur before terminators.

This should not yield any functional change, but allows block
splitting of control flow, such as that in D145329.

Reviewed By: arsenm

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

13 months agoFix TableGen emitter: hasValue() has been renamed has_value()
Mehdi Amini [Fri, 2 Jun 2023 03:54:32 +0000 (20:54 -0700)]
Fix TableGen emitter: hasValue() has been renamed has_value()

This codepath isn't exercised in-tree right now unfortunately, this only
happens when a dialect does not use the default entry points for types
parsing AND is extensible: both of these aren't the default settings and
the combination of them isn't common.

Fix #63058

13 months ago[RISCV][NFC] Use common prefix to simplify test.
Jianjian GUAN [Thu, 1 Jun 2023 09:32:25 +0000 (17:32 +0800)]
[RISCV][NFC] Use common prefix to simplify test.

Reviewed By: frasercrmck

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

13 months ago[lldb] Take StringRef names in GetChildAtNamePath (NFC)
Dave Lee [Sun, 28 May 2023 23:03:42 +0000 (16:03 -0700)]
[lldb] Take StringRef names in GetChildAtNamePath (NFC)

Following D151810, this changes `GetChildAtNamePath` to take a path of `StringRef`
values instead of `ConstString`.

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

13 months ago[lldb] Take StringRef name in GetIndexOfChildWithName (NFC)
Dave Lee [Sun, 28 May 2023 22:52:06 +0000 (15:52 -0700)]
[lldb] Take StringRef name in GetIndexOfChildWithName (NFC)

As with D151615, which changed `GetIndexOfChildMemberWithName` to take a `StringRef`
instead of a `ConstString`, this change does the same for `GetIndexOfChildWithName`.

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

13 months ago[libc++] Refactor the mandatory header inclusion tests to .gen.py
Louis Dionne [Wed, 31 May 2023 16:43:14 +0000 (09:43 -0700)]
[libc++] Refactor the mandatory header inclusion tests to .gen.py

This allows removing a bunch of boilerplate from the test suite and
reducing the amount of manual stuff contributors have to do when they
add a new public header.

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

13 months ago[libc++] Make sure we use POSIX paths in header_information.py
Louis Dionne [Thu, 1 Jun 2023 18:18:53 +0000 (11:18 -0700)]
[libc++] Make sure we use POSIX paths in header_information.py

Otherwise, the various lists of headers have different content based
on whether they are run on Windows or other platforms, which makes it
really difficult to write .gen.py tests correctly.

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

13 months ago[FuzzMutate] Handle BB without predecessor, avoid insertion after `musttail call...
Henry Yu [Fri, 2 Jun 2023 02:51:41 +0000 (19:51 -0700)]
[FuzzMutate] Handle BB without predecessor, avoid insertion after `musttail call`, avoid sinking token type

FuzzMutate didn't consider some corner cases and leads to mutation failure when mutating some modules.
This patch fixes 3 bugs:

- Add null check when encountering basic blocks without predecessor to avoid segmentation fault
- Avoid insertion after `musttail call` instruction
- Avoid sinking token type

Unit tests are also added.

Reviewed By: Peter

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

13 months ago[X86][MC] Use MCInstrDesc to access CondCode operand
Amir Ayupov [Fri, 2 Jun 2023 01:59:27 +0000 (18:59 -0700)]
[X86][MC] Use MCInstrDesc to access CondCode operand

BOLT may add an extra MCOperand as annotation, making the number of operands in
MCInst different from MCInstrDesc information. A recent change broke our use as
the last operand is no longer a cond code.

Partially revert 287dd0142c08caad5b32628f3842dfd5d5c59d03 to rely on MCInstrDesc
to access CondCode operand.

Reviewed By: skan

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

13 months agoRestrict the test from 22667e3220de5ead353a2148265d841644b63824
Jim Ingham [Fri, 2 Jun 2023 01:42:06 +0000 (18:42 -0700)]
Restrict the test from 22667e3220de5ead353a2148265d841644b63824

I fixed some long-standing failures in SBTarget::FindGlobalVariables
but the fix is in the the accelerator table lookups.  I fixed it in
the DWARF mappable tables but not everyone uses those, so I had to
restrict the test to systems I know did.

13 months ago[lldb/crashlog] Add test for non-symbolicated report crash
Med Ismail Bennani [Fri, 2 Jun 2023 00:50:55 +0000 (17:50 -0700)]
[lldb/crashlog] Add test for non-symbolicated report crash

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb/crashlog] Run python formatter (nfc)
Med Ismail Bennani [Fri, 2 Jun 2023 00:13:16 +0000 (17:13 -0700)]
[lldb/crashlog] Run python formatter (nfc)

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb/crashlog] Create interactive crashlog with no binary
Med Ismail Bennani [Fri, 2 Jun 2023 00:10:39 +0000 (17:10 -0700)]
[lldb/crashlog] Create interactive crashlog with no binary

This patch changes the way we load a crash report into a scripted
process by creating a empty target.

To do so, it parses the architecture information from the report (for
both the legacy and json format) and uses that to create a target that
doesn't have any executable, like what we do when attaching to a process.

For the legacy format, we mostly rely on the `Code Type` line, since the
architure is an optional field on the `Binary Images` sections.

However for the json format, we first try to get the architecture while
parsing the image dictionary if we couldn't find it, we try to infer it
using the "flavor" key when parsing the frame's registers.

If the architecture is still not set after parsing the report, we raise
an exception.

rdar://107850263

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

Differential

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[lldb/crashlog] Fix crash when loading non-symbolicated report
Med Ismail Bennani [Wed, 31 May 2023 22:29:24 +0000 (15:29 -0700)]
[lldb/crashlog] Fix crash when loading non-symbolicated report

This patch should address the crashes when parsing a the crash report
frame dictionary.

If the crash report is not symbolicated, the `symbolLocation` key will
be missing. In that case, we should just use the `imageOffset`.

rdar://109836386

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

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
13 months ago[mlir][sparse] enhance sparse reduction support
Aart Bik [Thu, 1 Jun 2023 20:34:39 +0000 (13:34 -0700)]
[mlir][sparse] enhance sparse reduction support

Formerly, we accepted and/prod reductions as a standard
reduction but these change the semantics after sparsification
by not looking at implicit zeros. Therefore, we only accept
standard reductions that are insensitive to implicit vs.
explicit zeros, and leave the more complex reductions to
the sparse_tensor.reduce custom reduction implementation.

Reviewed By: Peiming

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

13 months agoFix regex & startsWith name lookup in SBTarget::FindGlobalVariables
Jim Ingham [Thu, 1 Jun 2023 23:12:52 +0000 (16:12 -0700)]
Fix regex & startsWith name lookup in SBTarget::FindGlobalVariables

There were two bugs here.

eMatchTypeStartsWith searched for "symbol_name" by adding ".*" to the
end of the symbol name and treating that as a regex, which isn't
actually a regex for "starts with". The ".*" is in fact a no-op.  When
we finally get to comparing the name, we compare against whatever form
of the name was in the accelerator table. But for C++ that might be
the mangled name. We should also try demangled names here, since most
users are going the see demangled not mangled names.  I fixed these
two bugs and added a bunch of tests for FindGlobalVariables.

This change is in the DWARF parser code, so there may be a similar bug
in PDB, but the test for this was already skipped for Windows, so I
don't know about this.

You might theoretically need to do this Mangled comparison in

DWARFMappedHash::MemoryTable::FindByName

except when we have names we always chop them before looking them up
so I couldn't see any code paths that fail without that change. So I
didn't add that to this patch.

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

13 months ago[RISCV][GlobalISel] Remove unused variable 'Index' (NFC)
Jie Fu [Thu, 1 Jun 2023 23:10:24 +0000 (07:10 +0800)]
[RISCV][GlobalISel] Remove unused variable 'Index' (NFC)

/data/llvm-project/llvm/lib/Target/RISCV/GISel/RISCVCallLowering.cpp:272:12: error: variable 'Index' set but not used [-Werror,-Wunused-but-set-variable]
  unsigned Index = 0;
           ^
1 error generated.

13 months ago[RISCV][GlobalISel] Add lowerCall for calling convention
Nitin John Raj [Thu, 1 Jun 2023 22:35:06 +0000 (15:35 -0700)]
[RISCV][GlobalISel] Add lowerCall for calling convention

This patch implements minimal support for lowering function calls to callees with arguments and/or return values according to the RISC-V calling convention. Integer, pointer and aggregate types are supported.

Feedback is very much appreciated.

Reviewed By: arsenm

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

13 months ago[lld][COFF] Retry failed paths to take advantage of winsysroot search paths
Arthur Eubanks [Wed, 31 May 2023 15:52:21 +0000 (08:52 -0700)]
[lld][COFF] Retry failed paths to take advantage of winsysroot search paths

With /winsysroot and without /machine, we don't know which paths to add to the search paths.

We do autodetect machine type and add winsysroot search paths in SymbolTable::addFile(), but that happens after all input files are opened. So in the loop where we read files, if we fail to open a file we can retry with the winsysroot search path potentially added by reading a previous file. This will fail if we try to open something in the winsysroot before reading a file that can give us the architecture, but shrug.

Fixes #54409

Reviewed By: rnk

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

13 months agoAMDGPU: Refine undef handling for llvm.amdgcn.class intrinsic
Matt Arsenault [Wed, 24 May 2023 14:56:09 +0000 (15:56 +0100)]
AMDGPU: Refine undef handling for llvm.amdgcn.class intrinsic

This barely matters since 99% are converted to the generic intrinsic now,
and the only real difference is the target intrinsic supports a variable
test mask. Start propagating poison. Prefer folding to a defined result (false)
for an undef test mask. Propagate undef for the first operand.

13 months ago[RISCV] Separate slideup/down pseudoinstructions from FMA instructions earlier in...
Craig Topper [Thu, 1 Jun 2023 22:25:40 +0000 (15:25 -0700)]
[RISCV] Separate slideup/down pseudoinstructions from FMA instructions earlier in the class hierarchy.

Remove RISCVMaskedPseudo from vslideup/down. I hadn't intended to
include them. I missed that they used the same classes as FMA.
They weren't tested and I don't have a use case yet.

This is also needed as I attempt refactor the classes to improve
D151850.

13 months ago[RISCV] Move vslideup/down tablegen classes together. NFC
Craig Topper [Thu, 1 Jun 2023 21:25:07 +0000 (14:25 -0700)]
[RISCV] Move vslideup/down tablegen classes together. NFC

13 months agoReland "[mlir][Vector] Extend xfer drop unit dim patterns"
Diego Caballero [Thu, 1 Jun 2023 21:47:48 +0000 (21:47 +0000)]
Reland "[mlir][Vector] Extend xfer drop unit dim patterns"

This reverts commit 76d71f3792b2b1864992446f7b1028b026dccd11.

13 months ago[mlir][Vector] Prevent vector-to-scalar xfer patterns from triggering on sub-vectors
Diego Caballero [Thu, 1 Jun 2023 21:45:39 +0000 (21:45 +0000)]
[mlir][Vector] Prevent vector-to-scalar xfer patterns from triggering on sub-vectors

Patterns that convert extract(transfer_read) into a scalar load where
incorrectly triggering for cases where a sub-vector instead of a scalar
was extracted.

Reviewed By: nicolasvasilache, hanchung, awarzynski

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

13 months ago[mlir][Vector] Add support for 0-D 'vector.shape_cast' lowering
Diego Caballero [Thu, 1 Jun 2023 21:45:11 +0000 (21:45 +0000)]
[mlir][Vector] Add support for 0-D 'vector.shape_cast' lowering

This PR adds support for shape casting from and to 0-D vectors.

Reviewed By: nicolasvasilache, hanchung, awarzynski

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

13 months ago[mlir][Vector] Disable 'vector.extract' folding for unsupported 0-D vectors
Diego Caballero [Thu, 1 Jun 2023 21:44:41 +0000 (21:44 +0000)]
[mlir][Vector] Disable 'vector.extract' folding for unsupported 0-D vectors

The `vector.extract` folding patterns do not support 0-D vectors
(actually, 0-D vector support couldn't even be implemented as a folding
pattern as it would require replacing `vector.extract` with a
`vector.extractelement` op). This patch is bailing out folding when 0-D
vectors are found.

Reviewed By: nicolasvasilache, hanchung

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

13 months ago[gn build] Port d51a84b4059c
LLVM GN Syncbot [Thu, 1 Jun 2023 22:11:58 +0000 (22:11 +0000)]
[gn build] Port d51a84b4059c

13 months ago[libc++][PSTL] Implement std::stable_sort
Nikolas Klauser [Thu, 1 Jun 2023 22:05:11 +0000 (15:05 -0700)]
[libc++][PSTL] Implement std::stable_sort

Reviewed By: #libc, ldionne

Spies: ldionne, libcxx-commits

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

13 months ago[libc] Add strtoint32 and strtoint64 tests
Michael Jones [Thu, 1 Jun 2023 21:01:04 +0000 (14:01 -0700)]
[libc] Add strtoint32 and strtoint64 tests

There were regressions in the testing framework due to none of the
functioning buildbots having a 32 bit long. This allowed the 32 bit
version of the strtointeger function to go untested. This patch adds
tests for strtoint32 and strtoint64, which are internal testing
functions that use constant integer sizes. It also fixes the tests to
properly handle these situations.

Reviewed By: sivachandra

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

13 months ago[GlobalISel] Delete code in GIMatcher complaining about unreachable rules.
Amara Emerson [Thu, 1 Jun 2023 21:10:52 +0000 (14:10 -0700)]
[GlobalISel] Delete code in GIMatcher complaining about unreachable rules.

Fixes #62897