platform/upstream/llvm.git
3 years ago[MC] Make MCStreamer aware of AsmParser's StartTokLoc
Fangrui Song [Mon, 2 Nov 2020 20:32:06 +0000 (12:32 -0800)]
[MC] Make MCStreamer aware of AsmParser's StartTokLoc

A SMLoc allows MCStreamer to report location-aware diagnostics, which
were previously done by adding SMLoc to various methods (e.g. emit*) in an ad-hoc way.

Since the file:line is most important, the column is less important and
the start token location suffices in many cases, this patch reverts
b7e7131af2dd7bdb03fa42a3bc1b4bc72ab95ce1

```
// old
symbol-binding-changed.s:6:8: error: local changed binding to STB_GLOBAL
.globl local
       ^
// new
symbol-binding-changed.s:6:1: error: local changed binding to STB_GLOBAL
.globl local
^
```

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D90511

3 years ago[clangd] Add -log=public to redact all request info from index server logs
Sam McCall [Sat, 31 Oct 2020 10:30:26 +0000 (11:30 +0100)]
[clangd] Add -log=public to redact all request info from index server logs

The index server has access to potentially-sensitive information, e.g. a
sequence of fuzzyFind requests reveals details about code completions in the
editor which in turn reveals details about the code being edited.
This information is necessary to provide the service, and our intention[1] is it
should never be retained beyond the scope of the request (e.g. not logged).

At the same time, some log messages should be exposed:
 - server startup/index reloads etc that don't pertain to a user request
 - basic request logs (method, latency, #results, error code) for monitoring
 - errors while handling requests, without request-specific data
The -log=public design accommodates these by allowing three types of logs:
 - those not associated with any user RPC request (via context-propagation)
 - those explicitly tagged as [public] in the log line
 - logging of format strings only, with no interpolated data (error level only)

[1] Specifically: Google is likely to run public instances of this server
for LLVM and potentially other projects, they will run in this configuration.
The details agreed in a Google-internal privacy review.
As clangd developers, we'd encourage others to use this configuration for public
instances too.

Differential Revision: https://reviews.llvm.org/D90526

3 years agoIgnore template instantiations if not in AsIs mode
Stephen Kelly [Mon, 1 Jun 2020 12:40:20 +0000 (13:40 +0100)]
Ignore template instantiations if not in AsIs mode

Summary:
IgnoreUnlessSpelledInSource mode should ignore these because they are
not written in the source.  This matters for example when trying to
replace types or values which are templated.  The new test in
TransformerTest.cpp in this commit demonstrates the problem.

In existing matcher code, users can write
`unless(isInTemplateInstantiation())` or `unless(isInstantiated())` (the
user must know which to use).  The point of the
TK_IgnoreUnlessSpelledInSource mode is to allow the novice to avoid such
details.  This patch changes the IgnoreUnlessSpelledInSource mode to
skip over implicit template instantiations.

This patch does not change the TK_AsIs mode.

Note: An obvious attempt at an alternative implementation would simply
change the shouldVisitTemplateInstantiations() in ASTMatchFinder.cpp to
return something conditional on the operational TraversalKind.  That
does not work because shouldVisitTemplateInstantiations() is called
before a possible top-level traverse() matcher changes the operational
TraversalKind.

Reviewers: sammccall, aaron.ballman, gribozavr2, ymandel, klimek

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D80961

3 years agoRename CXXUnresolvedConstructExpr::arg_size for consistency
Stephen Kelly [Fri, 30 Oct 2020 16:49:24 +0000 (16:49 +0000)]
Rename CXXUnresolvedConstructExpr::arg_size for consistency

Make it possible to use argumentCountIs and hasArgument with
CXXUnresolvedConstructExpr.

Differential Revision: https://reviews.llvm.org/D90553

3 years ago[FileCheck] Added documentation for --allow-unused-prefixes
Mircea Trofin [Mon, 2 Nov 2020 16:46:53 +0000 (08:46 -0800)]
[FileCheck] Added documentation for --allow-unused-prefixes

Differential Revision: https://reviews.llvm.org/D90621

3 years agoChange Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC
Duncan P. N. Exon Smith [Tue, 20 Oct 2020 22:11:52 +0000 (18:11 -0400)]
Change Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC

Change `Module::ASTFile` and `ModuleFile::File` to use
`Optional<FileEntryRef>` instead of `const FileEntry *`. One of many
steps toward removing `FileEntry::getName`.

Differential Revision: https://reviews.llvm.org/D89836

3 years ago[clangd] Fix check-clangd with no clang built
Sam McCall [Sat, 31 Oct 2020 11:36:17 +0000 (12:36 +0100)]
[clangd] Fix check-clangd with no clang built

- pass required=False to use_clang(), as we don't need it
- fix required=False (which was unused and rotted):
  - make derived substitutions conditional on it
  - add a feature so we can disable tests that need it
- conditionally disable our one test that depends on %resource_dir.
  This doesn't seem right from first principles, but isn't a big deal.

Differential Revision: https://reviews.llvm.org/D90528

3 years ago[Hexagon] Move isTypeForHVX from Hexagon TTI to HexagonSubtarget, NFC
Krzysztof Parzyszek [Mon, 2 Nov 2020 19:57:42 +0000 (13:57 -0600)]
[Hexagon] Move isTypeForHVX from Hexagon TTI to HexagonSubtarget, NFC

It's useful outside of Hexagon TTI, and with how TTI is implemented,
it is not accessible outside of TTI.

3 years ago[NFC][regalloc] Use MCRegister appropriately
Mircea Trofin [Fri, 30 Oct 2020 22:12:14 +0000 (15:12 -0700)]
[NFC][regalloc] Use MCRegister appropriately

Differential Revision: https://reviews.llvm.org/D90506

3 years ago[AMDGPU] Improve FLAT scratch detection
Stanislav Mekhanoshin [Mon, 2 Nov 2020 18:56:12 +0000 (10:56 -0800)]
[AMDGPU] Improve FLAT scratch detection

We were useing too broad check for isFLATScratch() which also
includes FLAT global.

Differential Revision: https://reviews.llvm.org/D90505

3 years ago[PartialInliner]: Handle code regions in a switch stmt cases
Ettore Tiotto [Mon, 2 Nov 2020 19:10:27 +0000 (14:10 -0500)]
[PartialInliner]: Handle code regions in a switch stmt cases

This patch enhances computeOutliningColdRegionsInfo() to allow it to
consider regions containing a single basic block and a single
predecessor as candidate for partial inlining.

Reviewed By: fhann

Differential Revision: https://reviews.llvm.org/D89911

3 years agoUndef the `DEFINE_C_API_STRUCT` macro after using it in the MLIR C API header (NFC)
Mehdi Amini [Mon, 2 Nov 2020 18:56:25 +0000 (18:56 +0000)]
Undef the `DEFINE_C_API_STRUCT` macro after using it in the MLIR C API header (NFC)

Leaking macros isn't a good practice when defining headers. This
requires to duplicate the macro definition in every header though, but
that seems like a better tradeoff right now.

Differential Revision: https://reviews.llvm.org/D90633

3 years ago[Sema] adds -Wfree-nonheap-object member var checks
Christopher Di Bella [Mon, 2 Nov 2020 18:59:38 +0000 (10:59 -0800)]
[Sema] adds -Wfree-nonheap-object member var checks

Checks to make sure that stdlib's (std::)free is being appropriately
used for member variables.

Differential Revision: https://reviews.llvm.org/D90269

3 years ago[flang] Allow array constructor implied DO loop indices as constant expressions
peter klausler [Fri, 30 Oct 2020 19:57:28 +0000 (12:57 -0700)]
[flang] Allow array constructor implied DO loop indices as constant expressions

When the bounds of an implied DO loop in an array constructor are
constant, the index variable of that loop is considered a constant
expression and can be used as such in the items in the value list
of the implied DO loop.  Since the KIND type parameter values of items
in the value list can depend on the various values taken by such an
index, it is not possible to represent those values with a single
typed expression.  So implement such loops by taking multiple passes
over the parse tree of the implied DO loop instead.

Differential revision: https://reviews.llvm.org/D90494

3 years ago[mlir][vector] Address post-commit review comments on vector ops folding patterns
Thomas Raoux [Mon, 2 Nov 2020 18:18:38 +0000 (10:18 -0800)]
[mlir][vector] Address post-commit review comments on vector ops folding patterns

Differential Revision: https://reviews.llvm.org/D90183

3 years ago[mlir][CAPI] Add APIs for mlirOperationGetName and Identifier.
Stella Laurenzo [Mon, 2 Nov 2020 18:26:38 +0000 (18:26 +0000)]
[mlir][CAPI] Add APIs for mlirOperationGetName and Identifier.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D90583

3 years ago[LLD] [COFF] Align all debug directories
Peter Penzin [Thu, 29 Oct 2020 22:50:40 +0000 (15:50 -0700)]
[LLD] [COFF] Align all debug directories

Match MSVC linker output - align all debug directories on four bytes,
while removing debug directory alignment. This would have the same
effect on CETCOMPAT support as D89919.

Chromium bug: https://crbug.com/1136664

Differential Revision: https://reviews.llvm.org/D89921

3 years ago[gn build] Port c17da8676a0
LLVM GN Syncbot [Mon, 2 Nov 2020 18:32:12 +0000 (18:32 +0000)]
[gn build] Port c17da8676a0

3 years agoSupport: Avoid std::tie in Support/FileSystem/UniqueID.h, NFC
Duncan P. N. Exon Smith [Fri, 30 Oct 2020 15:13:37 +0000 (11:13 -0400)]
Support: Avoid std::tie in Support/FileSystem/UniqueID.h, NFC

Running `-fsyntax-only` on UniqueID.h is 2x faster with this patch
(which avoids calling `std::tie` for `operator<`).  Since the transitive
includers of this file will go up as `FileEntryRef` gets used in more
places, avoid that compile-time hit.  This is a follow-up to
23ed570af1cc165afea1b70a533a4a39d6656501 (suggested by Reid Kleckner).

Also drop the `<tuple>` include from FileSystem.h (which was vestigal
from before UniqueID.h was split out).

Differential Revision: https://reviews.llvm.org/D90471

3 years ago[clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false
Alex Richardson [Mon, 2 Nov 2020 17:35:59 +0000 (17:35 +0000)]
[clang-format] Improve BAS_DontAlign+AllowAllArgumentsOnNextLine=false

TokenAnnotator::splitPenalty() was always returning 0 for opening parens if
AlignAfterOpenBracket was set to BAS_DontAlign, so the preferred point for
line breaking was always after the open paren (and was ignoring
PenaltyBreakBeforeFirstCallParameter). This change restricts the zero
penalty to the AllowAllArgumentsOnNextLine case. This results in improved
formatting for FreeBSD where we set AllowAllArgumentsOnNextLine: false
and a high value for PenaltyBreakBeforeFirstCallParameter to avoid breaking
after the open paren.

Before:
```
functionCall(
    paramA, paramB, paramC);
void functionDecl(
    int A, int B, int C)
```
After:
```
functionCall(paramA, paramB,
    paramC);
void functionDecl(int A, int B,
    int C)
```

Reviewed By: MyDeveloperDay

Differential Revision: https://reviews.llvm.org/D90246

3 years ago[AtomicExpand] Avoid creating an unnamed libcall
Alex Richardson [Mon, 2 Nov 2020 17:33:07 +0000 (17:33 +0000)]
[AtomicExpand] Avoid creating an unnamed libcall

I recently modified this pass to better support CHERI-RISC-V and while
doing so I noticed that this pass was calling M->getOrInsertFunction()
with the result of TLI->getLibcallName(RTLibType). However, AMDGPU fills
the libcalls array with nullptr, so this creates an anonymous function
instead. This patch changes expandAtomicOpToLibcall to return false in
case the libcall does not exist and changes the assert() in the callees to
a report_fatal_error() instead.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D88800

3 years agoCorrect the nomerge attribute documentation
Aaron Ballman [Mon, 2 Nov 2020 17:49:40 +0000 (12:49 -0500)]
Correct the nomerge attribute documentation

The nomerge attribute is a statement attribute not a function attribute.

3 years ago[ARM] Cost model test for target intrinsics. NFC
David Green [Mon, 2 Nov 2020 17:46:48 +0000 (17:46 +0000)]
[ARM] Cost model test for target intrinsics. NFC

3 years agoRevert "[Clang] Add the ability to map DLL storage class to visibility"
Ben Dunbobbin [Mon, 2 Nov 2020 17:32:55 +0000 (17:32 +0000)]
Revert "[Clang] Add the ability to map DLL storage class to visibility"

This reverts commit 415f7ee8836944942d8beb70e982e95a312866a7.

The added tests were failing on the build bots!

3 years ago[RISCV] Make SelectRORIW handle the commutability of OR.
Craig Topper [Mon, 2 Nov 2020 17:31:01 +0000 (09:31 -0800)]
[RISCV] Make SelectRORIW handle the commutability of OR.

The SHL and SRL could be in opposite order so account for that.

Differential Revision: https://reviews.llvm.org/D90586

3 years ago[AggressiveInstCombine] Add funnel shift tests
Simon Pilgrim [Mon, 2 Nov 2020 17:26:22 +0000 (17:26 +0000)]
[AggressiveInstCombine] Add funnel shift tests

Based off existing rotate test coverage

3 years ago[AggressiveInstCombine] Regenerate rotate tests
Simon Pilgrim [Mon, 2 Nov 2020 17:23:33 +0000 (17:23 +0000)]
[AggressiveInstCombine] Regenerate rotate tests

3 years ago[libc++] Migrate warning flags to the DSL
Louis Dionne [Thu, 29 Oct 2020 21:30:28 +0000 (17:30 -0400)]
[libc++] Migrate warning flags to the DSL

This makes us closer to running the test suite on platforms where the
legacy test suite configuration doesn't work.

One notable change after this commit is that the tests will be run with
warnings enabled on GCC too, which wasn't the case before. However,
previous commits should have tweaked the test suite to make sure it
passes with warnings enabled on GCC.

Note that warnings can still be disabled with `--param enable_warnings=False`,
as before.

Differential Revision: https://reviews.llvm.org/D90432

3 years ago[flang] Design document for runtime derived type descriptions (NFC)
peter klausler [Fri, 30 Oct 2020 21:21:45 +0000 (14:21 -0700)]
[flang] Design document for runtime derived type descriptions (NFC)

Differential revision: https://reviews.llvm.org/D90500

3 years ago[TableGen] Fix a couple of minor issues regarding the paste operator.
Paul C. Anagnostopoulos [Mon, 2 Nov 2020 13:40:49 +0000 (08:40 -0500)]
[TableGen] Fix a couple of minor issues regarding the paste operator.

Update the documentation to fully describe it.

Differential Revision: https://reviews.llvm.org/D90617

3 years ago[x86] add AVX2 cost model entries for maxnum of 256-bit vectors
Sanjay Patel [Mon, 2 Nov 2020 17:01:49 +0000 (12:01 -0500)]
[x86] add AVX2 cost model entries for maxnum of 256-bit vectors

As noticed in D90554 ,
the AVX2 costs for 256-bit vectors did not include FMAXNUM entries,
so we fell back to AVX1 which assumes those ops will be split into
128-bit halves or something close to that.

Differential Revision: https://reviews.llvm.org/D90613

3 years ago[InstCombine] add multi-use tests for negator; NFC
Sanjay Patel [Sun, 1 Nov 2020 16:26:07 +0000 (11:26 -0500)]
[InstCombine] add multi-use tests for negator; NFC

PR47997

3 years ago[RISCV] When matching RORIW, make sure the same input is given to both shifts.
Craig Topper [Mon, 2 Nov 2020 16:45:33 +0000 (08:45 -0800)]
[RISCV] When matching RORIW, make sure the same input is given to both shifts.

The code is looking for (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1))).
We need to ensure X and Y are the same.

Differential Revision: https://reviews.llvm.org/D90580

3 years ago[AggressiveInstCombine] foldGuardedRotateToFunnelShift - generalize rotation to funne...
Simon Pilgrim [Mon, 2 Nov 2020 16:19:32 +0000 (16:19 +0000)]
[AggressiveInstCombine] foldGuardedRotateToFunnelShift - generalize rotation to funnel shift matcher.

Replace matchRotate with a more general matchFunnelShift - at the moment this is still just used for rotation patterns.

3 years ago[Clang] Add the ability to map DLL storage class to visibility
Ben Dunbobbin [Mon, 2 Nov 2020 15:11:56 +0000 (15:11 +0000)]
[Clang] Add the ability to map DLL storage class to visibility

For PlayStation we offer source code compatibility with
Microsoft's dllimport/export annotations; however, our file
format is based on ELF.

To support this we translate from DLL storage class to ELF
visibility at the end of codegen in Clang.

Other toolchains have used similar strategies (e.g. see the
documentation for this ARM toolchain:

https://developer.arm.com/documentation/dui0530/i/migrating-from-rvct-v3-1-to-rvct-v4-0/changes-to-symbol-visibility-between-rvct-v3-1-and-rvct-v4-0)

This patch adds the ability to perform this translation. Options
are provided to support customizing the mapping behaviour.

Differential Revision: https://reviews.llvm.org/D89970

3 years ago[test] Fix unused FileCheck prefix in ThinLTO test
Teresa Johnson [Mon, 2 Nov 2020 17:05:11 +0000 (09:05 -0800)]
[test] Fix unused FileCheck prefix in ThinLTO test

Add intended and missing prefix check.

3 years ago[clangd] Account for vendor in version string
Shoaib Meenai [Sat, 31 Oct 2020 00:43:41 +0000 (17:43 -0700)]
[clangd] Account for vendor in version string

The vendor will be prefixed to the "clangd" and can be an arbitrary
string, so account for it in the test.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D90517

3 years ago[clang] Limit scope of CLANG_VENDOR definition
Shoaib Meenai [Sat, 31 Oct 2020 00:42:09 +0000 (17:42 -0700)]
[clang] Limit scope of CLANG_VENDOR definition

It's only used by Version.cpp, so limit the definition to just that one
file instead of making all of Clang recompile if you change CLANG_VENDOR.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D90516

3 years ago[MemProf] Reenable test with fix for bot failures
Teresa Johnson [Fri, 30 Oct 2020 15:03:35 +0000 (08:03 -0700)]
[MemProf] Reenable test with fix for bot failures

The issue was unexpected macro expansion when the bot's test output
directory contained a token matching a build system macro (e.g.
"linux"). Switch to using a hardcoded path, which is invalid but is
sufficient for ensuring that the path is passed down to the runtime.

Differential Revision: https://reviews.llvm.org/D90466

3 years ago[libc++][CI] Allow retries in case an agent is lost
Louis Dionne [Mon, 2 Nov 2020 16:58:01 +0000 (11:58 -0500)]
[libc++][CI] Allow retries in case an agent is lost

We see this fairly often on our Linux bots, which appear to be killed
by GCE from time to time.

3 years ago[LLDB/Lua] call lua_close() on Lua dtor
Pedro Tammela [Sun, 1 Nov 2020 18:02:30 +0000 (18:02 +0000)]
[LLDB/Lua] call lua_close() on Lua dtor

This patch calls `lua_close()` on Lua dtor.

This guarantees that the Lua GC finalizers are honored, aside from the
usual internal clean up.

It also guarantees a call to the `__close` metamethod of any active
to-be-closed variable in Lua 5.4.

Since the previous `luaL_openlibs()` was a noop, because the standard
library is cached internally, I've removed it.

Differential Revision: https://reviews.llvm.org/D90557

3 years ago[FileCheck] Fix comments and eof in allow-unused-prefixes.txt
Mircea Trofin [Mon, 2 Nov 2020 16:50:34 +0000 (08:50 -0800)]
[FileCheck] Fix comments and eof in allow-unused-prefixes.txt

3 years ago[ARM][MachineOutliner] Do not overestimate LR liveness in return block
Momchil Velikov [Mon, 2 Nov 2020 16:26:10 +0000 (16:26 +0000)]
[ARM][MachineOutliner] Do not overestimate LR liveness in return block

The `LiveRegUnits` utility (as well as `LivePhysRegs`) considers
callee-saved registers to be alive at the point after the return
instruction in a block. In the ARM backend, the `LR` register is
classified as callee-saved, which is not really correct (from an ARM
eABI or just common sense point of view).  These two conditions cause
the `MachineOutliner` to overestimate the liveness of `LR`, which
results in unnecessary saves/restores of `LR` around calls to outlined
sequences.  It also causes the `MachineVerifer` to crash in some
cases, because the save instruction reads a dead `LR`, for example
when the following program:

int h(int, int);

int f(int a, int b, int c, int d) {
  a = h(a + 1, b - 1);
  b = b + c;
  return 1 + (2 * a + b) * (c - d) / (a - b) * (c + d);
}

int g(int a, int b, int c, int d) {
  a = h(a - 1, b + 1);
  b = b + c;
  return 2 + (2 * a + b) * (c - d) / (a - b) * (c + d);
}

is compiled with `-target arm-eabi -march=armv7-m -Oz`.

This patch computes the liveness of `LR` in return blocks only, while
taking into account the few ARM instructions, which read `LR`, but
nevertheless the register is not mentioned (explicitly or implicitly)
in the instruction operands.

Differential Revision: https://reviews.llvm.org/D89189

3 years ago[ELF] --emit-relocs: fix st_value of STT_SECTION in the presence of a gap before...
Fangrui Song [Mon, 2 Nov 2020 16:37:15 +0000 (08:37 -0800)]
[ELF] --emit-relocs: fix st_value of STT_SECTION in the presence of a gap before the first input section

In the presence of a gap, the st_value field of a STT_SECTION symbol is the
address of the first input section (incorrect if there is a gap). Set it to the
output section address instead.

In -r mode, this bug can cause an incorrect non-zero st_value of a STT_SECTION
symbol (while output sections have zero addresses, input sections may have
non-zero outSecOff).  The non-zero st_value can cause the final link to have
incorrect relocation computation (both GNU ld and LLD add st_value of the
STT_SECTION symbol to the output section address).

Reviewed By: grimar

Differential Revision: https://reviews.llvm.org/D90520

3 years ago[libc++] NFC: Re-generate the ABI lists with the new script
Louis Dionne [Mon, 2 Nov 2020 16:35:21 +0000 (11:35 -0500)]
[libc++] NFC: Re-generate the ABI lists with the new script

The new script keeps the results sorted, which is why the ABI lists appear
to have changed so much. However, this commit makes no actual ABI change.

3 years ago[libc++] Make it easier to re-generate the ABI lists
Louis Dionne [Wed, 30 Sep 2020 20:30:04 +0000 (16:30 -0400)]
[libc++] Make it easier to re-generate the ABI lists

Instead of having to remember the command-line to use every time, this
commit adds a CMake target to generate the ABI list in the current
configuration, if it is supported.

As a fly-by change, remove scripts that are now unused (sym_match.py
and sym_extract.py).

3 years agoRevert "[MLIR] Support walks over regions and blocks"
Frederik Gossen [Mon, 2 Nov 2020 16:13:15 +0000 (16:13 +0000)]
Revert "[MLIR] Support walks over regions and blocks"

This reverts commit dbae3d50f114a8ec0a7c3211e3b1b9fb6ef22dbd.
Cannot build with gcc/g++ 7.5.0.

3 years agoRevert "[MLIR] Use `llvm::is_one_of` in walk templates"
Frederik Gossen [Mon, 2 Nov 2020 16:10:59 +0000 (16:10 +0000)]
Revert "[MLIR] Use `llvm::is_one_of` in walk templates"

This reverts commit 56299b1e58bf3720dff2fe60163739ee1554a371.
Cannot build with gcc/g++ 7.5.0.

3 years ago[Debugify] Port -debugify-each to NewPM
Fangrui Song [Mon, 2 Nov 2020 16:16:43 +0000 (08:16 -0800)]
[Debugify] Port -debugify-each to NewPM

Preemptively switch 2 tests to the new PM

Reviewed By: aeubanks

Differential Revision: https://reviews.llvm.org/D90365

3 years ago[libc++/libc++abi] Use Python3_EXECUTABLE consistently to run utilities
Louis Dionne [Mon, 2 Nov 2020 16:07:10 +0000 (11:07 -0500)]
[libc++/libc++abi] Use Python3_EXECUTABLE consistently to run utilities

3 years ago[gn build] Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`
Nico Weber [Mon, 2 Nov 2020 15:49:54 +0000 (10:49 -0500)]
[gn build] Run `git ls-files '*.gn' '*.gni' | xargs llvm/utils/gn/gn.py format`

3 years ago[gn build] (manually) port c6eaa14e11
Nico Weber [Mon, 2 Nov 2020 15:43:38 +0000 (10:43 -0500)]
[gn build] (manually) port c6eaa14e11

3 years ago[analyzer][ReturnPtrRangeChecker] Fix a false positive on end() iterator
Kirstóf Umann [Mon, 2 Nov 2020 15:37:59 +0000 (16:37 +0100)]
[analyzer][ReturnPtrRangeChecker] Fix a false positive on end() iterator

ReturnPtrRange checker emits a report if a function returns a pointer which
points out of the buffer. However, end() iterator of containers is always such
a pointer, so this always results a false positive report. This false positive
case is now eliminated.

This patch resolves these tickets:
https://bugs.llvm.org/show_bug.cgi?id=20929
https://bugs.llvm.org/show_bug.cgi?id=25226
https://bugs.llvm.org/show_bug.cgi?id=27701

Patch by Tibor Brunner!

Differential Revision: https://reviews.llvm.org/D83678

3 years agoReland "[TTI] Add VecPred argument to getCmpSelInstrCost."
Florian Hahn [Mon, 2 Nov 2020 12:40:34 +0000 (12:40 +0000)]
Reland "[TTI] Add VecPred argument to getCmpSelInstrCost."

This reverts the revert commit 408c4408facc3a79ee4ff7e9983cc972f797e176.

This version of the patch includes a fix for a crash caused by
treating ICmp/FCmp constant expressions as instructions.

Original message:

On some targets, like AArch64, vector selects can be efficiently lowered
if the vector condition is a compare with a supported predicate.

This patch adds a new argument to getCmpSelInstrCost, to indicate the
predicate of the feeding select condition. Note that it is not
sufficient to use the context instruction when querying the cost of a
vector select starting from a scalar one, because the condition of the
vector select could be composed of compares with different predicates.

This change greatly improves modeling the costs of certain
compare/select patterns on AArch64.

I am also planning on putting up patches to make use of the new argument in
SLPVectorizer & LV.

3 years ago[libc++] Split off iostreams explicit instantiations into its own source file
Louis Dionne [Mon, 2 Nov 2020 15:30:29 +0000 (10:30 -0500)]
[libc++] Split off iostreams explicit instantiations into its own source file

This makes it cleaner to add more instantiations without cluttering the
actual implementation of ios.

3 years ago[lldb] Generalize an deflake gdb-remote *client* tests
Pavel Labath [Mon, 2 Nov 2020 15:11:47 +0000 (16:11 +0100)]
[lldb] Generalize an deflake gdb-remote *client* tests

This is similar in spirit to what D90313 did for server tests.

3 years agoRevert "Add a new altera kernel name restriction check to clang-tidy."
Nico Weber [Mon, 2 Nov 2020 15:29:13 +0000 (10:29 -0500)]
Revert "Add a new altera kernel name restriction check to clang-tidy."

This reverts commit 43a38a65233039b5e71797a644d41a890f8d7f2b,
and follow-up 5a7bc5e2595903e51f0b31e3faf82024e965c962.

The commit breaks check-clang-tools, the test added in the change
does not pass.

3 years agoAMDGPU: Reorder checks
Matt Arsenault [Sat, 17 Oct 2020 18:28:52 +0000 (14:28 -0400)]
AMDGPU: Reorder checks

3 years ago[libc++abi] Get rid of warnings when running the tests with GCC
Louis Dionne [Fri, 30 Oct 2020 21:33:02 +0000 (17:33 -0400)]
[libc++abi] Get rid of warnings when running the tests with GCC

3 years agoFix link to a new check within the release notes.
Aaron Ballman [Mon, 2 Nov 2020 15:18:47 +0000 (10:18 -0500)]
Fix link to a new check within the release notes.

3 years ago[gn build] (manually) port 76a168bce01 better
Nico Weber [Mon, 2 Nov 2020 15:14:52 +0000 (10:14 -0500)]
[gn build] (manually) port 76a168bce01 better

3 years agoRegisterCoalescer: Use Register
Matt Arsenault [Tue, 20 Oct 2020 17:05:38 +0000 (13:05 -0400)]
RegisterCoalescer: Use Register

3 years agoAdd a new altera kernel name restriction check to clang-tidy.
Frank Derry Wanye [Mon, 2 Nov 2020 15:11:38 +0000 (10:11 -0500)]
Add a new altera kernel name restriction check to clang-tidy.

The altera kernel name restriction check finds kernel files and include
directives whose filename is "kernel.cl", "Verilog.cl", or "VHDL.cl".
Such kernel file names cause the Altera Offline Compiler to generate
intermediate design files that have the same names as certain internal
files, which leads to a compilation error.

As per the "Guidelines for Naming the Kernel" section in the "Intel FPGA
SDK for OpenCL Pro Edition: Programming Guide."

3 years ago[SLP] Added testcase for PR47623
Dávid Bolvanský [Mon, 2 Nov 2020 15:01:51 +0000 (16:01 +0100)]
[SLP] Added testcase for PR47623

3 years ago[lldb/test] Fix a fragile assumption in TestTypeGetModule
Pavel Labath [Mon, 2 Nov 2020 10:35:13 +0000 (11:35 +0100)]
[lldb/test] Fix a fragile assumption in TestTypeGetModule

the binary can contain more than three compile units if the compiler
support files (crtbegin/end, etc.) come with their own debug info.

3 years ago[TableGen][SchedModels] Fix read/write variant substitution
Evgeny Leviant [Mon, 2 Nov 2020 14:39:04 +0000 (17:39 +0300)]
[TableGen][SchedModels] Fix read/write variant substitution

Patch fixes case when sched class has write and read variants belonging
to different processor models.

Differential revision: https://reviews.llvm.org/D89777

3 years ago[PS4] Support dllimport/export attributes
Ben Dunbobbin [Mon, 2 Nov 2020 14:09:53 +0000 (14:09 +0000)]
[PS4] Support dllimport/export attributes

For PS4 development we support dllimport/export annotations in
source code. This patch enables the dllimport/export attributes
on PS4 by adding a new function to query the triple for whether
dllimport/export are used and using that function to decide
whether these attributes are supported. This replaces the current
method of checking if the target is Windows.

This means we can drop the use of "TargetArch" in the .td file
(which is an improvement as dllimport/export support isn't really
a function of the architecture).

I have included a simple codgen test to show that the attributes
are accepted and have an effect on codegen for PS4. I have also
enabled the DLLExportStaticLocal and DLLImportStaticLocal
attributes, which we support downstream. However, I am unable to
write a test for these attributes until other patches for PS4
dllimport/export handling land upstream. Whilst writing this
patch I noticed that, as these attributes are internal, they do
not need to be target specific (when these attributes are added
internally in Clang the target specific checks have already been
run); however, I think leaving them target specific is fine
because it isn't harmful and they "really are" target specific
even if that has no functional impact.

Differential Revision: https://reviews.llvm.org/D90442

3 years ago[gn build] (manually) port 76a168bce01
Nico Weber [Mon, 2 Nov 2020 14:22:06 +0000 (09:22 -0500)]
[gn build] (manually) port 76a168bce01

3 years agoRevert "[llvm-exegesis] Save target state before running the benchmark."
Clement Courbet [Mon, 2 Nov 2020 14:10:41 +0000 (15:10 +0100)]
Revert "[llvm-exegesis] Save target state before running the benchmark."

_fxsave64 is not available on some buildbots.

This reverts commit 274de447fe9621082a523a7227157aeb84702a7d.

3 years ago[Flang][Driver] Add PrintPreprocessedInput FrontendAction (`flang-new -E`)
Caroline Concatto [Tue, 27 Oct 2020 12:26:47 +0000 (12:26 +0000)]
[Flang][Driver] Add PrintPreprocessedInput FrontendAction (`flang-new -E`)

This patch implements the first frontend action for the Flang parser (i.e.
Fortran::parser). This action runs the preprocessor and is invoked with the
`-E` flag. (i.e. `flang-new -E <input-file>). The generated output is printed
to either stdout or the output file (specified with `-` or `-o <output-file>`).

Note that currently there is no mechanism to map options for the
frontend driver (i.e. Fortran::frontend::FrontendOptions) to options for
the parser (i.e. Fortran::parser::Options). Instead,
Frotran::parser::options are hard-coded to:

```
std::vector<std::string> searchDirectories{"."s};
searchDirectories = searchDirectories;
isFixedForm = false;
_encoding(Fortran::parser::Encoding::UTF_8);
```

These default settings are compatible with the current Flang driver. Further
work is required in order for CompilerInvocation to read and map
clang::driver::options to Fortran::parser::options.

Co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>
Differential Revision: https://reviews.llvm.org/D88381

3 years ago[llvm-exegesis] Save target state before running the benchmark.
Clement Courbet [Mon, 2 Nov 2020 08:15:17 +0000 (09:15 +0100)]
[llvm-exegesis] Save target state before running the benchmark.

Some benchmarked instructions might set target state. Preserve this
state. See PR26418.

Differential Revision: https://reviews.llvm.org/D90592

3 years agoRevert "Fix ds_read2/write2 unaligned offsets"
Jay Foad [Mon, 2 Nov 2020 14:01:33 +0000 (14:01 +0000)]
Revert "Fix ds_read2/write2 unaligned offsets"

This reverts commit 2e7e898c8f0b38dc11fbce2553fc715067aaf42f.

It was committed by mistake.

3 years agoFix ds_read2/write2 unaligned offsets
Jay Foad [Mon, 2 Nov 2020 13:05:15 +0000 (13:05 +0000)]
Fix ds_read2/write2 unaligned offsets

3 years ago[AMDGPU] Precommit ds_read2/write2 with unaligned offset tests. NFC.
Jay Foad [Mon, 2 Nov 2020 13:47:44 +0000 (13:47 +0000)]
[AMDGPU] Precommit ds_read2/write2 with unaligned offset tests. NFC.

3 years ago[AMDGPU] Generate test checks. NFC.
Jay Foad [Mon, 2 Nov 2020 12:50:16 +0000 (12:50 +0000)]
[AMDGPU] Generate test checks. NFC.

3 years ago[AMDGPU] Remove a comment. NFC.
Jay Foad [Mon, 2 Nov 2020 12:52:32 +0000 (12:52 +0000)]
[AMDGPU] Remove a comment. NFC.

This was obsoleted by f78687df9b7 which added gfx9 aligned/unaligned
tests.

3 years agoUse --use-color in run-clang-tidy.py
David Sanders [Mon, 2 Nov 2020 13:38:20 +0000 (08:38 -0500)]
Use --use-color in run-clang-tidy.py

Now that clang-tidy supports the --use-color command line option, it's
a better user experience to use --use-color in run-clang-tidy.py and
preserving the colored output.

3 years ago[libc++] NFC: Remove warning about non-void function returning void
Louis Dionne [Mon, 2 Nov 2020 13:25:16 +0000 (08:25 -0500)]
[libc++] NFC: Remove warning about non-void function returning void

3 years ago[LV][X86] Regenerate gather_scatter tests. NFCI.
Simon Pilgrim [Mon, 2 Nov 2020 11:57:37 +0000 (11:57 +0000)]
[LV][X86] Regenerate gather_scatter tests. NFCI.

Reduce diff in D90554

3 years ago[SLP][X86] Add AVX512VL test target coverage for PR47629
Simon Pilgrim [Mon, 2 Nov 2020 11:40:40 +0000 (11:40 +0000)]
[SLP][X86] Add AVX512VL test target coverage for PR47629

As suggested on D90445 - the AVX512F test case alone won't handle 128/256-bit vector gather pattern very well

3 years ago[RISCV] Avoid std::pair<> in FPReg StringSwitch to avoid MSVC compile failures. NFCI.
Simon Pilgrim [Mon, 2 Nov 2020 11:30:39 +0000 (11:30 +0000)]
[RISCV] Avoid std::pair<> in FPReg StringSwitch to avoid MSVC compile failures. NFCI.

As discussed on D90322, some MSVC builds are failing with is_trivially_copyable static asserts (see D86126) - we can avoid this by not using the std::pair<unsigned,unsigned> which held both the FP+DP Registers, just handle the FP register and convert to DP on the fly.

3 years ago[flang][driver] Rename the accessors/mutators (NFC)
Andrzej Warzynski [Wed, 28 Oct 2020 10:47:48 +0000 (10:47 +0000)]
[flang][driver] Rename the accessors/mutators (NFC)

As per point 3 in [1]:

```
Accessor member functions are named with the non-public data member's
name, less the trailing underscore.  Mutator member functions are named
set_...
```

Originally we just followed the LLVM's style, which is incompatible with
Flang. This patch renames the accessors and mutators accordingly.

`getDiagnostics` and `GetDiagnostics` are replaced with one accessor:
`diagnostics`. `SetDiagnostics` was neither implemented nor used, so
it's deleted.

[1] https://github.com/llvm/llvm-project/blob/master/flang/docs/C++style.md#naming

Differential Revision: https://reviews.llvm.org/D90300

3 years ago[clangd] Value initialize SymbolIDs
Kadir Cetinkaya [Thu, 29 Oct 2020 15:04:53 +0000 (16:04 +0100)]
[clangd] Value initialize SymbolIDs

We were default initializing SymbolIDs before, which would leave
indeterminate values in underlying std::array.

This patch updates the underlying data initalization to be value-init and adds a
way to check for validness of a SymbolID.

Differential Revision: https://reviews.llvm.org/D90397

3 years ago[flang][driver] Use --match-full-lines in tests for `-test-io`
Andrzej Warzynski [Mon, 2 Nov 2020 09:34:27 +0000 (09:34 +0000)]
[flang][driver] Use --match-full-lines in tests for `-test-io`

Use `--match-full-lines` to make sure that FileCheck doesn't match the
output against the `CHECK` lines (which, like other comments, are also
printed).

More specifically, we want to make sure that the following `check` in the
input file:
```
! CHECK: <some-fortran-input>
```
is matched by FileCheck with `<some-fortran-input>` in the generated
output. Without `--match-full-lines`, that check-line will be matched
with `!CHECK:  <some-fortran-input>` instead (which is also
printed together with other contents of the file).

Adding `--match-full-lines` makes the tests stricter and this change
revealed that some `check`s were passing only because that flag was
missing. These are updated accordingly.

Reviewed By: CarolineConcatto, sameeranjoshi

Differential Revision: https://reviews.llvm.org/D90306

3 years ago[clangd] Improve remote-index test
Kirill Bobyrev [Mon, 2 Nov 2020 09:55:17 +0000 (10:55 +0100)]
[clangd] Improve remote-index test

Introduce a separate thread that will kill `clangd-index-server` after 10 seconds regardless. This helps shut down the test if the server hangs and `stderr.readline()` does not contain inititalizatiton message. It prevents "necessary" waiting delay for the server warm-up and only introduces additional delay if the test fails.

It also makes use of `subprocess.Popen.kill()` which is a portable way of handling process shutdown and avoids using signals.

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D90590

3 years ago[llvm-exegesis] Print signal name when the snippet crashed.
Clement Courbet [Fri, 30 Oct 2020 10:35:47 +0000 (11:35 +0100)]
[llvm-exegesis] Print signal name when the snippet crashed.

Differential Revision: https://reviews.llvm.org/D90453

3 years ago[yaml2obj] - Add support of Offset for .strtab/.shstrtab/.dynstr sections.
Georgii Rymar [Fri, 30 Oct 2020 07:58:13 +0000 (10:58 +0300)]
[yaml2obj] - Add support of Offset for .strtab/.shstrtab/.dynstr sections.

These sections are implicit and handled a bit differently.
Currently the "Offset" is ignored for them.
This patch fixes an issue.

Differential revision: https://reviews.llvm.org/D90446

3 years agoRevert "[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register."
Caroline Concatto [Mon, 2 Nov 2020 08:15:50 +0000 (08:15 +0000)]
Revert "[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register."

This reverts commit 8b281bfaf35d00d42c2993fd5a80d749cc21f45e.

3 years ago[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register.
Caroline Concatto [Fri, 23 Oct 2020 09:37:08 +0000 (10:37 +0100)]
[AArch64][AsmParser] Remove 'x31' alias for 'sp/xzr' register.

Only the aliases 'xzr' and 'sp' exist for the physical register x31.
The reason for wanting to remove the alias 'x31' is because it allows users
to write invalid asm that is not accepted by the GNU assembler.

Is there any objection to removing this alias? Or do we want to keep
this for compatibility with existing code that uses w31/x31?

Differential Revision: https://reviews.llvm.org/D90153

3 years ago[clangd] Add lit tests for remote index
Kirill Bobyrev [Mon, 2 Nov 2020 07:38:05 +0000 (08:38 +0100)]
[clangd] Add lit tests for remote index

Reviewed By: kadircet

Differential Revision: https://reviews.llvm.org/D90291

3 years ago[clangd] Fix ParsedASTTest.TopLevelDecls test.
Ilya Golovenko [Mon, 2 Nov 2020 07:25:45 +0000 (08:25 +0100)]
[clangd] Fix ParsedASTTest.TopLevelDecls test.

Google test matcher `DeclKind` uses `NamedDecl::getDeclKindName()` to compare its result with expected declaration name.
Both, returned value of this function and the expected kind name argument have type `const char *`, so this matcher effectively
compares two pointers instead of the respective strings.

The test was passing on most platforms because compilers mostly were able to coalesce these string literals.

Patch By: Ilya Golovenko

Reviewed By: hokein

Differential Revision: https://reviews.llvm.org/D90384

3 years ago[CodeGen][X86] Remove unused check-prefix in strict FP tests.
Wang, Pengfei [Mon, 2 Nov 2020 06:30:40 +0000 (14:30 +0800)]
[CodeGen][X86] Remove unused check-prefix in strict FP tests.

3 years ago[RISCV] Add a test case for another issue in SelectRORIW. NFC
Craig Topper [Mon, 2 Nov 2020 06:12:20 +0000 (22:12 -0800)]
[RISCV] Add a test case for another issue in SelectRORIW. NFC

When validating C3 in (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1)), i32)
we are truncating it to 32 bits before checking its value. We need
to check all 64 bits.

3 years ago[PowerPC] Fix a crash in POWER 9 setb peephole
Qiu Chaofan [Mon, 2 Nov 2020 06:29:43 +0000 (14:29 +0800)]
[PowerPC] Fix a crash in POWER 9 setb peephole

Variable InnerIsSel references FalseRes, while FalseRes might be
zext/sext. So InnerIsSel should reference SetOrSelCC, otherwise a crash
will happen.

Reviewed By: steven.zhang

Differential Revision: https://reviews.llvm.org/D90142

3 years ago[compiler-rt][NFC] Fix typo in comment
Jim Lin [Mon, 2 Nov 2020 02:58:07 +0000 (10:58 +0800)]
[compiler-rt][NFC] Fix typo in comment

3 years ago[RISCV] Add a test case to show a bug in SelectRORIW. NFC
Craig Topper [Mon, 2 Nov 2020 04:24:09 +0000 (20:24 -0800)]
[RISCV] Add a test case to show a bug in SelectRORIW. NFC

The function is matching (sext_inreg (or (shl X, C2), (shr (and Y, C3), C1))),
with appropriate checks for the constants to be a rotate. But it
fails to check that X and Y are the same which is also necessary.

3 years ago[RISCV] Add more rev32 and rev16 test cases using fshl/fshr intrinsics. NFC
Craig Topper [Sun, 1 Nov 2020 20:40:31 +0000 (12:40 -0800)]
[RISCV] Add more rev32 and rev16 test cases using fshl/fshr intrinsics. NFC

fshl/fshr intrinsics turn into rotl/rotr ISD opcodes and we don't
have a complete set of patterns.

We pattern match rotl, but we have a custom match for rori that gets
priority. We don't pattern match rotr and we don't have patterns
or custom code for rori from rotr.

3 years ago[CodeGen][X86] Remove unused check-prefix in adx tests.
Wang, Pengfei [Mon, 2 Nov 2020 03:38:46 +0000 (11:38 +0800)]
[CodeGen][X86] Remove unused check-prefix in adx tests.

Not needed after 226261353288e.

3 years agoNFC: Wrap lines in Python.md.
Stella Laurenzo [Mon, 2 Nov 2020 03:23:44 +0000 (19:23 -0800)]
NFC: Wrap lines in Python.md.

3 years ago[MemProf] Fix test failure on windows
Teresa Johnson [Mon, 2 Nov 2020 03:06:50 +0000 (19:06 -0800)]
[MemProf] Fix test failure on windows

Fix failure in new test from 0949f96dc6521be80ebb8ebc1e1c506165c22aac:
Don't match exact file path separator.

Should fix:
http://lab.llvm.org:8011/#/builders/119/builds/437/steps/9/logs/FAIL__Clang__memory-profile-filename_c