Florian Hahn [Thu, 20 Jan 2022 10:22:20 +0000 (10:22 +0000)]
[IRBuilder] Migrate and-folding to value-based FoldAnd.
Similar to the migration of or-folding to FoldOr, there are a few cases
where the fold in IRBuilder::CreateAnd triggered directly. Those have
been updated.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D117431
Valentin Clement [Thu, 20 Jan 2022 09:56:23 +0000 (10:56 +0100)]
[flang][NFC] Fix header guard and comment
Casey Carter [Thu, 20 Jan 2022 09:46:58 +0000 (01:46 -0800)]
[libcxx][test] Use TEST_HAS_BUILTIN in test code
... rather than using `__has_builtin` directly. This both (1) allows a compiler that doesn't speak `__has_builtin` to workaround with preprocessor magic, and (2) avoids diagnostics about things that look like function like macros after `#if` but are not.
eopXD [Sat, 6 Nov 2021 09:05:43 +0000 (02:05 -0700)]
[RISCV] Imply extensions in RISCVTargetInfo::initFeatureMap
Under ASTContext, clang only copies the features from the options with
Target->initFeatureMap, and no implications is done there. This makes
clang_cc1 fail to imply into `zve32x` for the vector extension, and test
cases will have to add ` -target-feature +experimental-zve32x` in order
to work.
This patch fixes it.
Reviewed By: kito-cheng
Differential Revision: https://reviews.llvm.org/D113336
Valentin Clement [Thu, 20 Jan 2022 09:23:47 +0000 (10:23 +0100)]
[flang][NFC] Fix header guard
Fix header guard to fit other files.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D117662
Matthias Springer [Thu, 20 Jan 2022 09:14:59 +0000 (18:14 +0900)]
[mlir][bufferization] Move one-shot bufferization to Bufferization dialect
This commit is the first step towards unifying core bufferization and One-Shot Bufferize.
This commit does not move over the implementations of BufferizableOpInterface yet. This will be done in separate commits. This change does also not move the unit tests yet. The tests will be moved together with op interface implementations and split into separate files.
Differential Revision: https://reviews.llvm.org/D117641
David Spickett [Wed, 19 Jan 2022 16:56:41 +0000 (16:56 +0000)]
[llvm][AArch64] Accept armv8.8 "hbc" and "mops" in .arch_extension directive
Reviewed By: lenary
Differential Revision: https://reviews.llvm.org/D117693
Victor Perez [Thu, 20 Jan 2022 08:13:00 +0000 (08:13 +0000)]
[LegalizeTypes][VP] Add widening support for vp.gather and vp.scatter
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117557
Marek Kurdej [Thu, 20 Jan 2022 08:35:09 +0000 (09:35 +0100)]
[clang-format] Add tests for aligning `operator=` with `=delete`. NFC.
Also, add test case from https://github.com/llvm/llvm-project/issues/33044.
This was actually fixed in https://github.com/llvm/llvm-project/commit/
480a1fab72f4e367a5986d572914d252c318431d, but there were no tests for delete.
Nikita Popov [Wed, 5 Jan 2022 08:48:17 +0000 (09:48 +0100)]
Reapply [MemCpyOpt] Look through pointer casts when checking capture
This is a recommit of the patch without changes. The reason for
the revert has been addressed in D117679.
-----
The user scanning loop above looks through pointer casts, so we
also need to strip pointer casts in the capture check. Previously
the source was incorrectly considered not captured if a bitcast
was passed to the call.
Nikita Popov [Mon, 13 Dec 2021 09:54:53 +0000 (10:54 +0100)]
Reapply [MemCpyOpt] Make capture check during call slot optimization more precise
This is a recommit of the patch without changes. The reason for
the revert has been addressed in D117679.
-----
Call slot optimization is currently supposed to be prevented if
the call can capture the source pointer. Due to an implementation
bug, this check currently doesn't trigger if a bitcast of the source
pointer is passed instead. I'm somewhat afraid of the fallout of
fixing this bug (due to heavy reliance on call slot optimization
in rust), so I'd like to strengthen the capture reasoning a bit first.
In particular, I believe that the capture is fine as long as a)
the call itself cannot depend on the pointer identity, because
neither dest has been captured before/at nor src before the
call and b) there is no potential use of the captured pointer
before the lifetime of the source alloca ends, either due to
lifetime.end or a return from a function. At that point the
potentially captured pointer becomes dangling.
Differential Revision: https://reviews.llvm.org/D115615
Richard [Thu, 20 Jan 2022 08:21:46 +0000 (01:21 -0700)]
[clang-tidy] Revert documentation change (NFC)
Restore a fix to the list of checks that was undone by a recent commit.
Chenbing.Zheng [Thu, 20 Jan 2022 08:14:28 +0000 (08:14 +0000)]
[RISCV] Add intrinsic for Zbt extension
RV32: fsl, fsr, fsri
RV64: fsl, fsr, fsri, fslw, fsrw, fsriw
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117468
Nikita Popov [Wed, 19 Jan 2022 14:47:13 +0000 (15:47 +0100)]
[MemCpyOpt] Fix metadata merging during call slot optimization
Call slot optimization currently merges the metadata between the
call and the load. However, we also need to merge in the metadata
of the store.
Part of the reason why we might have gotten away with this
previously is that usually the load and the store are the same
instruction (a memcpy), this can only happen if call slot
optimization occurs on an actual load/store pair.
This addresses the issue reported in
https://reviews.llvm.org/D115615#3251386.
Differential Revision: https://reviews.llvm.org/D117679
Nikita Popov [Wed, 19 Jan 2022 13:33:21 +0000 (14:33 +0100)]
[Support] Remove incorrect noalias return attribute in BumpPtrAllocator
The memory returned by the Allocate() function is also otherwise
accessible -- and is indeed accessed by the DestroyAll() method of
SpecificBumpPtrAlloactor. This is a violation of the noalias return
contract.
This should address the issue reported in
https://reviews.llvm.org/D116728#3252464.
Differential Revision: https://reviews.llvm.org/D117664
Jez Ng [Thu, 20 Jan 2022 07:59:12 +0000 (23:59 -0800)]
[lld-macho] Fix grammar in doc
Jino Park [Thu, 20 Jan 2022 07:42:19 +0000 (08:42 +0100)]
[clang-format] Fix bug in parsing `operator<` with template
Fixes https://github.com/llvm/llvm-project/issues/44601.
This patch handles a bug when parsing a below example code :
```
template <class> class S;
template <class T> bool operator<(S<T> const &x, S<T> const &y) {
return x.i < y.i;
}
template <class T> class S {
int i = 42;
friend bool operator< <>(S const &, S const &);
};
int main() { return S<int>{} < S<int>{}; }
```
which parse `< <>` as `<< >`, not `< <>` in terms of tokens as discussed in discord.
1. Add a condition in `tryMergeLessLess()` considering `operator` keyword and `>`
2. Force to leave a whitespace between `tok::less` and a template opener
3. Add unit test
Reviewed By: MyDeveloperDay, curdeius
Differential Revision: https://reviews.llvm.org/D117398
eopXD [Wed, 27 Oct 2021 12:52:20 +0000 (05:52 -0700)]
[RISCV] Add the zve extension according to the v1.0 spec
`zve` is the new standard vector extension to specify varying degrees of
vector support for embedding processors. The `zve` extension is related
to the `zvl` extension and other updates that are added in v1.0.
According to https://github.com/riscv-non-isa/riscv-c-api-doc/pull/21,
Clang defines macro `__riscv_v_max_elen`, `__riscv_v_max_elen_fp` for
`zve` and it can be used by applications that uses the vector extension.
Authored by: Zakk Chen <zakk.chen@sifive.com> @khchen
Co-Authored by: Eop Chen <eop.chen@sifive.com> @eopXD
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D112408
Lang Hames [Thu, 20 Jan 2022 06:58:37 +0000 (17:58 +1100)]
[ORC] Fix another missing std::move from
9eb4939b862.
Lang Hames [Thu, 20 Jan 2022 06:56:56 +0000 (17:56 +1100)]
[ORC] Fix missing std::move from
9eb4939b862.
Lang Hames [Thu, 20 Jan 2022 03:21:36 +0000 (14:21 +1100)]
[ORC] Allow JITDylib::getDFSLinkOrder and friends to fail for defunct JITDylibs.
Calls to JITDylib's getDFSLinkOrder and getReverseDFSLinkOrder methods (both
static an non-static versions) are now valid to make on defunct JITDylibs, but
will return an error if any JITDylib in the link order is defunct.
This means that platforms can safely lookup link orders by name in response to
jit-dlopen calls from the ORC runtime, even if the call names a defunct
JITDylib -- the call will just fail with an error.
Fangrui Song [Thu, 20 Jan 2022 06:33:32 +0000 (22:33 -0800)]
[ELF] Replace .zdebug string comparison with SHF_COMPRESSED check. NFC
Jonas Devlieghere [Thu, 20 Jan 2022 05:50:51 +0000 (21:50 -0800)]
[dsymutil] Don't print timestamp warning if we have no timestamp
If we have no timestamp (0), don't print the corresponding warning. The
binary holder already successfully ignores these cases, but the warning
for swift interface files was lacking it.
rdar://
86036385
Differential revision: https://reviews.llvm.org/D117333
Johannes Doerfert [Sat, 8 Jan 2022 22:53:19 +0000 (16:53 -0600)]
[OpenMP][AMDGPU] Optimize the linked in math libraries
Once we linked in math files, potentially even if we link in only other
"system libraries", we want to optimize the code again. This is not only
reasonable but also helps to hide various problems with the missing
attribute annotations in the math libraries.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D116906
Jim Lin [Thu, 20 Jan 2022 02:52:26 +0000 (10:52 +0800)]
[M68k][NFC] Rename Bt(BT) to Btst(BTST)
It seems that implementation of Bt refered from x86.
In M68k, Bt(BT) should be renamed to Btst(BTST).
Reviewed By: myhsu
Differential Revision: https://reviews.llvm.org/D117534
Johannes Doerfert [Wed, 3 Nov 2021 16:52:21 +0000 (11:52 -0500)]
[OpenMP] Avoid costly shadow map traversals whenever possible
In the OpenMC app we saw `omp target update` spending an awful lot of
time in the shadow map traversal without ever doing any update there.
There are two cases that allow us to avoid the traversal completely.
The simplest thing is that small updates cannot (reasonably) contain
an attached pointer part. The other case requires to track in the
mapping table if an entry might contain an attached pointer as part.
Given that we have a single location shadow map entries are created,
the latter is actually fairly easy as well.
Differential Revision: https://reviews.llvm.org/D113124
Johannes Doerfert [Wed, 19 Jan 2022 00:56:10 +0000 (18:56 -0600)]
[OpenMP] Introduce an environment variable to disable atomic map clauses
Atomic handling of map clauses was introduced to comply with the OpenMP
standard (see D104418). However, many apps won't need this feature which
can be costly in certain situations. To allow for applications to
opt-out we now introduce the `LIBOMPTARGET_MAP_FORCE_ATOMIC` environment
flag that voids the atomicity guarantee of the standard for map clauses
again, shifting the burden to the user.
This patch also de-duplicates the code that introduces the events used
to enforce atomicity as a cleanup.
Differential Revision: https://reviews.llvm.org/D117627
Heejin Ahn [Sat, 4 Sep 2021 06:31:52 +0000 (23:31 -0700)]
[WebAssembly] Support Wasm EH + Wasm SjLj
D108960 added support for SjLj using Wasm EH instructions, which we call
Wasm SjLj going forward. (We call the old SjLj Emscripten SjLj) But it
did not support using Wasm EH and Wasm SjLj together. So far users of
Wasm EH had to use Wasm EH with Emscripten SjLj, which had a certain
limitation and it suffered from bigger code size increases as well.
This enables using Wasm EH and Wasm SjLj together.
1. This redirects `catchswitch` and `cleanupret` that unwind to caller
to `catch.dispatch.longjmp` BB, which is a `catchswitch` BB that
handles longjmps.
2. D108960 converted all longjmpable `call`s to `invokes` that unwind to
`catch.dispatch.longjmp`. This CL checks if the `call` is embedded
within another `catchpad`, and if so, makes it unwind to its nearest
parent's unwind destination, rather than `catch.dispatch.longjmp`.
This is necessary to preserve the scoping structure.
Reviewed By: dschuff
Differential Revision: https://reviews.llvm.org/D117610
Fangrui Song [Thu, 20 Jan 2022 04:09:41 +0000 (20:09 -0800)]
[ELF] Remove StringRefZ
StringRefZ does not improve performance. Non-local symbols always have eagerly
computed nameSize. Most local symbols's lengths will be updated in either:
* shouldKeepInSymtab
* SymbolTableBaseSection::addSymbol
Its benefit is offsetted by strlen in every call site (sums up to 5KiB code in a
release x86-64 build), so using StringRefZ may be slower.
In a -s link (uncommon) there is minor speedup, like ~0.3% for clang and chrome.
Reviewed By: alexander-shaposhnikov
Differential Revision: https://reviews.llvm.org/D117644
River Riddle [Thu, 20 Jan 2022 03:24:08 +0000 (19:24 -0800)]
[mlir] Fix GCC5 build broken by improper name redefinition
Luo, Yuanke [Wed, 29 Dec 2021 08:05:32 +0000 (16:05 +0800)]
Combine to vpdpbusd when operand is constant and small enough.
Differential Revision: https://reviews.llvm.org/D116363
Ben Shi [Thu, 30 Dec 2021 07:59:30 +0000 (07:59 +0000)]
[AVR] Generate ELPM for loading byte/word from extended program memory
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D116493
Ben Shi [Sat, 18 Dec 2021 10:03:11 +0000 (10:03 +0000)]
[AVR][MC] Generate section '.progmemX.data' for extended flash banks
Reviewed By: aykevl
Differential Revision: https://reviews.llvm.org/D115987
Hsiangkai Wang [Thu, 20 Jan 2022 01:32:53 +0000 (01:32 +0000)]
[RISCV] Add a test to show the bug in the RA caused by reserved BP.
The bug is reported in https://github.com/llvm/llvm-project/issues/53016.
Authored-by: Kito Cheng <kito.cheng@sifive.com>
Differential Revision: https://reviews.llvm.org/D117738
Nico Weber [Thu, 20 Jan 2022 02:15:31 +0000 (21:15 -0500)]
[gn build] (manually) port
30c17e70a4d7
minglotus-6 [Thu, 13 Jan 2022 20:44:15 +0000 (12:44 -0800)]
[llvm-dis] Add an option `dump-thinlto-index-only` in llvm-dis to read ThinLTO minimized code only.
Mircea Trofin [Thu, 20 Jan 2022 01:51:42 +0000 (17:51 -0800)]
[MLGO] Don't run the 'release' mode tests in non-autogenerated cases
Adrian Tong [Tue, 23 Nov 2021 00:11:45 +0000 (00:11 +0000)]
Optimize shift and accumulate pattern in AArch64.
AArch64 supports unsigned shift right and accumulate. In case we see a
unsigned shift right followed by an OR. We could turn them into a USRA
instruction, given the operands of the OR has no common bits.
Differential Revision: https://reviews.llvm.org/D114405
Craig Topper [Thu, 20 Jan 2022 01:52:09 +0000 (17:52 -0800)]
[LoopPeel] Pass TripCount to computePeelCount by value instead of by reference. NFC
The TripCount is not modified by the function so it doesn't need
to be passed by reference. Verified by passing it as const reference
before changing to value.
Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D117735
Peter Klausler [Tue, 11 Jan 2022 19:24:55 +0000 (11:24 -0800)]
[flang] Accept INDEX(..., BACK=array)
The intrinsic table entry for INDEX mistakenly required
the optional BACK= argument to be scalar, but it's an
elemental intrinsic that can accept a conforming array.
Differential Revision: https://reviews.llvm.org/D117700
Peter Klausler [Tue, 11 Jan 2022 20:28:35 +0000 (12:28 -0800)]
[flang] Accept sparse argument keyword names for MAX/MIN
Accept any keyword argument names of the form "An" for
values of n >= 3 in calls to the intrinsic functions MAX, MIN,
and their variants, so long as "n" has no leading zero and
all the keywords are distinct. Previously, f18 was needlessly
requiring the names to be contiguous. When synthesizing keywords
to characterize the procedure's interface, don't conflict with
the program's keywords.
Differential Revision: https://reviews.llvm.org/D117701
River Riddle [Wed, 19 Jan 2022 02:28:51 +0000 (18:28 -0800)]
[mlir] Make locations required when adding/creating block arguments
BlockArguments gained the ability to have locations attached a while ago, but they
have always been optional. This goes against the core tenant of MLIR where location
information is a requirement, so this commit updates the API to require locations.
Fixes #53279
Differential Revision: https://reviews.llvm.org/D117633
Mohammed Nurul Hoque [Thu, 20 Jan 2022 01:27:02 +0000 (17:27 -0800)]
[RISCV] Add patterns to MIR sign-extension removal pass.
This patch adds a few instruction patterns that generate sign-extended values or propagate them, adding to the pass introduced in https://reviews.llvm.org/D116397
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D117465
Peter Klausler [Tue, 11 Jan 2022 18:38:26 +0000 (10:38 -0800)]
[flang] Accept BOZ literals for some actual arguments
Consistent with previously documented policy, in which
BOZ literals are accepted in non-standard-conforming circumstances
where they can be converted to an unambiguous known numeric type,
allow BOZ literals to be passed as an actual argument in a reference
to a procedure whose explicit interface has a corresponding dummy
argument with a numeric type to which the BOZ literal may be
converted. Improve error messages associated with BOZ literal
actual arguments, too: don't emit multiple errors.
Differential Revision: https://reviews.llvm.org/D117698
Peter Klausler [Tue, 11 Jan 2022 19:01:12 +0000 (11:01 -0800)]
[flang] Improve error message (initialized variable in pure subprogram)
When variable with the SAVE attribute appears in a pure subprogram,
emit a more specialized error message if the SAVE attribute was acquired
from static initialization.
Differential Revision: https://reviews.llvm.org/D117699
Joseph Huber [Wed, 19 Jan 2022 19:52:08 +0000 (14:52 -0500)]
[OpenMP] Expand short verisions of OpenMP offloading triples
The OpenMP offloading libraries are built with fixed triples and linked
in during compile time. This would cause un-helpful errors if the user
passed in the wrong expansion of the triple used for the bitcode
library. because we only support these triples for OpenMP offloading we
can normalize them to the full verion used in the bitcode library.
Reviewed By: jdoerfert, JonChesterfield
Differential Revision: https://reviews.llvm.org/D117634
Hsiangkai Wang [Tue, 18 Jan 2022 07:44:27 +0000 (07:44 +0000)]
[docs] Fix typo in the example code in ProgrammersManual.
Differential Revision: https://reviews.llvm.org/D117665
Hsiangkai Wang [Tue, 18 Jan 2022 11:51:53 +0000 (11:51 +0000)]
[docs] Put define DEBUG_TYPE after include directives.
Differential Revision: https://reviews.llvm.org/D117666
Craig Topper [Thu, 20 Jan 2022 00:59:45 +0000 (16:59 -0800)]
[LoopPeeling] Fix stale comments. NFC
These comments were not updated when PeelingPreferences split from
UnrollingPreferences.
Alexandre Ganea [Thu, 20 Jan 2022 00:44:18 +0000 (19:44 -0500)]
Re-land [CodeView] Add full repro to LF_BUILDINFO record
This patch writes the full -cc1 command into the resulting .OBJ, like MSVC does. This allows for external tools (Recode, Live++) to rebuild a source file without any external dependency but the .OBJ itself (other than the compiler) and without knowledge of the build system.
The LF_BUILDINFO record stores a full path to the compiler, the PWD (CWD at program startup), a relative or absolute path to the source, and the full CC1 command line. The stored command line is self-standing (does not depend on the environment). In the same way, MSVC doesn't exactly store the provided command-line, but an expanded version (a somehow equivalent of CC1) which is also self-standing.
For more information see PR36198 and D43002.
Differential Revision: https://reviews.llvm.org/D80833
Johannes Doerfert [Wed, 27 Oct 2021 22:00:41 +0000 (17:00 -0500)]
[DWARF][FIX] Try not to crash for nvptx with missing debug information
This prevents crashes in the OpenMP offload pipeline as not everything
is properly annotated with debug information, e.g., the runtimes we link
in. While we might want to have them annotated, it seems to be generally
useful to gracefully handle missing debug info rather than crashing.
TODO: A test is missing and can hopefully be distilled prior to landing.
This fixes #51079.
Differential Revision: https://reviews.llvm.org/D116959
Johannes Doerfert [Wed, 19 Jan 2022 21:47:50 +0000 (15:47 -0600)]
[OpenMP][FIX] Replace ICVs only with values valid at the getter position
While we might know the value if an ICV at a getter position it is not
always clear that we can simply use it. Verify the value is valid first
to avoid invalid IR.
Fixes #53300.
Jez Ng [Thu, 20 Jan 2022 00:30:52 +0000 (16:30 -0800)]
[lld-macho] Mention string literal deduplication as a difference from ld64
Reviewed By: keith
Differential Revision: https://reviews.llvm.org/D117250
Siva Chandra Reddy [Thu, 13 Jan 2022 23:40:49 +0000 (23:40 +0000)]
[libc] Move type definitions to their own self contained header files.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D117282
Dominik Grewe [Wed, 19 Jan 2022 23:44:43 +0000 (23:44 +0000)]
Preserve function argument locations.
Previously the optional locations of function arguments were dropped in
`parseFunctionArgumentList`. This CL adds another output argument to the
function through which they are now returned. The values are then plumbed
through as an array of optional locations in the various places.
Reviewed By: rriddle
Differential Revision: https://reviews.llvm.org/D117604
River Riddle [Wed, 19 Jan 2022 20:18:30 +0000 (12:18 -0800)]
[mlir] Don't print `// no predecessors` on entry blocks
Entry blocks can never have predecessors, so this is unnecessary.
Fixes #53287
Differential Revision: https://reviews.llvm.org/D117713
Lang Hames [Wed, 19 Jan 2022 23:54:56 +0000 (10:54 +1100)]
[ORC] Fix typo in comment.
Mehdi Amini [Wed, 19 Jan 2022 19:44:13 +0000 (19:44 +0000)]
Fix crash in MLIR opaque attribute parser
An assertion is triggered when the dialect is malformed.
Differential Revision: https://reviews.llvm.org/D117709
Adrian Prantl [Wed, 19 Jan 2022 23:33:59 +0000 (15:33 -0800)]
Fix modules build by moving implementation into .cpp file
Konstantina [Wed, 19 Jan 2022 16:57:09 +0000 (08:57 -0800)]
[AMDGPU][NFC] Add autogenerated tests for vgpr-tuple-allocation.ll
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D117692
Richard [Wed, 19 Jan 2022 22:04:11 +0000 (15:04 -0700)]
[clang-tidy] Use literal block instead of code block (NFC)
I used a C++ code block in check documentation to show example
output from clang-tidy, but since the example output isn't
kosher C++, sphinx didn't like that when it went to syntax
highlight the block. So switch to a literal block instead
and forego any highlighting.
Fixes build error
<https://lab.llvm.org/buildbot/#/builders/115/builds/21145>
Jonas Devlieghere [Wed, 19 Jan 2022 22:19:37 +0000 (14:19 -0800)]
[lldb] Fix LLDB_FULL_VERSION_STRING
Currently LLDB_FULL_VERSION_STRING is set to "LLDB_VERSION_STRING"
rather than the content of the CMake variable with that name.
Siva Chandra Reddy [Wed, 19 Jan 2022 08:33:05 +0000 (08:33 +0000)]
[libc] Add a naming rule for global constants.
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D117645
Jon Chesterfield [Wed, 19 Jan 2022 22:07:22 +0000 (22:07 +0000)]
[openmp] Always pass valid triple to openmp-targets when using newRTL
Previously, we sometimes pass fopenmp-targets=nvptx64-nvidia-cuda-newRTL
Reviewed By: jhuber6
Differential Revision: https://reviews.llvm.org/D117715
John Ericson [Tue, 18 Jan 2022 22:58:31 +0000 (22:58 +0000)]
[cmake] Move HandleOutOfTreeLLVM to common cmake utils
This is better than libunwind and libcxxabi fishing it out of libcxx's
module directory.
It is done in prepartion for a better version of D117537 which deduplicates
CMake logic instead of just renaming to avoid a name clash.
Reviewed By: phosek, #libunwind, #libc_abi, Ericson2314
Differential Revision: https://reviews.llvm.org/D117617
Luís Marques [Wed, 19 Jan 2022 21:55:35 +0000 (21:55 +0000)]
[RISCV] Fix incomplete asm statement parsing
For instructions without operands, the final `AsmToken::EndOfStatement`
wasn't being consumed. In the context of inline assembly, the resulting
empty statements would cause extraneous empty lines to be emitted. Fix
the issue by consuming the `EndOfStatement` token.
Differential Revision: https://reviews.llvm.org/D117565
Eli Friedman [Wed, 19 Jan 2022 21:53:47 +0000 (13:53 -0800)]
[OpenMPOpt] Use SetVector to store list of kernels.
Fixes test failures on reverse-iteration buildbot.
Luís Marques [Wed, 19 Jan 2022 21:53:43 +0000 (21:53 +0000)]
[docs][lli] Fix lli rst docs formatting
Differential Revision: https://reviews.llvm.org/D109092
Keith Smiley [Wed, 19 Jan 2022 21:34:04 +0000 (13:34 -0800)]
[lld-macho] Silence XAR deprecation warning
If you're building this on macOS 12.x+ this produces a deprecation
warning. I'm not sure what this means for the bitcode format going
forward, but it seems safe to silence for now.
Do we need to worry about GCC for this?
Differential Revision: https://reviews.llvm.org/D117718
Keith Smiley [Wed, 19 Jan 2022 01:17:28 +0000 (17:17 -0800)]
[lld-macho] Implement -noall_load
This flag is the default, so in ld64 it is not implemented, but it can
be useful to negate previous -all_load arguments. Specifically if your
build system has some global linker flags, that you may want to negate
for specific links. We use something like this today to make sure some
C++ symbols are automatically discovered for all links, which passing
-all_load hides.
Differential Revision: https://reviews.llvm.org/D117629
Mehdi Amini [Wed, 19 Jan 2022 19:57:59 +0000 (19:57 +0000)]
Change elided large constant syntax to make it more explicit
When the printer is requested to elide large constant, we emit an opaque
attribute instead. This patch fills the dialect name with
"elided_large_const" instead of "_" to remove some user confusion when
they later try to consume it.
Differential Revision: https://reviews.llvm.org/D117711
Fangrui Song [Wed, 19 Jan 2022 20:25:01 +0000 (12:25 -0800)]
[ELF] Fix split-stack caller with hidden non-split-stack callee
Fix a regression after
aabe901d57d6df4cd2786163359a7b2a7aae8c32 (`[ELF] Remove
one redundant computeBinding`): isLocal() does not indicate that the symbol is
originally local. For simplicity, just drop this optimization.
Stella Stamenova [Wed, 19 Jan 2022 20:02:22 +0000 (12:02 -0800)]
[mlir] Configure mlir so that it can be directly included in a parent cmakelists.txt
The goal is to allow a project to directly include the `CMakeLists.txt` of mlir via something such as `add_directory`. This currently doesn't work because the exported targets then end up being imported in the same top-level project and `cmake` is not happy. LLVM works around this by guarding the exports based on the existence of the `LLVMSupport` library. This change does the same using `MLIRSupport`. In our experience, no targets need to be added to the export in the case.
If there's a preferred way of doing this or a better lib to use as the main target to check for, please let me know.
Reviewed By: stellaraccident
Differential Revision: https://reviews.llvm.org/D117599
Mircea Trofin [Wed, 19 Jan 2022 19:33:20 +0000 (11:33 -0800)]
Fix build break introduced by D117147
Casey Carter [Wed, 29 Dec 2021 23:56:24 +0000 (15:56 -0800)]
[libcxx][test] Portably test that `{w,}format_context` is a specialization of `basic_format_context`
Differential Revision: https://reviews.llvm.org/D117606
Richard [Wed, 29 Dec 2021 23:49:36 +0000 (16:49 -0700)]
[clang-tidy] Narrow cppguidelines-macro-usage to actual constants
Previously, any macro that didn't look like a varargs macro
or a function style macro was reported with a warning that
it should be replaced with a constexpr const declaration.
This is only reasonable when the macro body contains constants
and not expansions like ",", "[[noreturn]]", "__declspec(xxx)",
etc.
So instead of always issuing a warning about every macro that
doesn't look like a varargs or function style macro, examine the
tokens in the macro and only warn about the macro if it contains
only comment and constant tokens.
Differential Revision: https://reviews.llvm.org/D116386
Fixes #39945
wren romano [Tue, 18 Jan 2022 19:39:54 +0000 (11:39 -0800)]
[mlir][sparse] Simplifying assertions in fromCOO
Hoisting invariant assertions to the top
Reviewed By: aartbik
Differential Revision: https://reviews.llvm.org/D117408
natashaknk [Wed, 19 Jan 2022 19:06:00 +0000 (11:06 -0800)]
[tosa][mlir] Lowering for dynamic shapes in the reduce_x ops in tosa-to-linalg
Reviewed By: rsuderman
Differential Revision: https://reviews.llvm.org/D117691
Joseph Huber [Wed, 19 Jan 2022 19:13:54 +0000 (19:13 +0000)]
[openmp] Unconditionally set march commandline argument
Extracted from D117246. This reflects the march value used by the
compile back into the toolchain arguments, letting downstream processes
such as LTO rely on it being present. Subsequent patches should also be able
to remove the two other calls to checkSystemForAMDGPU.
Reviewed By: jonchesterfield
Differential Revision: https://reviews.llvm.org/D117706
Vladislav Khmelevsky [Wed, 19 Jan 2022 19:06:06 +0000 (22:06 +0300)]
[BOLT] Remove unreachable uncond branch after return
This patch fixes the removal of unreachable uncondtional branch located
after return instruction.
Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei
Reviewed By: Amir
Differential Revision: https://reviews.llvm.org/D117677
Mircea Trofin [Wed, 22 Dec 2021 20:46:06 +0000 (12:46 -0800)]
[MLGO] ML Regalloc Eviction Advisor
The bulk of the implementation is common between 'release' mode (==AOT-ed
model) and 'development' mode (for training), the main difference is
that in development mode, we may also log features (for training logs),
inject scoring information (currently after the Virtual Register
Rewriter) and then produce the log file.
This patch also introduces the score injection pass, 'Register
Allocation Pass Scoring', which is trivially just logging the score in
development mode.
Differential Revision: https://reviews.llvm.org/D117147
Wenlei He [Mon, 17 Jan 2022 19:59:37 +0000 (11:59 -0800)]
[PartialInline] Bail out on asm-goto/callbr
Fixing ICE when partial inline tries to deal with blockaddress uses of function which is typical for asm-goto/callbr. We ran into this with PGO multi-region partial inline.
Differential Revision: https://reviews.llvm.org/D117509
Thomas Raoux [Wed, 19 Jan 2022 18:32:16 +0000 (10:32 -0800)]
[mlir][spirv] Add math.fma lowering to spirv
Differential Revision: https://reviews.llvm.org/D117704
Craig Topper [Wed, 19 Jan 2022 18:31:56 +0000 (10:31 -0800)]
[RISCV] Obey -riscv-v-fixed-length-vector-elen-max when lowering mask BUILD_VECTORs.
We may not be allowed to use vXiXLen vectors. Consult ELEN to
determine what is allowed. This will become even more important
when Zve32 is added.
Reviewed By: frasercrmck, arcbbb
Differential Revision: https://reviews.llvm.org/D117518
Jonas Devlieghere [Wed, 19 Jan 2022 17:57:08 +0000 (09:57 -0800)]
[dsymutil] Print the swift interface modification time in warning
The warning was printing the timestamp from the debug map twice rather
than both the file system modification time and debug map modification
time.
rdar://
86036385
Differential revision: https://reviews.llvm.org/D117331
Yannic Bonenberger [Wed, 19 Jan 2022 18:34:03 +0000 (10:34 -0800)]
[libc] improve error message for unsupported target platforms
Reviewed By: michaelrj
Differential Revision: https://reviews.llvm.org/D116888
Ellis Hoag [Wed, 19 Jan 2022 18:36:49 +0000 (10:36 -0800)]
Fix broken comment in InstrProfData.inc
This comment was introduced in https://reviews.llvm.org/D117631
Differential Revision: https://reviews.llvm.org/D117705
Nathan James [Wed, 19 Jan 2022 18:36:35 +0000 (18:36 +0000)]
[clang-tidy][NFC] replace some redundant std::string creations
Jean Perier [Wed, 19 Jan 2022 18:12:12 +0000 (19:12 +0100)]
[flang] Prevent any non constant result extent to be inlined on caller side
UBOUND, SIZE, and SHAPE folding was still creating expressions that are
invalid on the caller side without the call expression context.
A previous patch intended to deal with this situation (https://reviews.llvm.org/D116933)
but it assumed the return expression would be a descriptor inquiry to
the result symbol, which is not the case if the extent expression is
"scope invariant" inside the called subroutine (e.g., referring to
intent(in) dummy arguments). Simply prevent folding from inlining non
constant extent expression on the caller side.
Folding could be later improved by having ad-hoc folding for UBOUND, SIZE, and
SHAPE on function references where it could try replacing the dummy symbols
by the actual expression, but this is left as a possible later improvement.
Differential Revision: https://reviews.llvm.org/D117686
Fangrui Song [Wed, 19 Jan 2022 18:14:49 +0000 (10:14 -0800)]
[lld-macho] Add --start-lib --end-lib
In ld.lld, when an ObjFile/BitcodeFile is read in --start-lib state, the file is
given archive semantics. --end-lib closes the previous --start-lib. A build
system can use this feature as an alternative to archives. This patch ports
the feature to lld-macho.
--start-lib and --end-lib are positional, unlike usual ld64 options.
I think the slight drawback does not matter as (a) reusing option names
make build systems convenient (b) `--start-lib a.o b.o --end-lib` conveys more
information than an alternative design: `-objlib a.o -objlib b.o` because
--start-lib makes it clear which objects are in the same conceptual archive.
This provides flexibility (c) `-objlib`/`-filelist` interaction may be weird.
Close https://github.com/llvm/llvm-project/issues/52931
Reviewed By: #lld-macho, Jez Ng, oontvoo
Differential Revision: https://reviews.llvm.org/D116913
Richard Howell [Wed, 19 Jan 2022 18:12:32 +0000 (10:12 -0800)]
[clang] support relative roots to vfs overlays
This diff adds support for relative roots to VFS overlays. The directory root
will be made absolute from the current working directory and will be used to
determine the path style to use. This supports the use of VFS overlays with
remote build systems that might use a different working directory for each
compilation.
Reviewed By: benlangmuir
Differential Revision: https://reviews.llvm.org/D116174
Ellis Hoag [Wed, 19 Jan 2022 18:09:56 +0000 (10:09 -0800)]
[InstrProf] Restore InstrProfData.inc to fix Fuchsia builds
https://reviews.llvm.org/D116179 introduced some changes to
`InstrProfData.inc` which broke some downstream builds. This commit
reverts those changes since they only changes two field names.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D117631
Petr Hosek [Wed, 19 Jan 2022 18:08:17 +0000 (10:08 -0800)]
[DebugInfod] Prefix debuginfod cache directory
This prevents the debuginfod client from dumping files directly into the
default cache directory (e.g., ~/.cache). Instead, these files are
placed in a subdirectory (e.g., ~/.cache/llvm-debuginfod/client).
Behavior is unaffected if the cache directory is provided by the
DEBUGINFO_CACHE_PATH environment variable.
Patch By: mysterymath
Differential Revision: https://reviews.llvm.org/D117619
Peter Klausler [Mon, 10 Jan 2022 23:59:12 +0000 (15:59 -0800)]
[flang] Intrinsic assignment of distinct but "same" derived types
Subclause 7.5.2.4 lists conditions under which two distinct derived
types are to be considered the same type for purposes of argument
association, assignment, and so on. These conditions are implemented
in evaluate::IsTkCompatibleWith(), but assignment semantics doesn't
use it for testing for intrinsic assignment compatibility. Fix that.
Differential Revision: https://reviews.llvm.org/D117621
Yaxun (Sam) Liu [Wed, 19 Jan 2022 17:56:21 +0000 (12:56 -0500)]
AMDGPU: Account for usage HIP-style dynamic LDS
Disable promote alloca to LDS when HIP-style dynamic LDS since the size
is unknown at compile time.
Patch by: Siu Chi Chan
Reviewed by: Matt Arsenault, Yaxun Liu
Differential Revision: https://reviews.llvm.org/D117494
Fangrui Song [Wed, 19 Jan 2022 18:01:53 +0000 (10:01 -0800)]
[ELF] Allow non-bitcode archive with an empty index
When an archive with an empty index contains only bitcode files, it is
handled as a group of lazy (--start-lib) object files. If there is a
non-bitcode file, there will be a diagnostic a la GNU ld.
For some programs, the archive member extraction ratio is high (e.g. for chrome,
79% archive members are extracted according to --print-archive-stats=). Because
symbol interning is cached for ObjFile::parseLazy but not for ArchiveFile,
parsing an archive as a group of --start-lib object files may be faster.
If the linker speculatively creates section representations for archive members,
the archive index will not be used.
If we take the above view, the archive index is essentially useless. If a user
wants a fast build without using --start-lib, they may just build thin archives
without index (`ar rcS --thin`).
Therefore, I suggest that we no longer treat the code as a hack, instead as a
supported feature. I believe we will do this anyway if we add parallel symbol
interning (parallel symbol interning for lazy object files is simpler than that
for archives).
Ecosystem issues:
* parseLazy actually has nearly the same behavior as ArchiveFile::parse, but the symbol order may be different.
* users may get addicted to the behavior and build archives not working with GNU ld and gold. I think it is easy to rebuild archives to be compatible.
Reviewed By: ikudrin
Differential Revision: https://reviews.llvm.org/D117284
Nicolas Vasilache [Wed, 19 Jan 2022 17:49:06 +0000 (12:49 -0500)]
[mlir][Linalg] Add a useLinalgCopy option to Linalg bufferization.
Benchmarks show that memref::CopyOp is curently up to 200x slower than
tiled and vectorized versions of linalg::Copy.
Add a temporary flag to allow comprehensive bufferize to generate a
linalg::GenericOp that implements a copy until this performance bug is
resolved.
Differential Revision: https://reviews.llvm.org/D117696
David Blaikie [Wed, 19 Jan 2022 17:56:53 +0000 (09:56 -0800)]
unique_ptrify the ModuleManager's VisitState linked list
Jonas Devlieghere [Wed, 19 Jan 2022 17:16:16 +0000 (09:16 -0800)]
[lldb] Initialize Python exactly once
We got a few crash reports that showed LLDB initializing Python on two
separate threads. Make sure Python is initialized exactly once.
rdar://
87287005
Differential revision: https://reviews.llvm.org/D117601
Yaxun (Sam) Liu [Wed, 19 Jan 2022 17:19:06 +0000 (12:19 -0500)]
Prevent adding module flag amdgpu_hostcall multiple times
HIP program with printf call fails to compile with -fsanitize=address
option, because of appending module flag - amdgpu_hostcall twice, one
for printf and one for sanitize option. This patch fixes that issue.
Patch by: Praveen Velliengiri
Reviewed by: Yaxun Liu, Roman Lebedev
Differential Revision: https://reviews.llvm.org/D116216