Walter Erquinigo [Wed, 21 Apr 2021 21:20:17 +0000 (14:20 -0700)]
[lldb-vscode] redirect stderr/stdout to the IDE's console
In certain occasions times, like when LLDB is initializing and
evaluating the .lldbinit files, it tries to print to stderr and stdout
directly. This confuses the IDE with malformed data, as it talks to
lldb-vscode using stdin and stdout following the JSON RPC protocol. This
ends up terminating the debug session with the user unaware of what's
going on. There might be other situations in which this can happen, and
they will be harder to debug than the .lldbinit case.
After several discussions with @clayborg, @yinghuitan and @aadsm, we
realized that the best course of action is to simply redirect stdout and
stderr to the console, without modifying LLDB itself. This will prove to
be resilient to future bugs or features.
I made the simplest possible redirection logic I could come up with. It
only works for POSIX, and to make it work with Windows should be merely
changing pipe and dup2 for the windows equivalents like _pipe and _dup2.
Sadly I don't have a Windows machine, so I'll do it later once my office
reopens, or maybe someone else can do it.
I'm intentionally not adding a stop-redirecting logic, as I don't see it
useful for the lldb-vscode case (why would we want to do that, really?).
I added a test.
Note: this is a simpler version of D80659. I first tried to implement a
RIIA version of it, but it was problematic to manage the state of the
thread and reverting the redirection came with some non trivial
complexities, like what to do with unflushed data after the debug
session has finished on the IDE's side.
River Riddle [Wed, 21 Apr 2021 21:33:30 +0000 (14:33 -0700)]
[mlir][mlir-lsp-server] Add some initial documentation on the MLIR LSP server
This covers some of the basic documentation, but is still missing some documentation/examples of features provided by the server. Feature documentation will be added in a followup.
Differential Revision: https://reviews.llvm.org/D100690
River Riddle [Wed, 21 Apr 2021 21:33:18 +0000 (14:33 -0700)]
[mlir] Add a vscode language extension for MLIR
This utilizes the mlir-lsp server to provide language services for MLIR files opened in vscode. The extension currently supports syntax highlighting, as well as tracking definitions/uses/source locations for SSA values and blocks.
Differential Revision: https://reviews.llvm.org/D100607
River Riddle [Wed, 21 Apr 2021 21:33:04 +0000 (14:33 -0700)]
[mlir][mlir-lsp] Add a new C++ LSP server for MLIR named mlir-lsp-server
This commits adds a basic LSP server for MLIR that supports resolving references and definitions. Several components of the setup are simplified to keep the size of this commit down, and will be built out in later commits. A followup commit will add a vscode language client that communicates with this server, paving the way for better IDE experience when interfacing with MLIR files.
The structure of this tool is similar to mlir-opt and mlir-translate, i.e. the implementation is structured as a library that users can call into to implement entry points that contain the dialects/passes that they are interested in.
Note: This commit contains several files, namely those in `mlir-lsp-server/lsp`, that have been copied from the LSP code in clangd and adapted for use in MLIR. This copying was decided as the best initial path forward (discussed offline by several stake holders in MLIR and clangd) given the different needs of our MLIR server, and the one for clangd. If a strong desire/need for unification arises in the future, the existence of these files in mlir-lsp-server can be reconsidered.
Differential Revision: https://reviews.llvm.org/D100439
River Riddle [Wed, 21 Apr 2021 21:32:50 +0000 (14:32 -0700)]
Add a new AsmParserState class to capture detailed source information for .mlir files
This information isn't useful for general compilation, but is useful for building tools that process .mlir files. This class will be used in a followup to start building an LSP language server for MLIR.
Differential Revision: https://reviews.llvm.org/D100438
Petr Hosek [Tue, 20 Apr 2021 23:14:02 +0000 (16:14 -0700)]
[MC] Use COMDAT for LSDA only if IR comdat type is any
This fixed issue introduced in
16af97393346ad636298605930a8b503a55eb40a
and
796feb61637c407aefcc0d462f24a1cc41f350d8.
Differential Revision: https://reviews.llvm.org/D100909
Walter Erquinigo [Wed, 21 Apr 2021 21:33:02 +0000 (14:33 -0700)]
Fix TestVSCode_launch test
Broken in https://lab.llvm.org/buildbot/#/builders/96/builds/6933
We don't really need to run this test on arm, but would be worth fixing
it later.
Olle Fredriksson [Wed, 21 Apr 2021 20:48:28 +0000 (22:48 +0200)]
[MemCpyOpt] Allow variable lengths in memcpy optimizer
This makes the memcpy-memcpy and memcpy-memset optimizations work for
variable sizes as long as they are equal, relaxing the old restriction
that they are constant integers. If they're not equal, the old
requirement that they are constant integers with certain size
restrictions is used.
The implementation works by pushing the length tests further down in the
code, which reveals some places where it's enough that the lengths are
equal (but not necessarily constant).
Differential Revision: https://reviews.llvm.org/D100870
Jonas Devlieghere [Wed, 21 Apr 2021 20:59:54 +0000 (13:59 -0700)]
Re-land "[Driver] Support default libc++ library location on Darwin"
This reverts commit
05eeed9691aeb3e0316712195b998e9078cdceb0 and after
fixing the impacted lldb tests in
5d1c43f333c2327be61604dc90ea675f0d1e6913.
[Driver] Support default libc++ library location on Darwin
Darwin driver currently uses libc++ headers that are part of Clang
toolchain when available (by default ../include/c++/v1 relative to
executable), but it completely ignores the libc++ library itself
because it doesn't pass the location of libc++ library that's part
of Clang (by default ../lib relative to the exceutable) to the linker
always using the system copy of libc++.
This may lead to subtle issues when the compilation fails because the
headers that are part of Clang toolchain are incompatible with the
system library. Either the driver should ignore both headers as well as
the library, or it should always try to use both when available.
This patch changes the driver behavior to do the latter which seems more
reasonable, it makes it easy to test and use custom libc++ build on
Darwin while still allowing the use of system version. This also matches
the Clang driver behavior on other systems.
Differential Revision: https://reviews.llvm.org/D45639
Yaxun (Sam) Liu [Wed, 21 Apr 2021 18:34:37 +0000 (14:34 -0400)]
[HIP] Add option -fgpu-inline-threshold
Add option -fgpu-inline-threshold for inline threshold for device compilation only.
Reviewed by: Artem Belevich
Differential Revision: https://reviews.llvm.org/D99233
Louis Dionne [Wed, 21 Apr 2021 21:12:01 +0000 (17:12 -0400)]
[libc++] Move macOS testing out of the 2nd CI stage
It's too slow, which delays the posting of CI results to Phabricator
when another step in the same stage fails.
Peter Collingbourne [Tue, 20 Apr 2021 21:54:32 +0000 (14:54 -0700)]
scudo: Make prepareTaggedChunk() and resizeTaggedChunk() generic.
Now that we have a more efficient implementation of storeTags(),
we should start using it from resizeTaggedChunk(). With that, plus
a new storeTag() function, resizeTaggedChunk() can be made generic,
and so can prepareTaggedChunk(). Make it so.
Now that the functions are generic, move them to combined.h so that
memtag.h no longer needs to know about chunks.
Differential Revision: https://reviews.llvm.org/D100911
Peter Collingbourne [Tue, 20 Apr 2021 21:53:41 +0000 (14:53 -0700)]
scudo: Use DC GZVA instruction in storeTags().
DC GZVA can operate on multiple granules at a time (corresponding to
the CPU's cache line size) so we can generally expect it to be faster
than STZG in a loop.
Differential Revision: https://reviews.llvm.org/D100910
Walter Erquinigo [Mon, 12 Apr 2021 20:00:37 +0000 (13:00 -0700)]
[lldb-vscode] Add postRunCommands
This diff ass postRunCommands, which are the counterpart of the preRunCommands. TThey will be executed right after the target is launched or attached correctly, which means that the targets can assume that the target is running.
Differential Revision: https://reviews.llvm.org/D100340
Arthur Eubanks [Wed, 21 Apr 2021 16:41:17 +0000 (09:41 -0700)]
[Evaluator] Bitcast result of pointer stripping
Trying to evaluate a GEP would assert with
"Ty == cast<PointerType>(C->getType()->getScalarType())->getElementType()"
because the type of the pointer we would evaluate the GEP argument to
would be a different type than the GEP was expecting. We should treat
pointer stripping as a bitcast.
The test adds a redundant GEP that would crash due to type mismatch.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D100970
Jonas Devlieghere [Wed, 21 Apr 2021 20:18:36 +0000 (13:18 -0700)]
[lldb] Use the compiler from the SDK in simulator tests
Use the clang compiler from the SDK to build the simulator test programs
to ensure we pick up the correct libc++.
Mehdi Chinoune [Wed, 21 Apr 2021 19:00:55 +0000 (14:00 -0500)]
[flang][msvc] Fix compilation of external-hello-world test with MSVC.
MSVC doesn't accept division by zero.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D96069
Alexey Bataev [Wed, 21 Apr 2021 20:00:28 +0000 (13:00 -0700)]
[SLP]Add a test with broadcast shuffle kind in SLP, NFC.
Arthur Eubanks [Wed, 21 Apr 2021 19:13:53 +0000 (12:13 -0700)]
[LLParser] Print mismatched types in error message
Helps with debugging invalid handcrafted IR.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D100990
Dávid Bolvanský [Wed, 21 Apr 2021 19:59:46 +0000 (21:59 +0200)]
[LoopIdiom] Added testcase from PR44378; NFC
Jez Ng [Wed, 21 Apr 2021 19:43:38 +0000 (15:43 -0400)]
[lld-macho][nfc] Add accessors for commonly-used PlatformInfo fields
As discussed here: https://reviews.llvm.org/D100523#inline-951543
Reviewed By: #lld-macho, thakis, alexshap
Differential Revision: https://reviews.llvm.org/D100978
Nikita Popov [Wed, 21 Apr 2021 19:15:22 +0000 (21:15 +0200)]
Revert "[InstCombine] Fold multiuse shr eq zero"
This reverts commit
9423f78240a216e3f38b394a41fe3427dee22c26.
A performance regression with this patch has been reported at
https://reviews.llvm.org/rG9423f78240a2#990953. Reverting for now.
Roland McGrath [Sat, 17 Apr 2021 02:00:25 +0000 (19:00 -0700)]
[scudo] Avoid empty statement warnings
An empty macro that expands to just `... else ;` can get
warnings from some compilers (e.g. GCC's -Wempty-body).
Reviewed By: cryptoad, vitalybuka
Differential Revision: https://reviews.llvm.org/D100693
Jordan Rupprecht [Mon, 19 Apr 2021 21:32:26 +0000 (14:32 -0700)]
[lldb] Fix RichManglingContext::FromCxxMethodName() leak
`RichManglingContext::FromCxxMethodName` allocates a m_cxx_method_parser, but never deletes it.
This fixes a `-DLLVM_USE_SANITIZER=Leaks` failure.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D100795
sstefan1 [Wed, 21 Apr 2021 19:02:28 +0000 (21:02 +0200)]
[FuncAttrs] Don't infer willreturn for nonexact definitions
Discovered during attributor testing comparing stats with
and without the attributor. Willreturn should not be inferred
for nonexact definitions.
Differential Revision: https://reviews.llvm.org/D100988
Emily Shi [Sat, 10 Apr 2021 00:47:54 +0000 (17:47 -0700)]
[compiler-rt] check max address from kernel is <= mmap range size
If these sizes do not match, asan will not work as expected. Previously, we added compile-time checks for non-iOS platforms. We check at run time for iOS because we get the max VM size from the kernel at run time.
rdar://
76477969
Reviewed By: delcypher
Differential Revision: https://reviews.llvm.org/D100784
sstefan1 [Tue, 20 Apr 2021 17:55:11 +0000 (19:55 +0200)]
[SimplifyLibCalls] Don't change alignment when creating memset
Fix for PR49984
This was discovered during Attributor testing.
Memset was always created with alignment of 1
and in case when strncpy alignment was changed
it triggered an assertion in the AttrBuilder.
Memset will now be created with appropriate alignment.
Differential Revision: https://reviews.llvm.org/D100875
Ahmed Taei [Mon, 19 Apr 2021 23:52:47 +0000 (16:52 -0700)]
Fix FoldReshapeOpWithUnitExtent generating illegal reshape
This will prevent fusion that spains all dims and generates
(d0, d1, ...) -> () reshape that isn't legal
Differential Revision: https://reviews.llvm.org/D100805
Sanjay Patel [Wed, 21 Apr 2021 18:13:30 +0000 (14:13 -0400)]
[InstSimplify] generalize ctlz-of-shifted-constant
https://alive2.llvm.org/ce/z/zWL_VQ
Sanjay Patel [Wed, 21 Apr 2021 18:07:34 +0000 (14:07 -0400)]
[InstSimplify] add tests for ctlz-of-shift-constant; NFC
Nico Weber [Wed, 21 Apr 2021 18:21:36 +0000 (14:21 -0400)]
[lld/mac] add aarch64 to requirements of encryption-info.s test
Mark de Wever [Wed, 21 Apr 2021 18:12:03 +0000 (20:12 +0200)]
[libc++][doc] Improve Phabricator links.
Removes the "reviews." part of the links as suggested by @ldionne in
D100707.
Krzysztof Parzyszek [Wed, 21 Apr 2021 17:50:40 +0000 (12:50 -0500)]
[Polly] Explicitly include all std headers
There were some recent header changes, and now some std classes
are no longer available in ScopDetection.cpp with the pre-existing
includes.
Simon Pilgrim [Wed, 21 Apr 2021 16:43:23 +0000 (17:43 +0100)]
[X86][SSE] getFauxShuffleMask - don't decode OR(SHUFFLE,SHUFFLE) containing UNDEFs. (PR50049)
PR50049 demonstrated an infinite loop between OR(SHUFFLE,SHUFFLE) <-> BLEND(SHUFFLE,SHUFFLE) patterns.
The UNDEF elements were allowing a combined shuffle mask to be widened which lost the undef element, resulting us needing to use the BLEND pattern (as the undef element would need to be zero for the OR pattern). But then bitcast folds would re-expose the undef element allowing us to use OR again.....
Michał Górny [Mon, 23 Nov 2020 13:24:54 +0000 (14:24 +0100)]
[lldb] [test/Register] Initial tests for regsets in core dumps
Add initial tests for reading register sets from core dumps. This
includes a C++ program to write registers and dump core, resulting core
dumps for Linux, FreeBSD and NetBSD, and the tests to verify them.
The tests are split into generic part, verifying user-specified register
values, and coredump-specific tests that verify memory addresses that
differ for every dump.
At this moment, all platforms support GPRs and FPRs up to XMM for amd64
target. The i386 target does not work on NetBSD at all, and is missing
FPRs entirely on FreeBSD.
Differential Revision: https://reviews.llvm.org/D91963
Jez Ng [Wed, 21 Apr 2021 17:35:12 +0000 (13:35 -0400)]
[lld-macho] Support LC_ENCRYPTION_INFO
This load command records a range spanning from the end of the load
commands to the end of the `__TEXT` segment. Presumably the kernel will encrypt
all this data.
Reviewed By: #lld-macho, thakis
Differential Revision: https://reviews.llvm.org/D100973
Alexey Bataev [Fri, 16 Apr 2021 18:29:01 +0000 (11:29 -0700)]
[OPENMP]Fix PR49698: OpenMP declare mapper causes segmentation fault.
The implicitly generated mappings for allocation/deallocation in mappers
runtime should be mapped as implicit, also no need to clear member_of
flag to avoid ref counter increment. Also, the ref counter should not be
incremented for the very first element that comes from the mapper
function.
Differential Revision: https://reviews.llvm.org/D100673
Fangrui Song [Wed, 21 Apr 2021 17:27:55 +0000 (10:27 -0700)]
[lsan][docs] Clarify supported platforms
Differential Revision: https://reviews.llvm.org/D100907
Christopher Di Bella [Wed, 21 Apr 2021 16:41:13 +0000 (16:41 +0000)]
[libcxx][iterator] adds `std::indirectly_readable` and `std::indirectly_writable`
Implements parts of:
* P0896R4 The One Ranges Proposal`
Depends on D99873.
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D100073
Michael Kruse [Wed, 21 Apr 2021 15:12:23 +0000 (10:12 -0500)]
[PollyACC] Fix declaration/stub definition mismatch. NFC.
external.c defines stub functions that are never used because of how
Polly uses PPCG. Unfortunately, they are declared as functions without
return values or parameters which does not match their declarations.
Since they are never called, this was usually not a problem, but an LTO
build gets confused with differently declared functions, or in case of
pet_options_args, a global variable declaration that is defined as a
function
Resolve by including the declaring headers in external.c which forces
the declaration and definition to match at compile-time.
This fixes llvm.org/50021
Arthur O'Dwyer [Mon, 19 Apr 2021 01:47:08 +0000 (21:47 -0400)]
[libc++] s/_LIBCPP_NO_HAS_CHAR8_T/_LIBCPP_HAS_NO_CHAR8_T/g
This was raised in D94511.
Differential Revision: https://reviews.llvm.org/D100736
Arthur O'Dwyer [Tue, 20 Apr 2021 18:14:35 +0000 (14:14 -0400)]
[libc++] [test] Remove epicyclic workarounds for vector/span; use T[] or std::array.
Simplify the test code, and drive-by also test that these algorithms
return the right iterator as their return value.
Differential Revision: https://reviews.llvm.org/D100876
Hongtao Yu [Wed, 21 Apr 2021 16:14:50 +0000 (09:14 -0700)]
[CSSPGO] Exclude pseudo probe from slotindex verification.
Nico Weber [Wed, 21 Apr 2021 15:49:17 +0000 (11:49 -0400)]
[gn build] add llvm-profgen to gn build
Didn't notice it missing due to https://reviews.llvm.org/D89707#2705110
LLVM GN Syncbot [Wed, 21 Apr 2021 15:39:33 +0000 (15:39 +0000)]
[gn build] Port
97e383aa061b
Alexander Shaposhnikov [Wed, 21 Apr 2021 15:18:20 +0000 (08:18 -0700)]
[lld][MachO] Refactor findCommand
Refactor findCommand to allow passing multiple types. NFC.
Test plan: make check-lld-macho
Differential revision: https://reviews.llvm.org/D100954
Pavel Labath [Wed, 21 Apr 2021 15:31:41 +0000 (17:31 +0200)]
[lldb/test] Clean up TestThreadSpecificBpPlusCondition inferior
The test had a race that could cause two threads to end up with the same
"thread local" value. I believe this would not cause the test to fail,
but it could cause it to succeed even when the functionality is broken.
The new implementation removes this uncertainty, and removes a lot of
cruft left over from the time this test was written using pthreads.
Stanislav Mekhanoshin [Tue, 20 Apr 2021 22:58:01 +0000 (15:58 -0700)]
[AMDGPU] Lower regbanks reassign threshold to 15000
Let it work on a very small kernels only. Measurements showed
the performance benefit is not worth the compile time.
Differential Revision: https://reviews.llvm.org/D100904
Louis Dionne [Tue, 20 Apr 2021 18:40:43 +0000 (14:40 -0400)]
[libc++] Add std::ranges::iter_move and std::iter_rvalue_reference_t
Original patch by @cjdb, modified by @ldionne.
Differential Revision: https://reviews.llvm.org/D99873
Nico Weber [Wed, 21 Apr 2021 15:10:45 +0000 (11:10 -0400)]
[flang] iwyu fixes after
ba7a92c01e8
Nico Weber [Wed, 21 Apr 2021 15:02:58 +0000 (11:02 -0400)]
[mlir] hopefully final round of iwyu fixes after
ba7a92c01e8
Pavel Labath [Fri, 16 Apr 2021 19:52:59 +0000 (21:52 +0200)]
[lldb/test] Modernize lldb-server test inferior
Avoid c string manipulation by introducing a StringRef-like
consume_front operation.
Nico Weber [Wed, 21 Apr 2021 14:54:44 +0000 (10:54 -0400)]
[mlir] yet more iwyu fixes after
ba7a92c01e8
Nico Weber [Wed, 21 Apr 2021 14:50:59 +0000 (10:50 -0400)]
[mlir] more iwyu fixes after
ba7a92c01e8
Nico Weber [Wed, 21 Apr 2021 14:48:54 +0000 (10:48 -0400)]
[mlir] some iwyu fixes after
ba7a92c01e8
Martin Probst [Wed, 21 Apr 2021 13:43:41 +0000 (15:43 +0200)]
clang-format: [JS] do not wrap after `asserts`
`asserts` is a pseudo keyword in TypeScript used in return types.
Wrapping after it triggers automatic semicolon insertion, which
breaks the code semantics/syntax.
`asserts` is different from other pseudo keywords in that it is
specific to TS and only carries meaning in a very specific location.
Thus introducing a token type is probably overkill.
Differential Revision: https://reviews.llvm.org/D100953
dfukalov [Wed, 21 Apr 2021 13:38:53 +0000 (16:38 +0300)]
[TTI] NFC: Change getVectorSplitCost to return InstructionCost
This patch migrates the TTI cost interfaces to return an InstructionCost.
See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html
Reviewed By: sdesmalen
Differential Revision: https://reviews.llvm.org/D100952
Anirudh Prasad [Wed, 21 Apr 2021 14:19:52 +0000 (10:19 -0400)]
[AsmParser][ms][X86] Fix possible misbehaviour in parsing of special tokens at start of string.
- Previously, https://reviews.llvm.org/D72680 introduced a new attribute called `AllowSymbolAtNameStart` (in relation to the MAsmParser changes) in `MCAsmInfo.h` which (according to the comment in the header) allows the following behaviour:
```
/// This is true if the assembler allows $ @ ? characters at the start of
/// symbol names. Defaults to false.
```
- However, the usage of this field in AsmLexer.cpp doesn't seem completely accurate* for a couple of reasons.
```
default:
if (MAI.doesAllowSymbolAtNameStart()) {
// Handle Microsoft-style identifier: [a-zA-Z_$.@?][a-zA-Z0-9_$.@#?]*
if (!isDigit(CurChar) &&
isIdentifierChar(CurChar, MAI.doesAllowAtInName(),
AllowHashInIdentifier))
return LexIdentifier();
}
```
1. The Dollar and At tokens, when occurring at the start of the string, are treated as separate tokens (AsmToken::Dollar and AsmToken::At respectively) and not lexed as an Identifier.
2. I'm not too sure why `MAI.doesAllowAtInName()` is used when `AllowAtInIdentifier` could be used. For X86 platforms, afaict, this shouldn't be an issue, since the `CommentString` attribute isn't "@". (alternatively the call to the setter can be set anywhere else as needed). The `AllowAtInName` does have an additional important meaning, but in the context of AsmLexer, shouldn't mean anything different compared to `AllowAtInIdentifier`
My proposal is the following:
- Introduce 3 new fields called `AllowQuestionTokenAtStartOfString`, `AllowDollarTokenAtStartOfString` and `AllowAtTokenAtStartOfString` in MCAsmInfo.h which will encapsulate the previously documented behaviour of "allowing $, @, ? characters at the start of symbol names")
- Introduce these fields where "$", "@" are lexed, and treat them as identifiers depending on whether `Allow[Dollar|At]TokenAtStartOfString` is set.
- For the sole case of "?", append it to the existing logic for treating a "default" token as an Identifier.
z/OS (HLASM) will also make use of some of these fields in follow up patches.
completely accurate* - This was based on the comments and the intended behaviour the code. I might have completely misinterpreted it, and if that is the case my sincere apologies. We can close this patch if necessary, if there are no changes to be made :)
Depends on https://reviews.llvm.org/D99374
Reviewed By: Jonathan.Crowther
Differential Revision: https://reviews.llvm.org/D99889
thomasraoux [Wed, 21 Apr 2021 14:02:17 +0000 (07:02 -0700)]
[mlir][NFC] Refactor linalg substituteMin and AffineMinSCF canonizalizations
Break up the dependency between SCF ops and substituteMin helper and make a
more generic version of AffineMinSCFCanonicalization. This reduce dependencies
between linalg and SCF and will allow the logic to be used with other kind of
ops. (Like ID ops).
Differential Revision: https://reviews.llvm.org/D100321
Nico Weber [Wed, 21 Apr 2021 14:00:30 +0000 (10:00 -0400)]
[Support] Don't include VirtualFileSystem.h in CommandLine.h
CommandLine.h is indirectly included in ~50% of TUs when building
clang, and VirtualFileSystem.h is large.
(Already remarked by jhenderson on D70769.)
No behavior change.
Differential Revision: https://reviews.llvm.org/D100957
Simon Pilgrim [Wed, 21 Apr 2021 14:06:35 +0000 (15:06 +0100)]
[PhaseOrdering] Add test case for PR45682
Ensures that the correct sequence of simplifycfg/instcombine/sroa reduce the IR to just a icmp+assume (which will be dropped in backend)
Simon Pilgrim [Wed, 21 Apr 2021 10:42:17 +0000 (11:42 +0100)]
[MC] MCInstrDesc.h - remove unnecessary <string> include. NFCI.
Victor Campos [Mon, 12 Apr 2021 16:03:06 +0000 (17:03 +0100)]
[Clang][ARM] Define __VFP_FP__ macro unconditionally
Clang only defines __VFP_FP__ when the FPU is enabled. However, gcc
defines it unconditionally.
This patch aligns Clang with gcc.
Reviewed By: peter.smith, rengolin
Differential Revision: https://reviews.llvm.org/D100372
Fraser Cormack [Wed, 21 Apr 2021 13:37:50 +0000 (14:37 +0100)]
[SelectionDAG] Fix minor typo in ISDOpcodes.h. NFC
Aaron Ballman [Wed, 21 Apr 2021 13:25:00 +0000 (09:25 -0400)]
Do not pass null attributes to BuildAttributedStmt during instantiation
When transforming an attribute during template instantiation, if the
transformation fails, it may result in a null attribute being returned.
This null attribute should not be passed in as one of the attributes
used to create an attributed statement.
If all of the attributes fail to transform, we do not create an
attributed statement at all.
There are no attributes that return null currently, so there is no easy
way to test this currently. However, this fixes a crash caused by
8344675908424ee532d4ae30e5043c5a5834e02c.
Guillaume Chatelet [Wed, 21 Apr 2021 13:25:24 +0000 (13:25 +0000)]
[libc] Enhance ArrayRef + unittests
This patch mostly adds unittests for `ArrayRef` and `MutableArrayRef`, additionnaly:
- We mimic the behavior of `std::vector` and disallow CV qualified type (`ArrayRef<const X>` is not allowed).
This is to make sure that the type traits are always valid (e.g. `value_type`, `pointer`, ...).
- In the previous implementation `ArrayRef` would define `value_type` as `const T` but this is not correct, it should be `T` for both `MutableArrayRef` and `ArrayRef`.
- We add the `equals` method to ease testing,
- We define the constructor taking an `Array` outside of the base implementation to ensure we match `const Array<T>&` and not `Array<const T>&` in the case of `ArrayRef`.
Differential Revision: https://reviews.llvm.org/D100732
Caroline Concatto [Mon, 12 Apr 2021 10:22:53 +0000 (11:22 +0100)]
[AArch64][SVE] Fix crash with icmp+select
This patch changes the lowering of SELECT_CC from Legal to Expand for scalable
vector and adds support for scalable vectors in performSelectCombine.
When selecting the nodes to lower in visitSELECT it checks if it is possible to
use SELECT_CC in cases where SETCC is followed by SELECT. visistSELECT checks
if SELECT_CC is legal or custom to replace SELECT by SELECT_CC.
SELECT_CC used to be legal for scalable vector, so the node changes to
SELECT_CC. This used to crash the compiler as there is no support for SELECT_CC
with scalable vectors. So now the compiler lowers to VSELECT instead of
SELECT_CC.
Differential Revision: https://reviews.llvm.org/D100485
Matt Arsenault [Tue, 20 Apr 2021 18:44:41 +0000 (14:44 -0400)]
AMDGPU: Fix indirect tail calls
Fix a selection error on uniform callees, and use a regular call if
divergent.
Neal (nealsid) [Wed, 21 Apr 2021 13:11:17 +0000 (15:11 +0200)]
Some FormatEntity.cpp cleanup and unit testing
Just fixing a few things I noticed as I am working on another feature for format
strings in the prompt: forward decls, adding constexpr constructors, various
checks, and unit tests for FormatEntity::Parse and new Definition constructors,
etc.
Reviewed By: teemperor
Differential Revision: https://reviews.llvm.org/D98153
LemonBoy [Wed, 21 Apr 2021 13:08:44 +0000 (15:08 +0200)]
[clang] Recognize ppc32 as valid mcpu value
The `ppc32` cpu model was introduced a while ago in
a9321059b912155cd81cf0776d54a7d6838ef7ab as an independent copy of the `ppc` one but was never wired into clang.
Reviewed By: #powerpc, nemanjai
Differential Revision: https://reviews.llvm.org/D100933
John Brawn [Wed, 21 Apr 2021 12:44:54 +0000 (13:44 +0100)]
Fix clang/test/Frontend/plugin-annotate-functions.c
FileCheck now gives an error when there's a check for an undefined
variable, which this test does in one of its NOT checks. Fix this by
being a bit looser in what the test checks.
Alexander Shaposhnikov [Wed, 21 Apr 2021 12:41:14 +0000 (05:41 -0700)]
[lld][MachO] Add support for LC_VERSION_MIN_* load commands
This diff adds initial support for the legacy LC_VERSION_MIN_* load commands.
Test plan: make check-lld-macho
Differential revision: https://reviews.llvm.org/D100523
Sylvain Audi [Tue, 20 Apr 2021 20:56:49 +0000 (16:56 -0400)]
Reland "[clang-scan-deps] Add support for clang-cl"
This reverts commit
199c39748292cbc89cd148a0d8364ebb1014ec38.
This time, clang-scan-deps's search for output argument in clang-cl command line will now ignore arguments preceded by "-Xclang".
That way, it won't detect a /o argument in "-Xclang -ivfsoverlay -Xclang /opt/subpath"
Initial patch description:
clang-scan-deps contains some command line parsing and modifications.
This patch adds support for clang-cl command options.
Differential Revision: https://reviews.llvm.org/D92191
David Green [Wed, 21 Apr 2021 11:11:41 +0000 (12:11 +0100)]
[AArch64] Add and update reverse mask tests. NFC
Sven van Haastregt [Wed, 21 Apr 2021 10:58:37 +0000 (11:58 +0100)]
[OpenCL] Do not add builtins with unavailable types
Add functionality to assign extensions to types in OpenCLBuiltins.td
and use that information to filter candidates that should not be
exposed if a type is not available.
Differential Revision: https://reviews.llvm.org/D100209
Sven van Haastregt [Wed, 21 Apr 2021 10:58:29 +0000 (11:58 +0100)]
[OpenCL] Refactor shuffle builtin decls
The shuffle and shuffle2 builtins relied on processing two TypeLists
for different arguments in sync. This will no longer work when a type
(e.g. double) in one of the TypeLists is optional.
Rewrite the declarations using explicit types instead of GenericTypes.
Martin Storsjö [Wed, 21 Apr 2021 10:33:13 +0000 (13:33 +0300)]
[llvm-rc] Fix a new test to disambiguate macOS paths like /Users/... from options starting with a slash
This should fix test failures on macOS.
Simon Tatham [Wed, 21 Apr 2021 10:19:37 +0000 (11:19 +0100)]
[ARM][Driver][Windows] Allow command-line upgrade to Armv8.
If you gave clang the options `--target=arm-pc-windows-msvc` and
`-march=armv8-a+crypto` together, the crypto extension would not be
enabled in the compilation, and you'd see the following warning
message suggesting that the 'armv8-a' had been ignored:
clang: warning: ignoring extension 'crypto' because the 'armv7-a' architecture does not support it [-Winvalid-command-line-argument]
This happens because Triple::getARMCPUForArch(), for the Win32 OS,
unconditionally returns "cortex-a9" (an Armv7 CPU) regardless of
MArch, which overrides the architecture setting on the command line.
I don't think that the combination of Windows and AArch32 _should_
unconditionally outlaw the use of the crypto extension. MSVC itself
doesn't think so: you can perfectly well compile Thumb crypto code
using its AArch32-targeted compiler.
All the other default CPUs in the same switch statement are
conditional on a particular MArch setting; this is the only one that
returns a particular CPU _regardless_ of MArch. So I've fixed this one
by adding a condition, so that if you ask for an architecture *above*
v7, the default of Cortex-A9 no longer overrides it.
Reviewed By: mstorsjo
Differential Revision: https://reviews.llvm.org/D100937
Michał Górny [Tue, 13 Apr 2021 22:54:08 +0000 (00:54 +0200)]
[lldb] [MainLoop] Support multiple callbacks per signal
Support registering multiple callbacks for a single signal. This is
necessary to support multiple co-existing native process instances, with
separate SIGCHLD handlers.
The system signal handler is registered on first request, additional
callback are added on subsequent requests. The system signal handler
is removed when last callback is unregistered.
Differential Revision: https://reviews.llvm.org/D100418
Simon Pilgrim [Wed, 21 Apr 2021 10:17:01 +0000 (11:17 +0100)]
[DAG] TargetLowering.cpp - breakup if-else chains where each block returns. NFCI.
Match style guide that requests that if+return blocks are separate.
Fraser Cormack [Tue, 20 Apr 2021 13:30:27 +0000 (14:30 +0100)]
[DAGCombiner] Support all-ones/all-zeros SPLAT_VECTOR in more combines
This patch adds incrementally-better support for SPLAT_VECTOR in a
handful of vector combines by changing a few more
isBuildVectorAllOnes/isBuildVectorAllZeros to the equivalent
isConstantSplatVectorAllOnes/Zeros calls.
Reviewed By: paulwalker-arm
Differential Revision: https://reviews.llvm.org/D100851
Fraser Cormack [Tue, 20 Apr 2021 10:41:32 +0000 (11:41 +0100)]
[RISCV] Further fixes for RVV stack offset computation
This patch fixes a case missed out by D100574, in which RVV scalable
stack offset computations may require three live registers in the case
where the offset's fixed component is 12 bits or larger and has a
scalable component.
Instead of adding an additional emergency spill slot, this patch further
optimizes the scalable stack offset computation sequences to reduce
register usage.
By emitting the sequence to compute the scalable component before the
fixed component, we can free up one scratch register to be reallocated
by the sequence for the fixed component. Doing this saves one register
and thus one additional emergency spill slot.
Compare:
$x5 = LUI 1
$x1 = ADDIW killed $x5, -1896
$x1 = ADD $x2, killed $x1
$x5 = PseudoReadVLENB
$x6 = ADDI $x0, 50
$x5 = MUL killed $x5, killed $x6
$x1 = ADD killed $x1, killed $x5
versus:
$x5 = PseudoReadVLENB
$x1 = ADDI $x0, 50
$x5 = MUL killed $x5, killed $x1
$x1 = LUI 1
$x1 = ADDIW killed $x1, -1896
$x1 = ADD $x2, killed $x1
$x1 = ADD killed $x1, killed $x5
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D100847
Martin Storsjö [Wed, 21 Apr 2021 09:40:39 +0000 (12:40 +0300)]
[llvm-rc] Try to fix the Preprocessor/llvm-rc.rc test on non arm/x86 architectures
When llvm-rc invokes clang for preprocessing, it uses a target
triple derived from the default target. The test verifies that
e.g. _WIN32 is defined when preprocessing.
If running clang with e.g. -target ppc64le-windows-msvc, that
particular arch/OS combination isn't hooked up, so _WIN32 doesn't
get defined in that configuration. Therefore, the preprocessing
test fails.
Instead make llvm-rc inspect the architecture of the default target.
If it's one of the known supported architectures, use it as such,
otherwise set a default one (x86_64). (Clang can run preprocessing
with an x86_64 target triple, even if the x86 backend isn't
enabled.)
Also remove superfluous llvm:: specifications on enums in llvm-rc.cpp.
Andrzej Warzynski [Wed, 14 Apr 2021 10:43:14 +0000 (10:43 +0000)]
[flang][driver] Add support for `-fget-definition`
This patch adds `-fget-definition` to `flang-new`. The semantics of this
option are identical in both drivers. The error message in the
"throwaway" driver is updated so that it matches the one from
`flang-new` (which is auto-generated and cannot be changed easily).
Tests are updated accordingly. A dedicated test for error handling was
added: get-definition.f90 (for the sake of simplicity,
getdefinition01.f90 no longer tests for errors).
The `ParseFrontendArgs` function is updated so that it can return
errors. This change is required in order to report invalid values
following `-fget-definition`.
The actual implementation of `GetDefinitionAction::ExecuteAction()` was
extracted from f18.cpp (i.e. the bit that deals with
`-fget-definition`).
Depends on: https://reviews.llvm.org/D100556
Differential Revision: https://reviews.llvm.org/D100558
Pavel Labath [Sat, 17 Apr 2021 16:31:17 +0000 (18:31 +0200)]
[lldb/ELF] Fix IDs of synthetic eh_frame symbols
The code used the total number of symbols to create a symbol ID for the
synthetic symbols. This is not correct because the IDs of real symbols
can be higher than their total number, as we do not add all symbols (and
in particular, we never add symbol zero, which is not a real symbol).
This meant we could have symbols with duplicate IDs, which caused
problems if some relocations were referring to the duplicated IDs. This
was the cause of the failure of the test D97786.
This patch fixes the code to use the ID of the highest (last) symbol
instead.
Butygin [Sat, 10 Apr 2021 16:38:11 +0000 (19:38 +0300)]
[mlir] Assume terminators in nested regions are always legal in FuncBufferizePass
Previously, any terminator without ReturnLike and BranchOpInterface traits (e.g. scf.condition) were causing pass to fail.
Differential Revision: https://reviews.llvm.org/D100832
Martin Storsjö [Wed, 14 Apr 2021 13:24:30 +0000 (16:24 +0300)]
[llvm-rc] Run clang to preprocess input files
Allow opting out from preprocessing with a command line argument.
Update tests to pass -no-preprocess to make it not try to use clang
(which isn't a build level dependency of llvm-rc), but add a test that
does preprocessing under clang/test/Preprocessor.
Update a few options to allow them both joined (as -DFOO) and separate
(-D BR), as rc.exe allows both forms of them.
With the verbose flag set, this prints the preprocessing command
used (which differs from what rc.exe does).
Tests under llvm/test/tools/llvm-rc only test constructing the
preprocessor commands, while tests under clang/test/Preprocessor test
actually running the preprocessor.
Differential Revision: https://reviews.llvm.org/D100755
Martin Storsjö [Thu, 15 Apr 2021 11:01:06 +0000 (14:01 +0300)]
[llvm-cvtres] Reduce the set of dependencies of llvm-cvtres. NFC.
Don't use createBinary() but call the WindowsResource class directly.
The createBinary() function references all supported object file
types and ends up pulling way more from all the underlying libraries
than what is necessary.
This shrinks a stripped llvm-cvtres from 4.6 MB to 463 KB.
Differential Revision: https://reviews.llvm.org/D100833
ShihPo Hung [Wed, 21 Apr 2021 08:48:02 +0000 (01:48 -0700)]
[RISCV][Clang] Add RVV AMO builtins
Add vamo[swap/add/xor/and/or/min/max/minu/maxu] builtins.
Reviewed By: khchen
Differential Revision: https://reviews.llvm.org/D100448
David Sherwood [Tue, 6 Apr 2021 10:06:58 +0000 (11:06 +0100)]
[AArch64] Add instruction costs for FP_TO_UINT and FP_TO_SINT with half types
We were missing some instruction costs when converting vectors of
floating point half types into integers, so I've added those here.
I also manually generated assembly code for each FP->int case and
looked at the number of instructions generated, which meant
adjusting some of the existing costs too.
I've updated an existing test to reflect the new costs:
Analysis/CostModel/AArch64/sve-fptoi.ll
Differential Revision: https://reviews.llvm.org/D99935
Christian Kühnel [Wed, 21 Apr 2021 08:17:03 +0000 (10:17 +0200)]
[NFC] fixed link in documentation
Pushpinder Singh [Wed, 21 Apr 2021 08:05:13 +0000 (08:05 +0000)]
Revert "[AMDGPU][OpenMP] Add amdgpu-arch tool to list AMD GPUs installed"
This reverts commit
3194761d2763a471dc6426a3e77c1445cb9ded3b.
Yang Fan [Wed, 21 Apr 2021 08:00:57 +0000 (16:00 +0800)]
[lld][ELF] Fix "enumeral and non-enumeral type in conditional expression" warning (NFC)
GCC warning:
```
/llvm-project/lld/ELF/SyntheticSections.cpp: In member function ‘virtual void lld::elf::VersionTableSection::writeTo(uint8_t*)’:
/llvm-project/lld/ELF/SyntheticSections.cpp:3128:34: warning: enumeral and non-enumeral type in conditional expression [-Wextra]
3128 | write16(buf, s.sym->isLazy() ? VER_NDX_GLOBAL : s.sym->versionId);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
Yang Fan [Wed, 21 Apr 2021 07:45:25 +0000 (15:45 +0800)]
[SCEV] Fix -Wunused-variable warning (NFC)
GCC warning:
```
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp: In member function ‘const llvm::SCEV* llvm::ScalarEvolution::getLosslessPtrToIntExpr(const llvm::SCEV*, unsigned int)::SCEVPtrToIntSinkingRewriter::visitUnknown(const llvm::SCEVUnknown*)’:
/llvm-project/llvm/lib/Analysis/ScalarEvolution.cpp:1152:13: warning: unused variable ‘ExprPtrTy’ [-Wunused-variable]
1152 | Type *ExprPtrTy = Expr->getType();
| ^~~~~~~~~
```
Christian Kühnel [Wed, 24 Feb 2021 13:44:37 +0000 (14:44 +0100)]
added section on CI system
Add documentation for working with the CI systems.
This is based on the discussion in the Infrastructure Working Group:
https://github.com/ChristianKuehnel/iwg-workspace/issues/37
Differential Revision: https://reviews.llvm.org/D97389
Nikita Popov [Wed, 21 Apr 2021 07:44:54 +0000 (09:44 +0200)]
Revert "[InstSimplify] Bypass no-op `and`-mask, using known bits (PR49543)"
This reverts commit
ea1a0d7c9ae3e5232a4163fc67efad4aabd51f2b.
While this is strictly more powerful, it is also strictly slower.
InstSimplify intentionally does not perform many folds that it
is allowed to perform, if doing so requires a KnownBits calculation
that will be repeated in InstCombine.
Maybe it's worthwhile to do this here, but that needs a more
explicitly stated motivation, evaluated in a review.
David Sherwood [Tue, 20 Apr 2021 16:23:18 +0000 (17:23 +0100)]
[Docs] Fix formatting issue for llvm.experimental.stepvector in LangRef
The llvm.experimental.stepvector section was missing the '^^^' line
underneath the intrinsic name.
Zakk Chen [Fri, 9 Apr 2021 05:21:04 +0000 (22:21 -0700)]
[RISCV][MC] Mask load should not have VMConstraint.
Add a test, dest register could be v0.
Reviewed By: HsiangKai
Differential Revision: https://reviews.llvm.org/D100825
Tobias Gysi [Wed, 21 Apr 2021 06:37:18 +0000 (06:37 +0000)]
[mlir][linalg] adapt named op generalization to work with captures.
Instead of always running the region builder check if the generalized op has a region attached. If yes inline the existing region instead of calling the region builder. This change circumvents a problem with named operations that have a region builder taking captures and the generalization pass not knowing about this captures.
Differential Revision: https://reviews.llvm.org/D100880
Michael Kruse [Wed, 21 Apr 2021 05:40:47 +0000 (00:40 -0500)]
[PollyACC] Configure PollyPPCG only if needed.
The PollyPPCG library is only needed when POLLY_ENABLE_GPGPU_CODEGEN=ON.
If disabled, the library target is still created, but not linked against
anything.
This change does not add create the PollyPPCG build target if not
needed.
Motivated by llvm.org/PR50021