Arthur Eubanks [Mon, 17 Jul 2023 21:52:08 +0000 (14:52 -0700)]
Revert "[SLP][NFC]Improve compile-time by using map {TreeEntry *, Instruction *}"
This reverts commit
0d21b7cbdeb2f2eb5ef123a15099da0b651b24c0.
Causes broken IR, test case provided at
https://reviews.llvm.org/rG0d21b7cbdeb2f2eb5ef123a15099da0b651b24c0
Nick Desaulniers [Mon, 17 Jul 2023 21:40:09 +0000 (14:40 -0700)]
[ConstantHoisting] use struct rather than tuple for adjustments
We pack this info in a tuple just to spread it back out for a function
call. Spreads in C++ are awkward. If I want to add an additional
element to the tuple, I need to add more calls to std::get<> later. Just
use a struct.
Reviewed By: void
Differential Revision: https://reviews.llvm.org/D155236
Matt Arsenault [Thu, 13 Jul 2023 17:04:42 +0000 (13:04 -0400)]
AMDGPU: Split and convert some rcp and rsq tests to generated checks
Matt Arsenault [Mon, 17 Jul 2023 12:18:51 +0000 (08:18 -0400)]
DAG: Constant fold frexp nodes
Special casing the nonfinite exponent value everywhere is kind of
annoying.
Matt Arsenault [Mon, 17 Jul 2023 00:32:01 +0000 (20:32 -0400)]
InstSimplify: Handle basic folds for frexp
Handle constant folding and idempotent folding. Not sure
this is an appropriate use of undef for the inf/nan case. The
C version says the second result is "unspecified". The AMDGPU
instruction returns 0.
Matt Arsenault [Mon, 17 Jul 2023 00:13:00 +0000 (20:13 -0400)]
InstSimplify: Add baseline tests for frexp handling
Matt Arsenault [Mon, 17 Jul 2023 21:14:40 +0000 (17:14 -0400)]
ValueTracking: Fix computeKnownFPClass for vector-with-scalar powi
Fixes regression reported after
0f4eb557e87912afa412b1b0299d10eb7443410b
Anna Thomas [Mon, 17 Jul 2023 21:17:00 +0000 (17:17 -0400)]
[LV] Precommit test for interleaving miscompile
Identified another miscompile while working on fixing interleaving's
current miscompile in D154309. This is different from testcases landed in D154309,
since it showcases an incorrect sinking of store (the former testcases
in that review and follow-up ones) showed incorrect hoisting of loads
across stores.
Alexey Bataev [Mon, 17 Jul 2023 20:16:45 +0000 (13:16 -0700)]
[SLP][NFC]Improve performance of isGatherShuffledEntry() function, NFC.
Transformed if checks to asserts and simplified some more code to
improve compile time.
Rob Suderman [Mon, 17 Jul 2023 20:32:49 +0000 (13:32 -0700)]
[mlir] Add `ComplexType` conversion support for `convertScalarToDtype`
Linalg operations can include `complex` types in the src/target types.
This should include conversion between `arith` and `complex` types when
constructing `linalg` operations.
Reviewed By: kuhar
Differential Revision: https://reviews.llvm.org/D154740
Paul Robinson [Mon, 17 Jul 2023 18:49:53 +0000 (11:49 -0700)]
Reland "[PS4/PS5] Tidy up driver warnings finding the SDK"
Instead of warning possibly up to 3 times about the same problem,
warn only about the actual missing directories.
This reverts commit
9b3323d39f635db870de958f067c672f54d7b192.
The warning will stay DefaultIgnore upstream, because a variety of
tests aren't expecting it and updating the tests isn't worth the
effort.
Jan Svoboda [Fri, 7 Jul 2023 02:27:48 +0000 (19:27 -0700)]
[clang][modules] Skip submodule & framework re-definitions in module maps
Before D150478, there were situations when Clang avoided parsing a module map because it was likely to re-define an already defined module (either by a PCM or by previously-found module map). Since Clang no longer performs that check and does parse the extra module map (due to the FW/FW_Private issue described in D150478), this patch re-implements the same semantics by skipping the duplicate definition of the framework module while parsing the module map.
Depends on D150478.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150479
Jan Svoboda [Thu, 6 Jul 2023 17:07:04 +0000 (19:07 +0200)]
[clang][modules][deps] Parse "FW_Private" module map even after loading "FW" PCM
When Clang loads a PCM that depends on another PCM describing framework module "FW", `ModuleMap` registers "FW" as known, without seeing the module map that defines it (or the adjacent "FW_Private" module map). Later, when looking at a header from "FW_Private", `ModuleMap` returns early due to having knowledge about "FW" and never associates that header with "FW_Private", leading to it being treated as textual. This behavior is caused by D150292, where the scanner stops calling `HeaderSearch::lookupModule()` eagerly for every loaded PCM.
This patch skips an early check when trying to figure out the framework module for a header, which ensures the "FW" and (most importantly) "FW_Private" module maps can be parsed even after loading "FW" from a PCM. Note that the `HeaderSearch::loadModuleMapFile()` function we not call unconditionally has caching behavior of its own, meaning it will avoid parsing module map file repeatedly.
Depends on D150320.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150478
Jan Svoboda [Thu, 6 Jul 2023 16:30:06 +0000 (18:30 +0200)]
[clang][modules][deps] Avoid checks for relocated modules
Currently, `ASTReader` performs some checks to diagnose relocated modules. This can add quite a bit of overhead to the scanner: it requires looking up, parsing and resolving module maps for all transitively loaded module files (and all the module maps encountered in the search paths on the way). Most of those checks are not really useful in the scanner anyway, since it uses strict context hash and immutable filesystem, which prevent those scenarios in the first place.
This can speed up scanning by up to 30%.
Depends on D150292.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150320
Jan Svoboda [Thu, 6 Jul 2023 16:18:03 +0000 (18:18 +0200)]
[clang][modules] Serialize `Module::DefinitionLoc`
This is a prep patch for avoiding the quadratic number of calls to `HeaderSearch::lookupModule()` in `ASTReader` for each (transitively) loaded PCM file. (Specifically in the context of `clang-scan-deps`).
This patch explicitly serializes `Module::DefinitionLoc` so that we can stop relying on it being filled by the module map parser. This change also required change to the module map parser, where we used the absence of `DefinitionLoc` to determine whether a file came from a PCM file. We also need to make sure we consider the "containing" module map affecting when writing a PCM, so that it's not stripped during serialization, which ensures `DefinitionLoc` still ends up pointing to the correct offset. This is intended to be a NFC change.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D150292
Siu Chi Chan [Mon, 10 Jul 2023 17:30:23 +0000 (13:30 -0400)]
[HIP] Ignore host linker flags for device-only
When compiling in device only mode (e.g. --offload-device-only), the
host linker phase would not happen and therefore, the driver should
ignore all the host linker flags.
Differential Revision: https://reviews.llvm.org/D154881
Change-Id: I8244acef5c33108cf15b1dbb188f974f30099718
Valentin Clement [Mon, 17 Jul 2023 20:25:11 +0000 (13:25 -0700)]
[flang][openacc][NFC] Add test for scalar allocatable and pointer reduction
Add test for simple scalar allocatable or pointer. Set up the TODO
to be triggered when the allocatable or pointer are arrays.
Support for pointer/allocatable arrays will come next.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155230
Cassie Jones [Mon, 17 Jul 2023 19:56:35 +0000 (12:56 -0700)]
[Driver] Also warn about -mwatchos-version-min and -mtvos-version-min
Sometimes users pass this option when targeting embedded architectures like armv7m on non-darwin platforms.
This applies to watchOS and tvOS as well as iOS.
Depends on D155407
Reviewed By: MaskRay, ahatanak
Differential Revision: https://reviews.llvm.org/D155408
Nikolas Klauser [Mon, 17 Jul 2023 20:19:52 +0000 (13:19 -0700)]
[libc++][NFC] Remove unused macro definition
Louis Dionne [Tue, 4 Jul 2023 22:11:16 +0000 (18:11 -0400)]
[libc++] Move _LIBCPP_NO_THREAD_SAFETY_ANALYSIS to __config
This makes __threading_support contain nothing but the base threading
API provided by the system.
Differential Revision: https://reviews.llvm.org/D155458
Valentin Clement [Mon, 17 Jul 2023 20:02:50 +0000 (13:02 -0700)]
[flang][openacc] Add proper TODO for reduction with dynamic shaped array
Lowering for reduction with dynamic shaped arrays is not implemented yet.
Add a proper TODO for the time being.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D155324
Peter Klausler [Mon, 17 Jul 2023 16:42:12 +0000 (09:42 -0700)]
[flang] Fix minor nits with INCLUDE line recognition
Fix some problems with INCLUDE line recognition pointed out by some
recently-added tests to the LLVM test suite.
Differential Revision: https://reviews.llvm.org/D155497
Alex Langford [Tue, 11 Jul 2023 23:45:32 +0000 (16:45 -0700)]
[lldb][NFCI] Avoid construction of temporary std::strings in RegisterValue
Differential Revision: https://reviews.llvm.org/D155030
Yaxun (Sam) Liu [Mon, 17 Jul 2023 15:57:38 +0000 (11:57 -0400)]
[HIP] Rename predefined macros
Rename HIP_API_PER_THREAD_DEFAULT_STREAM and __HIP_NO_IMAGE_SUPPORT
so that they follow the convention with prefix and postfix __.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D155480
Peter Klausler [Tue, 11 Jul 2023 17:05:22 +0000 (10:05 -0700)]
[flang] Extension: allow DATA to precede declaration under IMPLICIT NONE(TYPE)
It is not standard conforming under IMPLICIT NONE(TYPE) for a name to
appear in a DATA statement prior to its explicit type declaration,
but it is benign, supported in other compilers, and attested in real
applications. Support it with an optional portability warning.
Fixes GitHub LLVM bug https://github.com/llvm/llvm-project/issues/63783.
Peter Klausler [Mon, 10 Jul 2023 23:06:09 +0000 (16:06 -0700)]
[flang] Avoid bogus errors with LBOUND/UBOUND(assumed rank array, DIM=)
Don't emit bogus compile-time error messages about out-of-range values
for the DIM= argument to LBOUND/BOUND when the array in question is an
assumed-rank dummy array argument.
Differential Revision: https://reviews.llvm.org/D155494
Peter Klausler [Mon, 17 Jul 2023 16:38:55 +0000 (09:38 -0700)]
[flang] Correct disambiguation of possible statement function definitions
The statement "A(J) = expr" could be an assignment to an element of an
array A, an assignment to the target of a pointer-valued function A, or
the definition of a new statement function in the local scope named A,
depending on whether it appears in (what might still be) the specification
part of a program or subprogram and what other declarations and definitions
for A might exist in the local scope or have been imported into it.
The standard requires that the name of a statement function appear in
an earlier type declaration statement if it is also the name of an
entity in the enclosing scope. Some other Fortran compilers mistakenly
enforce that rule in the case of an assignment to the target of a
pointer-valued function in the containing scope, after misinterpreting
the assignment as a new local statement function definition.
This patch cleans up the handling of the various possibilities and
resolves what was a crash in the case of a statement function definition
whose name was the same as that of a procedure in the outer scope whose
result is *not* a pointer.
Differential Revision: https://reviews.llvm.org/D155493
Peter Klausler [Thu, 6 Jul 2023 00:42:36 +0000 (17:42 -0700)]
[flang] Emit errors on vector subscripts with duplicated elements when object must be definable
When the left-hand side of an assignment, or any other context demanding
definability, comprises a designator with a vector subscript that is
known at compilation time to have one or more duplicated elements,
emit an error message.
Differential Revision: https://reviews.llvm.org/D155492
Peter Klausler [Wed, 5 Jul 2023 21:03:14 +0000 (14:03 -0700)]
[flang] Fix constraint check on CLASS() entities
Entities declared with CLASS() must be dummy arguments, allocatables,
or pointers. This constraint check is currently correct for objects
but not for procedures, and getting it right needs to avoid being
confused between pointers to procedures and pointers returned by
procedures.
Differential Revision: https://reviews.llvm.org/D155491
Leonard Grey [Wed, 21 Jun 2023 21:23:04 +0000 (17:23 -0400)]
[lsan][Darwin] Unconditionally strip high bits from potential pointers
The method cache stashes a mask in the high bits under some circumstances:
https://github.com/apple-oss-distributions/objc4/blob/
689525d556eb3dee1ffb700423bccf5ecc501dbf/runtime/objc-cache.mm#L589
I'm hitting this now on macOS 13.4 arm64, so we can no longer rely on OBJC_FAST_IS_RW to identify potential pointers that need to be transformed
Differential Revision: https://reviews.llvm.org/D153471
Martin Braenne [Mon, 17 Jul 2023 18:42:36 +0000 (18:42 +0000)]
[clang][dataflow] Bugfix for `refreshStructValue()`.
In the case where the expression was not yet associated with a storage location, we created a new storage location but failed to associate it with the expression.
The newly added test fails without the fix.
Reviewed By: xazax.hun
Differential Revision: https://reviews.llvm.org/D155465
wren romano [Fri, 7 Jul 2023 19:46:32 +0000 (12:46 -0700)]
[llvm] Allow SMLoc to be used in constexpr context
Since `StringRef::empty` can be used in constexpr context, it seems reasonable that `SMLoc::isValid` should be too. The default-ctor and `operator==` are made constexpr for consistency.
In particular, the `constexpr` keyword is needed for silencing warnings on Windows (whereas Linux allows constexpr usage without the keyword).
Reviewed By: jpienaar
Differential Revision: https://reviews.llvm.org/D154741
Peter Klausler [Wed, 5 Jul 2023 18:19:47 +0000 (11:19 -0700)]
[flang] Catch impure specifics called in DO CONCURRENT
Rework the code used to check for calls to impure procedures in DO CONCURRENT
constructs. The current code wasn't checking the representation of the
procedure references in the strongly typed expressions, so it was missing
calls to impure subprograms made via generic interfaces. While here,
improve error messages, and fix some minor issues exposed by testing the
improved checks.
Differential Revision: https://reviews.llvm.org/D155489
Alexey Bataev [Mon, 17 Jul 2023 16:47:01 +0000 (09:47 -0700)]
[SLP][NFC]Improve compile-time by using map {TreeEntry *, Instruction *}
in getLastInstructionInBundle(), NFC.
Instead of building EntryToLastInstruction before the vectorization,
build it automatically during the calls to getLastInstructionInBundle()
function.
Peter Klausler [Mon, 3 Jul 2023 21:33:12 +0000 (14:33 -0700)]
[flang] Disallow noninteroperable dummy procedures from interoperable procedures
A BIND(C) interoperable procedure must have only interoperable dummy procedures.
Differential Revision: https://reviews.llvm.org/D155488
Peter Klausler [Mon, 17 Jul 2023 18:30:30 +0000 (11:30 -0700)]
[flang][unittests] Silence compiler warning
At least one compiler more recent that the one that I test with emits
a warning (valid but benign) for some code in a unit test that I
modified a few minutes ago. Adding some curly braces to placate the
compiler.
Jim Ingham [Mon, 17 Jul 2023 17:50:17 +0000 (10:50 -0700)]
Fix the root directory completion test.
It was implicitly assumning that "/" would have no files in it, only
directories. That's not true, for instance on macOS if you've navigated
to the root directory in the Finder...
Since we're assuming everything we check against is a directory, then we
need to filter the completion for that coming in.
Johannes Doerfert [Tue, 20 Jun 2023 23:43:24 +0000 (16:43 -0700)]
[Attributor] Replace AAReturnedValues with AAPotentialValuesReturned
The very first AA, at least the first one in order, is not necessary
anymore. `AAReturnedValues` was from a different time; one might say, a
simpler time.
It was rewriten once to use `Attribute::getAssumedSimplifiedValues`,
which is what the replacement, `AAPotentialValuesReturned`, does too.
To match the old behavior we needed to avoid the helper
`AAReturnedFromReturnedValues` and iterate the return instructions
explicitly, however, it is still less complexity than it was before.
`AAReturnedFromReturnedValues` and `getAssumedSimplifiedValues` now
allow users to stop at PHI and select nodes or to ignore those and look
through. `AANoFPClass` will stop at select and phi nodes to read the
fast math flags.
Fixes: https://github.com/llvm/llvm-project/issues/63404
Differential Revision: https://reviews.llvm.org/D154917
Johannes Doerfert [Tue, 11 Jul 2023 04:03:06 +0000 (21:03 -0700)]
[Attributor][NFC] Improve debug message
Paul Robinson [Mon, 17 Jul 2023 17:30:44 +0000 (10:30 -0700)]
Revert "[PS4/PS5] Tidy up driver warnings finding the SDK"
This reverts commit
ba9a7f73a12e75b005bfec359ddc37999b1d38c0.
Bot failures due to enabling the warning by default.
e.g. https://lab.llvm.org/buildbot/#/builders/139/builds/45263
Andrzej Warzynski [Sat, 15 Jul 2023 16:21:34 +0000 (16:21 +0000)]
[mlir][linalg] Fix vectorisation of tensor.extract with dynamic shapes
The Linalg vectoriser incorrectly recognises the following
`tensor.extract` as contiguous:
```
func.func @example(%in: tensor<123x321xf32>, %arg1: tensor<1x?x8xf32>) -> tensor<1x?x8xf32> {
%c0 = arith.constant 1 : index
%2 = linalg.generic {
indexing_maps = [#map1],
iterator_types = ["parallel", "parallel", "parallel"]
} outs(%arg1 : tensor<1x?x8xf32>)
{
^bb0(%arg3: f32):
%idx_0 = linalg.index 0 : index
%idx_1 = linalg.index 1 : index
%idx = arith.addi %idx_0, %idx_1 : index
%7 = tensor.extract %in[%c0, %idx] : tensor<123x321xf32>
linalg.yield %7 : f32
} -> tensor<1x?x8xf32>
return %2 : tensor<1x?x8xf32>
}
```
However, the following index Op corresponds to the dynamic dimension
in the iteration space:
```
%idx_1 = linalg.index 1 : index
```
The vectoriser should assume that:
* this index Op _is not_ loop invariant,
* the resulting memory access is a gather load
This is what this patch fixes.
Differential Revision: https://reviews.llvm.org/D155373
Paul Kirth [Mon, 17 Jul 2023 17:09:47 +0000 (17:09 +0000)]
[clang][docs] Fix tag target name in link
The `see patch` tag conflicted w/ one later in the document. Changing
the text should fix the documentation build error.
Differential Revision: https://reviews.llvm.org/D155490
Amy Kwan [Mon, 17 Jul 2023 14:57:34 +0000 (09:57 -0500)]
[AIX][TLS] Account for local-exec accesses in XCOFFObjectWriter
This is a follow up to D149722 and aims to address https://github.com/llvm/llvm-project/issues/63885.
Local-exec accesses were not previously accounted for in XCOFFObjectWriter.
Specifically, the R_TLS_LE relocation was not previously handled, which lead to
the incorrect value being written for the relocation target.
Within this patch, the value being written is set to the symbol's virtual
address and extra relocation tests are added.
Differential Revision: https://reviews.llvm.org/D155415
Amir Ayupov [Mon, 17 Jul 2023 16:50:17 +0000 (09:50 -0700)]
[BOLT][Utils] Add dot2html module entry point
Peter Klausler [Tue, 11 Jul 2023 18:06:21 +0000 (11:06 -0700)]
[flang][runtime] Don't do partial data transfer on short character read with ADVANCE='NO', PAD='NO'
When a non-advancing formatted READ can't completely fill a CHARACTER
input item with data, and PAD='NO', don't modify the variable at all.
This matters when the error is recoverable.
Fixes https://github.com/llvm/llvm-project/issues/63772
Differential Revision: https://reviews.llvm.org/D155000
Simon Pilgrim [Mon, 17 Jul 2023 16:58:25 +0000 (17:58 +0100)]
[X86] Regenerate tail-call-casts.ll test coverage
Nicolas Vasilache [Mon, 17 Jul 2023 16:08:00 +0000 (18:08 +0200)]
[mlir][test] Fix linking error post test-lower-to-nvvm
This fixes builds for
7e78ecfe10ea9071234de8d385b87d338d280266 (both cmake and bazel) as well as trim unnecessary dependencies.
This is achieved by moving the functionality to test/lib/GPU which is a more natural landing pad.
Nicolas Vasilache [Mon, 17 Jul 2023 16:08:00 +0000 (18:08 +0200)]
[mlir][test] Fix linking error post test-lower-to-nvvm
Hongtao Yu [Fri, 14 Jul 2023 00:22:57 +0000 (17:22 -0700)]
[PseudoProbe] Remove unnecessary asserts about non-zero discriminator.
Despite previous efforts in fixing accidentally setting deduplication factor and avoiding enforcing a callsite debug loc for pseudo probes, I'm still seeing an IR probe having a non-zero discriminator. This time it is due to the merge of two probes with irreconsilable debug locations and the merged probe ends up getting the original callsite locs. Therefore I'm removing the assert about IR probe should always have a zero discriminator. This safe since
- Probe discriminators are only emitted in FS-AFDO mode; and
- The first FS discriminator assigning pass always clears non-discriminators left over from IR passes.
Reviewed By: wenlei
Differential Revision: https://reviews.llvm.org/D155252
Mark de Wever [Sun, 9 Jul 2023 15:54:11 +0000 (17:54 +0200)]
[libc++][doc] Updates the release notes.
This is a preparation for the upcoming LLVM 17 release.
Reviewed By: ldionne, jloser, H-G-Hristov, #libc
Differential Revision: https://reviews.llvm.org/D154874
Paul Robinson [Thu, 13 Jul 2023 17:42:41 +0000 (10:42 -0700)]
[PS4/PS5] Tidy up driver warnings finding the SDK
Instead of warning possibly up to 3 times about the same problem,
warn only about the actual missing directories.
Paul Kirth [Fri, 24 Mar 2023 00:09:29 +0000 (00:09 +0000)]
[clang] Preliminary fat-lto-object support
Fat LTO objects contain both LTO compatible IR, as well as generated
object code. This allows users to defer the choice of whether to use LTO
or not to link-time. This is a feature available in GCC for some time,
and makes the existing -ffat-lto-objects flag functional in the same
way as GCC's.
This patch adds support for that flag in the driver, as well as setting the
necessary codegen options for the backend. Largely, this means we select
the newly added pass pipeline for generating fat objects.
Users are expected to pass -ffat-lto-objects to clang in addition to one
of the -flto variants. Without the -flto flag, -ffat-lto-objects has no
effect.
// Compile and link. Use the object code from the fat object w/o LTO.
clang -fno-lto -ffat-lto-objects -fuse-ld=lld foo.c
// Compile and link. Select full LTO at link time.
clang -flto -ffat-lto-objects -fuse-ld=lld foo.c
// Compile and link. Select ThinLTO at link time.
clang -flto=thin -ffat-lto-objects -fuse-ld=lld foo.c
// Compile and link. Use ThinLTO with the UnifiedLTO pipeline.
clang -flto=thin -ffat-lto-objects -funified-lto -fuse-ld=lld foo.c
// Compile and link. Use full LTO with the UnifiedLTO pipeline.
clang -flto -ffat-lto-objects -funified-lto -fuse-ld=lld foo.c
// Link separately, using ThinLTO.
clang -c -flto=thin -ffat-lto-objects foo.c
clang -flto=thin -fuse-ld=lld foo.o -ffat-lto-objects # pass --lto=thin --fat-lto-objects to ld.lld
// Link separately, using full LTO.
clang -c -flto -ffat-lto-objects foo.c
clang -flto -fuse-ld=lld foo.o # pass --lto=full --fat-lto-objects to ld.lld
Original RFC: https://discourse.llvm.org/t/rfc-ffat-lto-objects-support/63977
Depends on D146776
Reviewed By: tejohnson, MaskRay
Differential Revision: https://reviews.llvm.org/D146777
Simon Pilgrim [Mon, 17 Jul 2023 16:16:47 +0000 (17:16 +0100)]
[DAG] SelectionDAG::getNode() - consistently use N1 for first operand. NFCI.
This has been annoying me for years - rename Operand to N1 so it matches all the other getNode() calls, and simplifies my debug watch windows!
Matthias Springer [Mon, 17 Jul 2023 16:05:44 +0000 (18:05 +0200)]
[mlir][vector][NFC] Drop `get...AttrStrName` helper functions
These functions are not needed. They are auto-generated from the `.td` files.
Differential Revision: https://reviews.llvm.org/D155483
Leonard Grey [Mon, 17 Jul 2023 16:05:18 +0000 (12:05 -0400)]
[gn] Port
8ac71b026ee6 (no more _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
Craig Topper [Mon, 17 Jul 2023 16:12:14 +0000 (09:12 -0700)]
[RISCV] Remove 'not FeatureStdExtC' from Zcmp predicate.
C is only incompatible if D is also enabled. This already checked
in RISCVISAInfo.cpp.
Mark de Wever [Fri, 7 Jul 2023 16:32:20 +0000 (18:32 +0200)]
[libc++][format] Fixes an off by one error.
The post-condition on the functions is that the buffer is not full.
This post-conditon is used as pre-condition of the push_back function.
When a copy, fill, of transform function exactly fit in the buffer this
post-condition was validated.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D155397
Piotr Zegar [Mon, 17 Jul 2023 15:01:38 +0000 (15:01 +0000)]
[clang-tidy] Model noexcept more properly in bugprone-exception-escape
During call stack analysis skip called noexcept functions
as they wont throw exceptions, they will crash.
Check will emit warnings for those functions separately.
Fixes: #43667, #49151, #51596, #54668, #54956
Reviewed By: carlosgalvezp
Differential Revision: https://reviews.llvm.org/D153458
Craig Topper [Mon, 17 Jul 2023 15:58:29 +0000 (08:58 -0700)]
[RISCV] Re-define sha256, Zksed, and Zksh intrinsics to use i32 types.
Previously we returned i32 on RV32 and i64 on RV64. The instructions
only consume 32 bits and only produce 32 bits. For RV64, the result
is sign extended to 64 bits like *W instructions.
This patch removes this detail from the interface to improve
portability and consistency. This matches the proposal for scalar
intrinsics here https://github.com/riscv-non-isa/riscv-c-api-doc/pull/44
I've included IR autoupgrade support as well.
I'll be doing this for other builtins/intrinsics that currently use
'long' in other patches.
Reviewed By: VincentWu
Differential Revision: https://reviews.llvm.org/D154647
Guray Ozen [Mon, 17 Jul 2023 15:38:03 +0000 (17:38 +0200)]
[mlir][nvvm] Delete backslash
Delete the backslash. It was there to compile tablegen file. It looks like space also works fine.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D155474
Marco Elver [Mon, 17 Jul 2023 14:58:23 +0000 (16:58 +0200)]
[ThreadSanitizer] Add fallback DebugLocation for memintrinsic calls
When building with debug info enabled, some load/store instructions do
not have a DebugLocation attached. When using the default IRBuilder, it
attempts to copy the DebugLocation from the insertion-point instruction.
When there's no DebugLocation, no attempt is made to add one.
Add a fallback DebugLocation with the help of InstrumentationIRBuilder for
memintrinsics. In particular, the compiler may optimize load/store without
debug info into memintrinsics, which then are missing debug info as well.
Jakob Koschel [Mon, 17 Jul 2023 10:41:16 +0000 (12:41 +0200)]
[SanitizerCoverage] Add fallback DebugLocation for instrumented calls
When building the kernel with LTO, KCOV & debug information enabled,
multiple inlinable SanitizerCoverage functions require debug information
present.
In such cases we repurpose the InstrumentationIRBuilder that ensures
the necessary debug information is added if necessary.
This has been done analogous to the work for the ThreadSanitizer
in D124937.
Bug: https://github.com/ClangBuiltLinux/linux/issues/1721
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D155377
Jakob Koschel [Mon, 17 Jul 2023 10:40:48 +0000 (12:40 +0200)]
[AddressSanitizer] Add fallback DebugLocation for instrumented calls
When building the kernel with LTO, KASAN & debug information enabled,
multiple inlinable AddressSanitizer functions require debug information
present.
In such cases we repurpose the InstrumentationIRBuilder that ensures
the necessary debug information is added if necessary.
This has been done analogous to the work for the ThreadSanitizer
in D124937.
Bug: https://github.com/ClangBuiltLinux/linux/issues/1721
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D155376
Craig Topper [Mon, 17 Jul 2023 15:47:42 +0000 (08:47 -0700)]
[RISCV] Add FP compare test to condops.ll to show a missed opportunity to remove an xori. NFC
This is a case that D155288 won't get.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D155327
Craig Topper [Mon, 17 Jul 2023 15:43:43 +0000 (08:43 -0700)]
[IRGen] Remove 'Sve' from the name of some IR names that are shared with RISC-V now.
Reviewed By: c-rhodes
Differential Revision: https://reviews.llvm.org/D155220
Matthias Springer [Mon, 17 Jul 2023 15:10:33 +0000 (17:10 +0200)]
[mlir][Interfaces] Fix DestinationStyleOpInterface for vector ops
This revision fixes `hasTensorSemantics` and `hasBufferSemantics` for vector transfer ops, which may have a vector operand. `VectorType` implements `ShapedType` and such operands do not affect whether an op has tensor or buffer semantics. Also implement `DestinationStyleOpInterface` on `TransferReadOp` so that `hasTensorSemantics`/`hasBufferSemantics` can be called. (The op has no inits, but this makes it symmetric to `TransferWriteOp`.)
Differential Revision: https://reviews.llvm.org/D155469
Craig Topper [Mon, 17 Jul 2023 15:30:40 +0000 (08:30 -0700)]
[RISCV] Add bf16 as a valid type for the FPR16 register class.
This makes it possible for D153234 to use the FPR16 register class
for bf16 instructions.
Differential Revision: https://reviews.llvm.org/D155418
Nicolas Vasilache [Sun, 16 Jul 2023 11:13:07 +0000 (13:13 +0200)]
[mlir][cuda] Add a test-lower-to-nvvm catchall passpipeline.
This mirrors the test-lower-to-llvm pass pipeline that provides some sanity when running e2e examples.
One peculiarity of the GPU pipeline is that we want to allow 32b indexing in kernels.
This is currently not straightforward as there are dependencies between passes.
This new test pass orders passes in a way that connects end-to-end.
Differential Revision: https://reviews.llvm.org/D155463
Guray Ozen [Mon, 17 Jul 2023 12:42:30 +0000 (14:42 +0200)]
[mlir][nvvm] Add `cp.async.bulk.tensor.shared.cluster.global`
This work introduce `cp.async.bulk.tensor.shared.cluster.global` in NVVM dialect that executes load using TMA.
Depends on D155056
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D155060
Guray Ozen [Mon, 17 Jul 2023 12:27:32 +0000 (14:27 +0200)]
[mlir][nvgpu] Verify invalid copy size (nfc)
This work improves verifier for invalid cases. It is NFC.
Reviewed By: nicolasvasilache, springerm
Differential Revision: https://reviews.llvm.org/D155448
Simon Pilgrim [Mon, 17 Jul 2023 14:34:52 +0000 (15:34 +0100)]
[DAG] Move lshr narrowing from visitANDLike to SimplifyDemandedBits
Inspired by some of the cases from D145468
Let SimplifyDemandedBits handle the narrowing of lshr to half-width if we don't require the upper bits, the narrowed shift is profitable and the zext/trunc are free.
A future patch will propose the equivalent shl narrowing combine.
Differential Revision: https://reviews.llvm.org/D146121
Adam Paszke [Mon, 17 Jul 2023 14:32:31 +0000 (14:32 +0000)]
[MLIR][CAPI] Add C API dialect registration methods for Arith, Math, MemRef and Vector dialects
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D155450
Matthias Springer [Mon, 17 Jul 2023 14:08:08 +0000 (16:08 +0200)]
[mlir][IR] Remove duplicate `isLastMemrefDimUnitStride` functions
This function is duplicated in various dialects.
Differential Revision: https://reviews.llvm.org/D155462
Alex Zinenko [Thu, 13 Jul 2023 17:55:36 +0000 (17:55 +0000)]
[mlir][nvgpu] add simple pipelining for shared memory copies
Add a simple transform operation to the NVGPU extension that performs
software pipelining of copies to shared memory. The functionality is
extremely minimalistic in this version and only supports copies from
global to shared memory inside an `scf.for` loop with either
`vector.transfer` or `nvgpu.device_async_copy` operations when
pipelining preconditions are already satisfied in the IR. This is the
minimally useful version that uses the more general loop pipeliner in an
NVGPU-specific way. Further extensions and orthogonalizations will be
necessary.
This required a change to the loop pipeliner itself to properly
propagate errors should the predicate generator fail.
This is loosely inspired from the vesion in IREE, but has less unsafe
assumptions and more principled way of communicating decisions.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D155223
Amaury Séchet [Mon, 17 Jul 2023 14:03:54 +0000 (14:03 +0000)]
[NFC] Add test case for D154533.
Aleksandr Popov [Sun, 16 Jul 2023 23:00:21 +0000 (01:00 +0200)]
[IRCE] Add NSW flag to main loop's indvar base
We have guarantees that induction variable will not overflow in the main
loop after the loop constrained. Therefore we can add no wrap flags on
its base in order not to miss info that loop is countable.
Add NSW flag now, since adding NUW flag requires a bit more complicated
analysis.
Reviewed By: skatkov
Differential Revision: https://reviews.llvm.org/D154954
Leandro Lupori [Tue, 11 Jul 2023 20:08:13 +0000 (20:08 +0000)]
[compiler-rt][xray] Fix alignment of XRayFileHeader
XRayFileHeader storage was obtained from std::aligned_storage
using its default alignment and not the struct's alignment
requirement. This was causing a bus error on AArch32, on armv8
machines, where vld1.64/vst1.64 instructions with 128-bit
alignment requirement were being used to copy XRayFileHeader.
There is still another issue with fdr-single-thread.cpp test on
armv7. Now it runs until completion and produces a valid log file,
but for some reason the function name appears as _end in it,
instead of the expected mangled fn name.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155013
Jared Grubb [Fri, 14 Jul 2023 17:26:09 +0000 (10:26 -0700)]
[clang-format] Fix support for ObjC blocks with pointer return types
The ObjC-block detection code only supports a single token as the return type. Add support to detect pointers, too (ObjC has lots of object-pointers).
For example, using `BasedOnStyle: WebKit`, the following is stable output:
```
int* p = ^int*(void)
{ //
return nullptr;
}
();
```
After the patch, this is stable:
```
int* p = ^int*(void) { //
return nullptr;
}();
```
Differential Review: https://reviews.llvm.org/D146434
Louis Dionne [Tue, 4 Jul 2023 21:45:24 +0000 (17:45 -0400)]
[libc++][NFC] Remove unnecessary declarations in __thread/id.h
Louis Dionne [Tue, 4 Jul 2023 21:42:31 +0000 (17:42 -0400)]
[libc++][NFC] clang-format __thread/id.h since it just got moved
Louis Dionne [Tue, 4 Jul 2023 22:44:00 +0000 (18:44 -0400)]
[libc++] Remove internal "build-with-external-thread-library" configuration
Our threading support layer is currently a huge mess. There are too many
configurations with too many confusing names, and none of them are tested
in the usual CI. Here's a list of names related to these configurations:
LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY
_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
LIBCXXABI_BUILD_EXTERNAL_THREAD_LIBRARY
_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
LIBCXX_HAS_EXTERNAL_THREAD_API
_LIBCPP_HAS_THREAD_API_EXTERNAL
This patch cleans this up by removing the ability to build libc++ with
an "external" threading library for testing purposes, removing 4 out of
6 "names" above. That setting was meant to be used by libc++ developers,
but we don't use it in-tree and it's not part of our CI.
I know the ability to use an external threading API is used by some folks
out-of-tree, and this patch doesn't change that. This only changes the
way they will have to test their external threading support. After this
patch, the intent would be for them to set `-DLIBCXX_HAS_EXTERNAL_THREAD_API=ON`
when building the library, and to provide their usual `<__external_threading>`
header when they are testing the library. This can be done easily now
that we support custom lit configuration files in test suites.
The motivation for this patch is that our threading support layer is
basically unmaintainable -- anything beyond adding a new "backend" in
the slot designed for it requires incredible attention. The complexity
added by this setting just doesn't pull its weigh considering the
available alternatives.
Concretely, this will also allow future patches to clean up
`<__threading_support>` significantly.
Differential Revision: https://reviews.llvm.org/D154466
Andrew Gozillon [Mon, 17 Jul 2023 13:20:13 +0000 (08:20 -0500)]
[Flang][OpenMP][MLIR] An mlir transformation pass for marking FuncOp's implicitly called from TargetOp's and declare target marked FuncOp's as implicitly declare target
This pass will mark functions called from TargetOp's
and declare target functions as implicitly declare
target by adding the MLIR declare target attribute
directly to the function.
This pass executes after the initial lowering of Fortran's PFT
to MLIR (FIR/OMP+Arith etc.) and is one of a series of passes
that aim to clean up the MLIR for offloading (seperate passes
in different patches, one for early outlining, another for declare
target function filtering).
Reviewers: jsjodin, skatrak, kiaranchandramohan
Differential Revision: https://reviews.llvm.org/D154247
Nimish Mishra [Mon, 17 Jul 2023 12:57:47 +0000 (18:27 +0530)]
[mlir][OpenMP] Fixed internal compiler error with atomic update operation verification
Fixes https://github.com/llvm/llvm-project/issues/61089 by updating the
verification followed like translation from OpenMP+LLVM MLIR
dialect to LLVM IR.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D153217
Aaron Ballman [Mon, 17 Jul 2023 13:01:51 +0000 (09:01 -0400)]
Fix Clang Sphinx build
This addresses the issues accidentally introduced in
b0697a1cb0b539c773548f62402816e2d9b6f107
Timm Bäder [Sat, 15 Jul 2023 13:11:27 +0000 (15:11 +0200)]
[clang][Interp][NFC] Fix a doc comment and a typo
Weining Lu [Mon, 17 Jul 2023 12:34:32 +0000 (20:34 +0800)]
[Triple] Add llvm::Triple::isLoongArch{32,64}
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D155163
Matthias Springer [Mon, 17 Jul 2023 08:30:06 +0000 (10:30 +0200)]
[mlir][NVGPU][NFC] Clean up code structure
* Move passes to `Transforms` directory.
* Add `Utils.h` (will be utilized in a subsequent change).
Differential Revision: https://reviews.llvm.org/D155427
Jay Foad [Mon, 17 Jul 2023 08:34:45 +0000 (09:34 +0100)]
[AMDGPU] Add targets gfx1150 and gfx1151
This is the target definition only. Currently they are treated the same
as GFX 11.0.x.
Differential Revision: https://reviews.llvm.org/D155429
Timm Bäder [Sat, 8 Jul 2023 08:44:43 +0000 (10:44 +0200)]
[clang][Interp] Diagnose callsite for implicit functions
We don't have any code to point at here, so the diagnostics would just
point to the record declaration. Make them point to the call site
intead.
Differential Revision: https://reviews.llvm.org/D154761
Jay Foad [Mon, 17 Jul 2023 11:55:27 +0000 (12:55 +0100)]
[AMDGPU] Add test case for zext of f16 to i32
Preserve the test case from this abandoned review:
D51925 [AMDGPU] Fix issue for zext of f16 to i32
Guillaume Chatelet [Thu, 13 Jul 2023 11:38:21 +0000 (11:38 +0000)]
[libc][NFC] Split memcmp implementations per platform
This is a follow up on D154800 and D154770 to make the code structure more principled and avoid too many nested #ifdef/#endif.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D155181
Simi Pallipurath [Thu, 13 Jul 2023 13:32:05 +0000 (14:32 +0100)]
[compiler-rt] [Arm] Make the tests for the runtime functions __aeabi_c{d,f} work on Big-Endian.
We are trying to build the compiler-rt as big-endian. And found that the tests compiler-rt/test/builtins/Unit/arm/aeabi_cdcmpeq_test.c and compiler-rt/test/builtins/Unit/arm/aeabi_cfcmpeq_test.c do not work on big endian at the moment. This patch makes these tests work on big endian as well.
Reviewed By: peter.smith, simon_tatham
Differential Revision: https://reviews.llvm.org/D155208
Guillaume Chatelet [Thu, 13 Jul 2023 10:58:41 +0000 (10:58 +0000)]
[libc][NFC] Split memset implementations per platform
This is a follow up on D154800 and D154770 to make the code structure more principled and avoid too many nested #ifdef/#endif.
Reviewed By: courbet
Differential Revision: https://reviews.llvm.org/D155174
Jakub Chlanda [Mon, 17 Jul 2023 09:34:54 +0000 (11:34 +0200)]
[NFC][AMDGPU] Default initialize the Subtarget
This is to address a static analizer warning:
The pointer field will point to an arbitrary memory location, any
attempt to write may cause corruption. In <unnamed>
R600DAGToDAGISel.:R600DAGToDAGISel (llvm::TargetMachine &,
livm::CodeGenOpt::Level): A pointer field is not initialized in the
constructor (CWE-457)
Differential Revision: https://reviews.llvm.org/D154414
David Green [Mon, 17 Jul 2023 09:23:27 +0000 (10:23 +0100)]
[AArch64] Regenerate CostModel tests with update_analyze_test_checks. NFC
Simon Pilgrim [Fri, 14 Jul 2023 13:37:58 +0000 (14:37 +0100)]
[X86] Canonicalize vXi64 SIGN_EXTEND_INREG vXi1 to use v2Xi32 splatted shifts instead
If somehow a vXi64 bool sign_extend_inreg pattern has been lowered to vector shifts (without PSRAQ support), then try to canonicalize to vXi32 shifts to improve likelihood of value tracking being able to fold them away.
Using a PSLLQ and bitcasted PSRAD node make it very difficult for later fold to recover from this.
Nuno Lopes [Mon, 17 Jul 2023 09:11:14 +0000 (10:11 +0100)]
[ScalarizeMaskedMemIntrin] Use poison instead of undef as placeholder [NFC]
This is used for masked out lanes, that are replaced with the passthrough value
Oleg Shyshkov [Mon, 17 Jul 2023 08:47:51 +0000 (10:47 +0200)]
[mlir][bazel] Fix build.
David Spickett [Tue, 13 Jun 2023 14:11:44 +0000 (15:11 +0100)]
[lldb][AArch64] Add test predicate for systems with SME enabled
"sme" is just one of many cpuinfo features for SME but it's the
only one we need for testing.
The rest are related to the use of certain instructions and
don't change the register state available.
Reviewed By: omjavaid
Differential Revision: https://reviews.llvm.org/D154823
Sander de Smalen [Mon, 10 Jul 2023 10:58:52 +0000 (11:58 +0100)]
[AArch64] NFC: Replace 'forceStreamingCompatibleSVE' with 'isNeonAvailable'.
The AArch64Subtarget interface 'isNeonAvailable' is more appropriate going
forward, as we may also want to generate 'streaming SVE' code (not just
'streaming-compatible SVE' code), but here we must still make sure not to
use NEON instructions which are invalid in streaming SVE mode.