Craig Topper [Tue, 2 Aug 2022 16:29:39 +0000 (09:29 -0700)]
[RISCV] Add scheduler classes to PseudoVMV*R_V.
I think these pseudos will exist when the post-RA scheduler runs
so they should have sched classes.
Reviewed By: monkchiang
Differential Revision: https://reviews.llvm.org/D130945
Craig Topper [Tue, 2 Aug 2022 16:29:22 +0000 (09:29 -0700)]
[RISCV] Add scheduler class to PseudoReadVLENB.
Reviewed By: monkchiang
Differential Revision: https://reviews.llvm.org/D130938
Alexander Timofeev [Mon, 1 Aug 2022 18:15:48 +0000 (20:15 +0200)]
[AMDGPU] avoid blind converting to VALU REG_SEQUENCE and PHIs
In the
2e29b0138ca243 we introduce a specific solving algorithm
that analyzes the VGPR to SGPR copies use chains and either lowers
the copy to v_readfirstlane_b32 or converts the whole chain to VALU forms.
Same time we still have the code that blindly converts to VALU REG_SEQUENCE and PHIs
in case they produce SGPR but have VGPRs input operands. In case the REG_SEQUENCE and PHIs
are in the VGPR to SGPR copy use chain, and this chain was considered long enough to convert
copy to v_readfistlane_b32, further lowering them to VALU leads to several kinds of issues.
At first, we have v_readfistlane_b32 which is completely useless because most parts of its use chain
were moved to VALU forms. Second, we may encounter subtle bugs related to the EXEC-dependent CF
because of the weird mixing of SALU and VALU instructions.
This change removes the code that moves REG_SEQUENCE and PHIs to VALU. Instead, we use the fact
that both REG_SEQUENCE and PHIs have copy semantics. That is, if they define SGPR but have VGPR inputs,
we insert VGPR to SGPR copies to make them pure SGPR. Then, the new copies are processed by the common
VGPR to SGPR lowering algorithm.
This is Part 2 in the series of commits aiming at the massive refactoring of the SIFixSGPRCopies pass.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D130367
Jay Foad [Thu, 21 Jul 2022 12:14:06 +0000 (13:14 +0100)]
[AMDGPU] Remove IR SpeculativeExecution pass from codegen pipeline
This pass seems to have very little effect because all it does is hoist
some instructions, but it is followed later in the codegen pipeline by
the IR CodeSinking pass which does the opposite.
Differential Revision: https://reviews.llvm.org/D130258
John Regehr [Tue, 2 Aug 2022 16:32:49 +0000 (10:32 -0600)]
llvm-reduce: reorder passes to run the ones first that delete function bodies; this makes reductions go faster
Jay Foad [Tue, 2 Aug 2022 16:09:58 +0000 (17:09 +0100)]
[AMDGPU] Take advantage of VOP3 literals in convertToThreeAddress
This improves a corner case where v_fmac can be converted to v_fma on
GFX10+ even if it has a literal operand.
Differential Revision: https://reviews.llvm.org/D130992
Alok Kumar Sharma [Mon, 11 Oct 2021 05:52:28 +0000 (11:22 +0530)]
[clang][OpenMP][DebugInfo] Mark OpenMP generated functions as artificial
The Clang compiler generates internal functions for OpenMP. Current
patch marks these functions as artificial.
Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D111521
Philip Reames [Tue, 2 Aug 2022 15:03:01 +0000 (08:03 -0700)]
[LV] Recognize store of invariant value to invariant address as uniform
This extends the handling of uniform memory operations to handle the case where a store is storing a loop invariant value. Unlike the general case of a store to an invariant address where we must use the last active lane, in this case we can use any lane since all lanes must produce the same result.
For context, the basic structure of the existing code and how the change fits in:
* First, we select a widening strategy. (The result is irrelevant for this patch.)
* Then we determine if a computation is uniform within all lanes of VF. (Note this is the uniform-per-part definition, not LAI's uniform across all unrolled iterations definition.)
* If it is, we overrule the widening strategy, and unconditionally scalarize.
* VPReplicationRecipe - which is what actually does the scalarization - knows how to handle unform-per-part values including for scalable vectors. However, we do need to know that the expression is safe to execute without predication - e.g. the uniform mem op was unconditional in the original loop. (This part was split off and already landed.)
An obvious question is why not simply implement the generic case? The answer is that I'm going to, but doing so without a canonicalization towards uniform causes regressions due to bad interaction with scalarization/uniformity of values feeding the uniform mem-op. This patch is needed to avoid those regressions.
Differential Revision: https://reviews.llvm.org/D130364
Peixin Qiao [Tue, 2 Aug 2022 15:07:02 +0000 (23:07 +0800)]
[flang] Add some semantic checks for derived type with BIND attribute
This supports checks in C1801-C1805 for derived type with BIND attribute.
The other compilers such as 'gfortran' and 'ifort' do not report error
for C1802 and C1805, so emit warnings for them.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D130438
Peixin Qiao [Tue, 2 Aug 2022 15:02:12 +0000 (23:02 +0800)]
[flang] Support extention intrinsic ABORT
The semantic checks and runtime have been supported. This supports the
lowering of intrinsic ABORT.
`gfortran` prints a backtrace before abort, unless `-fno-backtrace` is
given. This is good to use. The intrinsic BACKTRACE is not supported
yet, so add TODO in the runtime.
This extention is needed in SPEC2017 521.wrf_r in
https://github.com/llvm/llvm-project/issues/55955.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D130439
Peixin Qiao [Tue, 2 Aug 2022 14:59:28 +0000 (22:59 +0800)]
[flang] Support lowering of intrinsic module procedure `c_loc`
As Fortran 2018 18.2.3.6, the intrinsic `c_loc(x)` gets the C address
of argument `x`. It returns the scalar of type C_PTR. As defined in
iso_c_binding in `flang/module/__fortran_builtins.f90`, C_PTR is the
derived type with only one component of integer 64.
This supports the lowering of intrinsic module procedure `c_loc` by
converting the address of argument into integer 64, where the argument
is lowered as Box and the address is generated using fir.box_addr.
The lowering of intrinsic `c_funloc` has the similar characteristic and
will be supported later.
The execution tests for various data types are in issue
https://github.com/llvm/llvm-project/issues/56552.
Reviewed By: Jean Perier
Differential Revision: https://reviews.llvm.org/D129659
Phoebe Wang [Tue, 2 Aug 2022 13:58:15 +0000 (21:58 +0800)]
[X86][FP16] Fix vector_shuffle and lowering without f16c feature problems
The problem Alexander reported on D127982 was caused by an optimization
for AVX512-FP16 instruction. We must limit it to the feature enabled only.
During the investigation, I found we didn't expand for fp_round/fp_extend
without F16C. This may result runtime crash, so change them too.
Reviewed By: RKSimon
Differential Revision: https://reviews.llvm.org/D130817
Pavel Labath [Wed, 9 Mar 2022 15:00:26 +0000 (16:00 +0100)]
[lldb] Create an enum to specify the kind of ArchSpec matching
s/true/ArchSpec::ExactMatch
s/false/ArchSpec::CompatibleMatch
Differential Revision: https://reviews.llvm.org/D121290
Gabriel Ravier [Tue, 2 Aug 2022 13:52:31 +0000 (09:52 -0400)]
[lld] Fixed a number of typos
I went over the output of the following mess of a command:
`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`
and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).
Differential Revision: https://reviews.llvm.org/D130982
Aaron Ballman [Tue, 2 Aug 2022 13:39:36 +0000 (09:39 -0400)]
Revert "Missing tautological compare warnings due to unary operators"
This reverts commit
0cc3c184c784d5f0d55de8ad0a9eeee876acd149.
The changes did not account for templated code where one instantiation
may trigger the diagnostic but other instantiations will not, as in:
```
template <int I, class T>
void foo(int x) {
bool b1 = (x & sizeof(T)) == 8;
bool b2 = (x & I) == 8;
bool b3 = (x & 4) == 8;
}
void run(int x) {
foo<4, int>(8);
}
```
Simon Tatham [Tue, 2 Aug 2022 09:24:30 +0000 (10:24 +0100)]
[yaml2obj] Add a `-E` flag to preprocess only.
If you're having trouble getting a yaml2obj macro expansion to do what
you want, it's useful to be able to print the output of the
preprocessing to see what your macros expanded to //before// going
into the YAML processing phase.
yaml2obj has its own preprocessing system which isn't the same as any
other well-known thing like cpp. So there's no way to do this macro
expansion via another tool: yaml2obj will have to do it itself.
In this commit I add an `-E` flag to yaml2obj to do that.
Differential Revision: https://reviews.llvm.org/D130981
Jay Foad [Fri, 29 Jul 2022 10:40:11 +0000 (11:40 +0100)]
[IRBuilder] CreateIntrinsic with implicit mangling
Add a new IRBuilderBase::CreateIntrinsic which takes the return type and
argument values for the intrinsic call but does not take an explicit
list of types to mangle. Instead the builder works this out from the
intrinsic declaration and the types of the supplied arguments.
This means that the mangling is hidden from the client, which in turn
means that intrinsic definitions can change which arguments are mangled
without requiring any changes to the client code.
Differential Revision: https://reviews.llvm.org/D130776
David Green [Tue, 2 Aug 2022 12:01:59 +0000 (13:01 +0100)]
[AArch64] Fold Mul(And(Srl(X, 15), 0x10001), 0xffff) to CMLTz
This folds a v4i32 Mul(And(Srl(X, 15), 0x10001), 0xffff) into a v8i16
CMLTz instruction. The Srl and And extract the top bit (whether the
input is negative) and the Mul sets all values in the i16 half to all
1/0 depending on if that top bit was set. This is equivalent to a v8i16
CMLTz instruction. The same applies to other sizes with equivalent
constants.
Differential Revision: https://reviews.llvm.org/D130874
Muhammad Omair Javaid [Tue, 2 Aug 2022 11:57:05 +0000 (16:57 +0500)]
[LLDB] Skip buildbot failures AArch64/Windows
TestInlineStepping.py is flaky while TestUseSourceCache.py fails on
Windows 11 only. Marked them skipped to make buildbot happy.
jacquesguan [Tue, 2 Aug 2022 03:36:50 +0000 (11:36 +0800)]
[mlir][Math] Add constant folder for TanhOp.
This patch adds constant folder for TanhOp which only supports single and double precision floating-point.
Differential Revision: https://reviews.llvm.org/D130960
David Green [Tue, 2 Aug 2022 11:29:40 +0000 (12:29 +0100)]
[AArch64] Mul fold tests for D130874. NFC
Alex Zinenko [Tue, 2 Aug 2022 11:22:40 +0000 (13:22 +0200)]
[mlir] add TOC to top-level documents
Multiple top-level MLIR documents did not have a table of contents tag,
making them harder to nagivate.
Igor Zhukov [Tue, 2 Aug 2022 10:46:31 +0000 (12:46 +0200)]
[libc++] Implement P2499R0 (`string_view` range constructor should be `explicit`)
Reviewed By: #libc, philnik, Mordante
Spies: Mordante, jloser, philnik, libcxx-commits
Differential Revision: https://reviews.llvm.org/D130785
Gabriel Ravier [Tue, 2 Aug 2022 10:42:04 +0000 (12:42 +0200)]
[libcxx] Fixed a number of typos
I went over the output of the following mess of a command:
`(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z | parallel --xargs -0 cat | aspell list --mode=none --ignore-case | grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n | grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)`
and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).
Reviewed By: #libc, philnik
Spies: philnik, libcxx-commits, mgorny, arichardson
Differential Revision: https://reviews.llvm.org/D130905
Simon Pilgrim [Tue, 2 Aug 2022 10:38:47 +0000 (11:38 +0100)]
[DAG] matchRotateSub - ensure the (pre-extended) shift amount is wide enough for the amount mask (PR56859)
matchRotateSub is given shift amounts that will already have stripped any/zero-extend nodes from - so make sure those values are wide enough to take a mask.
Adrian Kuegel [Tue, 2 Aug 2022 10:31:22 +0000 (12:31 +0200)]
[mlir] Update comment now that DenseArrayAttr has Tensor type.
Andrzej Warzynski [Tue, 26 Jul 2022 09:49:29 +0000 (09:49 +0000)]
[flang][docs][nfc] Refine FlangOptionsDocs.td
Currently, FlangOptionsDocs.td doesn't specify `ExcludedFlags` which
means that in the generated documentation file we expose flags that:
* we don't necessarily won't to advertise to our users (e.g. hidden flags), or
* are not supported altogether (e.g. CL options).
This patch defines `ExcludeFlags` to fix that. The definition of
`ExcludeFlags` was copied from Clang so that LLVM frontends have
consistent documentation.
It might be a bit counter-intuitive that IncludeFlags alone is not
sufficient here. However, the current logic in ClangOptionDocEmitter.cpp
will parse IncludeFlags and print all options that contains one of the
included flags, as well as their aliases. So, for example, for -fopenmp
(which is a supported Flang option), one would also get /fopenmp (i.e.
CL mode equivalent for -fopenmp). By adding ExcludeFlags, we make sure
that such aliases are excluded.
I've also taken the liberty and moved FlangOptionsDocs.td. Originally it
was located in Flang's "flang/include" directory, but there shouldn't be
any implementation/documentation files there. Instead, I'm moving it to
the "flang/docs" directory.
Differential Revision: https://reviews.llvm.org/D130558
Dawid Jurczak [Tue, 2 Aug 2022 08:17:50 +0000 (10:17 +0200)]
[NFC] Remove some boilerplate from SmallVector header
In SmallVector header we use couple of times exactly same enable_if,
in this change we de-duplicate it and declare only once.
Extracted from: https://reviews.llvm.org/D129990
Differential Revision: https://reviews.llvm.org/D130779
Stephan Herhut [Tue, 2 Aug 2022 08:21:02 +0000 (10:21 +0200)]
[mlir] Use EXPECT_DEBUG_DEATH in unit test
This allows the tests to also pass when compiled in opt mode.
David Sherwood [Mon, 18 Jul 2022 09:36:11 +0000 (10:36 +0100)]
[AArch64][LoopVectorize] Disable tail-folding for SVE when loop has interleaved accesses
If we have interleave groups in the loop we want to vectorise then
we should fall back on normal vectorisation with a scalar epilogue. In
such cases when tail-folding is enabled we'll almost certainly go on to
create vplans with very high costs for all vector VFs and fall back on
VF=1 anyway. This is likely to be worse than if we'd just used an
unpredicated vector loop in the first place.
Once the vectoriser has proper support for analysing all the costs
for each combination of VF and vectorisation style, then we should
be able to remove this.
Added an extra test here:
Transforms/LoopVectorize/AArch64/sve-tail-folding-option.ll
Differential Revision: https://reviews.llvm.org/D128342
Alex Bradbury [Tue, 2 Aug 2022 08:43:32 +0000 (09:43 +0100)]
[RISCV][NFCI] Set TransientStackAlignment and rely on it rather than RVV-specific logic on RVV-less functions
* TargetFrameLowering has a TransientStackAlignment field that "returns
the number of bytes to which the stack pointer must be aligned at all
times, even between calls.
* As explained in the [RISC-V calling
convention](https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-cc.adoc),
the stack pointer must remain fully aligned throughout execution for
compliant code. This is important for embedded targets that might avoid
realigning the stack pointer for interrupt service routines. Systems
running full OSes may always realign the stack anyway.
* TransientStackAlignment is used in estimateStackSize in
MachineFrameInfo and in PEI::calculateFrameObjectOffsets.
* estimateStackSize is only used in the RISC-V backend for scavenging
slots. It may be possible to craft a function where the difference
is observable, but it wouldn't be a meaningful test.
* calculateFrameObjectOffsets makes use of TransientStackAlignment,
but then sets the stack alignment to the max of that alignment and
MaxAlign, which is unconditionally set to 16 in
RISCVFrameLowering::processFunctionBeforeFrameFinalized
* I've changed this logic to only set MaxAlign if there are RVV frame
objects. There should be no functional change here for either RVV
targets (MaxAlign is set as before) or non-RVV targets
(TransientStackAlign is now 16 anyway).
Differential Revision: https://reviews.llvm.org/D130068
Tim Northover [Fri, 29 Jul 2022 13:39:44 +0000 (14:39 +0100)]
Outliner: add "target-cpu" feature from source function to outlined
The CPU is used to determine which inline asm instructions are allowed, so
needs to be copied across in case the outlined function contains any.
wanglian [Tue, 2 Aug 2022 07:59:27 +0000 (15:59 +0800)]
[RISCV][NFC] Use defined variable instead some code.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D130687
Martin Storsjö [Tue, 2 Aug 2022 08:15:02 +0000 (11:15 +0300)]
[OpenMP] Fix warnings about unused expressions when OMPT_LOOP_DISPATCH is a no-op. NFC.
This fixes warnings like these:
../runtime/src/kmp_dispatch.cpp:2159:24: warning: left operand of comma operator has no effect [-Wunused-value]
OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
^~~~~
../runtime/src/kmp_dispatch.cpp:2159:31: warning: left operand of comma operator has no effect [-Wunused-value]
OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
^~~~~
../runtime/src/kmp_dispatch.cpp:2159:46: warning: left operand of comma operator has no effect [-Wunused-value]
OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
~~~~~~~ ^~
../runtime/src/kmp_dispatch.cpp:2159:50: warning: expression result unused [-Wunused-value]
OMPT_LOOP_DISPATCH(*p_lb, *p_ub, pr->u.p.st, status);
^~~~~~
Tom Stellard [Fri, 29 Jul 2022 20:26:29 +0000 (20:26 +0000)]
workflows: Fix error when searching for backport reviewers
jacquesguan [Mon, 1 Aug 2022 03:31:57 +0000 (11:31 +0800)]
[LV] Refactor getExtendedAddReductionCost to support other extended reduction more than Add.
Now the API getExtendedAddReductionCost is used to determine the cost of extended Add reduction with optional Mul. For Arm, it could cover the cases. But for other target, for example: RISCV, they support other kinds of extended recution, such as FAdd.
This patch does the following changes:
1, Split getExtendedAddReductionCost into 2 new API: getExtendedReductionCost which handles the extended reduction with addtional input of Opcode; getMulAccReductionCost which handle the MLA cases the getExtendedAddReductionCost.
2, Refactor getReductionPatternCost, add some contraint condition to make sure the getMulAccReductionCost should only handle the reuction of Add + Mul.
Differential Revision: https://reviews.llvm.org/D130868
Martin Storsjö [Fri, 15 Jul 2022 21:11:00 +0000 (00:11 +0300)]
[mlir] Fix calling the native mlir-tblgen tool when cross compiling flang
When the mlir-tblgen tool is set up, the `MLIR_TABLEGEN_EXE` variable
is set, which either points to the mlir-tblgen tool built in the current
cmake build, or points to one built in a nested cmake build (if cross
conpiling, or if building with e.g. `LLVM_OPTIMIZED_TABLEGEN`.
The `MLIR_TABLEGEN_EXE` variable is only set within the scope of the
mlir/CMakeLists.txt file, so it's unavailable in sibling level projects
such as flang.
Set the `MLIR_TABLEGEN_EXE` and the `MLIR_TABLEGEN_TARGET` variables
as global, so that flang can use them properly without guessing.
Differential Revision: https://reviews.llvm.org/D130350
Martin Storsjö [Fri, 15 Jul 2022 21:14:02 +0000 (00:14 +0300)]
[flang] Don't try to run the newly built flang-new when cross compiling
If CMAKE_CROSSCOMPILING, then the newly built flang-new executable was
cross compiled and thus can't be executed on the build system, and thus
can't be used for generating module files.
Differential Revision: https://reviews.llvm.org/D130349
Martin Storsjö [Tue, 2 Aug 2022 07:28:12 +0000 (10:28 +0300)]
[lldb] Silence a GCC warning about missing returns after a fully covered switch. NFC.
Martin Storsjö [Mon, 1 Aug 2022 08:50:44 +0000 (11:50 +0300)]
[OpenMP] Only include CMAKE_DL_LIBS on unix platforms
CMAKE_DL_LIBS is documented as "Name of library containing dlopen
and dlclose".
On Windows platforms, there's no system provided dlopen/dlclose, but
it can be argued that if you really intend to call dlopen/dlclose,
you're going to be using a third party compat library like
https://github.com/dlfcn-win32/dlfcn-win32, and CMAKE_DL_LIBS should
expand to its name.
This has been argued upstream in CMake in
https://gitlab.kitware.com/cmake/cmake/-/issues/17600 and
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1642, that
CMAKE_DL_LIBS should expand to "dl" on mingw platforms.
The merge request wasn't merged though, as it caused some amount of
breakage, but in practice, Fedora still carries a custom CMake patch
with the same effect.
Thus, this patch fixes cross compiling OpenMP for mingw targets
on Fedora with their custom-patched CMake.
Differential Revision: https://reviews.llvm.org/D130892
Fangrui Song [Tue, 2 Aug 2022 07:47:36 +0000 (00:47 -0700)]
[Driver] Remove Separate form for XRay options
Supporting something like `-fxray-instruction-threshold= 1` is not intended.
Nikita Popov [Tue, 2 Aug 2022 07:29:25 +0000 (09:29 +0200)]
[LangRef] Fix typo in GEP docs
Introduced in D130356, reported here:
https://reviews.llvm.org/rG7ac7ec820296#inline-7690
Adrian Kuegel [Tue, 2 Aug 2022 07:27:20 +0000 (09:27 +0200)]
[mlir][Bazel] Fix typo in file name.
Adrian Kuegel [Tue, 2 Aug 2022 07:23:03 +0000 (09:23 +0200)]
[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Tue, 2 Aug 2022 07:15:43 +0000 (09:15 +0200)]
[mlir][Bazel] Add yet another missing dependency.
Adrian Kuegel [Tue, 2 Aug 2022 07:10:18 +0000 (09:10 +0200)]
[mlir][Bazel] Add missing dependency.
Adrian Kuegel [Tue, 2 Aug 2022 06:53:31 +0000 (08:53 +0200)]
[mlir][Bazel] Update bazel build after
14d79afeae63d78de9483f750fafaba13c7ae2dc
Differential Revision: https://reviews.llvm.org/D130965
Purva-Chaudhari [Tue, 2 Aug 2022 06:59:26 +0000 (12:29 +0530)]
Handles failing driver tests of clang
Added support for incremental mode 8 and 28 ie. `frontend::EmitBC:` and `frontend::PrintPreprocessedInput:`
Added supporting clang tests to test in clang-repl mode
Reviewed By: v.g.vassilev
Differential Revision: https://reviews.llvm.org/D125946
Adrian Kuegel [Tue, 2 Aug 2022 06:34:48 +0000 (08:34 +0200)]
[mlir][Bazel] Remove reference to deleted header.
Fangrui Song [Tue, 2 Aug 2022 05:06:46 +0000 (22:06 -0700)]
[ELF] --reproduce: strip directories for --print-archive-stats= and --why-extract=
Similar to -o and -Map.
Emmmer [Mon, 1 Aug 2022 10:02:06 +0000 (18:02 +0800)]
[LLDB][RISCV] Add riscv register enums
According to [RISC-V ISA Spec](https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf) and [riscv-v-spec](https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#3-vector-extension-programmers-model)
Reviewed By: DavidSpickett
Differential Revision: https://reviews.llvm.org/D130899
Konstantin Varlamov [Tue, 2 Aug 2022 03:43:28 +0000 (20:43 -0700)]
[libc++][ranges][NFC] Fix a few links on the Ranges status page.
Chuanqi Xu [Tue, 2 Aug 2022 02:26:07 +0000 (10:26 +0800)]
[C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header
units. This results that we couldn't compile a Hello World Example with
Header Units. This patch tries to fix this.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D130871
jacquesguan [Mon, 1 Aug 2022 07:52:55 +0000 (15:52 +0800)]
[mlir][Math] Add constant folder for TanOp.
This patch adds constant folder for TanOp which only supports single and double precision floating-point.
Differential Revision: https://reviews.llvm.org/D130873
Chuanqi Xu [Tue, 2 Aug 2022 03:08:41 +0000 (11:08 +0800)]
Revert "[C++20] [Modules] Handle initializer for Header Units"
This reverts commit
db6152ad66d7cf48f9f5c3eb28bf54c092978773.
This commit fails in ppc64. Since we want to backport it to 15.x. So
revert it now to keep the patch complete.
Fangrui Song [Tue, 2 Aug 2022 02:39:25 +0000 (19:39 -0700)]
[Driver] Remove deprecated -fsanitize-coverage-{black,white}list=
Fangrui Song [Tue, 2 Aug 2022 02:31:25 +0000 (19:31 -0700)]
[docs] Regenerate clang/docs/ClangCommandLineReference.rst
Also update -ftime-trace='s help to fix a recommonmark error.
Chuanqi Xu [Tue, 2 Aug 2022 02:26:07 +0000 (10:26 +0800)]
[C++20] [Modules] Handle initializer for Header Units
Previously when we add module initializer, we forget to handle header
units. This results that we couldn't compile a Hello World Example with
Header Units. This patch tries to fix this.
Reviewed By: iains
Differential Revision: https://reviews.llvm.org/D130871
Jeff Niu [Mon, 1 Aug 2022 18:20:26 +0000 (14:20 -0400)]
[mlir] Change DenseArrayAttr to TensorType
Previously, DenseArrayAttr used VectorType for its shaped type.
VectorType is problematic for arrays because it doesn't support zero
dimensions, meaning that an empty array would have `vector<i32>` as its
type. ElementsAttr would think that an empty dense array is size 1, not
0. This patch switches over to TensorType, which does support zero
dimensions.
Fixes #56860
Reviewed By: mehdi_amini
Differential Revision: https://reviews.llvm.org/D130921
Fangrui Song [Tue, 2 Aug 2022 02:00:43 +0000 (19:00 -0700)]
[sancov] Remove deprecated -blacklist after D113514
Siva Chandra Reddy [Fri, 29 Jul 2022 19:50:35 +0000 (19:50 +0000)]
[libc] Add GNU extension functions pthread_setname_np and pthread_getname_np.
Reviewed By: michaelrj, lntue
Differential Revision: https://reviews.llvm.org/D130872
Fangrui Song [Tue, 2 Aug 2022 01:53:20 +0000 (18:53 -0700)]
[llvm-cov] Remove deprecated -name-whitelist after D112816
Alex Brachet [Tue, 2 Aug 2022 00:56:05 +0000 (00:56 +0000)]
[clang] Only run test on x86
Sotiris Apostolakis [Mon, 1 Aug 2022 22:21:11 +0000 (22:21 +0000)]
[SelectOpti] Auto-disable other cmov optis when the new select-opti pass is enabled
Reviewed By: davidxl
Differential Revision: https://reviews.llvm.org/D129817
Craig Topper [Mon, 1 Aug 2022 23:50:56 +0000 (16:50 -0700)]
[RISCV] Simplify test case from D130931. NFC
Sunho Kim [Mon, 1 Aug 2022 23:44:18 +0000 (08:44 +0900)]
[IntelJITEvents] Add missing include.
Fixes compilation error.
Differential Revision: https://reviews.llvm.org/D130898
Manish Gupta [Mon, 1 Aug 2022 23:06:23 +0000 (23:06 +0000)]
[mlir][NVGPU] nvgpu.mmasync on F32 through TF32
Adds optional attribute to support tensor cores on F32 datatype by lowering to `mma.sync` with TF32 operands. Since, TF32 is not a native datatype in LLVM we are adding `tf32Enabled` as an attribute to allow the IR to be aware of `MmaSyncOp` datatype. Additionally, this patch adds placeholders for nvgpu-to-nvgpu transformation targeting higher precision tf32x3.
For mma.sync on f32 input using tensor cores there are two possibilites:
(a) tf32 (1 `mma.sync` per warp-level matrix-multiply-accumulate)
(b) tf32x3 (3 `mma.sync` per warp-level matrix-multiply-accumulate)
Typically, tf32 tensor core acceleration comes at a cost of accuracy from missing precision bits. While f32 has 23 precision bits, tf32 has only 10 precision bits. tf32x3 aims to recover the precision bits by splitting each operand into two tf32 values and issue three `mma.sync` tensor core operations.
Reviewed By: ThomasRaoux
Differential Revision: https://reviews.llvm.org/D130294
Martin Sebor [Mon, 1 Aug 2022 22:44:53 +0000 (16:44 -0600)]
[InstCombine] Correct strtol folding with nonnull endptr
Reflect in the pointer's offset the length of the leading part
of the consumed string preceding the first converted digit.
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D130912
Ben Langmuir [Mon, 1 Aug 2022 20:30:41 +0000 (13:30 -0700)]
[clang] Only modify FileEntryRef names that are externally remapped
As progress towards having FileEntryRef contain the requested name of
the file, this commit narrows the "remap" hack to only apply to paths
that were remapped to an external contents path by a VFS. That was
always the original intent of this code, and the fact it was making
relative paths absolute was an unintended side effect.
Differential Revision: https://reviews.llvm.org/D130935
Craig Topper [Mon, 1 Aug 2022 22:26:20 +0000 (15:26 -0700)]
[RISCV] Teach RISCVMergeBaseOffset to merge %lo/%pcrel_lo into load/store after folding arithmetic.
It's possible we have:
lui a0, %hi(sym)
addi a0, %lo(sym)
addi a0, <offset1>
lw a0, <offset2>(a0)
We want to arrive at
lui a0, %hi(sym+offset1+offset2)
lw a0, %lo(sym+offset1+offset2)
We currently fail to do this because we only consider loads/stores
if we didn't find any arithmetic.
This patch splits arithmetic folding and load/store folding into
two separate phases. The load/store folding can no longer assume
the offset in hi/lo is 0 so we must combine the offsets. I've applied
the same simm32 limit that we applied in the arithmetic folding.
Reviewed By: luismarques
Differential Revision: https://reviews.llvm.org/D130931
Ilia Diachkov [Mon, 1 Aug 2022 19:56:31 +0000 (22:56 +0300)]
[SPIRV] use tablegen to create SPIRVBaseInfo*
The patch replaces SPIRVBaseInfo.* previously created using macros by
the tablegen approach. There are many small changes in other files due to
differences in namespaces. Also, functions in SPIRVUtils are moved to
the llvm namespace.
Differential Revision: https://reviews.llvm.org/D130518
Co-authored-by: Aleksandr Bezzubikov <zuban32s@gmail.com>
Co-authored-by: Michal Paszkowski <michal.paszkowski@outlook.com>
Co-authored-by: Andrey Tretyakov <andrey1.tretyakov@intel.com>
Co-authored-by: Konrad Trifunovic <konrad.trifunovic@intel.com>
Alex Brachet [Mon, 1 Aug 2022 22:12:04 +0000 (22:12 +0000)]
[clang] Make test agnostic to file seperator character
Alex Brachet [Mon, 1 Aug 2022 21:52:58 +0000 (21:52 +0000)]
[clang] Re-enable test after marking it XFAIL
This test had to be disabled because ps4 targets don't support
-fuse-ld. Preferably, this should just be unsupported for ps4
targets. However no such lit feature exists so I have just gone
ahead and set the target explicitly. Moreover, this needs
to create a terminal link step, either an executable or shared
object to get the link error. With the change to the explicit
target I've had to also add -nostartfiles -nostdlib so that
clang doesn't pull crt files into the link which may not be
present. Again, this would likely be solved if this test
was unsupported for the one platform that disables -fuse-ld
River Riddle [Sat, 16 Jul 2022 03:08:32 +0000 (20:08 -0700)]
[mlir] Remove OpaqueElementsAttr
This attribute is technical debt from the early stages of MLIR, before
ElementsAttr was an interface and when it was more difficult for
dialects to define their own types of attributes. At present it isn't
used at all in tree (aside from being convenient for eliding other
ElementsAttr), and has had little to no evolution in the past three years.
Differential Revision: https://reviews.llvm.org/D129917
David Blaikie [Mon, 1 Aug 2022 21:56:05 +0000 (21:56 +0000)]
Fold assert-used variable into assert
Fixes #56724
Ben Langmuir [Mon, 1 Aug 2022 20:18:31 +0000 (13:18 -0700)]
[clang] Update code that assumes FileEntry::getName is absolute NFC
It's an accident that we started return asbolute paths from
FileEntry::getName for all relative paths. Prepare for getName to get
(closer to) return the requested path. Note: conceptually it might make
sense for the dependency scanner to allow relative paths and have the
DependencyConsumer decide if it wants to make them absolute, but we
currently document that it's absolute and I didn't want to change
behaviour here.
Differential Revision: https://reviews.llvm.org/D130934
Tue Ly [Mon, 1 Aug 2022 21:44:39 +0000 (17:44 -0400)]
[libc][doc] Update implementation status of tanhf.
Slava Gurevich [Mon, 1 Aug 2022 20:46:37 +0000 (13:46 -0700)]
[LLDB][NFC][Correctness] Fix bad null check
Fix incorrect null-check logic, likely cause by copy-paste
Differential Revision: https://reviews.llvm.org/D130937
Alexander Yermolovich [Mon, 1 Aug 2022 21:38:47 +0000 (14:38 -0700)]
[BOLT][DWARF] Fix handling of multiple DW_OP_addrx in an expression
We were not handling correclty multiple DW_OP_addrx in the location expression.
This was exposed by clang-15 build in release mode with debug information.
Reviewed By: maksfb
Differential Revision: https://reviews.llvm.org/D130812
Mehdi Amini [Mon, 1 Aug 2022 21:25:43 +0000 (21:25 +0000)]
[MLIR] Reduce precision check for expm1 folder: this is dependent on libm (NFC)
We noticed this failing depending on the platform, checking the last few
digit isn't necessary for this test anyway.
Alex Brachet [Mon, 1 Aug 2022 21:10:56 +0000 (21:10 +0000)]
[clang] Temporarily expect failure from test
Alex Brachet [Mon, 1 Aug 2022 20:59:40 +0000 (20:59 +0000)]
[clang] Don't create executable in test
Kirill Okhotnikov [Mon, 1 Aug 2022 20:54:26 +0000 (22:54 +0200)]
[libc][math] Build fail fix: obsolete header.
Jakob Johnson [Mon, 1 Aug 2022 14:34:47 +0000 (07:34 -0700)]
[trace] Replace TraceCursorUP with TraceCursorSP
The use of `std::unique_ptr` with `TraceCursor` adds unnecessary complexity to adding `SBTraceCursor` bindings
Specifically, since `TraceCursor` is an abstract class there's no clean
way to provide "deep clone" semantics for `TraceCursorUP` short of
creating a pure virtual `clone()` method (afaict).
After discussing with @wallace, we decided there is no strong reason to
favor wrapping `TraceCursor` with `std::unique_ptr` over `std::shared_ptr`, thus this diff
replaces all usages of `std::unique_ptr<TraceCursor>` with `std::shared_ptr<TraceCursor>`.
This sets the stage for future diffs to introduce `SBTraceCursor`
bindings in a more clean fashion.
Test Plan:
Differential Revision: https://reviews.llvm.org/D130925
Craig Topper [Mon, 1 Aug 2022 20:42:01 +0000 (13:42 -0700)]
[RISCV] Move Pre-RA pseudo expansion from addMachineSSAOptimization to addPreRegAlloc.
addMachineSSAOptimization is skipped for -O0, but this pass is
required for -O0.
Kirill Okhotnikov [Thu, 28 Jul 2022 13:25:56 +0000 (15:25 +0200)]
[libc][math] Added tanhf function.
Correct rounding function. Performance ~2x faster than glibc analog.
Performance (llvm 12 intel):
```
CORE_MATH_PERF_MODE=rdtsc PERF_ARGS='' ./perf.sh tanhf
GNU libc version: 2.31
GNU libc release: stable
13.279
37.492
18.145
CORE_MATH_PERF_MODE=rdtsc PERF_ARGS='--latency' ./perf.sh tanhf
GNU libc version: 2.31
GNU libc release: stable
40.658
109.582
66.568
```
Differential Revision: https://reviews.llvm.org/D130780
Alex Brachet [Mon, 1 Aug 2022 20:31:01 +0000 (20:31 +0000)]
[clang] Fix build when targeting ps4
-fuse-ld is not available for ps4 targets
Joseph Huber [Mon, 1 Aug 2022 20:20:24 +0000 (16:20 -0400)]
[Libomptarget][NFC] Remove unused CMake file
Summary:
This file is no longer used, get rid of it.
Markus Böck [Mon, 1 Aug 2022 20:15:36 +0000 (22:15 +0200)]
[flang] Fix flang GCC Buildbot broken by D130731
GCC and that specific build bot issued warnings turned errors, due to a narrowing conversion from `unsigned` to `int32_t`. Silence these via a static_cast.
Vasileios Porpodas [Fri, 29 Jul 2022 00:01:15 +0000 (17:01 -0700)]
[TTI][AArch64][SLP] Sets the cost of an ADD reduction 2xi64 to 2.
2xi64 is the legalized type for wide reductions (like 16xi64) and setting the
cost to 2 makes `load-reduce` and `load-zext-reduce` patterns profitable.
The few performance measurments that I did on an aarch64 machine confirm that
these patterns are actually faster when vectorized.
Differential Revision: https://reviews.llvm.org/D130740
Alex Brachet [Mon, 1 Aug 2022 19:59:45 +0000 (19:59 +0000)]
[Driver] Re-run lld with --reproduce when it crashes
This was discussed on https://discourse.llvm.org/t/rfc-generating-lld-reproducers-on-crashes/58071/12
When lld crashes, or errors when -gen-reproducer=error
and -fcrash-diagnostics=all clang will re-run lld with
--reproduce=$temp_file for easily reproducing the
crash/error.
Differential Revision: https://reviews.llvm.org/D120175
Joseph Huber [Mon, 1 Aug 2022 18:57:27 +0000 (14:57 -0400)]
[Libomptarget] Replace std::vector with llvm::SmallVector
The runtime makes some use of `std::vector` data structures. We should
be able to replace these trivially with `llvm::SmallVector` instead.
This should allow us to avoid heap allocations in the majority of cases
now.
Reviewed By: tianshilei1992
Differential Revision: https://reviews.llvm.org/D130927
Craig Topper [Mon, 1 Aug 2022 19:33:11 +0000 (12:33 -0700)]
[RISCV] Pre-commit tests for D130931. NFC
Fangrui Song [Mon, 1 Aug 2022 19:56:15 +0000 (12:56 -0700)]
[MachineFunctionPass] Support -print-changed={,c}diff{,-quiet}
Follow-up to D130434.
Move doSystemDiff to PrintPasses.cpp and call it in MachineFunctionPass.cpp.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D130833
River Riddle [Wed, 20 Jul 2022 01:22:55 +0000 (18:22 -0700)]
[mlir] Add a new builtin DenseResourceElementsAttr
This attributes is intended cover the current set of use cases that abuse
DenseElementsAttr, e.g. when the data is large. Using resources for large
data is one of the major reasons why they were added; e.g. they can be
deallocated mid-compilation, they support a wide variety of data origins
(e.g, heap allocated, mmap'd, etc.), they can support mutation, etc.
I considered at length not having a builtin variant of this, and instead
having multiple versions of this attribute for dialects that are interested,
but they all boiled down to the exact same attribute definition. Given the
generality of this attribute, it feels more aligned to keep it next to DenseArrayAttr
(given that DenseArrayAttr covers the "small" case, and DenseResourcesElementsAttr
covers the "large" case). The underlying infra used to build this attribute is
general, and having a builtin attribute doesn't preclude users from defining
their own when it makes sense (they can even share a blob manager with the
builtin dialect to avoid data duplication).
Differential Revision: https://reviews.llvm.org/D130022
River Riddle [Tue, 26 Jul 2022 01:25:26 +0000 (18:25 -0700)]
[mlir] Add a generic DialectResourceBlobManager to simplify resource blob management
The DialectResourceBlobManager class provides functionality for managing resource blobs
in a generic, dialect-agnostic fashion. In addition to this class, a dialect interface and custom
resource handle are provided to simplify referencing and interacting with the manager. These
classes intend to simplify the work required for dialects that want to manage resource blobs
during compilation, such as for large elements attrs. The old manager for the resource example
in the test dialect has been updated to use this, which provides and cleaner and more consistent API.
This commit also adds new HeapAsmResourceBlob and ImmortalAsmResourceBlob to simplify
creating resource blobs in common scenarios.
Differential Revision: https://reviews.llvm.org/D130021
Krzysztof Drewniak [Mon, 25 Jul 2022 17:22:18 +0000 (17:22 +0000)]
[mlir][Arith] Fix up integer range inference for truncation
Attempting to apply the range analysis to real code revealed that
trunci wasn't correctly handling the case where truncation would
create wider ranges - for example, if we truncate [255, 257] : i16 to
i8, the result can be 255, 0, or 1, which isn't a contiguous range of
values.
The previous implementation would naively map this to [255, 1], which
would cause issues with unsigned ranges and unification.
Reviewed By: Mogball
Differential Revision: https://reviews.llvm.org/D130501
Vang Thao [Wed, 27 Jul 2022 21:17:31 +0000 (14:17 -0700)]
[AMDGPU] Fix DGEMM hazard for GFX90a
For VALU write and memory (VM, L/DS, FLAT) instructions, SQ would insert
wait-states to avoid data hazard. However when there is a DGEMM instruction
in-between them, SQ incorrectly disables the wait-states thus the data hazard
needs to be handled with this workaround.
Reviewed By: rampitec
Differential Revision: https://reviews.llvm.org/D130677
Jakob Johnson [Mon, 1 Aug 2022 18:41:46 +0000 (11:41 -0700)]
[trace][intelpt] Update TraceIntelPTBundleSaver.cpp to accommodate FileSpec API changes
D130309 introduced changes to the FileSpec API which broke usages of
`GetCString()` in TraceIntelPTBundleSaver.cpp. This diff replaces usages
of `GetCString()` with `GetPath().c_str()` as suggested by D130309.
Test Plan:
Building with the trace plug-in now succeeds
Differential Revision: https://reviews.llvm.org/D130924
David Goldman [Mon, 18 Jul 2022 20:32:59 +0000 (16:32 -0400)]
[clangd] Add decl/def support to SymbolDetails
Add an optional declarationRange and definitionRange to SymbolDetails.
This will allow SourceKit-LSP to implement toggling between goto
definition/declaration based on whether the symbol at the cursor
is a definition or declaration.
Differential Revision: https://reviews.llvm.org/D130041