Arthur Eubanks [Fri, 30 Jun 2023 04:24:03 +0000 (21:24 -0700)]
[gn build] Port
853b2a84cb99
Arthur Eubanks [Fri, 30 Jun 2023 04:19:07 +0000 (21:19 -0700)]
Revert "[MC,x86-32] Remove a gold<2.34 workaround"
This reverts commit
a699921baa91e6c2979ec0f0482430c57f51761d.
Seems to cause miscompiles (https://crbug.com/1459232), following up with author.
Craig Topper [Fri, 30 Jun 2023 03:58:55 +0000 (20:58 -0700)]
[RISCV] Mark zvkn* and zvks* extensions as enabled when all their subextensions are.
These extensions don't contain any instructions on their own, they
are just aliases for a set of extensions. We should set the preprocessor
define anytime all the sub-extensions are supported.
Reviewed By: kito-cheng, eopXD
Differential Revision: https://reviews.llvm.org/D154171
Ben Shi [Tue, 20 Jun 2023 10:00:56 +0000 (18:00 +0800)]
[CSKY] Optimize subtraction with SUBI32/SUBI16
Reviewed By: zixuan-wu
Differential Revision: https://reviews.llvm.org/D153326
V Donaldson [Fri, 30 Jun 2023 03:23:56 +0000 (20:23 -0700)]
[flang] Reinstate class query test
Remove kind=10 test variant, which is not universally supported.
wanglei [Tue, 11 Apr 2023 03:48:42 +0000 (11:48 +0800)]
[LoongArch] Reuse LoongArchRegWithSubRegs class to shorten some code in LoongArchRegisterInfo.td. NFC
wangpc [Fri, 30 Jun 2023 03:01:58 +0000 (11:01 +0800)]
[RISCV][NFC] Replace Join with !interleave
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D153940
wangpc [Fri, 30 Jun 2023 02:51:41 +0000 (10:51 +0800)]
[RISCV][NFC] Format TableGen files and remove unused defs
Make sure there is no single line for '{' to be consistent with
other codes.
`InvalidIndex` is removed since it's unused now. And comments are
updated.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D153939
Amir Ayupov [Fri, 30 Jun 2023 02:54:29 +0000 (19:54 -0700)]
Revert "[BOLT][Instrumentation] Don't share counters when using append-pid"
This reverts commit
02c3724d43840339fdc91d21747e96b5f7405bb0.
This change breaks instrumented Clang:
https://lab.llvm.org/buildbot/#/builders/252/builds/2700
Amir Ayupov [Fri, 30 Jun 2023 02:29:36 +0000 (19:29 -0700)]
Revert "[BOLT][Instrumentation] Put Allocator itslef in shared memory by default"
This reverts commit
ad4e0770ca7ebbc4dd6635b17421819b2393aa33.
Breaks BOLT upstream testing:
https://lab.llvm.org/buildbot/#/builders/244/builds/13736
V Donaldson [Fri, 30 Jun 2023 01:28:11 +0000 (18:28 -0700)]
[flang] test update
Jason Molenda [Fri, 30 Jun 2023 01:21:57 +0000 (18:21 -0700)]
"fp" -> "flags" typeo in description of generic registers
the list of generic registers is meant to include
LLDB_REGNUM_GENERIC_FLAGS but it copy & pasted the
name "fp".
rdar://
100857252
Johannes Doerfert [Fri, 30 Jun 2023 01:02:20 +0000 (18:02 -0700)]
[OpenMPOpt][FIX] Internalization is an IR change too
The bots reported that we changed the IR w/o reporting it. The reason
was that internalization was not reported as changed. Forwarding the
result solves the problem.
Test coverage via
llvm/test/Transforms/Attributor/reduced/openmp_opt_constant_type_crash.ll
Fangrui Song [Fri, 30 Jun 2023 00:59:15 +0000 (17:59 -0700)]
[AArch64][MachO] Drop a 2015 ld64 workaround avoiding local relocations
Commit
d6223a24718df3c30b67422c2eb6d0e93af9c4e8 introduced an ld64 workaround
that disables local relocations for many pointer-sized relocations (e.g.
relocations referencing `__DATA,__literal*`).
ld64 has been fixed long ago (2015). Drop this workaround so that the
behavior matches x86-64.
Reviewed By: pete
Differential Revision: https://reviews.llvm.org/D152831
Jason Molenda [Fri, 30 Jun 2023 00:50:21 +0000 (17:50 -0700)]
Recognize BSS-only DATA segments as sections that need to be slid
ObjectFileMachO::SetLoadAddress() should allow for a DATA segment
that has no file content to be slid in the vmaddr, it is valid
to have such a section.
Differential Revision: https://reviews.llvm.org/D154037
rdar://
99744343
V Donaldson [Fri, 30 Jun 2023 00:42:05 +0000 (17:42 -0700)]
[flang] Test update
Ting Wang [Fri, 30 Jun 2023 00:35:59 +0000 (20:35 -0400)]
[PowerPC][NFC] add SADDO/SSUBO test case
Differential Revision: https://reviews.llvm.org/D152339
Reviewed By: qiucf
Ting Wang [Fri, 30 Jun 2023 00:32:15 +0000 (20:32 -0400)]
[PowerPC][NFC] expose issue on absol-jump-table-enabled.ll (relocation-model=pic + ppc-use-absolute-jumptables)
Differential Revision: https://reviews.llvm.org/D154047
Han-Kuan Chen [Thu, 29 Jun 2023 17:07:02 +0000 (10:07 -0700)]
[SLP] Provide an universal interface for FixedVectorType::get. NFC.
Differential Revision: https://reviews.llvm.org/D154114
Jason Molenda [Fri, 30 Jun 2023 00:01:16 +0000 (17:01 -0700)]
Add 'target dump section-load-list' for lldb debugging
A command to dump the Target's SectionLoadList, to debug
possible issues with the table.
Differential Revision: https://reviews.llvm.org/D154169
V Donaldson [Thu, 29 Jun 2023 18:32:56 +0000 (11:32 -0700)]
[flang] IEEE_ARITHMETIC intrinsic module procedures
Implement
- IEEE_CLASS
- IEEE_COPY_SIGN
- IEEE_GET_ROUNDING_MODE
- IEEE_IS_FINITE
- IEEE_IS_NAN
- IEEE_IS_NEGATIVE
- IEEE_IS_NORMAL
- IEEE_SET_ROUNDING_MODE
- IEEE_SIGNBIT
- IEEE_SUPPORT_ROUNDING
- IEEE_UNORDERED
- IEEE_VALUE
for all REAL kinds (2, 3, 4, 8, 10, 16) where applicable.
Philip Reames [Thu, 29 Jun 2023 23:10:32 +0000 (16:10 -0700)]
[RISCV] Rename a couple of binary vector td classes/multiclasses
These used a different naming scheme than the rest of the file. The base class itself isn't too confusing - it's just a TA suffix vs the usual unsuffixed. However, the multiclass having a TA suffix while defining all three of TA, TU, and MASK was rather confusing.
Shafik Yaghmour [Thu, 29 Jun 2023 22:38:14 +0000 (15:38 -0700)]
[Clang] Fix crash in isCXXDeclarationSpecifier when attempting to annotate template name
When attempting to decide if in C++17 a type template for class template
argument deduction and the code is ill-formed the condition to break is
checking the current token is an identifier when it should be checking
if the next token is not ::.
This fixes: https://github.com/llvm/llvm-project/issues/57495
https://github.com/llvm/llvm-project/issues/63052
Differential Revision: https://reviews.llvm.org/D134334
Ian Anderson [Mon, 26 Jun 2023 22:07:24 +0000 (15:07 -0700)]
[libc++][Modules] Make module exports consistent with header includes
Some modules export modules that they don't import (i.e. that their header doesn't directly include). That sometimes works when the exported submodule is in the same module, but when the `std` mega module is broken up (D144322), some of the exports stop working. Make the exports and includes consistent, either by adding includes for the exports, or by removing exports for missing includes.
The `concepts.equality_comparable` export in `std.iterator.__iterator.concepts` isn't doing anything because 1) it's resolved as `std.iterator.__iterator.concepts.equality_comparable` and 2) there's a `__concepts` submodule in between `std.concepts` and `equality_comparable`. Fix it to be `std.concepts.__concepts.equality_comparable`.
<span> is listed in both `std.span` and `std.experimental.span`. Delete the latter module.
There is no `__errc` module or header, so remove that export from `std.system_error`.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D153211
Yuanfang Chen [Thu, 29 Jun 2023 22:33:00 +0000 (15:33 -0700)]
Adjust tests in
632dd6a4ca0036009f for ARM host
size_t is unsigned int on ARM.
Raghu Maddhipatla [Fri, 9 Jun 2023 23:27:35 +0000 (18:27 -0500)]
[Flang] [OpenMP] [Semantics] Change SIMD ALIGNED clause support from parsing a std::list<Name> to OmpObjectlist
This is an assisting patch which is implemented to address review comment to switch std::list<Name> to OmpObjectlist from https://reviews.llvm.org/D142722.
Also addressed a semantic check https://github.com/llvm/llvm-project/issues/61161 OpenMP 5.2 standard states that only pointer variables (C_PTR, Cray pointers, POINTER or ALLOCATABLE items) can appear in SIMD aligned clause (section 5.11). And not to allow common block names on an ALIGNED clause.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D152637
Denis Revunov [Tue, 20 Jun 2023 15:04:17 +0000 (15:04 +0000)]
[BOLT][Instrumentation] Add dumping function to instrumentation hash tables
Since there are no other means to debug the instrumentation library
other than using stdout, having a function to print hash table entries
is very useful.
Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771
Denis Revunov [Wed, 21 Jun 2023 07:21:50 +0000 (07:21 +0000)]
[BOLT][Instrumentation] Disallow combining append-pid with sleep-time/wait-forks
The point of instrumentation-sleep-time option is to have a watcher
process which shares memory with all other forks and dumps a common
profile each n seconds. Combining it with append-pid suggests that we
should get a private profile of each fork every n seconds, but such
behavior is not implemented currently and is not easy to implement in
general, because we somehow need to intercept each individual fork,
launch a watcher process just for that fork, and also map counters so
that they're only shared with that single fork. Since we're not doing
it, we just disallow such combination of options.
Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771
Denis Revunov [Tue, 20 Jun 2023 15:00:36 +0000 (15:00 +0000)]
[BOLT][Instrumentation] Put Allocator itslef in shared memory by default
In absence of instrumentation-file-append-pid option,
global allocator uses shared pages for allocation. However, since it is a
global variable, it gets COW'd after fork if instrumentation-sleep-time
is used, or if a process forks by itself. This means it handles the same
pages to every process which causes hash table corruption. Thus, if we
want shared pages, we need to put the allocator itself in a shared page,
which we do in this commit in __bolt_instr_setup.
I also added a couple of assertions to sanity-check the hash table.
Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771
Denis Revunov [Thu, 15 Jun 2023 15:43:04 +0000 (15:43 +0000)]
[BOLT][Instrumentation] Don't share counters when using append-pid
The point of append-pid option is to record separate profiles for
separate forks, which is impossible when counters are the same for
every process. It leads to a sum of all profiles in every file, plus
GlobalWriteProfileMutex located in a shared memory prevents some
processes from dumping their data at all.
Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D153771
Denis Revunov [Thu, 29 Jun 2023 21:14:45 +0000 (00:14 +0300)]
[BOLT][Instrumentation] Add mmap return value assertions
In a very rare case that mmap call fails, we'll at least get a message
instead of segfault.
Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D154056
Denis Revunov [Thu, 29 Jun 2023 08:57:48 +0000 (11:57 +0300)]
[BOLT][Instrumentation][NFC] define and use mmap flags
Reviewed By: rafauler, Amir
Differential Revision: https://reviews.llvm.org/D154056
Haojian Wu [Thu, 29 Jun 2023 22:02:05 +0000 (00:02 +0200)]
Fix -Wunused-variable in release build.
Brendon Cahoon [Thu, 29 Jun 2023 20:37:56 +0000 (15:37 -0500)]
[AMDGPU] Reserve SGPR pair when long branches are present
Branch relaxation requires 2 additional SGPRs for AMDGPU to handle the
case when an indirect branch target is too far away. The register
scavanger may not find available registers, which causes a “did not find
scavenging index” assert to occur in assignRegToScavengingIndex.
In this patch, we estimate before register allocation whether an
indirect branch is likely to be needed, and reserve 2 SGPRs if the
branch distance is found to be above a threshold. The distance threshold
is an approximation as the exact code size and branch distance are
unknown prior to register allocation.
Patch by Corbin Robeck. Thanks!
Differential Review: https://reviews.llvm.org/D149775
varconst [Thu, 29 Jun 2023 21:49:45 +0000 (14:49 -0700)]
[libc++] Remove the legacy debug mode.
See https://discourse.llvm.org/t/rfc-removing-the-legacy-debug-mode-from-libc/71026
Reviewed By: #libc, Mordante, ldionne
Differential Revision: https://reviews.llvm.org/D153672
Yuanfang Chen [Thu, 1 Dec 2022 02:44:10 +0000 (18:44 -0800)]
[Clang] Implements CTAD for aggregates P1816R0 and P2082R1
Differential Revision: https://reviews.llvm.org/D139837
philass [Thu, 29 Jun 2023 21:14:00 +0000 (14:14 -0700)]
[mlir] Remove self-include from BytecodeOpInterface.h (NFC)
Differential Revision: https://reviews.llvm.org/D153830
Louis Dionne [Wed, 28 Jun 2023 13:22:34 +0000 (09:22 -0400)]
[libc++] Stop using __builtin_assume in _LIBCPP_ASSERT
__builtin_assume can sometimes worsen code generation. For now, the
guideline seems to be to avoid adding assumptions without a clear
optimization intent. Since _LIBCPP_ASSERT is very general, we can't
have a clear optimization intent at this level, which makes
__builtin_assume the wrong tool for the job -- at least until
__builtin_assume is changed.
See https://discourse.llvm.org/t/llvm-assume-blocks-optimization/71609
for a discussion of this.
Differential Revision: https://reviews.llvm.org/D153968
Joseph Huber [Thu, 29 Jun 2023 20:03:18 +0000 (15:03 -0500)]
[libc] Enable the 'div' routines on the GPU
This patch simply enables the `div`, `ldiv,` and, `lldiv` functions on
the GPU. This should be straightforward enough.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D154143
Johannes Doerfert [Mon, 19 Jun 2023 21:58:12 +0000 (14:58 -0700)]
[Attributor][NFC] Introduce IRP helpers for Attr and Arg handling
Johannes Doerfert [Fri, 23 Jun 2023 01:32:25 +0000 (18:32 -0700)]
[Attributor] Remove now obsolete initialization code
With the helpers in place to judge AAs [1] we can remove the custom
rolled initialization checking code. This exposed a minor oversight in
the AAMemoryLocation where we did not check the IR before we gave up for
a declaration.
[1] https://github.com/llvm/llvm-project/commit/
d33bca840a824f59296230e83181012a0b1ba7ec
V Donaldson [Thu, 29 Jun 2023 17:58:05 +0000 (10:58 -0700)]
[flang] Block containing an interface
Name mangling may be invoked for an interface procedure contained in
a block in a context that does not have access to block ID mapping.
Procedures can't be defined inside a block, so name mangling doesn't
need a block map. Relax an assert to account for this.
block
interface
subroutine ss(n) bind(c)
integer :: n
end subroutine
end interface
call ss(5)
end block
end
Ben Langmuir [Wed, 28 Jun 2023 22:54:17 +0000 (15:54 -0700)]
[clang][modules] Avoid serializing all diag mappings in non-deterministic order
When writing a pcm, we serialize diagnostic mappings in order to
accurately reproduce the diagnostic environment inside any headers from
that module. However, the diagnostic state mapping table contains
entries for every diagnostic ID ever accessed, while we only want to
serialize the ones that are actually modified from their default value.
Futher, we need to serialize them in a deterministic order.
rdar://
111477511
Differential Revision: https://reviews.llvm.org/D154016
Daniel Kiss [Thu, 29 Jun 2023 17:31:22 +0000 (19:31 +0200)]
[lld][AArch64] Add BTI landing pad to PLT entries when the symbol is exported.
With relative vtables the caller jumps directly to the plt entries in the shared object,
therefore landing pad is need for these entries.
Reproducer:
main.cpp
```
#include "v.hpp"
int main() {
A* a = new B();
a->do_something2();
return 0;
}
```
v.hpp
```
struct A {
virtual void do_something() = 0;
virtual void do_something2();
};
struct B : public A {
void do_something() override;
void do_something2() override;
};
```
v.cpp
```
#include "v.hpp"
void A::do_something2() { }
void B::do_something() { }
void B::do_something2() { }
```
```
CC="clang++ --target=aarch64-unknown-linux-gnu -fuse-ld=lld -mbranch-protection=bti"
F=-fexperimental-relative-c++-abi-vtables
${=CC} $F -shared v.cpp -o v.so -z force-bti
${=CC} $F main.cpp -L./ v.so -Wl,-rpath=. -z force-bti
qemu-aarch64-static -L /usr/aarch64-linux-gnu -cpu max ./a.out
```
For v.so, the regular vtable entry is relocated by an R_AARCH64_ABS64 relocation referencing _ZN1B13do_something2Ev.
```
_ZTV1B:
.xword _ZN1B13do_something2Ev
```
Using relative vtable entry for a DSO has a downside of creating many PLT entries and making their addresses escape.
The relative vtable entry references a PLT entry _ZN1B13do_something2Ev@plt.
```
.L_ZTV1A.local:
.word (_ZN1A13do_something2Ev@PLT-.L_ZTV1A.local)-8
```
fixes: #63580
Reviewed By: peter.smith, MaskRay
Differential Revision: https://reviews.llvm.org/D153264
LLVM GN Syncbot [Thu, 29 Jun 2023 20:10:25 +0000 (20:10 +0000)]
[gn build] Port
b4ff893877ff
Christopher Ferris [Thu, 29 Jun 2023 02:36:29 +0000 (19:36 -0700)]
[scudo] Use getMonotonicTimeFast for tryLock.
In tryLock, the Precedence value is set using the fast time function
now. This should speed up tryLock calls slightly.
This should be okay even though the value is used as a kind of random
value in getTSDAndLockSlow. The fast time call still sets enough bits
to avoid getting the same TSD on every call.
Reviewed By: Chia-hungDuan
Differential Revision: https://reviews.llvm.org/D154039
Christian Trott [Thu, 29 Jun 2023 19:36:07 +0000 (13:36 -0600)]
[libc++][mdspan] Implement layout_left
This commit implements layout_left in support of C++23 mdspan
(https://wg21.link/p0009). layout_left is a layout mapping policy
whose index mapping corresponds to the memory layout of Fortran arrays.
Thus the left most index has stride-1 access, and the right most index
is associated with the largest stride.
Co-authored-by: Damien L-G <dalg24@gmail.com>
Differential Revision: https://reviews.llvm.org/D153783
Fangrui Song [Thu, 29 Jun 2023 19:53:31 +0000 (12:53 -0700)]
Revert D145226 "[mlir][Transforms][NFC] CSE: Add non-pass entry point"
This reverts commit
189033e6bede96de0d74e61715fcd1b48d95e247.
This commit causes memory leak. See comments on D145226.
Johannes Doerfert [Thu, 29 Jun 2023 17:22:04 +0000 (10:22 -0700)]
[Attributor][FIX] Check AA preconditions
AAs often have preconditions, e.g., that the associated type is a
pointer type. If these do not hold, we do not need to bother creating
the AA. Best case, we invalidate it right away, worst case, we crash or
do something wrong (as happend in the issues below).
Fixes: https://github.com/llvm/llvm-project/issues/63553
Fixes: https://github.com/llvm/llvm-project/issues/63597
Johannes Doerfert [Thu, 29 Jun 2023 19:01:39 +0000 (12:01 -0700)]
[Attributor][FIX] Ensure AAAssumptionInfo properly reports change
I have no test as I just noticed the wrong change status reported by
update randomly.
Johannes Doerfert [Fri, 23 Jun 2023 21:32:31 +0000 (14:32 -0700)]
[Attributor] Introduce helpers to judge AAs prior to creation
This is a partial cleanup to centralize the initialization and update
decisions for AAs. Lifting the burdon and boilerplate on users and
making it harder to accidentally perform unsound deductions.
The two static helpers show how we can lift the decisions to generate an
AA into the Attributor, avoiding trivial AAs that just cost us compile
time and maintenance code (to check for pre-conditions).
John Harrison [Thu, 29 Jun 2023 18:53:52 +0000 (14:53 -0400)]
[lldb-vscode] Adjusting CreateSource to detect compiler generated frames.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D154026
Antonio Frighetto [Thu, 29 Jun 2023 18:32:55 +0000 (20:32 +0200)]
[ConstraintElimination] Handle solving-only `ICMP_NE` predicates
Simplification of non-equality predicates for solving constraint
systems is now supported by checking the validity of related
inequalities and equalities.
Differential Revision: https://reviews.llvm.org/D152684
Sam McCall [Thu, 29 Jun 2023 19:20:53 +0000 (21:20 +0200)]
[dataflow] fix compile on gcc7
Reported on https://reviews.llvm.org/D153674
This returned expression is move-eligible, this is a bug in old GCC.
Jennifer Yu [Wed, 21 Jun 2023 23:26:35 +0000 (16:26 -0700)]
[OMP5.2] Initial support for doacross clause.
Yaxun (Sam) Liu [Thu, 29 Jun 2023 13:00:39 +0000 (09:00 -0400)]
[HIP] Fix version detection for old HIP-PATH
ROCm used to install components under individual directories,
e.g. HIP installed to /opt/rocm/hip and rocblas installed to
/opt/rocm/rocblas. ROCm has transitioned to a flat directory
structure where all components are installed to /opt/rocm.
HIP-PATH and --hip-path are supposed to be /opt/rocm as
clang detect HIP version by /opt/rocm/share/hip/version.
However, some existing HIP app still uses HIP-PATH=/opt/rocm/hip.
To avoid regression, clang will also try detect share/hip/version
under the parent directory of HIP-PATH or --hip-path.
This way, the detection will work for both new HIP-PATH and
old HIP-PATH.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D154077
Fixes: SWDEV-407757
Alexey Bataev [Thu, 29 Jun 2023 18:44:51 +0000 (11:44 -0700)]
[SLP][NFC]Add a test for buildvector with reused scalars and
extractelements.
John Harrison [Thu, 29 Jun 2023 18:49:17 +0000 (14:49 -0400)]
[lldb-vscode] Prior to running the launchCommands during a launch request set the launch info so the configured launch information is accessible by the launch commands.
Reviewed By: wallace
Differential Revision: https://reviews.llvm.org/D154028
John Harrison [Thu, 29 Jun 2023 16:56:50 +0000 (12:56 -0400)]
Creating a startDebugging reverse DAP request handler in lldb-vscode.
Adds support for a reverse DAP request to startDebugging. The new request can be used to launch child processes from lldb scripts, for example it would be start forward to configure a debug configuration for a server and a client allowing you to launch both processes with a single debug configuraiton.
Reviewed By: wallace, ivanhernandez13
Differential Revision: https://reviews.llvm.org/D153447
Aart Bik [Wed, 28 Jun 2023 19:54:12 +0000 (12:54 -0700)]
[mlir][sparse] Start migration to new surface syntax for STEA
We are in the progress of migrating to a much improved surface syntax for the Sparse Tensor Encoding Attribute (STEA).
You can see a preview of this in the StableHLO RFC at
https://github.com/openxla/stablehlo/blob/main/rfcs/
20230210-sparsity.md
//**This design is courtesy Wren Romano.**//
This initial revision
(1) Introduces the first version of a new parser written by Wren Romano
(2) Introduces a simple "migration plan" using NEW_SYNTAX on the STEA, which will allow us to test the new parser with new examples, as well as migrate existing examples over without the need to rewrite them all
This first "drop" merely provides the entry points to parse the new syntax. The parser is still under active development. For example, we need to address the "lookahead" issue when parsing the lvl spec (viz. do we see l0 = d0 or a direct d0). Another larger task is to actually implement "affine" parsing (since the MLIR affine parser is not accessible in other parts of the tree).
EXAMPLE:
Currently, CSR looks like
#CSR = #sparse_tensor.encoding<{
lvlTypes = ["dense","compressed"],
dimToLvl = affine_map<(i,j) -> (i,j)>
}>
but you can "force" the new parser with
#CSR = #sparse_tensor.encoding<{
NEW_SYNTAX =
(d0, d1) -> (l0 = d0 : dense, l1 = d1 : compressed)
}>
Reviewed By: Peiming
Differential Revision: https://reviews.llvm.org/D153997
Arthur Eubanks [Thu, 29 Jun 2023 18:27:15 +0000 (11:27 -0700)]
[gn build] Fix tablegen dependencies
The source_set needs to depend on Support so llvm-config files are generated first.
Joseph Huber [Thu, 29 Jun 2023 17:03:40 +0000 (12:03 -0500)]
[libc] Fix the implementation of exit on the GPU
The RPC calls all have delays associated with them. Currently the `exit`
function does an async send and immediately exits the GPU. This can have
the effect that the RPC server never sees the exit call and we continue.
This patch changes that to first sync with the server before continuing
to perform its exit. There is still a hazard here, where the kernel can
complete before the RPC call reads back its response, but this is simply
multi-threaded hazards. This change ensures that the server *will*
always exit some time after the GPU exits.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D154112
Aiden Grossman [Thu, 29 Jun 2023 18:16:41 +0000 (18:16 +0000)]
[llvm-exegesis] Change map address in memory annotation tests
Test failures have been reported by some LLVM developers in regards to
the low value of of the location where the memory is being mapped into
the virtual address space as it causes problems with some default
configurations of vm.mmap_min_addr. This patch sets it to 2^20 (1048576)
to alleviate this issues as most distros seem to use a default value of
65536.
wlei [Thu, 29 Jun 2023 00:21:40 +0000 (17:21 -0700)]
[CSSPGO] Enable stale profile matching by default for CSSPGO
We tested the stale profile matching on several Meta's internal services, all results are positive, for instance, in one service that refreshed its profile every one or two weeks, it consistently gave 1~2% performance improvement. We also observed an instance that a trivial refactoring caused a 2% regression and the matching can successfully recover the whole regression. Therefore, we'd like to turn it on by default for CSSPGO.
Reviewed By: hoy, wenlei
Differential Revision: https://reviews.llvm.org/D154027
Slava Zakharin [Thu, 29 Jun 2023 17:39:52 +0000 (10:39 -0700)]
[flang][hlfir] Set/propagate 'unordered' attribute for elementals.
This patch adds 'unordered' attribute handling the HLFIR elementals'
builders and fixes the attribute handling in lowering and transformations.
Depends on D154031, D154032
Reviewed By: jeanPerier, tblah
Differential Revision: https://reviews.llvm.org/D154035
Slava Zakharin [Thu, 29 Jun 2023 17:39:40 +0000 (10:39 -0700)]
[flang][hlfir] Do not inline ordered elementals.
This patch just disables inlining of ordered hlfir.elemental operations.
Proving the safeness of inlining is left for future development.
Depends on D154032
Reviewed By: jeanPerier, tblah
Differential Revision: https://reviews.llvm.org/D154034
Noah Goldstein [Thu, 29 Jun 2023 07:37:23 +0000 (02:37 -0500)]
[InstCombine] Canonicalize `(icmp eq/ne (and x, C), x)` -> `(icmp eq/ne (and x, ~C), 0)`
This increases the likelyhood `x` is single-use and is typically
easier to analyze.
Proofs: https://alive2.llvm.org/ce/z/8ZpS2W
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D154004
Mark de Wever [Thu, 29 Jun 2023 17:56:28 +0000 (19:56 +0200)]
[NFC][libc++] Use a better type_trait to show the intention.
Igor Kirillov [Mon, 12 Jun 2023 10:18:16 +0000 (10:18 +0000)]
[LV] Add mask support for vectorizing interleaved groups
This patch extends LoopVectorize to handle the vectorization of interleaved
memory accesses with scalable vectors when mask is required or/and predicated
tail folding is enabled.
Differential Revision: https://reviews.llvm.org/D152258
Luke Lau [Thu, 29 Jun 2023 16:04:41 +0000 (16:04 +0000)]
[SLP] Explicitly pass AccessTy to getGEPCost
Building on D149889, this patch updates SLP to pass the vector type as
the AccessTy to getGEPCost.
This should have the effect of GEPs being costed for more often instead
of being treated as foldable into the address mode and thus free, as
some architectures, notably RISC-V, do not have offset+reg addressing
modes for vector memory accesses.
Note that in SLP, GEPs are costed in two places: getPointersChainCost
and GetGEPCostDiff.
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D153570
Luke Lau [Thu, 29 Jun 2023 12:26:55 +0000 (12:26 +0000)]
[RISCV][SLP] Add tests for unprofitable SLP vectorization due to GEP. NFC
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D149888
Slava Zakharin [Thu, 29 Jun 2023 16:41:44 +0000 (09:41 -0700)]
[flang][hlfir] Codegen for unordered elemental operations.
Depends on D154031, D154032
Reviewed By: jeanPerier, tblah
Differential Revision: https://reviews.llvm.org/D154033
Slava Zakharin [Thu, 29 Jun 2023 16:41:43 +0000 (09:41 -0700)]
[flang][hlfir] Parse unordered attribute for elemental operations.
By default, `hlfir.elemental` and `hlfir.elemental_addr` must process
the elements in order. The `unordered` attribute may be set,
if it is safe to process the elements out of order.
This patch just adds parsing support for the new attribute.
Reviewed By: jeanPerier, tblah
Differential Revision: https://reviews.llvm.org/D154032
Slava Zakharin [Thu, 29 Jun 2023 16:41:36 +0000 (09:41 -0700)]
[flang][hlfir] Lower ordered elemental subroutine calls.
This patch sets `unordered` `fir.do_loop` attribute during lowering
of elemental subroutine calls to HLFIR, when it is safe to do so.
Proper handling of `hlfir.elemental` will be done in a separate patch.
Reviewed By: jeanPerier, tblah
Differential Revision: https://reviews.llvm.org/D154031
Sergei Barannikov [Sat, 24 Jun 2023 10:34:12 +0000 (13:34 +0300)]
[clang][CodeGen] Remove no-op EmitCastToVoidPtr (NFC)
Reviewed By: JOE1994
Differential Revision: https://reviews.llvm.org/D153694
Craig Topper [Thu, 29 Jun 2023 17:23:39 +0000 (10:23 -0700)]
[RISCV] Add a helper class for creating GPR register classes.
Reduces the amount of repeated template parameters for every class.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D154042
Joseph Huber [Thu, 29 Jun 2023 16:32:50 +0000 (11:32 -0500)]
[OpenMP] Adjust using the NVPTX architecture detection tool
A previous patch by @arsenm adjusted these to find the `amdgpu-arch`
tool correctly if we do a `LLVM_ENABLE_PROJECTS` build. This patch
applies the same to `nvptx-arch` tool to keep it consistent.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D154107
Scott Todd [Thu, 22 Jun 2023 19:27:41 +0000 (12:27 -0700)]
[mlir][docgen] Handle Windows line endings in doc generation.
The `printReindented` function searches for Unix style line endings (`\n`), but strings may have Windows style line endings (`\r\n`). Prior to this change, generated document sections could have extra indentation, which some markdown renderers interpret as code blocks rather than paragraphs.
Differential Revision: https://reviews.llvm.org/D153591
Emilia Kond [Thu, 29 Jun 2023 16:46:04 +0000 (19:46 +0300)]
[clang-format] Correctly annotate operator free function call
The annotator correctly annotates an overloaded operator call when
called as a member function, like `x.operator+(y)`, however, when called
as a free function, like `operator+(x, y)`, the annotator assumed it was
an overloaded operator function *declaration*, instead of a call.
This patch allows for a free function call to correctly be annotated as
a call, but only if the current like cannot be a declaration, usually
within the bodies of a function.
Fixes https://github.com/llvm/llvm-project/issues/49973
Reviewed By: HazardyKnusperkeks, owenpan, MyDeveloperDay, Nuullll
Differential Revision: https://reviews.llvm.org/D153798
Carlos Eduardo Seo [Thu, 29 Jun 2023 14:08:10 +0000 (11:08 -0300)]
Replace sprintf by snprintf
The macOS toolchain deprecated sprintf in favor of snprintf. This was blocking
the build on macOS. Replaced all instances of sprintf by snprintf.
Valentin Clement [Thu, 29 Jun 2023 16:45:12 +0000 (09:45 -0700)]
[openacc] Allow async, wait and device_type on the data construct
From OpenACC 3.2 specification:
The async, wait, and device_type clauses may be specified on data
constructs.
This patch adds these clauses in the ACC.td file and adds some tests
for them in flang parsing.
Reviewed By: razvanlupusoru
Differential Revision: https://reviews.llvm.org/D154013
Jean Perier [Thu, 29 Jun 2023 16:38:18 +0000 (18:38 +0200)]
[flang] Fix array substring emboxing code generation
The code generation of the fir.embox op creating descriptors for
array substring with a non constant length base was using the
substring length to compute the first dimension result stride.
Fix it to use the input length instead.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D154086
Fangrui Song [Thu, 29 Jun 2023 16:39:57 +0000 (09:39 -0700)]
[RISCV] Make linker-relaxable instructions terminate MCDataFragment
`MCExpr::evaluateAsAbsolute` has a longstanding bug. When the MCAssembler is
non-null and the MCAsmLayout is null, it may incorrectly fold A-B even if A and
B are separated by a linker-relaxable instruction. This behavior can suppress
some ADD/SUB relocations and lead to wrong results if the linker performs
relaxation.
To fix the bug, ensure that linker-relaxable instructions only appear at the end
of an MCDataFragment, thereby making them terminate the fragment. When computing
A-B, suppress folding if A and B are separated by a linker-relaxable
instruction.
* `.subsection` now correctly give errors for non-foldable expressions.
* gen-dwarf.s will pass even if we add back the .debug_line or .eh_frame/.debug_frame code from D150004
* This will fix suppressed relocation when we add R_RISCV_SET_ULEB128/R_RISCV_SUB_ULEB128.
In the future, we should investigate the desired behavior for
`MCExpr::evaluateAsAbsolute` when both MCAssembler and MCAsmLayout are non-null.
(Note: MCRelaxableFragment is only for assembler-relaxation. If we ever need
linker-relaxable MCRelaxableFragment, we would need to adjust RISCVMCExpr.cpp
(D58943/D73211).)
Depends on D153096
Differential Revision: https://reviews.llvm.org/D153097
Arthur Eubanks [Mon, 26 Jun 2023 16:51:22 +0000 (09:51 -0700)]
[PassBuilder] Add textual representation for function simplification pipeline
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D153784
Jean Perier [Thu, 29 Jun 2023 16:36:05 +0000 (18:36 +0200)]
[flang] Support CHARACTER(4) pointer targets
fir.rebox is emitting an llvm.sdiv to compute the character length
given the byte size from the input descriptor.
Inside a fir.global, this is not needed given the target length must
be accessible via the type, and it caused MLIR to fail LLVM IR
code generation (and crash).
Use the input type length when available instead.
Reviewed By: PeteSteinfeld, vzakhari
Differential Revision: https://reviews.llvm.org/D154072
Arthur Eubanks [Thu, 29 Jun 2023 16:36:10 +0000 (09:36 -0700)]
[NFC] Update stale comment after D154001
Arthur Eubanks [Wed, 28 Jun 2023 21:08:38 +0000 (14:08 -0700)]
[ScalarEvolution] Analyze ranges for heap allocations
Followup to D153624. Allows for better exit count calculations for loops checking heap allocations against null.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D154001
Arthur Eubanks [Wed, 28 Jun 2023 21:04:57 +0000 (14:04 -0700)]
[test] Precommit SCEV test
Johannes Doerfert [Tue, 20 Jun 2023 04:37:21 +0000 (21:37 -0700)]
[Attributor][NFC] Introduce a flag to skip liveness checks
While we can disallow AAs, liveness checks are everywhere and if the
user doesn't want them it is costly to go through just to find out
everything is assumed live.
Johannes Doerfert [Wed, 28 Jun 2023 00:31:11 +0000 (17:31 -0700)]
[OpenMPOpt] Properly check AA pointers
The interface was changed to return pointers, so we need to check them
for null now at they might actually be null in the future).
Johannes Doerfert [Wed, 28 Jun 2023 00:29:31 +0000 (17:29 -0700)]
[AAAMDAttributes] AAPointerInfo depends on AAUnderlyingObjects
Johannes Doerfert [Wed, 28 Jun 2023 00:20:21 +0000 (17:20 -0700)]
[AMDGPUAttributor][NFC] Make the debug output meaningful
Zhiheng Xie [Thu, 29 Jun 2023 11:37:49 +0000 (04:37 -0700)]
[OpenMP] Fix lvalue reference type generation in untied task loop
For variables with lvalue reference type in untied task loop,
it now wrongly sets its actual type as ElementType. It should
be converted to pointer type.
It fixes https://github.com/llvm/llvm-project/issues/62965
Reviewed By: ABataev
Differential Revision: https://reviews.llvm.org/D153321
Scott Linder [Tue, 27 Jun 2023 19:03:37 +0000 (19:03 +0000)]
[NFC][AMDGPU] Refactor AMDGPUDisassembler
Clean up ahead of a patch to fix bugs in the AMDGPUDisassembler.
Use split-file to simplify and extend existing kernel-descriptor
disassembly tests.
Add a comment to AMDHSAKernelDescriptor.h, as at least one small set
towards keeping all kernel-descriptor sensitive code in sync.
Reviewed By: MaskRay, kzhuravl, arsenm
Differential Revision: https://reviews.llvm.org/D130105
Valentin Clement [Thu, 29 Jun 2023 16:05:21 +0000 (09:05 -0700)]
[flang][openacc] Fix name resolution for fct name in acc routine
Name resolution was failing when the routine name is
a function/subroutine in the parent scope.
Reviewed By: vzakhari
Differential Revision: https://reviews.llvm.org/D154002
sstwcw [Thu, 29 Jun 2023 15:37:06 +0000 (15:37 +0000)]
[clang-format] Indent Verilog struct literal on new line
Before:
```
c = //
'{default: 0};
```
After:
```
c = //
'{default: 0};
```
If the line has to be broken, the continuation part should be
indented. Before this fix, it was not the case if the continuation
part was a struct literal. The rule that caused the problem was added
in
783bac6b. It was intended for aligning the field labels in
ProtoBuf. The type `TT_DictLiteral` was only for colons back then, so
the program didn't have to check whether the token was a colon when it
was already type `TT_DictLiteral`. Now the type applies to more
things including the braces enclosing a dictionary literal. In
Verilog, struct literals start with a quote. The quote is regarded as
an identifier by the program. So the rule for aligning the fields in
ProtoBuf applied to this situation by mistake.
Reviewed By: HazardyKnusperkeks
Differential Revision: https://reviews.llvm.org/D152623
Arnold Schwaighofer [Thu, 29 Jun 2023 15:07:11 +0000 (08:07 -0700)]
Add a type_checked_load_relative to support relative function pointer tables
This adds a type_checked_load_relative intrinsic whose semantics it is to
load a relative function pointer.
A relative function pointer is a pointer to a 32bit value that when
added to its address yields the address of the function.
Differential Revision: https://reviews.llvm.org/D143204
Peter Klausler [Fri, 23 Jun 2023 18:01:33 +0000 (11:01 -0700)]
[flang] Honor #line and related preprocessing directives
Extend the SourceFile class to take account of #line directives
when computing source file positions for error messages.
Adjust the output of #line directives to -E output so that they
reflect any #line directives that were in the input.
Differential Revision: https://reviews.llvm.org/D153910
Jeffrey Byrnes [Fri, 23 Jun 2023 21:42:30 +0000 (14:42 -0700)]
[HIP]: Add -fhip-emit-relocatable to override link job creation for -fno-gpu-rdc
Differential Revision: https://reviews.llvm.org/D153667
Change-Id: Idcc5c7c25dc350b8dc9a1865fd67982904d06ecd
Haojian Wu [Thu, 29 Jun 2023 11:57:36 +0000 (13:57 +0200)]
[clangd] Don't show header for namespace decl in Hover
The header for namespace symbol is barely useful.
Differential Revision: https://reviews.llvm.org/D154068