Mirko Brkusanin [Thu, 10 Dec 2020 11:40:49 +0000 (12:40 +0100)]
[AMDGPU] Resolve issues when picking between ds_read/write and ds_read2/write2
Both ds_read_b128 and ds_read2_b64 are valid for 128bit 16-byte aligned
loads but the one that will be selected is determined either by the order in
tablegen or by the AddedComplexity attribute. Currently ds_read_b128 has
priority.
While ds_read2_b64 has lower alignment requirements, we cannot always
restrict ds_read_b128 to 16-byte alignment because of unaligned-access-mode
option. This was causing ds_read_b128 to be selected for 8-byte aligned
loads regardles of chosen access mode.
To resolve this we use two patterns for selecting ds_read_b128. One
requires alignment of 16-byte and the other requires
unaligned-access-mode option.
Same goes for ds_write2_b64 and ds_write_b128.
Differential Revision: https://reviews.llvm.org/D92767
Nathan James [Thu, 10 Dec 2020 11:34:57 +0000 (11:34 +0000)]
[clang-tidy][NFC] Use moves instead of copies when constructing OptionsProviders.
Reviewed By: aaron.ballman
Differential Revision: https://reviews.llvm.org/D92267
Raphael Isemann [Thu, 10 Dec 2020 09:09:06 +0000 (10:09 +0100)]
[lldb] Allow LLDB to automatically retry a failed expression with an imported std C++ module
By now LLDB can import the 'std' C++ module to improve expression evaluation,
but there are still a few problems to solve before we can do this by default.
One is that importing the C++ module is slightly slower than normal expression
evaluation (mostly because the disk access and loading the initial lookup data
is quite slow in comparison to the barebone Clang setup the rest of the LLDB
expression evaluator is usually doing). Another problem is that some complicated
types in the standard library aren't fully supported yet by the ASTImporter, so
we end up types that fail to import (which usually appears to the user as if the
type is empty or there is just no result variable).
To still allow people to adopt this mode in their daily debugging, this patch
adds a setting that allows LLDB to automatically retry failed expression with a
loaded C++ module. All success expressions will behave exactly as they would do
before this patch. Failed expressions get a another parse attempt if we find a
usable C++ module in the current execution context. This way we shouldn't have
any performance/parsing regressions in normal debugging workflows, while the
debugging workflows involving STL containers benefit from the C++ module type
info.
This setting is off by default for now with the intention to enable it by
default on macOS soon-ish.
The implementation is mostly just extracting the existing parse logic into its
own function and then calling the parse function again if the first evaluation
failed and we have a C++ module to retry the parsing with.
Reviewed By: shafik, JDevlieghere, aprantl
Differential Revision: https://reviews.llvm.org/D92784
mydeveloperday [Thu, 10 Dec 2020 11:24:12 +0000 (11:24 +0000)]
[clang-format] NFC Add release note for IndentPragmas
Add additional release note to announce new clang-format option added during {D92753}
mydeveloperday [Thu, 10 Dec 2020 11:17:33 +0000 (11:17 +0000)]
[clang-format] Add IndentPragma style to eliminate common clang-format off scenario
A quick search of github.com, shows one common scenario for excessive use of //clang-format off/on is the indentation of #pragma's, especially around the areas of loop optimization or OpenMP
This revision aims to help that by introducing an `IndentPragmas` style, the aim of which is to keep the pragma at the current level of scope
```
for (int i = 0; i < 5; i++) {
// clang-format off
#pragma HLS UNROLL
// clang-format on
for (int j = 0; j < 5; j++) {
// clang-format off
#pragma HLS UNROLL
// clang-format on
....
```
can become
```
for (int i = 0; i < 5; i++) {
#pragma HLS UNROLL
for (int j = 0; j < 5; j++) {
#pragma HLS UNROLL
....
```
This revision also support working alongside the `IndentPPDirective` of `BeforeHash` and `AfterHash` (see unit tests for examples)
Reviewed By: curdeius
Differential Revision: https://reviews.llvm.org/D92753
mydeveloperday [Thu, 10 Dec 2020 11:13:22 +0000 (11:13 +0000)]
[clang-format] PR42434 Remove preprocessor and pragma lines from ObjectiveC guess
clang-format see the `disable:` in __pragma(warning(disable:)) as ObjectiveC method call
Remove any line starting with `#` or __pragma line from being part of the ObjectiveC guess
https://bugs.llvm.org/show_bug.cgi?id=42434
Reviewed By: curdeius, krasimir
Differential Revision: https://reviews.llvm.org/D92922
mydeveloperday [Thu, 10 Dec 2020 11:06:48 +0000 (11:06 +0000)]
[clang-format] [NFC] Fix spelling and grammatical errors in IncludeBlocks text
Fix spelling mistake
Leave space after `.` and before beginning of next sentence
Reword it slightly to try and make it more readable.
Ensure RST is updated correctly (it generated a change)
Reviewed By: HazardyKnusperkeks, curdeius
Differential Revision: https://reviews.llvm.org/D92822
David Green [Thu, 10 Dec 2020 10:49:00 +0000 (10:49 +0000)]
[ARM] Additional test for Min loop. NFC
David Green [Thu, 10 Dec 2020 10:30:31 +0000 (10:30 +0000)]
[ARM] Remove copies from low overhead phi inductions.
The phi created in a low overhead loop gets created with a default
register class it seems. There are then copied inserted between the low
overhead loop pseudo instructions (which produce/consume GPRlr
instructions) and the phi holding the induction. This patch removes
those as a step towards attempting to make t2LoopDec and t2LoopEnd a
single instruction, and appears useful in it's own right as shown in the
tests.
Differential Revision: https://reviews.llvm.org/D91267
Alex Zinenko [Tue, 8 Dec 2020 15:09:20 +0000 (16:09 +0100)]
[mlir] Explicitly track branch instructions in translation to LLVM IR
The current implementation of the translation to LLVM IR relies on the
existence of a one-to-one mapping between MLIR blocks and LLVM IR basic blocks
in order to configure PHI nodes with appropriate source blocks. The one-to-one
mapping model is broken in presence of OpenMP operations that use LLVM's
OpenMPIRBuilder, which produces multiple blocks under the hood. This can lead
to invalid LLVM IR being emitted if OpenMPIRBuilder moved the branch operation
into a basic block different from the one it was originally created in;
specifically, a block that is not a direct predecessor could be used in the PHI
node. Instead, keep track of the mapping between MLIR LLVM dialect branch
operations and their LLVM IR counterparts and take the parent basic block of
the LLVM IR instruction at the moment of connecting the PHI nodes to
predecessors.
This behavior cannot be triggered as of now, but will be once we introduce the
conversion of OpenMP workshare loops.
Reviewed By: kiranchandramohan
Differential Revision: https://reviews.llvm.org/D92845
Jun Ma [Tue, 8 Dec 2020 07:46:12 +0000 (15:46 +0800)]
[TruncInstCombine] Remove scalable vector restriction
Differential Revision: https://reviews.llvm.org/D92819
Benjamin Kramer [Thu, 10 Dec 2020 09:57:14 +0000 (10:57 +0100)]
Remove Shapet assignment operator that's identical to the default. NFC.
Raphael Isemann [Thu, 10 Dec 2020 09:56:46 +0000 (10:56 +0100)]
[lldb][NFC] Fix a typo in TestCppMultipleInheritance
Benjamin Kramer [Thu, 10 Dec 2020 09:53:56 +0000 (10:53 +0100)]
[Hexagon] Fold single-use variables into assert. NFCI.
Silences unused variable warnings in Release builds.
Benjamin Kramer [Wed, 9 Dec 2020 11:06:51 +0000 (12:06 +0100)]
[mlir][Shape] Make sure tensor_cast(constant_shape) folding uses the correct type
This is still subtle, but I think the test cases are sufficient to show
that it works.
Differential Revision: https://reviews.llvm.org/D92927
David Green [Thu, 10 Dec 2020 09:17:34 +0000 (09:17 +0000)]
[ARM] MVE vcreate tests, for dual lane moves. NFC
LLVM GN Syncbot [Thu, 10 Dec 2020 09:13:09 +0000 (09:13 +0000)]
[gn build] Port
f80b29878b0
Haojian Wu [Thu, 10 Dec 2020 09:11:15 +0000 (10:11 +0100)]
[AST] Fix a constexpr-evaluator crash on error-dependent returnstmt.
When the evaluator encounters an error-dependent returnstmt, before this patch
it returned a ESR_Returned without setting the result, the callsides think this
is a successful execution, and try to access the Result which causes the crash.
The fix is to always return failed as we don't know the result of the
error-dependent return stmt.
Differential Revision: https://reviews.llvm.org/D92969
Luo, Yuanke [Sun, 6 Sep 2020 02:17:22 +0000 (10:17 +0800)]
[X86] AMX programming model.
This patch implements amx programming model that discussed in llvm-dev
(http://lists.llvm.org/pipermail/llvm-dev/2020-August/144302.html).
Thank Hal for the good suggestion in the RA. The fast RA is not in the patch yet.
This patch implemeted 7 components.
1. The c interface to end user.
2. The AMX intrinsics in LLVM IR.
3. Transform load/store <256 x i32> to AMX intrinsics or split the
type into two <128 x i32>.
4. The Lowering from AMX intrinsics to AMX pseudo instruction.
5. Insert psuedo ldtilecfg and build the def-use between ldtilecfg to amx
intruction.
6. The register allocation for tile register.
7. Morph AMX pseudo instruction to AMX real instruction.
Change-Id: I935e1080916ffcb72af54c2c83faa8b2e97d5cb0
Differential Revision: https://reviews.llvm.org/D87981
Adrian Kuegel [Wed, 9 Dec 2020 09:41:33 +0000 (10:41 +0100)]
Add sqrt lowering from standard to ROCDL
Add a lowering for sqrt from standard dialect to ROCDL.
Differential Revision: https://reviews.llvm.org/D92921
Lang Hames [Wed, 9 Dec 2020 01:37:50 +0000 (12:37 +1100)]
[JITLink][ELF] Reformat/add debug logging in ELF_x86_64.cpp.
Moves symbol name to the end of the output and makes other columns fixed width
so that they line up.
Marek Kurdej [Thu, 10 Dec 2020 07:38:41 +0000 (08:38 +0100)]
[libc++] [P1164] [C++20] Make fs::create_directory() error if there is already a non-directory.
Also mark LWG2935 and LWG3079 as complete.
Applied retroactively to previous standards too, as it's a DR.
* https://wg21.link/P1164
* https://wg21.link/lwg2935
* https://wg21.link/lwg3079
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D92769
Marek Kurdej [Thu, 10 Dec 2020 07:37:21 +0000 (08:37 +0100)]
[libc++] Add a script to automatize updating test for a new header.
Idea from D92525.
This script globs include/ directory and updates the tests in test/libcxx.
This patch does not generate module.modulemap nor CMakeLists.txt.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D92656
Kazu Hirata [Thu, 10 Dec 2020 07:34:07 +0000 (23:34 -0800)]
[Tablegen] Use llvm::is_contained (NFC)
Sergey Dmitriev [Thu, 10 Dec 2020 06:51:58 +0000 (22:51 -0800)]
[llvm-link][NFC] Minor cleanup
llvm::Linker::linkModules() is a static member, so there is no need
to pass reference to llvm::Linker instance to loadArFile() function.
Reviewed By: tra
Differential Revision: https://reviews.llvm.org/D92918
Kazushi (Jam) Marukawa [Thu, 10 Dec 2020 06:10:01 +0000 (15:10 +0900)]
[VE][NFC] Disable VP tests
VP tests recently added don't work on Release mode. They work on
Debug mode, so I disable them on Release mode to make tests work.
Arthur Eubanks [Thu, 10 Dec 2020 06:04:59 +0000 (22:04 -0800)]
[test] Fix coro-retcon.ll under NPM
The full aa-pipeline is required to remove the extra store.
Sam Clegg [Thu, 10 Dec 2020 04:46:37 +0000 (20:46 -0800)]
[lld][WebAssembly] Don't emit names for data segments that we omit
Followup to https://reviews.llvm.org/D92909
Differential Revision: https://reviews.llvm.org/D92997
Jonas Devlieghere [Thu, 10 Dec 2020 02:39:29 +0000 (18:39 -0800)]
[lldb] Kill the inferior instead of detaching during test suite runs
Kill (rather than detach) form the inferior if debugserver loses its
connection to lldb to prevent zombie processes.
Differential revision: https://reviews.llvm.org/D92908
Yuanfang Chen [Thu, 10 Dec 2020 02:16:45 +0000 (18:16 -0800)]
[NFCI] Add a missing triple in clang/test/CodeGen/ppc64le-varargs-f128.c
Richard Smith [Thu, 10 Dec 2020 02:07:52 +0000 (18:07 -0800)]
MSABI: Basic mangling for access to member subobjects in a class
non-type template parameter.
The mangling information used here comes from private communication with
Jon Caves at Microsoft.
Nico Weber [Thu, 10 Dec 2020 02:04:22 +0000 (21:04 -0500)]
[lld/mac] Use xxhash instead of MD5 for computing the UUID
15% faster for linking Chromium's base_unittests.txt, according to ministat:
```
N Min Max Median Avg Stddev
x 10 0.650213 0.
69287586 0.
65793395 0.
66127126 0.
012365407
+ 10 0.
54993701 0.
59006906 0.
55885506 0.
56146643 0.
013215349
Difference at 95.0% confidence
-0.0998048 +/- 0.0120244
-15.0929% +/- 1.81838%
(Student's t, pooled s = 0.0127974)
```
And matches what we do on the other ports.
Differential Revision: https://reviews.llvm.org/D92736
Alina Sbirlea [Sat, 5 Dec 2020 02:04:24 +0000 (18:04 -0800)]
[MemorySSA/docs] Extend MemorySSA documentation.
Fangrui Song [Thu, 10 Dec 2020 01:53:37 +0000 (17:53 -0800)]
[ELF] Rename --[no-]lto-new-pass-manager to --[no-]lto-legacy-pass-manager
Normally we should not delete options. However, the Clang driver passes
`-plugin-opt={new,legacy}-pass-manager` instead of
`--[no-]lto-legacy-pass-manager` (`-plugin-opt=new-pass-manager` has been used
since 7.0), and it is unlikely anyone will use the `--lto-*` style options directly.
So let's rename them to be consistent with the Clang driver option names.
Reviewed By: aeubanks
Differential Revision: https://reviews.llvm.org/D92988
Arthur Eubanks [Tue, 8 Dec 2020 23:15:10 +0000 (15:15 -0800)]
[LTO][NPM] Default to using NPM under ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
This affects users of LTO that don't explicitly set UseNewPM.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D92894
Fangrui Song [Thu, 10 Dec 2020 01:26:21 +0000 (17:26 -0800)]
[test] Fix test/Driver/ve-toolchain.cpp
It should specify --sysroot to test the paths of crt1.o/crti.o/crtbegin.o.
For a user who enable VE but do not actually have VE sysroot,
the "nld" command line will have bare "crt1.o" "crti.o" ... "crtbegin.o"
Fangrui Song [Thu, 10 Dec 2020 01:17:28 +0000 (17:17 -0800)]
[test] Fix Misc/time-passes.c
Hansang Bae [Thu, 10 Dec 2020 00:25:26 +0000 (18:25 -0600)]
[OpenMP] Use RTM lock for OMP lock with synchronization hint
This patch introduces a new RTM lock type based on spin lock which is
used for OMP lock with speculative hint on supported architecture.
Differential Revision: https://reviews.llvm.org/D92615
Nico Weber [Thu, 10 Dec 2020 01:11:19 +0000 (20:11 -0500)]
Revert "[clangd] Extract per-dir CDB cache to its own threadsafe class. NFC"
This reverts commit
634a377bd8cbaa515a58295cfd85dcb6a21381c1.
Breaks tests on Windows, see https://reviews.llvm.org/D92381#2443407
Fangrui Song [Thu, 10 Dec 2020 01:10:17 +0000 (17:10 -0800)]
Default CodeGenOptions::LegacyPassManager to !LLVM_ENABLE_NEW_PASS_MANAGER
Fixes test/CodeGen/flatten.c
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 00:56:08 +0000 (16:56 -0800)]
clangd: Migrate to FileEntryRef in TweakTests, NFC
Fangrui Song [Thu, 10 Dec 2020 00:57:36 +0000 (16:57 -0800)]
[Driver] Add -f[no-]legacy-pass-manager to supersede -f[no-]experimental-new-pass-manager
The new PM is considered stable and many downstream groups have adopted it (some
have adopted it for more than two years). Add -f[no-]legacy-pass-manager to reflect the
fact that it is no longer experimental and the legacy pass manager is something we strive to retire.
In the future, when the legacy PM eventually goes away,
-fno-experimental-new-pass-manager and -flegacy-pass-manager will be removed.
This patch also changes -f[no-]legacy-pass-manager to pass `-plugin-opt={new,legacy}-pass-manager` to the linker (supported by both ld.lld and LLVMgold.so) when -flto/-flto=thin is specified
Reviewed By: aeubanks, rsmith
Differential Revision: https://reviews.llvm.org/D92915
Fangrui Song [Thu, 10 Dec 2020 00:43:30 +0000 (16:43 -0800)]
Rename -plugin-opt=no-new-pass-manager to -plugin-opt=legacy-pass-manager
Stanislav Mekhanoshin [Wed, 9 Dec 2020 23:51:21 +0000 (15:51 -0800)]
[AMDGPU] Fix expansion of 192 bit spills in PEI
Differential Revision: https://reviews.llvm.org/D92979
Artem Belevich [Thu, 3 Dec 2020 21:48:37 +0000 (13:48 -0800)]
[DWARF] Allow toolchain to adjust specified DWARF version.
This is needed for CUDA compilation where NVPTX back-end only supports DWARF2,
but host compilation should be allowed to use newer DWARF versions.
Differential Revision: https://reviews.llvm.org/D92617
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 00:31:38 +0000 (16:31 -0800)]
Tooling: Migrate to FileEntryRef in clang::tooling::applyAllReplacements, NFC
Migrate to the `FileEntryRef` overload of `SourceManager::createFileID`.
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 00:15:07 +0000 (16:15 -0800)]
Frontend: Use a getVirtualFileRef for a named pipe main file, NFC
Krzysztof Parzyszek [Wed, 9 Dec 2020 23:52:03 +0000 (17:52 -0600)]
[Hexagon] Silence warnings about unused objects
Krzysztof Parzyszek [Wed, 9 Dec 2020 23:39:13 +0000 (17:39 -0600)]
[Hexagon] Fix build: move template specialization into namespace scope
Scott Linder [Wed, 9 Dec 2020 23:13:15 +0000 (23:13 +0000)]
[MC] Fix ICE with non-newline terminated input
There is an explicit option for the lexer to support this, but we crash
when `-preserve-comments` is enabled because it checks for
`getTok().getString().empty()` to detect the case. This doesn't
work currently because the lexer reports this case as a string of length
1, containing a null byte.
Change the lexer to instead report this case via an empty string, as the
null terminator isn't logically a part of the textual input, and the
check for `.empty()` seems natural and obvious in the calling code.
Reviewed By: niravd
Differential Revision: https://reviews.llvm.org/D92681
River Riddle [Wed, 9 Dec 2020 23:33:49 +0000 (15:33 -0800)]
[mlir][Interfaces] Tidy up the documentation for interfaces
The documentation has become a bit stale with age, and doesn't include great documentation for some newer concepts. This revision tidies up a majority of it, with some more cleanup to come in the future. The documentation for the declarative specification is also moved from OpDefinitions.md to Interfaces.md, which is a much more logical place for it to live.
Differential Revision: https://reviews.llvm.org/D92895
LLVM GN Syncbot [Wed, 9 Dec 2020 23:12:27 +0000 (23:12 +0000)]
[gn build] Port
f5d07a05bbd
Krzysztof Parzyszek [Mon, 7 Sep 2020 19:26:48 +0000 (14:26 -0500)]
[Hexagon] Realign HVX vectors wherever possible
Introduce HexagonVectorCombine as a helper class for vector-related
optimizations.
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 22:50:07 +0000 (14:50 -0800)]
clang-format: Migrate createInMemoryFile to FileEntryRef, NFC
Saleem Abdulrasool [Wed, 9 Dec 2020 22:47:50 +0000 (22:47 +0000)]
X86: use a data driven configuration of Windows x86 libcalls (NFC)
Rather than creating a series of associated calls and ensuring that
everything is lined up, use a table driven approach that ensures that
they two always stay in sync.
Nawrin Sultana [Mon, 30 Nov 2020 23:41:53 +0000 (17:41 -0600)]
[OpenMP] Add strict mode in num_tasks and grainsize
This patch adds new API __kmpc_taskloop_5 to accomadate strict
modifier (introduced in OpenMP 5.1) in num_tasks and grainsize
clause.
Differential Revision: https://reviews.llvm.org/D92352
Duncan P. N. Exon Smith [Thu, 5 Nov 2020 17:37:41 +0000 (12:37 -0500)]
Remove RemappedFiles param from ASTUnit::LoadFromASTFile, NFC
This parameter is always set to `None`. Remove it.
Differential Revision: https://reviews.llvm.org/D90889
Matt Morehouse [Wed, 9 Dec 2020 22:29:28 +0000 (14:29 -0800)]
[DFSan] Add custom wrapper for getsockopt.
The wrapper clears shadow for optval and optlen when written.
Reviewed By: stephan.yichao.zhao, vitalybuka
Differential Revision: https://reviews.llvm.org/D92961
Rahul Joshi [Wed, 9 Dec 2020 17:23:30 +0000 (09:23 -0800)]
[MLIR] Minor cleanup for Shape dialect.
- Remove some unused types from the Shape dialect
- Fix from_extent_tensor to only allow 1D index tensors
- Fix assuming_yield to only allow shape.assuming as the parent op.
- Fix some documentation typos and reword some things.
Differential Revision: https://reviews.llvm.org/D92901
Jason Molenda [Wed, 9 Dec 2020 22:12:15 +0000 (14:12 -0800)]
Ignore DBGArchitecture from dsymForUUID's plist
When the architecture from the returned plist differs from the
architecture lldb will pick when loading the binary file, lldb will
reject the binary as not matching. We are working with UUID's in
this case, so an architecture is not disambiguating anything; it
just opens this possibility for failing to load the specified binary.
Stop reading the architecture from the plist.
<rdar://problem/
71612561>
Differential revision: https://reviews.llvm.org/D92692
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 01:32:32 +0000 (17:32 -0800)]
ARCMigrate: Migrate ObjCMT.cpp over to FileEntryRef
Migrate ObjCMT.cpp from using `const FileEntry*` to `FileEntryRef`. This
is one of the blockers for changing `SourceManager` to use
`FileEntryRef`.
This adds an initial version of `SourceManager::getFileEntryRefForID`,
which uses to `FileEntry::getLastRef`; after `SourceManager` switches,
`SourceManager::getFileEntryForID` will need to call this function.
This also adds uses of `FileEntryRef` as a key in a `DenseMap`, and a
call to `hash_value(Optional)` in `DenseMapInfo<EditEntry>`; support for
these were added in prep commits.
Differential Revision: https://reviews.llvm.org/D92678
Peter Collingbourne [Wed, 9 Dec 2020 21:30:52 +0000 (13:30 -0800)]
scudo: Shrink secondary header and cache entry size by a word on Linux. NFCI.
Normally compilers will allocate space for struct fields even if the
field is an empty struct. Use the [[no_unique_address]] attribute to
suppress that behavior. This attribute that was introduced in C++20,
but compilers that do not support [[no_unique_address]] will ignore
it since it uses C++11 attribute syntax.
Differential Revision: https://reviews.llvm.org/D92966
Scott Linder [Wed, 9 Dec 2020 21:20:28 +0000 (21:20 +0000)]
[MC][AMDGPU] Consume EndOfStatement in asm parser
Avoids spurious newlines showing up in the output when emitting assembly
via MC.
Reviewed By: MaskRay, arsenm
Differential Revision: https://reviews.llvm.org/D92690
Craig Topper [Wed, 9 Dec 2020 18:21:40 +0000 (10:21 -0800)]
[X86] Use APInt::isSignedIntN instead of isIntN for 64-bit ANDs in X86DAGToDAGISel::IsProfitableToFold
Pretty sure we meant to be checking signed 32 immediates here
rather than unsigned 32 bit. I suspect I messed this up because
in MathExtras.h we have isIntN and isUIntN so isIntN differs in
signedness depending on whether you're using APInt or plain integers.
This fixes a case where we didn't fold a constant created
by shrinkAndImmediate. Since shrinkAndImmediate doesn't topologically
sort constants it creates, we can fail to convert the Constant
to a TargetConstant. This leads to very strange behavior later.
Fixes PR48458.
Reid Kleckner [Wed, 9 Dec 2020 21:30:22 +0000 (13:30 -0800)]
Avoid a possible one-byte OOB read off of .drectve sections
Pointed out by Ryan Prichard
Tres Popp [Wed, 9 Dec 2020 20:54:58 +0000 (21:54 +0100)]
[mlir] Allow RegionBranchOps in dependence analysis
This is to prevent assertion failures on scf.if and shape.assuming
operations where this is not enough information currently to handle any
aliasing information.
Differential Revision: https://reviews.llvm.org/D92963
Fangrui Song [Wed, 9 Dec 2020 21:31:03 +0000 (13:31 -0800)]
[LLD][gold] Add -plugin-opt=no-new-pass-manager
-DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=on configured LLD and LLVMgold.so
will use the new pass manager by default. Add an option to
use the legacy pass manager. This will also be used by the Clang driver
when -fno-new-pass-manager (D92915) / -fno-experimental-new-pass-manager is set.
Reviewed By: aeubanks, tejohnson
Differential Revision: https://reviews.llvm.org/D92916
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 20:30:48 +0000 (12:30 -0800)]
Frontend: Migrate to FileEntryRef in CompilerInstance::InitializeSourceManager, NFC
Use `FileManager::getVirtualFileRef` to get the virtual file for stdin,
and add an overload of `SourceManager::overrideFileContents` that takes
a `FileEntryRef`, migrating `CompilerInstance::InitializeSourceManager`.
Differential Revision: https://reviews.llvm.org/D92680
Yuanfang Chen [Wed, 9 Dec 2020 21:10:39 +0000 (13:10 -0800)]
[NFCI] Add missing triple to several LTO tests
Also remove the module triple of clang/test/CodeGenObjC/arc.ll, the
commandline tripe is all it needs.
Scott Linder [Wed, 9 Dec 2020 20:44:20 +0000 (20:44 +0000)]
[AMDGPU][MC] Restore old error position for "too few operands"
Revert part of https://reviews.llvm.org/D92084 to make it simpler to
start consuming the EndOfStatement token within AMDGPU's
ParseInstruction in a future patch. This also brings us back to what
every other target currently does.
A future change to move the position back to the end of the statement
would likely need to audit all of the AMDGPUOperand SMLoc ranges, and
determine the SMLoc for the last character of the last operand.
Reviewed By: dp
Differential Revision: https://reviews.llvm.org/D92960
Matt Morehouse [Wed, 9 Dec 2020 21:07:38 +0000 (13:07 -0800)]
[DFSan] Add custom wrapper for recvmsg.
The wrapper clears shadow for anything written by recvmsg.
Reviewed By: stephan.yichao.zhao
Differential Revision: https://reviews.llvm.org/D92949
Sam Clegg [Wed, 9 Dec 2020 05:47:19 +0000 (21:47 -0800)]
[WebAssembly] Add support for named data sections in wasm binaries
Followup to https://reviews.llvm.org/D91769 which added support
for names globals.
Differential Revision: https://reviews.llvm.org/D92909
Mircea Trofin [Wed, 9 Dec 2020 17:23:38 +0000 (09:23 -0800)]
[NFC] Removed unused prefixes in llvm/test/CodeGen/AArch64
Differential Revision: https://reviews.llvm.org/D92943
Kirill Bobyrev [Wed, 9 Dec 2020 20:40:10 +0000 (21:40 +0100)]
[clangd] NFC: Add client-side logging for remote index requests
Figuring out whether the server is responding and debugging issues with remote
index setup is no easy task: add verbose logging for client side RPC requests
to relieve some pain.
Reviewed By: sammccall
Differential Revision: https://reviews.llvm.org/D92181
Sergei Grechanik [Wed, 9 Dec 2020 19:03:56 +0000 (11:03 -0800)]
[mlir][Affine] Fix vectorizability check for multiple load/stores
This patch fixes a bug that allowed vectorizing of loops with loads and
stores having indexing functions varying along different memory
dimensions.
Reviewed By: aartbik, dcaballe
Differential Revision: https://reviews.llvm.org/D92702
Peyton, Jonathan L [Thu, 3 Dec 2020 18:07:33 +0000 (12:07 -0600)]
[OpenMP] Fix norespect affinity bug for Windows
KMP_AFFINITY=norespect was triggering an error because the underlying
process affinity mask was not updated to include the entire machine.
The Windows documentation states that the thread affinities must be
subsets of the process affinity. This patch also moves the printing
(for KMP_AFFINITY=verbose) of whether the initial mask was respected
out of each topology detection function and to one location where the
initial affinity mask is read.
Differential Revision: https://reviews.llvm.org/D92587
Peyton, Jonathan L [Fri, 4 Dec 2020 16:30:10 +0000 (10:30 -0600)]
[OpenMP] Fix too long name for shm segment on macOS
Remove the user id component to the shm segment name and just use
the pid like before.
Differential Revision: https://reviews.llvm.org/D92660
Gabor Marton [Fri, 27 Nov 2020 07:32:51 +0000 (08:32 +0100)]
[ASTImporter] Support CXXDeductionGuideDecl with local typedef
CXXDeductionGuideDecl with a local typedef has its own copy of the
TypedefDecl with the CXXDeductionGuideDecl as the DeclContext of that
TypedefDecl.
```
template <typename T> struct A {
typedef T U;
A(U, T);
};
A a{(int)0, (int)0};
```
Related discussion on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2020-November/067252.html
Without this fix, when we import the CXXDeductionGuideDecl (via
VisitFunctionDecl) then before creating the Decl we must import the
FunctionType. However, the first parameter's type is the afore mentioned
local typedef. So, we then start importing the TypedefDecl whose
DeclContext is the CXXDeductionGuideDecl itself. The infinite loop is
formed.
```
#0 clang::ASTNodeImporter::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl*) clang/lib/AST/ASTImporter.cpp:3543:0
#1 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/DeclNodes.inc:405:0
#2 clang::ASTImporter::ImportImpl(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8038:0
#3 clang::ASTImporter::Import(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8200:0
#4 clang::ASTImporter::ImportContext(clang::DeclContext*) clang/lib/AST/ASTImporter.cpp:8297:0
#5 clang::ASTNodeImporter::ImportDeclContext(clang::Decl*, clang::DeclContext*&, clang::DeclContext*&) clang/lib/AST/ASTImporter.cpp:1852:0
#6 clang::ASTNodeImporter::ImportDeclParts(clang::NamedDecl*, clang::DeclContext*&, clang::DeclContext*&, clang::DeclarationName&, clang::NamedDecl*&, clang::SourceLocation&) clang/lib/AST/ASTImporter.cpp:1628:0
#7 clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) clang/lib/AST/ASTImporter.cpp:2419:0
#8 clang::ASTNodeImporter::VisitTypedefDecl(clang::TypedefDecl*) clang/lib/AST/ASTImporter.cpp:2500:0
#9 clang::declvisitor::Base<std::add_pointer, clang::ASTNodeImporter, llvm::Expected<clang::Decl*> >::Visit(clang::Decl*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/DeclNodes.inc:315:0
#10 clang::ASTImporter::ImportImpl(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8038:0
#11 clang::ASTImporter::Import(clang::Decl*) clang/lib/AST/ASTImporter.cpp:8200:0
#12 llvm::Expected<clang::TypedefNameDecl*> clang::ASTNodeImporter::import<clang::TypedefNameDecl>(clang::TypedefNameDecl*) clang/lib/AST/ASTImporter.cpp:165:0
#13 clang::ASTNodeImporter::VisitTypedefType(clang::TypedefType const*) clang/lib/AST/ASTImporter.cpp:1304:0
#14 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:74:0
#15 clang::ASTImporter::Import(clang::QualType) clang/lib/AST/ASTImporter.cpp:8071:0
#16 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) clang/lib/AST/ASTImporter.cpp:179:0
#17 clang::ASTNodeImporter::VisitFunctionProtoType(clang::FunctionProtoType const*) clang/lib/AST/ASTImporter.cpp:1244:0
#18 clang::TypeVisitor<clang::ASTNodeImporter, llvm::Expected<clang::QualType> >::Visit(clang::Type const*) /home/egbomrt/WORK/llvm5/build/debug/tools/clang/include/clang/AST/TypeNodes.inc:47:0
#19 clang::ASTImporter::Import(clang::QualType) clang/lib/AST/ASTImporter.cpp:8071:0
#20 llvm::Expected<clang::QualType> clang::ASTNodeImporter::import<clang::QualType>(clang::QualType const&) clang/lib/AST/ASTImporter.cpp:179:0
#21 clang::QualType clang::ASTNodeImporter::importChecked<clang::QualType>(llvm::Error&, clang::QualType const&) clang/lib/AST/ASTImporter.cpp:198:0
#22 clang::ASTNodeImporter::VisitFunctionDecl(clang::FunctionDecl*) clang/lib/AST/ASTImporter.cpp:3313:0
#23 clang::ASTNodeImporter::VisitCXXDeductionGuideDecl(clang::CXXDeductionGuideDecl*) clang/lib/AST/ASTImporter.cpp:3543:0
```
The fix is to first create the TypedefDecl and only then start to import
the DeclContext.
Basically, we could do this during the import of all other Decls (not
just for typedefs). But it seems, there is only one another AST
construct that has a similar cycle: a struct defined as a function
parameter:
```
int struct_in_proto(struct data_t{int a;int b;} *d);
```
In that case, however, we had decided to return simply with an error
back then because that seemed to be a very rare construct.
Differential Revision: https://reviews.llvm.org/D92209
Richard Smith [Wed, 9 Dec 2020 20:13:29 +0000 (12:13 -0800)]
Add another test for PR48434.
Richard Smith [Thu, 12 Nov 2020 01:12:18 +0000 (17:12 -0800)]
Add new 'preferred_name' attribute.
This attribute permits a typedef to be associated with a class template
specialization as a preferred way of naming that class template
specialization. This permits us to specify that (for example) the
preferred way to express 'std::basic_string<char>' is as 'std::string'.
The attribute is applied to the various class templates in libc++ that have
corresponding well-known typedef names.
This is a re-commit. The previous commit was reverted because it exposed
a pre-existing bug that has since been fixed / worked around; see
PR48434.
Differential Revision: https://reviews.llvm.org/D91311
Richard Smith [Wed, 9 Dec 2020 20:04:03 +0000 (12:04 -0800)]
PR48434: Work around crashes due to deserialization cycles via typedefs.
Ensure that we can deserialize a TypedefType even while in the middle of
deserializing its TypedefDecl, by removing the need to look at the
TypedefDecl while constructing the TypedefType.
This fixes all the currently-known failures for PR48434, but it's not a
complete fix, because we can still trigger deserialization cycles, which
are not supposed to happen.
Fangrui Song [Wed, 9 Dec 2020 20:14:00 +0000 (12:14 -0800)]
[ELF] Reorganize "is only supported on" tests and fix some diagnostics
Duncan P. N. Exon Smith [Fri, 4 Dec 2020 22:41:52 +0000 (14:41 -0800)]
Frontend: Migrate to FileEntryRef in VerifyDiagnosticConsumer.cpp, NFC
Add a `FileEntryRef` overload of `SourceManager::translateFile`, and
migrate `ParseDirective` in VerifyDiagnosticConsumer.cpp to use it and
the corresponding overload of `createFileID`.
No functionality change here.
Differential Revision: https://reviews.llvm.org/D92699
Peter Collingbourne [Sat, 5 Dec 2020 08:22:33 +0000 (00:22 -0800)]
scudo: Fix quarantine allocation when MTE enabled.
Quarantines have always been broken when MTE is enabled because the
quarantine batch allocator fails to reset tags that may have been
left behind by a user allocation.
This was only noticed when running the Scudo unit tests with Scudo
as the system allocator because quarantines are turned off by
default on Android and the test binary turns them on by defining
__scudo_default_options, which affects the system allocator as well.
Differential Revision: https://reviews.llvm.org/D92881
Peter Collingbourne [Fri, 4 Dec 2020 23:03:49 +0000 (15:03 -0800)]
scudo: Split setRandomTag in two. NFCI.
Separate the IRG part from the STZG part since we will need to use
the latter on its own for some upcoming changes.
Differential Revision: https://reviews.llvm.org/D92880
Florian Hahn [Wed, 9 Dec 2020 19:39:44 +0000 (19:39 +0000)]
[AArch64] Add aarch64_neon_vcmla{_rot{90,180,270}} intrinsics.
Add builtins required to implement vcmla and rotated variants from
the ACLE
Reviewed By: t.p.northover
Differential Revision: https://reviews.llvm.org/D92929
Jon Chesterfield [Wed, 9 Dec 2020 19:45:20 +0000 (19:45 +0000)]
[libomptarget][amdgpu] clang-format src/rtl.cpp
Michael Munday [Wed, 9 Dec 2020 19:41:19 +0000 (19:41 +0000)]
[RISCV][NFC] Regenerate RISCV CodeGen tests
Regenerated using:
./llvm/utils/update_llc_test_checks.py -u llvm/test/CodeGen/RISCV/*.ll
This has added comments to spill-related instructions and added @plt to
some symbols.
Differential Revision: https://reviews.llvm.org/D92841
Jianzhou Zhao [Mon, 23 Nov 2020 08:33:59 +0000 (08:33 +0000)]
[dfsan] Track field/index-level shadow values in variables
*************
* The problem
*************
See motivation examples in compiler-rt/test/dfsan/pair.cpp. The current
DFSan always uses a 16bit shadow value for a variable with any type by
combining all shadow values of all bytes of the variable. So it cannot
distinguish two fields of a struct: each field's shadow value equals the
combined shadow value of all fields. This introduces an overtaint issue.
Consider a parsing function
std::pair<char*, int> get_token(char* p);
where p points to a buffer to parse, the returned pair includes the next
token and the pointer to the position in the buffer after the token.
If the token is tainted, then both the returned pointer and int ar
tainted. If the parser keeps on using get_token for the rest parsing,
all the following outputs are tainted because of the tainted pointer.
The CL is the first change to address the issue.
**************************
* The proposed improvement
**************************
Eventually all fields and indices have their own shadow values in
variables and memory.
For example, variables with type {i1, i3}, [2 x i1], {[2 x i4], i8},
[2 x {i1, i1}] have shadow values with type {i16, i16}, [2 x i16],
{[2 x i16], i16}, [2 x {i16, i16}] correspondingly; variables with
primary type still have shadow values i16.
***************************
* An potential implementation plan
***************************
The idea is to adopt the change incrementially.
1) This CL
Support field-level accuracy at variables/args/ret in TLS mode,
load/store/alloca still use combined shadow values.
After the alloca promotion and SSA construction phases (>=-O1), we
assume alloca and memory operations are reduced. So if struct
variables do not relate to memory, their tracking is accurate at
field level.
2) Support field-level accuracy at alloca
3) Support field-level accuracy at load/store
These two should make O0 and real memory access work.
4) Support vector if necessary.
5) Support Args mode if necessary.
6) Support passing more accurate shadow values via custom functions if
necessary.
***************
* About this CL.
***************
The CL did the following
1) extended TLS arg/ret to work with aggregate types. This is similar
to what MSan does.
2) implemented how to map between an original type/value/zero-const to
its shadow type/value/zero-const.
3) extended (insert|extract)value to use field/index-level progagation.
4) for other instructions, propagation rules are combining inputs by or.
The CL converts between aggragate and primary shadow values at the
cases.
5) Custom function interfaces also need such a conversion because
all existing custom functions use i16. It is unclear whether custome
functions need more accurate shadow propagation yet.
6) Added test cases for aggregate type related cases.
Reviewed-by: morehouse
Differential Revision: https://reviews.llvm.org/D92261
Jon Chesterfield [Wed, 9 Dec 2020 19:35:34 +0000 (19:35 +0000)]
[libomptarget][amdgpu] Let default number of teams equal number of CUs
Jon Chesterfield [Wed, 9 Dec 2020 19:12:10 +0000 (19:12 +0000)]
[libomptarget][amdgpu] Robust handling of device_environment symbol
Reid Kleckner [Tue, 8 Dec 2020 19:54:11 +0000 (11:54 -0800)]
Don't setup inalloca for swiftcc on i686-windows-msvc
Swiftcall does it's own target-independent argument type classification,
since it is not designed to be ABI compatible with anything local on the
target that isn't LLVM-based. This means it never uses inalloca.
However, we have duplicate logic for checking for inalloca parameters
that runs before call argument setup. This logic needs to know ahead of
time if inalloca will be used later, and we can't move the
CGFunctionInfo calculation earlier.
This change gets the calling convention from either the
FunctionProtoType or ObjCMethodDecl, checks if it is swift, and if so
skips the stackbase setup.
Depends on D92883.
Differential Revision: https://reviews.llvm.org/D92944
Reid Kleckner [Tue, 8 Dec 2020 21:54:34 +0000 (13:54 -0800)]
De-templatify EmitCallArgs argument type checking, NFCI
This template exists to abstract over FunctionPrototype and
ObjCMethodDecl, which have similar APIs for storing parameter types. In
place of a template, use a PointerUnion with two cases to handle this.
Hopefully this improves readability, since the type of the prototype is
easier to discover. This allows me to sink this code, which is mostly
assertions, out of the header file and into the cpp file. I can also
simplify the overloaded methods for computing isGenericMethod, and get
rid of the second EmitCallArgs overload.
Differential Revision: https://reviews.llvm.org/D92883
Raphael Isemann [Wed, 9 Dec 2020 19:02:00 +0000 (20:02 +0100)]
[lldb][NFC] Refactor _get_bool_config_skip_if_decorator
NFC preparation for another patch. Also add some documentation for why the
error value is true (and not false).
Jon Chesterfield [Wed, 9 Dec 2020 18:55:21 +0000 (18:55 +0000)]
[libomptarget][amdgpu] Improve diagnostics on arch mismatch
Justin Bogner [Wed, 9 Dec 2020 18:33:59 +0000 (10:33 -0800)]
Limit the recursion depth of SelectionDAG::isSplatValue()
This method previously always recursively checked both the left-hand
side and right-hand side of binary operations for splatted (broadcast)
vector values to determine if the parent DAG node is a splat.
Like several other SelectionDAG methods, limit the recursion depth to
MaxRecursionDepth (6). This prevents stack overflow.
See also https://issuetracker.google.com/
173785481
Patch by Nicolas Capens. Thanks!
Differential Revision: https://reviews.llvm.org/D92421
Alexey Bader [Wed, 9 Dec 2020 18:01:06 +0000 (21:01 +0300)]
[MCJIT] Add cmake variables to customize ittapi git location and revision.
To support llorg builds this patch provides the following changes:
1) Added cmake variable ITTAPI_GIT_REPOSITORY to control the location of ITTAPI repository.
Default value of ITTAPI_GIT_REPOSITORY is github location: https://github.com/intel/ittapi.git
Also, the separate cmake variable ITTAPI_GIT_TAG was added for repo tag.
2) Added cmake variable ITTAPI_SOURCE_DIR to control the place where the repo will be cloned.
Default value of ITTAPI_SOURCE_DIR is build area: PROJECT_BINARY_DIR
Reviewed By: etyurin, bader
Patch by ekovanov.
Differential Revision: https://reviews.llvm.org/D91935
Arthur Eubanks [Mon, 7 Dec 2020 23:25:43 +0000 (15:25 -0800)]
Reland Pin -loop-reduce to legacy PM
This was accidentally reverted by a later change.
LSR currently only runs in the codegen pass manager.
There are a couple issues with LSR and the NPM.
1) Lots of tests assume that LCSSA isn't run before LSR. This breaks a
bunch of tests' expected output. This is fixable with some time put in.
2) LSR doesn't preserve LCSSA. See
llvm/test/Analysis/MemorySSA/update-remove-deadblocks.ll. LSR's use of
SCEVExpander is the only use of SCEVExpander where the PreserveLCSSA option is
off. Turning it on causes some code sinking out of loops to fail due to
SCEVExpander's inability to handle the newly created trivial PHI nodes in the
broken critical edge (I was looking at
llvm/test/Transforms/LoopStrengthReduce/X86/2011-11-29-postincphi.ll).
I also tried simply just calling formLCSSA() at the end of LSR, but the extra
PHI nodes cause regressions in codegen tests.
We'll delay figuring these issues out until later.
This causes the number of check-llvm failures with -enable-new-pm true
by default to go from 60 to 29.
Reviewed By: asbirlea
Differential Revision: https://reviews.llvm.org/D92796
Fangrui Song [Wed, 9 Dec 2020 17:34:51 +0000 (09:34 -0800)]
[CMake] Add llvm-profgen to LLVM_TEST_DEPENDS
Otherwise `check-llvm-*` may not rebuild llvm-profgen, causing llvm-profgen tests
to fail if llvm-profgen happens to be stale.
Jonas Devlieghere [Tue, 8 Dec 2020 04:59:13 +0000 (20:59 -0800)]
[lldb] Track the API boundary using a thread_local variable.
The reproducers currently use a static variable to track the API
boundary. This is obviously incorrect when the SB API is used
concurrently. While I do not plan to support that use-case (right now),
I do want to avoid us crashing. As a first step, correctly track API
boundaries across multiple threads.
Before this patch SB API calls made by the embedded script interpreter
would be considered "behind the API boundary" and correctly ignored.
After this patch, we need to tell the reproducers to ignore the
scripting thread as a "private thread".
Differential revision: https://reviews.llvm.org/D92811