Fangrui Song [Thu, 8 Sep 2022 23:31:45 +0000 (16:31 -0700)]
[cc1as] Support --compress-debug-sections=zstd
`clang -gz=zstd -c a.s` generates ELFCOMPRESS_ZSTD compressed debug info
sections if compression decreases size.
Philip Reames [Thu, 8 Sep 2022 23:22:44 +0000 (16:22 -0700)]
Fix a warning caught by llvm-sphinx-docs
Joe Loser [Thu, 8 Sep 2022 20:26:11 +0000 (14:26 -0600)]
[clang] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.
Change call sites to use `std::size` instead. Leave the few call sites that
use a locally defined `array_lengthof` that are meant to test previous bugs
with NTTPs in clang analyzer and SemaTemplate.
Differential Revision: https://reviews.llvm.org/D133520
Fangrui Song [Thu, 8 Sep 2022 23:14:31 +0000 (16:14 -0700)]
[Driver] Rename Z to Zlib
Fangrui Song [Thu, 8 Sep 2022 23:11:29 +0000 (16:11 -0700)]
[Support] Rename DebugCompressionType::Z to Zlib
"Z" was so named when we had both gABI ELFCOMPRESS_ZLIB and the legacy .zdebug support.
Now we have just one zlib format, we should use the more descriptive name.
Philip Reames [Thu, 8 Sep 2022 23:04:03 +0000 (16:04 -0700)]
[docs] Fix a rebase error in 194900f
Philip Reames [Thu, 8 Sep 2022 22:54:14 +0000 (15:54 -0700)]
[docs][RISCV] Document status of scalar crypto extensions
This is based on a somewhat subjective review of the in-tree support, and where I thought further work was needed before I'd consider these "done". See the review for some discussion around what is left in terms of pattern matching.
Differential Revision: https://reviews.llvm.org/D133373
Philip Reames [Thu, 8 Sep 2022 22:50:34 +0000 (15:50 -0700)]
[docs][RISCV] Document status of assorted extensions
Sorry, there's no real theme to this. It's simply the rest of the extensions we implement which don't need individual discussion.
Differential Revision: https://reviews.llvm.org/D133529
Amir Ayupov [Thu, 8 Sep 2022 22:50:25 +0000 (15:50 -0700)]
[BOLT] Restrict ICP for functions with unknown control flow
ICP has two modes: jump table promotion and indirect call promotion.
The selection is based on whether an instruction has a jump table or not.
An instruction with unknown control flow doesn't have a jump table and will
fall under indirect call promotion policy which might be incorrect/unsafe
(if an instruction is not a tail call, i.e. has local jump targets).
Prevent ICP for functions containing instructions with unknown control flow.
Follow-up to https://reviews.llvm.org/D128870.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132882
Amir Ayupov [Thu, 8 Sep 2022 22:48:20 +0000 (15:48 -0700)]
[BOLT] Change reorder-blocks deprecated option warning output
Revert to using `BOLT-WARNING`
Reviewed By: #bolt, maksfb
Differential Revision: https://reviews.llvm.org/D132778
Christopher Bate [Thu, 8 Sep 2022 20:33:57 +0000 (14:33 -0600)]
[mlir] NFC - move declaration of `Range` to StaticValueUtils.h
`ViewLikeInterface.h` defines a struct `Range`, and it also depends on
`StaticValueUtils.h/cpp`. This change moves the definition of `Range` to
`StaticValueUtils.h`, which should not violate any existing dependency
requirement. This is done to support adding utilities using `Range`
under `Dialect/Utils` without creating a circular dependency on
`ViewLikeInterface`. It is possible that some targets depend on
`ViewLikeInterface` just for the `Range` struct. These can be later
updated to depend on the `MLIRDialectUtils` target.
Reviewed By: nicolasvasilache
Differential Revision: https://reviews.llvm.org/D133523
Nicolas Vasilache [Thu, 8 Sep 2022 21:50:09 +0000 (14:50 -0700)]
[mlir][memref] Add support for 0-D transfer / subview fold.
The 0-d case simply forwards the indexing from the source memref and
works out of the box.
Differential Revision: https://reviews.llvm.org/D133536
rdzhabarov [Thu, 8 Sep 2022 22:11:44 +0000 (22:11 +0000)]
Revert "Fix bazel deps.". Original change has been reverted.
This reverts commit
b3999fd261805a2c8fc14f9421b7d9e8af251a13.
Louis Dionne [Thu, 8 Sep 2022 13:53:49 +0000 (09:53 -0400)]
[libc++] Fix compilation error on platforms that don't implement std::tm
Instead of mentioning tm directly in the definition of __convert_to_tm,
take it as a template argument. As a fly-by also fix incorrect Lit feature
(should have been no-localization instead of libcpp-has-no-localization).
Differential Revision: https://reviews.llvm.org/D133490
Fangrui Song [Thu, 8 Sep 2022 22:09:39 +0000 (15:09 -0700)]
Revert D130308 "[clang] extend getCommonSugaredType to merge sugar nodes"
This reverts commit
16e5d6d7f98f1119aab3d10ec4f9e59b5aacd359.
There are multiple complaints on the review.
In addition, it may cause spurious
```
error: invalid operands to binary expression ('SinkPrinter' and 'char[cluster_name_length]')
note: candidate template ignored: substitution failure: variably modified type 'char *' cannot be used as a template argument SinkPrinter operator<<(const SinkPrinter &s, T) {
```
for some C++ code
Nicolas Vasilache [Thu, 8 Sep 2022 20:40:30 +0000 (13:40 -0700)]
[mlir][vector] NFC - Add rewriter.notifyMatchFailure messages for better debugging
Add rewriter.notifyMatchFailure messages for better debugging
Differential Revision: https://reviews.llvm.org/D133532
Fabian Parzefall [Thu, 8 Sep 2022 21:46:57 +0000 (14:46 -0700)]
[BOLT] Introduce SplitStrategy ABC
This introduces an abstract base class for splitting strategies to
document the interface a strategy needs to implement, and also to avoid
code bloat of the `splitFunction` method.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D132054
Zequan Wu [Wed, 7 Sep 2022 23:24:45 +0000 (16:24 -0700)]
[LLDB][NativePDB] Set block address range.
The block address range was missing before.
Differential Revision: https://reviews.llvm.org/D133461
Jakub Kuderski [Thu, 8 Sep 2022 21:34:24 +0000 (17:34 -0400)]
[mlir][func] Remove unnecessary link dependencies for MLIRFuncTransforms
This is so that FuncTransforms can be used by other dialects without introducing cyclic dependencies.
Tested by building with `BUILD_SHARED_LIBS=ON`
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D133527
rdzhabarov [Thu, 8 Sep 2022 21:17:42 +0000 (21:17 +0000)]
Fix bazel deps.
Jonathan Peyton [Mon, 1 Aug 2022 19:12:29 +0000 (14:12 -0500)]
[OpenMP][libomp] Cleanup __kmpc_flush() code
Have it be simple KMP_MFENCE() which incorporates x86-specific logic and
reduces to KMP_MB() for other architectures.
Differential Revision: https://reviews.llvm.org/D130928
Vitaly Buka [Fri, 2 Sep 2022 20:27:34 +0000 (13:27 -0700)]
[msan] Disambiguate warnings debug location
If multiple warnings created on the same instruction (debug location)
it can be difficult to figure out which input value is the cause.
This patches chains origins just before the warning using last origins
update debug information.
To avoid inflating the binary unnecessarily, do this only when uncertainty is
high enough, 3 warnings by default. On average it adds 0.4% to the
.text size.
Reviewed By: kda, fmayer
Differential Revision: https://reviews.llvm.org/D133232
bixia1 [Wed, 7 Sep 2022 21:34:04 +0000 (14:34 -0700)]
[mlir][sparse] Add codegen for expand op.
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D133454
Vitaly Buka [Wed, 7 Sep 2022 02:20:59 +0000 (19:20 -0700)]
[sanitizers] Invalidate GlobalsAA
GlobalsAA is considered stateless as usually transformations do not introduce
new global accesses, and removed global access is not a problem for GlobalsAA
users.
Sanitizers introduce new global accesses:
- Msan and Dfsan tracks origins and parameters with TLS, and to store stack origins.
- Sancov uses global counters. HWAsan store tag state in TLS.
- Asan modifies globals, but I am not sure if invalidation is required.
I see no evidence that TSan needs invalidation.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D133394
Fangrui Song [Thu, 8 Sep 2022 20:49:07 +0000 (13:49 -0700)]
[AST/Interp] Fix left shift overflow bug in D64146
Noticed by Dmitri Gribenko
Fangrui Song [Thu, 8 Sep 2022 20:39:30 +0000 (13:39 -0700)]
[AST/Interp] Fix latent unitialized use of memory bug in D64146
Exposed by D132727: clang/test/AST/Interp/arrays.cpp fails with --config=msan
Tom Honermann [Sat, 23 Jul 2022 03:17:32 +0000 (20:17 -0700)]
[clang] NFC: Add a missing const qualifier to Decl::isLocalExternDecl().
Joe Loser [Thu, 8 Sep 2022 15:05:04 +0000 (09:05 -0600)]
[lldb] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.
Change call sites to use `std::size` instead.
Differential Revision: https://reviews.llvm.org/D133501
Emilio Cota [Thu, 8 Sep 2022 19:04:39 +0000 (15:04 -0400)]
[mlir] ConvertAsyncToLLVM: add missing dependence on async dialect
Differential Revision: https://reviews.llvm.org/D133516
Diego Caballero [Thu, 8 Sep 2022 20:11:37 +0000 (20:11 +0000)]
[mlir][tosa] Add apply scale flags to TosaToArith creation API
TosaToArith has two flags to enable/disable 'tosa.apply_scale' ops and
to use a 64-bit/32-bit implementation for it. This patch makes the flags
available from the pass creation API.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D133515
Aart Bik [Thu, 8 Sep 2022 18:41:29 +0000 (11:41 -0700)]
[mlir][sparse] improve dimop rewriting during conversion
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D133512
Dominic Chen [Tue, 16 Aug 2022 23:41:26 +0000 (16:41 -0700)]
[clang][ARM][NFC] Clean up signed conversion and undefined macros in builtin header
These warnings were identified while debugging modules with Wsystem-headers.
Differential Revision: https://reviews.llvm.org/D132003
Craig Topper [Thu, 8 Sep 2022 19:34:59 +0000 (12:34 -0700)]
[RISCV] Add RecurKind::FMulAdd to isLegalToVectorizeReduction for scalable vectors.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D133511
Jakub Kuderski [Thu, 8 Sep 2022 19:31:31 +0000 (15:31 -0400)]
Revert "[mlir][arith] Attempt to fix shared libs build for EmulateWideInt"
This reverts commit
4902c3b7f89a3351512b679cd6220fc55c8b3d2d.
Revert "[mlir][arith] Add wide integer emulation pass"
This reverts commit
fa8eb2708814a406261588fafe922047095b0db0.
Revert https://reviews.llvm.org/D133135 due to link errors with shared
libs on.
Philip Reames [Thu, 8 Sep 2022 19:25:07 +0000 (12:25 -0700)]
[docs][RISCV] Document experimental extensions
This adds a description of the currently existing experimental extensions. I took all information about versions and specifications from either the original commits, or current code. I'm not terribly familiar with any of these, so double checking my facts is much appreciated.
Differential Revision: https://reviews.llvm.org/D133214
Mircea Trofin [Thu, 8 Sep 2022 19:10:56 +0000 (12:10 -0700)]
[mlgo][nfc] Set logging level to warning or higher for TFLite
Jakub Kuderski [Thu, 8 Sep 2022 19:02:55 +0000 (15:02 -0400)]
[mlir][arith] Attempt to fix shared libs build for EmulateWideInt
Add missing CMake dependencies.
Original change: https://reviews.llvm.org/D133135
David Green [Thu, 8 Sep 2022 18:54:12 +0000 (19:54 +0100)]
[AArch64] Fix formatting of the Shuffle Cost tables. NFC
Quentin Colombet [Thu, 8 Sep 2022 18:49:47 +0000 (18:49 +0000)]
[mlir] Add missing dependency in bazel build
The MemRefTransform library now depends on ArithmeticUtils because
of the newly added SimplifyExtractStridedMetadata pass.
Felipe de Azevedo Piovezan [Thu, 8 Sep 2022 18:37:46 +0000 (14:37 -0400)]
Revert "[lldb] Use just-built libcxx for tests when available"
This reverts commit
c38eeecbc7d929c9601f2189214a7a90d3982a47.
River Riddle [Thu, 1 Sep 2022 17:36:00 +0000 (10:36 -0700)]
[mlir][PDL] Infer result types from a `replace` as the last resort
This prevents situations where explicit results types were provided,
which have different types than the operation being replaced. This
is useful for supporting dialect conversion, which will have proper
support added in a followup.
Differential Revision: https://reviews.llvm.org/D133141
Paul Robinson [Wed, 7 Sep 2022 19:45:35 +0000 (12:45 -0700)]
Make llvm-tli-checker support static libraries
The original implementation assumed dynamic libraries and so looked
only at the dynamic symbol table. Use the regular symbol table for
ET_REL files.
Differential Revision: https://reviews.llvm.org/D133448
Jakub Kuderski [Thu, 8 Sep 2022 17:50:21 +0000 (13:50 -0400)]
[mlir][arith] Add wide integer emulation pass
In this first patch in a series to add wide integer emulation:
* Set up the initial pass structure
* Add a custom type converter
* Handle func ops
The initial implementation supports power-of-two integers types only. We
emulate wide integer operations by splitting original i2N integer types
into two iN halves
My immediate use case is to emulate i64 operations using i32 ones
on mobile GPUs that do not support i64.
Reviewed By: antiagainst, Mogball
Differential Revision: https://reviews.llvm.org/D133135
Felipe de Azevedo Piovezan [Tue, 30 Aug 2022 13:28:14 +0000 (09:28 -0400)]
[lldb] Use just-built libcxx for tests when available
This commit improves upon
cc0b5ebf7fc8, which added support for
specifying which libcxx to use when testing LLDB. That patch honored
requests by tests that had `USE_LIBCPP=1` defined in their makefiles.
Now, we also use a non-default libcxx if all conditions below are true:
1. The test is not explicitly requesting the use of libstdcpp
(USE_LIBSTDCPP=1).
2. The test is not explicitly requesting the use of the system's
library (USE_SYSTEM_STDLIB=1).
3. A path to libcxx was either provided by the user through CMake flags
or libcxx was built together with LLDB.
Condition (2) is new and introduced in this patch in order to support
tests that are either:
* Cross-platform (such as API/macosx/macCatalyst and
API/tools/lldb-server). The just-built libcxx is usually not built for
platforms other than the host's.
* Cross-language (such as API/lang/objc/exceptions). In this case, the
Objective C runtime throws an exceptions that always goes through the
system's libcxx, instead of the just built libcxx. Fixing this would
require either changing the install-name of the just built libcxx in Mac
systems, or tuning the DYLD_LIBRARY_PATH variable at runtime.
Some other tests exposes limitations of LLDB when running with a debug
standard library. TestDbgInfoContentForwardLists had an assertion
removed, as it was checking for buggy LLDB behavior (which now
crashes). TestFixIts had a variable renamed, as the old name clashes
with a standard library name when debug info is present. This is a known
issue: https://github.com/llvm/llvm-project/issues/34391.
For `TestSBModule`, the way the "main" module is found was changed to
look for the "a.out" module, instead of relying on the index being 0. In
some systems, the index 0 is dyld when a custom standard library is
used.
Differential Revision: https://reviews.llvm.org/D132940
Zequan Wu [Tue, 6 Sep 2022 22:38:54 +0000 (15:38 -0700)]
[LLDB][NativePDB] Fix PdbAstBuilder::GetParentDeclContext when ICF happens.
Removed `GetParentDeclContextForSymbol` as this is not necesssary. We can get
the demangled names from CVSymbol and then using it to create tag decl or
namespace decl. This also fixed a bug when icf applied.
Differential Revision: https://reviews.llvm.org/D133243
Filipp Zhinkin [Thu, 8 Sep 2022 13:19:43 +0000 (16:19 +0300)]
[ARM] Add tests on instructions fusion with comparison with zero; NFC
Baseline tests for D131786
Matheus Izvekov [Tue, 19 Jul 2022 09:02:32 +0000 (11:02 +0200)]
[clang] extend getCommonSugaredType to merge sugar nodes
This continues D111283 by extending the getCommonSugaredType
implementation to also merge non-canonical type nodes.
We merge these nodes by going up starting from the canonical
node, calculating their merged properties on the way.
If we reach a pair that is too different, or which we could not
otherwise unify, we bail out and don't try to keep going on to
the next pair, in effect striping out all the remaining top-level
sugar nodes. This avoids mismatching 'companion' nodes, such as
ElaboratedType, so that they don't end up elaborating some other
unrelated thing.
Depends on D111509
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D130308
Matheus Izvekov [Sun, 10 Oct 2021 13:28:37 +0000 (15:28 +0200)]
[clang] use getCommonSugar in an assortment of places
For this patch, a simple search was performed for patterns where there are
two types (usually an LHS and an RHS) which are structurally the same, and there
is some result type which is resolved as either one of them (typically LHS for
consistency).
We change those cases to resolve as the common sugared type between those two,
utilizing the new infrastructure created for this purpose.
Depends on D111283
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D111509
Matheus Izvekov [Wed, 25 May 2022 20:00:58 +0000 (22:00 +0200)]
[clang] template / auto deduction deduces common sugar
After upgrading the type deduction machinery to retain type sugar in
D110216, we were left with a situation where there is no general
well behaved mechanism in Clang to unify the type sugar of multiple
deductions of the same type parameter.
So we ended up making an arbitrary choice: keep the sugar of the first
deduction, ignore subsequent ones.
In general, we already had this problem, but in a smaller scale.
The result of the conditional operator and many other binary ops
could benefit from such a mechanism.
This patch implements such a type sugar unification mechanism.
The basics:
This patch introduces a `getCommonSugaredType(QualType X, QualType Y)`
method to ASTContext which implements this functionality, and uses it
for unifying the results of type deduction and return type deduction.
This will return the most derived type sugar which occurs in both X and
Y.
Example:
Suppose we have these types:
```
using Animal = int;
using Cat = Animal;
using Dog = Animal;
using Tom = Cat;
using Spike = Dog;
using Tyke = Dog;
```
For `X = Tom, Y = Spike`, this will result in `Animal`.
For `X = Spike, Y = Tyke`, this will result in `Dog`.
How it works:
We take two types, X and Y, which we wish to unify as input.
These types must have the same (qualified or unqualified) canonical
type.
We dive down fast through top-level type sugar nodes, to the
underlying canonical node. If these canonical nodes differ, we
build a common one out of the two, unifying any sugar they had.
Note that this might involve a recursive call to unify any children
of those. We then return that canonical node, handling any qualifiers.
If they don't differ, we walk up the list of sugar type nodes we dived
through, finding the last identical pair, and returning that as the
result, again handling qualifiers.
Note that this patch will not unify sugar nodes if they are not
identical already. We will simply strip off top-level sugar nodes that
differ between X and Y. This sugar node unification will instead be
implemented in a subsequent patch.
This patch also implements a few users of this mechanism:
* Template argument deduction.
* Auto deduction, for functions returning auto / decltype(auto), with
special handling for initializer_list as well.
Further users will be implemented in a subsequent patch.
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Differential Revision: https://reviews.llvm.org/D111283
Alan Zhao [Wed, 31 Aug 2022 20:45:40 +0000 (16:45 -0400)]
[lld][COFF] Add support for overriding weak symbols in LLVM bitcode input
LLVM bitcode contains support for weak symbols, so we can add support
for overriding weak symbols in the output COFF even though COFF doesn't
have inherent support for weak symbols.
The motivation for this patch is that Chromium is trying to use libc++'s
assertion handler mechanism, which relies on weak symbols [0], but we're
unable to perform a ThinLTO build on Windows due to this problem [1].
[0]: https://reviews.llvm.org/D121478
[1]: https://crrev.com/c/3863576
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D133165
Quentin Colombet [Thu, 1 Sep 2022 22:11:14 +0000 (22:11 +0000)]
[mlir][MemRef] Simplify extract_strided_metadata(subview)
Add a dedicated pass to simplify
extract_strided_metadata(other_op(memref)).
Currently the pass features only one pattern:
extract_strided_metadata(subview).
The goal is to get rid of the subview while materializing its effects on
the offset, sizes, and strides with respect to the base object.
In other words, this simplification replaces:
```
baseBuffer, offset, sizes, strides =
extract_strided_metadata(
subview(memref, subOffset, subSizes, subStrides))
```
With
```
baseBuffer, baseOffset, baseSizes, baseStrides =
extract_strided_metadata(memref)
strides#i = baseStrides#i * subSizes#i
offset = baseOffset + sum(subOffset#i * strides#i)
sizes = subSizes
```
Differential Revision: https://reviews.llvm.org/D133166
Peiming Liu [Thu, 8 Sep 2022 16:39:17 +0000 (16:39 +0000)]
[mlir][bufferization] fix typo in example code for bufferization.alloc_tensor
See BufferizationOps.cpp:408, the dynamic sizes are enclosed by "()" not "[]"
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Dialect/Bufferization/IR/BufferizationOps.cpp#L408
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D133505
V Donaldson [Thu, 8 Sep 2022 04:22:59 +0000 (21:22 -0700)]
[flang] Control flow with empty select case blocks
Fix control flow for empty select case blocks such as:
select case (2)
case (1)
print*, '1'
case (2)
! print*, '2'
case default
print*, 'default'
end select
natashaknk [Wed, 7 Sep 2022 22:40:17 +0000 (15:40 -0700)]
[mlir][tosa] Add dynamic width/height for pooling in tosa to linalg
Needed to support dynamic width/height for pooling inputs using
the similar convolution work.
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D133389
raghavmedicherla [Thu, 8 Sep 2022 16:04:12 +0000 (12:04 -0400)]
Revert "Support: Add mapped_file_region::sync(), equivalent to msync"
This reverts commit
142f51fc2f448845f6a32e767ffaa2b665eea11f.
This shouldn't be committed, it got committed accidentally.
Mathieu Fehr [Thu, 8 Sep 2022 15:46:59 +0000 (08:46 -0700)]
[mlir][NFC] Provide accessor for TableGen record
Constraint and Predicate classes did not expose their underlying
tablegen records. This means that for Constraints, it is not possible
to get the underlying base constraint of a variadic constraint.
For Predicate, it is not possible to get the predicates forming an
`Or` predicate for instance.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D133264
Sanjay Patel [Thu, 8 Sep 2022 16:09:26 +0000 (12:09 -0400)]
[InstCombine] fold icmp of truncated left shift, part 2
(trunc (1 << Y) to iN) == 2**C --> Y == C
(trunc (1 << Y) to iN) != 2**C --> Y != C
https://alive2.llvm.org/ce/z/xnFPo5
Follow-up to
d9e1f9d7591b0d3e4d. This was a suggested
enhancement mentioned in issue #51889.
Katherine Rasmussen [Wed, 24 Aug 2022 22:34:20 +0000 (15:34 -0700)]
[flang] Add co_sum to the list of intrinsics and update test
Add the collective subroutine, co_sum, to the list of intrinsics.
In accordance with 16.9.50 and 16.9.137, add a check for and an
error if coindexed objects are being passed to certain arguments
in co_sum and in move_alloc. Add a semantics test to check that
this error is successfully caught in calls to move_alloc. Remove
the XFAIL directive, update the ERROR directives and add
standard-conforming and non-standard conforming calls in the
semantics test for co_sum.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D114134
Kadir Cetinkaya [Thu, 8 Sep 2022 09:19:40 +0000 (11:19 +0200)]
[clangd] Set Incompleteness for spec fuzzyfind requests
Differential Revision: https://reviews.llvm.org/D133479
Fangrui Song [Thu, 8 Sep 2022 16:32:12 +0000 (09:32 -0700)]
[test] Fix compress-debug-sections-zlib-unavailable.s
Kadir Cetinkaya [Fri, 2 Sep 2022 12:24:03 +0000 (14:24 +0200)]
[clang] Fix a crash in constant evaluation
Philip Reames [Thu, 8 Sep 2022 16:07:08 +0000 (09:07 -0700)]
[LV] Use safe-divisor lowering for fixed vectors if profitable
This extends the safe-divisor widening scheme recently added for scalable vectors to handle fixed vectors as well.
Differential Revision: https://reviews.llvm.org/D132591
Jonas Paulsson [Thu, 8 Sep 2022 16:03:38 +0000 (18:03 +0200)]
[SystemZ] Fix new test case
Add 'REQUIRES: systemz-registered-target'.
Zain Jaffal [Thu, 8 Sep 2022 15:42:11 +0000 (16:42 +0100)]
[AArch64] Add test for vscale nontemporal loads larger than 256.
Reviewed By: fhahn
Differential Revision: https://reviews.llvm.org/D133498
Mark de Wever [Wed, 7 Sep 2022 16:55:23 +0000 (18:55 +0200)]
[libc++] Removes Clang 13 support.
Reviewed By: #libc, ldionne, jloser
Differential Revision: https://reviews.llvm.org/D133435
Zhixun Tan [Thu, 8 Sep 2022 15:43:47 +0000 (08:43 -0700)]
[mlir][dataflow] Remove Lattice::isUninitialized().
Currently, for sparse analyses, we always store a `Optional<ValueT>` in each lattice element. When it's `None`, we consider the lattice element as `uninitialized`.
However:
* Not all lattices have an `uninitialized` state. For example, `Executable` and `PredecessorState` have default values so they are always initialized.
* In dense analyses, we don't have the concept of an `uninitialized` state.
Given these inconsistencies, this patch removes `Lattice::isUninitialized()`. Individual analysis states are now default-constructed. If the default state of an analysis can be considered as "uninitialized" then this analysis should implement the following logic:
* Special join rule: `join(uninitialized, any) == any`.
* Special bail out logic: if any of the input states is uninitialized, exit the transfer function early.
Depends On D132086
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D132800
Jay Foad [Thu, 8 Sep 2022 13:36:23 +0000 (14:36 +0100)]
[AMDGPU] Fix shrinking of F16 FMA on newer subtargets
D125803 introduced shrinking of F16 FMA to FMAAK/FMAMK in
SIShrinkInstructions (useful on GFX10+ where VOP3 instructions may have
a literal operand) but failed to handle the V_FMA_F16_gfx9_e64 form of
the opcode which is used on GFX9+.
Differential Revision: https://reviews.llvm.org/D133489
Jonas Paulsson [Thu, 4 Aug 2022 10:16:44 +0000 (12:16 +0200)]
[SystemZ] Improve handling of vector alignments.
Make the DataLayout string always hold a vector alignment of 8 bytes,
regardless of the vector ABI. This makes the datalayout depend only on the
target triple which is the general expectation (in assertions).
On older architectures where vectors use the natural alignment (16 bytes),
the front end will maintain the same behavior and produce an overalignment
compared to the datalayout.
Reviewed By: uweigand
Differential Revision: https://reviews.llvm.org/D131158
David Goldman [Wed, 31 Aug 2022 17:33:09 +0000 (13:33 -0400)]
[clangd][ObjC] Improve completions for protocols + category names
- Render protocols as interfaces to differentiate them from classes
since a protocol and class can have the same name. Take this one step
further though, and only recommend protocols in ObjC protocol completions.
- Properly call `includeSymbolFromIndex` even with a cached
speculative fuzzy find request
- Don't use the index to provide completions for category names,
symbols there don't make sense
Differential Revision: https://reviews.llvm.org/D132962
Aart Bik [Thu, 8 Sep 2022 05:46:31 +0000 (22:46 -0700)]
[mlir][sparse] fix bug in workspace dimension computation
Access pattern expansion is always done along the innermost stored
dimension, but this was incorrectly reordered due to using a
general utility typically used by original dimensions only.
Reviewed By: bixia
Differential Revision: https://reviews.llvm.org/D133472
Thomas Lively [Thu, 8 Sep 2022 15:07:48 +0000 (08:07 -0700)]
[WebAssembly] Prototype `f32x4.relaxed_dot_bf16x8_add_f32`
As proposed in https://github.com/WebAssembly/relaxed-simd/issues/77. Only an
LLVM intrinsic and a clang builtin are implemented. Since there is no bfloat16
type, use u16 to represent the bfloats in the builtin function arguments.
Differential Revision: https://reviews.llvm.org/D133428
Joe Loser [Wed, 7 Sep 2022 00:06:58 +0000 (18:06 -0600)]
[llvm] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style
array: `llvm::array_lengthof`. This is useful prior to C++17, but not as
helpful for C++17 or later: `std::size` already has support for C-style
arrays.
Change call sites to use `std::size` instead.
Differential Revision: https://reviews.llvm.org/D133429
Djordje Todorovic [Thu, 8 Sep 2022 15:00:36 +0000 (17:00 +0200)]
Revert "Recommit "[AggressiveInstCombine] Lower Table Based CTTZ""
This reverts commit
f87993915768772d113bfd524347ce4341b843cf.
Krzysztof Parzyszek [Thu, 8 Sep 2022 14:06:05 +0000 (07:06 -0700)]
[Hexagon] Handle shifts of short vectors of i8
Eric Wang [Thu, 8 Sep 2022 00:12:29 +0000 (17:12 -0700)]
[NFC][Regalloc] Introduce the RegAllocPriorityAdvisorAnalysis
This patch introduces the priority analysis and the priority advisor,
the default implementation, and the scaffolding for introducing the
other implementations of the advisor.
Reviewed By: mtrofin
Differential Revision: https://reviews.llvm.org/D132835
Sanjay Patel [Thu, 8 Sep 2022 14:44:49 +0000 (10:44 -0400)]
[InstCombine] Fold icmp of truncated left shift
(trunc (1 << Y) to iN) == 0 --> Y u>= N
(trunc (1 << Y) to iN) != 0 --> Y u< N
These can be generalized in several ways as noted by the TODO
items, but this handles the pattern in the motivating bug report.
Fixes #51889
Differential Revision: https://reviews.llvm.org/D115480
Florian Hahn [Thu, 8 Sep 2022 14:45:32 +0000 (15:45 +0100)]
[AArch64] Add tests for lowering trunc to i8 using tbl.
Djordje Todorovic [Wed, 7 Sep 2022 09:57:43 +0000 (11:57 +0200)]
Recommit "[AggressiveInstCombine] Lower Table Based CTTZ"
Ivan Kosarev [Thu, 8 Sep 2022 13:56:37 +0000 (14:56 +0100)]
[AMDGPU] Only raise wave priority if there is a long enough sequence of VALU instructions.
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D124671
Jay Foad [Thu, 8 Sep 2022 13:13:17 +0000 (14:13 +0100)]
[AMDGPU] Add basic tests for emitting v_fma_f16 and friends
Florian Hahn [Thu, 8 Sep 2022 13:27:58 +0000 (14:27 +0100)]
[VPlan] Only generate single instr for loads uniform across all parts.
VPReplicateRecipe::isUniform actually means uniform-per-parts, hence a
scalar instruction is generated per-part.
This is a potential alternative D132892. For now the current patch only
catches cases where the address is trivially invariant (defined outside
VPlan), while D132892 catches any address that is considered invariant
by SCEV AFAICT.
It should be possible to hoist fully invariant recipes feeding loads out
of the vector loop region as well, but in practice LICM should do that
already.
This version of the patch artificially limits this to loads to make it
easier to compare, but this restriction should be easily liftable.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D133019
Florian Hahn [Thu, 8 Sep 2022 13:01:11 +0000 (14:01 +0100)]
[AArch64] Add tests for shuffle (tbl2, tbl2) -> tbl4 fold.
Add extra tests where shuffle (tbl2, tbl2) can be folded to tbl4.
Regenerate check lines automatically as well.
Nikita Popov [Thu, 8 Sep 2022 12:52:35 +0000 (14:52 +0200)]
[LICM] Add test for sret with conditional store (NFC)
Christian Sigg [Wed, 7 Sep 2022 21:59:18 +0000 (23:59 +0200)]
[lit] Test changes to make it work with bazel
These non-functional changes will make it easier to add the lit tests to the bazel build (see utils/bazel).
Reviewed By: bkramer
Differential Revision: https://reviews.llvm.org/D133416
Matt Devereau [Thu, 8 Sep 2022 11:30:06 +0000 (11:30 +0000)]
[AArch64][SVE] Add out of range SVE arg CC test
Add calling convention test for callee functions that have SVE
parameters outside of the z0-z7 range
liqinweng [Thu, 8 Sep 2022 10:33:29 +0000 (18:33 +0800)]
[AARCH64][COST] Improve cost of reverse shuffles for AArch64
Update the comments for reverse shuffles and add tests
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D132730
liqinweng [Thu, 8 Sep 2022 10:25:20 +0000 (18:25 +0800)]
[RISCV][COST] Add cost model for mask vector select instruction when its condition is a scalar type
Reviewed By: jacquesguan
Differential Revision: https://reviews.llvm.org/D132992
Manuel Brito [Thu, 8 Sep 2022 10:35:59 +0000 (11:35 +0100)]
[unittests] Change operands of Add in AsmWriterTest from Undef to Poison
Replacing UndefValue with PoisonValue in this test where it's use as dummy value
in light of the efforts to remove undef from llvm.
Differential Revision: https://reviews.llvm.org/D133481
Nico Weber [Thu, 8 Sep 2022 10:28:45 +0000 (06:28 -0400)]
[gn build] port
a0365abad811
David Spickett [Thu, 1 Sep 2022 13:30:39 +0000 (13:30 +0000)]
[LLVM][ARM] Remove options for armv2, 2A, 3 and 3M
Fixes #57486
These pre v4 architectures are not specifically supported
by codegen. As demonstrated in the linked issue.
GCC has not supported 3M since GCC 9 and presumably
2 and 2A earlier than that. So we are aligned in that sense.
(see https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=
2abd6e34fcf3bd9f9ffafcaa47cdc3ed443f9add)
This removes the options and associated testing.
The Pre_v4 build attribute remains mainly because its absence
would be more confusing. It will not be used other than to
complete the list of build attributes as shown in the ABI.
https://github.com/ARM-software/abi-aa/blob/main/addenda32/addenda32.rst#3352the-target-related-attributes
Reviewed By: nickdesaulniers, peter.smith, rengolin
Differential Revision: https://reviews.llvm.org/D133109
Johannes Reifferscheid [Thu, 8 Sep 2022 09:04:33 +0000 (11:04 +0200)]
Fix clang-format.
chenglin.bi [Thu, 8 Sep 2022 08:52:25 +0000 (16:52 +0800)]
[AArch64] add i56 load store pair test case; NFC
Fangrui Song [Thu, 8 Sep 2022 08:39:06 +0000 (01:39 -0700)]
[Driver] Support -gz=zstd
The driver option translates to --compress-debug-sections=zstd cc1/cc1as/GNU
assembler/linker options.
`clang -g -gz=zstd -c a.c` generates ELFCOMPRESS_ZSTD compressed debug info
sections if compression decreases size.
Nikita Popov [Wed, 7 Sep 2022 09:36:19 +0000 (11:36 +0200)]
[ConstantExpr] Remove fneg expression
As part of https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179,
this removes the fneg constant expression (which is, incidentally,
the only unary operator expression).
Differential Revision: https://reviews.llvm.org/D133418
Johannes Reifferscheid [Thu, 8 Sep 2022 07:38:50 +0000 (09:38 +0200)]
One-shot-bufferize: fix for inconsistent while arg types in before/after.
Currently, if the `before` and `after` regions of a while op have
tensor args in different indices, this leads to a crash.
This moves the pass-through check for args to the handling of the
condition block, since that is where the results are produced, so
it's also where copies must be made.
Reviewed By: springerm
Differential Revision: https://reviews.llvm.org/D133477
Fangrui Song [Thu, 8 Sep 2022 08:22:04 +0000 (08:22 +0000)]
C++/ObjC++: switch to gnu++17 as the default standard
Clang's default C++ standard is now `gnu++17` instead of `gnu++14`:
https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-standard/64360
* CUDA/HIP are unchanged: C++14 from D103221.
* Sony PS4/PS5 are unchanged: https://discourse.llvm.org/t/c-objc-switch-to-gnu-17-as-the-default-standard/64360/6
* lit feature `default-std-cxx` is added to keep CLANG_DEFAULT_STD_CXX=xxx tests working.
Whether the cmake variable should be retained is disccused in D133375.
Depends on D131464
Reviewed By: #clang-language-wg, aaron.ballman
Differential Revision: https://reviews.llvm.org/D131465
Uday Bondhugula [Sat, 3 Sep 2022 05:56:29 +0000 (11:26 +0530)]
Improve diagnostic when emitting operations with regions
This has a broad impact on diagnostics that attach an operation. Ops
with one or more regions will now be printed on a new line. It was
confusing and hard to read with a trailing first line for ops
with regions.
Before:
```
<unknown>:0: note: see current operation: affine.for %arg3 = 0 to 8192 {
affine.for %arg4 = 0 to 8192 step 512 {
affine.for %arg5 = 0 to 8192 step 128 {
...
```
After:
```
<unknown>:0: note: see current operation:
affine.for %arg3 = 0 to 8192 {
affine.for %arg4 = 0 to 8192 step 512 {
affine.for %arg5 = 0 to 8192 step 128 {
...
```
Differential Revision: https://reviews.llvm.org/D132645
Valentin Clement [Thu, 8 Sep 2022 08:15:36 +0000 (10:15 +0200)]
[flang] Deallocate intent(out) allocatables
From Fortran 2018 standard 9.7.3.2 point 6:
When a procedure is invoked, any allocated allocatable object that is an actual
argument corresponding to an INTENT (OUT) allocatable dummy argument is
deallocated; any allocated allocatable object that is a subobject of an actual
argument corresponding to an INTENT (OUT) dummy argument is deallocated.
Deallocation is done on the callee side. For BIND(C) procedure, the deallocation
is also done on the caller side.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D133348
Timm Bäder [Thu, 8 Sep 2022 08:02:36 +0000 (10:02 +0200)]
[clang][Interp] Only initialize initmaps for primitive arrays
As the comment states, this code should only run for primitive arrays.
This should fix the memory sanitize builds.
Fangrui Song [Thu, 8 Sep 2022 08:00:06 +0000 (01:00 -0700)]
[MC] Support writing ELFCOMPRESS_ZSTD compressed debug info sections
and add --compress-debug-sections=zstd to llvm-mc for testing.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D130724