platform/upstream/llvm.git
2 years ago[Driver] Correctly handle static C++ standard library
Petr Hosek [Tue, 21 Sep 2021 06:25:21 +0000 (23:25 -0700)]
[Driver] Correctly handle static C++ standard library

When statically linking C++ standard library, we shouldn't add -Bdynamic
after including the library on the link line because that might override
user settings like -static and -static-pie. Rather, we should surround
the library with --push-state/--pop-state to make sure that -Bstatic
only applies to C++ standard library and nothing else. This has been
supported since GNU ld 2.25 (2014) so backwards compatibility should
no longer be a concern.

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

2 years ago[GlobalISel][IRTranslator] Fix crash during bit-test switch optimization with odd...
Amara Emerson [Fri, 24 Sep 2021 06:49:39 +0000 (23:49 -0700)]
[GlobalISel][IRTranslator] Fix crash during bit-test switch optimization with odd types.

Odd switch case types cause a crash in the conversion to MVT. Instead use a pointer sized
scalar type which is what SDAG does in these cases.

2 years ago[clang-format][docs] Fix documentation of clang-format BasedOnStyle type
Ludovic Jozeau [Fri, 24 Sep 2021 07:14:53 +0000 (08:14 +0100)]
[clang-format][docs] Fix documentation of clang-format BasedOnStyle type

Fix little inconsistency and use `std::string` (which is used everywhere
else) instead of `string`

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

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

2 years ago[clang-format] ensure clang-format command-line argument sets up the default left...
mydeveloperday [Fri, 24 Sep 2021 07:11:05 +0000 (08:11 +0100)]
[clang-format] ensure clang-format command-line argument sets up the default left/right qualifier ordering

When specifying the alignment direction on the command line ensure
we set up the default ordering.

Fix spelling mistakes in the command-line argument

Reviewed By: HazardyKnusperkeks

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

2 years ago[lldb] Fix target-symbols-add-unwind.test for clang 7647a841
Pavel Labath [Fri, 24 Sep 2021 07:05:19 +0000 (09:05 +0200)]
[lldb] Fix target-symbols-add-unwind.test for clang 7647a841

We need a different flag combination to produce .debug_frame.

2 years ago[clang-offload-bundler][docs][NFC] invalid indentation cause build issue
mydeveloperday [Fri, 24 Sep 2021 07:03:52 +0000 (08:03 +0100)]
[clang-offload-bundler][docs][NFC] invalid indentation cause build issue

2 years ago[AArch64][GlobalISel] Fix crash in the extend(extract_vector_elt) optimization.
Amara Emerson [Fri, 24 Sep 2021 05:53:52 +0000 (22:53 -0700)]
[AArch64][GlobalISel] Fix crash in the extend(extract_vector_elt) optimization.

It was assuming that GPR extends could only have destination sizes of 32 or 64
bits, but for AArch64 we allow < 32 bits even without matching size physregs.

2 years ago[ORC-RT] Rename ExecutorAddress to ExecutorAddr.
Lang Hames [Fri, 24 Sep 2021 03:52:21 +0000 (20:52 -0700)]
[ORC-RT] Rename ExecutorAddress to ExecutorAddr.

This is an ORC-runtime counterpart to LLVM commit ef391df2b63, and the
motivation is the same: to move to a shorter name to improve the ergonomics of
this type before it's more widely adopted.

2 years ago[PowerPC] SemaChecking for darn family of builtins
Albion Fung [Thu, 23 Sep 2021 19:44:06 +0000 (14:44 -0500)]
[PowerPC] SemaChecking for darn family of builtins

The __darn family of builtins are only available on Pwr9,
and only __darn_32 is available on both 64 and 32 bit, while the rest
are only available on 64 bit. The patch adds sema checking
for these builtins and separate the __darn_32's 32 bit
test cases.

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

2 years agoFix that same path separator issue again...
David Blaikie [Fri, 24 Sep 2021 04:15:01 +0000 (21:15 -0700)]
Fix that same path separator issue again...

2 years agoDebugInfo: STN: Handle unreconstitutable types in function types
David Blaikie [Fri, 24 Sep 2021 04:13:16 +0000 (21:13 -0700)]
DebugInfo: STN: Handle unreconstitutable types in function types

2 years agoRemove non-portable directory separator from test
David Blaikie [Fri, 24 Sep 2021 03:46:57 +0000 (20:46 -0700)]
Remove non-portable directory separator from test

2 years ago[ORC] Rename ExecutorAddress to ExecutorAddr.
Lang Hames [Thu, 23 Sep 2021 19:00:47 +0000 (12:00 -0700)]
[ORC] Rename ExecutorAddress to ExecutorAddr.

Removing the 'ess' suffix improves the ergonomics without sacrificing clarity.
Since this class is likely to be used more frequently in the future it's worth
some short term pain to fix this now.

2 years ago[docs] Document the --print-passes flag in opt.
Frederic Cambus [Fri, 24 Sep 2021 03:26:36 +0000 (08:56 +0530)]
[docs] Document the --print-passes flag in opt.

Reviewed By: aeubanks, asbirlea

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

2 years ago[Sanitizers] intercept ttyent api on FreeBSD.
David Carlier [Fri, 24 Sep 2021 03:26:05 +0000 (04:26 +0100)]
[Sanitizers] intercept ttyent api on FreeBSD.

and ttyentpath separately on NetBSD.

Reviewed By: vitalybuka

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

2 years ago[TableGen] Allow targets to entirely ignore Psets for registers
Christudasan Devadasan [Thu, 23 Sep 2021 04:08:14 +0000 (00:08 -0400)]
[TableGen] Allow targets to entirely ignore Psets for registers

Tablegen currently expects targets to have at least one
pressure set for every broader register category. AMDGPU's
VGPR or AGPR, for instance, seemed to work correctly without
any pset, though we have forced one for each type to avoid
the assertion in computeRegUnitSets. However, psets can not
be entirely empty. At least one set is mandatory for every
target. This patch bypasses the assertion for the classes
when GeneratePressureSet is zero while ensuring the
RegUnitSets are not empty.

Reviewed By: arsenm, rampitec

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

2 years ago[gn build] Port a2c1cf09dfaa
LLVM GN Syncbot [Fri, 24 Sep 2021 03:01:20 +0000 (03:01 +0000)]
[gn build] Port a2c1cf09dfaa

2 years ago[ORC] Introduce EPCGenericDylibManager / SimpleExecutorDylibManager.
Lang Hames [Wed, 22 Sep 2021 05:34:46 +0000 (15:34 +1000)]
[ORC] Introduce EPCGenericDylibManager / SimpleExecutorDylibManager.

EPCGenericDylibManager provides an interface for loading dylibs and looking up
symbols in the executor, implemented using EPC-calls to functions in the
executor.

SimpleExecutorDylibManager is an executor-side service that provides the
functions used by EPCGenericDylibManager.

SimpleRemoteEPC is updated to use an EPCGenericDylibManager instance to
implement the ExecutorProcessControl loadDylib and lookup methods. In a future
commit these methods will be removed, and clients updated to use
EPCGenericDylibManagers directly.

2 years agoDebugInfo: Implement the -gsimple-template-names functionality
David Blaikie [Mon, 20 Sep 2021 03:45:42 +0000 (20:45 -0700)]
DebugInfo: Implement the -gsimple-template-names functionality

This excludes certain names that can't be rebuilt from the available
DWARF:

* Atomic types - no DWARF differentiating int from atomic int.
* Vector types - enough DWARF (an attribute on the array type) to do
  this, but I haven't written the extra code to add the attributes
  required for this
* Lambdas - ambiguous with any other unnamed class
* Unnamed classes/enums - would need column info for the type in
  addition to file/line number
* noexcept function types - not encoded in DWARF

2 years ago[AMDGPU] Legalize initialized LDS variables
Christudasan Devadasan [Thu, 16 Sep 2021 16:06:16 +0000 (12:06 -0400)]
[AMDGPU] Legalize initialized LDS variables

We don't allow an initializer for LDS variables
and there is an early abort during instruction
selection. This patch legalizes them by ignoring
the init values. During assembly emission, proper
error reporting already exists for such instances.

Reviewed By: arsenm

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

2 years ago[Driver] Default Generic_GCC x86 to -fasynchronous-unwind-tables
Fangrui Song [Fri, 24 Sep 2021 02:39:50 +0000 (19:39 -0700)]
[Driver] Default Generic_GCC x86 to -fasynchronous-unwind-tables

to match GCC and Clang's own x86-64.

2 years ago[Polly] Implement user-directed loop distribution/fission.
Michael Kruse [Wed, 22 Sep 2021 22:27:16 +0000 (17:27 -0500)]
[Polly] Implement user-directed loop distribution/fission.

This is a simple version without the possibility to define distribute
points or followup-transformations. However, it is the first
transformation that has to check whether the transformation is correct.

It interprets the same metadata as the LoopDistribute pass.

Re-apply after revert in c7bcd72a38bcf99e03e4651ed5204d1a1f2bf695 with
fix: Take isBand out of #ifndef NDEBUG since it now is used
unconditionally.

2 years agoAdd missing storageType to AttrDef to ODS
Mehdi Amini [Fri, 24 Sep 2021 00:15:49 +0000 (00:15 +0000)]
Add missing storageType to AttrDef to ODS

This is only noticeable when using an attribute across dialects I think.
Previously the namespace would be ommited, but it wouldn't matter as
long as the generated code stays within a single namespace.

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

2 years ago[mlir][linalg] Support tile+peel with TiledLoopOp
Matthias Springer [Fri, 24 Sep 2021 01:22:03 +0000 (10:22 +0900)]
[mlir][linalg] Support tile+peel with TiledLoopOp

Only scf.for was supported until now.

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

2 years ago[mlir][linalg] Merge all tiling passes into a single one.
Matthias Springer [Fri, 24 Sep 2021 01:16:14 +0000 (10:16 +0900)]
[mlir][linalg] Merge all tiling passes into a single one.

Passes such as `linalg-tile-to-tiled-loop` are merged into `linalg-tile`.

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

2 years ago[ThinLTO] Fix bot failures
Teresa Johnson [Fri, 24 Sep 2021 00:57:16 +0000 (17:57 -0700)]
[ThinLTO] Fix bot failures

Fix bot failures after 2c1defeee40cf643ea6f0fa5e01164c9a4c48c30. The new
GUID I added isn't matching because it is a local with the source path
prepended. There isn't much use in matching the GUID's exactly anyway,
so remove those from the patterns.

2 years ago[ThinLTO] Don't emit original GUID for locals to distributed indexes
Teresa Johnson [Wed, 22 Sep 2021 23:25:33 +0000 (16:25 -0700)]
[ThinLTO] Don't emit original GUID for locals to distributed indexes

In ThinLTO for locals we normally compute the GUID from the name after
prepending the source path to get a unique global id. SamplePGO indirect
call profiles contain the target GUID without this uniquification,
however (unless compiling with -funique-internal-linkage-names).
Therefore, the index contains the original GUID of the local symbols
(without module path prepended to uniquify), in order to correctly
handle the call edges added for these indirect call profile targets
with SamplePGO.

We were emitting these to the combined index when writing it out as
bitcode, which is unnecessary and causes overhead when writing out the
indexes for distributed backends. The only use of the original GUID name
is in the thin link. Suppress it in that case. This reduced the thin
link time for a large distributed build by about 7%, and the aggregate
size of the serialized indexes by over 2%.

Continue to print it when writing out the full index, since that is just
used for debugging and testing.

Update a distributed thinlto index test to contain a local and ensure
that we don't get a COMBINED_ORIGINAL_NAME record.

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

2 years ago[compiler-rt][profile] Make corrupted-profile.c more robust
Leonard Chan [Fri, 24 Sep 2021 00:16:47 +0000 (17:16 -0700)]
[compiler-rt][profile] Make corrupted-profile.c more robust

This test specifically checks that profiles are not mergeable if there's a
change in the CounterPtr in the profile header. The test manually changes
CounterPtr by explicitly calling memset on some offset into the profile file.
This test would fail if binary IDs were emitted because the offset calculation
does not take into account the binary ID sizes.

This patch updates the test to use types provided in profile/InstrProfData.inc
to make it more resistant to profile layout changes.

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

2 years ago[ORC] Shut down services in SimpleRemoteEPCServer.
Lang Hames [Wed, 22 Sep 2021 06:34:15 +0000 (16:34 +1000)]
[ORC] Shut down services in SimpleRemoteEPCServer.

This should have been included with ExecutorBootstrapService in 78b083dbb72,
but was accidentally left out. It give services a chance to release any
resources that they have acquired.

2 years ago[clang-format] Fix unittest failures with -Werror
Nemanja Ivanovic [Thu, 23 Sep 2021 23:22:30 +0000 (18:22 -0500)]
[clang-format] Fix unittest failures with -Werror

Commit a44ab1702539 added a unit test that fails to build with
-Werror which causes build bot breaks on bots that include that
option in their build. This patch just adds the necessary casts to
silence the warnings.

2 years agoFix -fno-unwind-tables -fasynchronous-unwind-tables to emit unwind tables
Fangrui Song [Thu, 23 Sep 2021 23:15:40 +0000 (16:15 -0700)]
Fix -fno-unwind-tables -fasynchronous-unwind-tables to emit unwind tables

This matches GCC.

Change the CC1 option to encode the unwind table level (1: needed by exceptions,
2: asynchronous) so that we can support two modes in the future.

2 years ago[NFC] Refactor tests to improve readability.
Daniil Fukalov [Thu, 23 Sep 2021 17:14:55 +0000 (20:14 +0300)]
[NFC] Refactor tests to improve readability.

2 years ago[RISCV] Limit transformAddImmMulImm to prevent an infinite loop.
Craig Topper [Thu, 23 Sep 2021 22:52:49 +0000 (15:52 -0700)]
[RISCV] Limit transformAddImmMulImm to prevent an infinite loop.

This fixes an issue reported in D108607.

2 years ago[CSSPGO] Do not pass -fpseudo-probe-for-profiling to the linker.
Hongtao Yu [Thu, 23 Sep 2021 22:43:40 +0000 (15:43 -0700)]
[CSSPGO] Do not pass -fpseudo-probe-for-profiling to the linker.

The correponding linker switch has been removed by https://reviews.llvm.org/D110209, so do not pass it in clang.

Reviewed By: wenlei

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

2 years agoRevert "[compiler-rt][profile] Add padding after binary IDs"
Leonard Chan [Thu, 23 Sep 2021 22:48:21 +0000 (15:48 -0700)]
Revert "[compiler-rt][profile] Add padding after binary IDs"

This reverts commit 6bc9c8dfe32cc4662f2ed9041af527f69dfff13b.

Reverted because this broke some PPC buildbots.

2 years ago[ORC] Fix file header.
Lang Hames [Wed, 22 Sep 2021 01:16:09 +0000 (11:16 +1000)]
[ORC] Fix file header.

2 years ago[libc++][NFC] Refactor the std::reverse_view tests
Louis Dionne [Thu, 23 Sep 2021 22:33:45 +0000 (18:33 -0400)]
[libc++][NFC] Refactor the std::reverse_view tests

Mostly, remove the global assumption that all ranges have size 8.
I should have called this out during the initial review.

2 years ago[AMDGPU] Propagate defining src reg for AGPR to AGPR Copys
Vang Thao [Fri, 27 Aug 2021 16:56:12 +0000 (09:56 -0700)]
[AMDGPU] Propagate defining src reg for AGPR to AGPR Copys

On targets that do not support AGPR to AGPR copying directly, try to find the
defining accvgpr_write and propagate its source vgpr register to the copies
before register allocation so the source vgpr register does not get clobbered.

The postrapseudos pass also attempt to propagate the defining accvgpr_write but
if the register to propagate is clobbered, it will give up and create new
temporary vgpr registers instead.

Reviewed By: rampitec

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

2 years ago[profile][fuchsia] Don't include extra NUL in log messages
Roland McGrath [Thu, 23 Sep 2021 20:36:24 +0000 (13:36 -0700)]
[profile][fuchsia] Don't include extra NUL in log messages

Reviewed By: phosek

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

2 years ago[lldb] Handle malformed qfThreadInfo reply
Ted Woodward [Thu, 16 Sep 2021 23:40:09 +0000 (18:40 -0500)]
[lldb] Handle malformed qfThreadInfo reply

If the remote gdbserver's qfThreadInfo reply has a trailing comma,
GDBRemoteCommunicationClient::GetCurrentProcessAndThreadIDs will return
an empty vector of thread ids. This will cause lldb to recurse through
three functions trying to get the list of threads, until it blows its
stack and crashes.

A trailing comma is a malformed response, but it shouldn't cause lldb to
crash. This patch will return the tids received before the malformed
response.

Reviewed By: clayborg, labath

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

2 years ago[OpenMP] Fix data-race in new device RTL
Joseph Huber [Thu, 23 Sep 2021 21:18:53 +0000 (17:18 -0400)]
[OpenMP] Fix data-race in new device RTL

This patch fixes a data-race observed when using the new device runtime
library. The Internal control variable for the parallel level is read in
the `__kmpc_parallel_51` function while it could potentially be written
by other threads. This causes data corruption and will cause
nondetermistic behaviour in the runtime. This patch fixes this by adding
an explicit synchronization before the region starts.

Reviewed By: jdoerfert

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

2 years agoRegAllocGreedy: Remove an unhelpful auto, and don't use a reference
Matt Arsenault [Wed, 1 Sep 2021 22:31:17 +0000 (18:31 -0400)]
RegAllocGreedy: Remove an unhelpful auto, and don't use a reference

2 years ago[RISCV] Add another isel optimization for (and (shl x, c2), c1)
Craig Topper [Thu, 23 Sep 2021 21:09:51 +0000 (14:09 -0700)]
[RISCV] Add another isel optimization for (and (shl x, c2), c1)

Turn (and (shl x, c2), c1) -> (slli (srli x, c3-c2), c3) if c1 is a
shifted mask with no leading zeros and c3 trailing zeros where c3
is greater than c2.

2 years ago[RISCV] Add more tests for (and (shl x, C2), C1) that can be improved by using a...
Craig Topper [Thu, 23 Sep 2021 20:57:00 +0000 (13:57 -0700)]
[RISCV] Add more tests for (and (shl x, C2), C1) that can be improved by using a pair of shifts. NFC

These tests have C1 as a shifted mask having no leading zeros and
C3 trailing zeros. If C3 is more than C2, we can select this as
(slli (srli x, C3-C2), C3).

2 years ago[CMake] Pass llvm-readelf to CMake external builds
Petr Hosek [Thu, 23 Sep 2021 07:48:24 +0000 (00:48 -0700)]
[CMake] Pass llvm-readelf to CMake external builds

This matches other LLVM binary tools.

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

2 years ago[clangd] Support `#pragma mark` in the outline
David Goldman [Mon, 12 Jul 2021 16:29:48 +0000 (12:29 -0400)]
[clangd] Support `#pragma mark` in the outline

Xcode uses `#pragma mark -` to draw a divider in the outline view
and `#pragma mark Note` to add `Note` in the outline view. For more
information, see https://nshipster.com/pragma/.

Since the LSP spec doesn't contain dividers for the symbol outline,
instead we treat `#pragma mark -` as a group with children - the
decls that come after it, implicitly terminating when the symbol's
parent ends.

The following code:

```
@implementation MyClass

- (id)init {}

- (int)foo;
@end
```

Would give an outline like

```
MyClass
        > Overrides
                    > init
        > Public Accessors
                    > foo
```

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

2 years ago[clang-format] NFC ensure Penality variable is passed back with Fixes
mydeveloperday [Thu, 23 Sep 2021 21:01:55 +0000 (22:01 +0100)]
[clang-format] NFC ensure Penality variable is passed back with Fixes

Fix set but not used warning

2 years agoRevert "[Polly] Implement user-directed loop distribution/fission."
Petr Hosek [Thu, 23 Sep 2021 21:02:38 +0000 (14:02 -0700)]
Revert "[Polly] Implement user-directed loop distribution/fission."

This reverts commit 52c30adc7dfe6334b71adf256d81f70e7b976143 which
breaks the build when NDEBUG is defined.

2 years agoSupport: Add closing namespace comment in raw_ostream_test.cpp, NFC
Duncan P. N. Exon Smith [Thu, 23 Sep 2021 20:58:42 +0000 (16:58 -0400)]
Support: Add closing namespace comment in raw_ostream_test.cpp, NFC

The closing namespace comment prevents clang-format from dropping a
blank line after the final test. Also add in a blank line (which
simplifies merging/rebasing/etc. WIP patches).

2 years ago[Polly] Remove -polly-opt-fusion option.
Michael Kruse [Thu, 23 Sep 2021 20:37:56 +0000 (15:37 -0500)]
[Polly] Remove -polly-opt-fusion option.

The name of the option is misleading and has been renamed by isl to
"serialize-sccs". Instead of also renaming the option, remove it.
The option is still accessible using

    -polly-isl-arg=--no-schedule-serialize-sccs

2 years ago[flang] Represent (parentheses around derived types)
peter klausler [Wed, 22 Sep 2021 23:49:09 +0000 (16:49 -0700)]
[flang] Represent (parentheses around derived types)

The strongly typed expression representation classes supported
a representation of parentheses only around intrinsic types
with specific kinds.  Parentheses around derived type variables
must also be preserved so that expressions may be distinguished
from variables; this distinction matters for actual arguments &
construct associations.

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

2 years ago[lldb] Show fix-it applied even if expression didn't evaluate succesfully
Augusto Noronha [Thu, 16 Sep 2021 19:26:49 +0000 (16:26 -0300)]
[lldb] Show fix-it applied even if expression didn't evaluate succesfully

If we applied a fix-it before evaluating an expression and that
expression didn't evaluate correctly, we should still tell users about
the fix-it we applied since that may be the reason why it didn't work
correctly.

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

2 years ago[mlir][sparse] Moved a conditional from the RT library to the generated MLIR.
wren romano [Wed, 22 Sep 2021 18:48:57 +0000 (11:48 -0700)]
[mlir][sparse] Moved a conditional from the RT library to the generated MLIR.

When generating code to add an element to SparseTensorCOO (e.g., when doing dense=>sparse conversion), we used to check for nonzero values on the runtime side, whereas now we generate MLIR code to do that check.

Reviewed By: aartbik

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

2 years ago[ORC][examples] Export exectuable symbols explicitly in LLJITWithExecutorProcessControl
Stefan Gränitz [Thu, 23 Sep 2021 19:37:16 +0000 (21:37 +0200)]
[ORC][examples] Export exectuable symbols explicitly in LLJITWithExecutorProcessControl

Functions in static code that should be callable from JITed code must be exported. For dynamic libraries extern functions are exported by default. For exectuables, linkers usually strip them away unless we explicitly ask for keeping them.

Reviewed By: xgupta

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

2 years ago[llvm] Fix a copy-pasto
Nico Weber [Thu, 23 Sep 2021 19:32:39 +0000 (15:32 -0400)]
[llvm] Fix a copy-pasto

We should use IMAGE_REL_I386_SECREL in the i386 section of this file.

IMAGE_REL_I386_SECREL and IMAGE_REL_AMD64_SECREL have the same
numeric value 0xB, so this doesn't change behavior.

2 years ago[llvm] Replace tab with spaces in one test
Nico Weber [Thu, 23 Sep 2021 19:31:32 +0000 (15:31 -0400)]
[llvm] Replace tab with spaces in one test

Also use just one space after comma. Now grepping for ', offset '
in llvm/test actually finds the test for `offset`.

No behavior change.

2 years ago[ORC] Minor renaming and typo fixes (NFC)
Stefan Gränitz [Thu, 23 Sep 2021 17:00:48 +0000 (19:00 +0200)]
[ORC] Minor renaming and typo fixes (NFC)

Two typos, one unsused include and some leftovers from the TargetProcessControl -> ExecutorProcessControl renaming

Reviewed By: xgupta

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

2 years ago[InlineAdvisor] Use one single quote
Fangrui Song [Thu, 23 Sep 2021 19:16:15 +0000 (12:16 -0700)]
[InlineAdvisor] Use one single quote

2 years ago[gn build] Port a44ab1702539
LLVM GN Syncbot [Thu, 23 Sep 2021 19:01:30 +0000 (19:01 +0000)]
[gn build] Port a44ab1702539

2 years ago[clang-format] Add Left/Right Const fixer capability
mydeveloperday [Thu, 23 Sep 2021 19:00:33 +0000 (20:00 +0100)]
[clang-format] Add Left/Right Const fixer capability

Developers these days seem to argue over east vs west const like they used to argue over tabs vs whitespace or the various bracing style. These previous arguments were mainly eliminated with tools like `clang-format` that allowed those rules to become part of your style guide. Anyone who has been using clang-format in a large team over the last couple of years knows that we don't have those religious arguments any more, and code reviews are more productive.

https://www.youtube.com/watch?v=fv--IKZFVO8
https://mariusbancila.ro/blog/2018/11/23/join-the-east-const-revolution/
https://www.youtube.com/watch?v=z6s6bacI424

The purpose of this revision is to try to do the same for the East/West const discussion. Move the debate into the style guide and leave it there!

In addition to the new `ConstStyle: Right` or `ConstStyle: Left` there is an additional command-line argument `--const-style=left/right` which would allow an individual developer to switch the source back and forth to their own style for editing, and back to the committed style before commit. (you could imagine an IDE might offer such a switch)

The revision works by implementing a separate pass of the Annotated lines much like the SortIncludes and then create replacements for constant type declarations.

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

2 years ago[AArch64] Update some sve-fixed-length test checks.
David Green [Thu, 23 Sep 2021 18:30:45 +0000 (19:30 +0100)]
[AArch64] Update some sve-fixed-length test checks.

Some of these test show very poor code generation. Updating the tests
to make the tests more maintainable and prevent problems from being
hidden behind badly written test checks. Also in some of them the check
lines were using incorrect prefixes.

These are not-quite auto-generated. They are generated with the normal
update scripts and then uninteresting checks are removed, which at least
makes the test _more_ maintainable without materially changing what they
are testing.

I have otherwise attempted to not alter what is tested.

2 years ago[RISCV] Add more isel optimizations for (and (shr x, c2), c1).
Craig Topper [Thu, 23 Sep 2021 18:16:34 +0000 (11:16 -0700)]
[RISCV] Add more isel optimizations for (and (shr x, c2), c1).

Turn (and (shr x, c2), c1) -> (slli (srli x, c2+c3), c3) if c1 is a
shifted mask with c2 leading zeros and c3 trailing zeros.

When the leading zeros is C2+32 we can use SRLIW in place of SRLI.

2 years ago[RISCV] Add more tests for (and (srl x, C2), C1) that can be improved by using a...
Craig Topper [Thu, 23 Sep 2021 17:10:44 +0000 (10:10 -0700)]
[RISCV] Add more tests for (and (srl x, C2), C1) that can be improved by using a pair of shifts. NFC

These tests have C1 as a shifted mask having C2 leading zeros and some
number of trailing zeros, C3. We can select this as
(slli (srli x, C2+C3), C3) or (slli (srliw x, C2+C3), C3).

2 years ago[x86] add AVX512 run for fcmp+logic ops; NFC
Sanjay Patel [Thu, 23 Sep 2021 18:11:00 +0000 (14:11 -0400)]
[x86] add AVX512 run for fcmp+logic ops; NFC

Suggested in D110342

2 years ago[x86] move combiner state check into convertIntLogicToFPLogic(); NFC
Sanjay Patel [Thu, 23 Sep 2021 15:43:40 +0000 (11:43 -0400)]
[x86] move combiner state check into convertIntLogicToFPLogic(); NFC

This function can be adapted to solve bugs like PR51245,
but it could require differentiating the combiner timing
between the existing and new transforms.

2 years agoRevert "Diagnose -Wunused-value based on CFG reachability"
Yuanfang Chen [Thu, 23 Sep 2021 18:12:00 +0000 (11:12 -0700)]
Revert "Diagnose -Wunused-value based on CFG reachability"

This reverts commit cbbf2e8c8ae7730ff0121f4868de4a7d188feb65.
It seems causing diagnoses in SFINAE context.

2 years ago[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs
Michał Górny [Mon, 20 Sep 2021 10:20:17 +0000 (12:20 +0200)]
[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs

Switch the gdb-remote client logic to use local (LLDB) register numbers
in value_regs/invalidate_regs rather than remote regnos. This involves
translating regnos received from lldb-server.

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

2 years ago[lldb] [gdb-remote] Refactor getting remote regs to use local vector
Michał Górny [Sat, 18 Sep 2021 18:00:40 +0000 (20:00 +0200)]
[lldb] [gdb-remote] Refactor getting remote regs to use local vector

Refactor remote register getters to collect them into a local
std::vector rather than adding them straight into DynamicRegisterInfo.
The purpose of this change is to lay groundwork for switching value_regs
and invalidate_regs to use local LLDB register numbers rather than
remote numbers.

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

2 years ago[WebAssembly] Add prototype relaxed SIMD fma/fms instructions
Thomas Lively [Thu, 23 Sep 2021 18:01:36 +0000 (11:01 -0700)]
[WebAssembly] Add prototype relaxed SIMD fma/fms instructions

Add experimental clang builtins, LLVM intrinsics, and backend definitions for
the new {f32x4,f64x2}.{fma,fms} instructions in the relaxed SIMD proposal:
https://github.com/WebAssembly/relaxed-simd/blob/main/proposals/relaxed-simd/Overview.md.
Do not allow these instructions to be selected without explicit user opt-in.

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

2 years ago[lldb] Add a C language REPL to test LLDB's REPL infrastructure
Raphael Isemann [Thu, 23 Sep 2021 17:13:50 +0000 (19:13 +0200)]
[lldb] Add a C language REPL to test LLDB's REPL infrastructure

LLDB has a bunch of code that implements REPL support, but all that code is
unreachable as no language in master currently has an implemented REPL backend.
The only REPL that exists is in the downstream Swift fork. All patches for this
generic REPL code therefore also only have tests downstream which is clearly not
a good situation.

This patch implements a basic C language REPL on top of LLDB's REPL framework.
Beside implementing the REPL interface and hooking it up into the plugin
manager, the only other small part of this patch is making the `--language` flag
of the expression command compatible with the `--repl` flag. The `--repl` flag
uses the value of `--language` to see which REPL should be started, but right
now the `--language` flag is only available in OptionGroups 1 and 2, but not in
OptionGroup 3 where the `--repl` flag is declared.

The REPL currently can currently only start if a running target exists. I'll add
the 'create and run a dummy executable' logic from Swift (which is requires when
doing `lldb --repl`) when I have time to translate all this logic to something
that will work with Clang.

I should point out that the REPL currently uses the C expression parser's
approach to persistent variables where only result variables and the ones
starting with a '$' are transferred between expressions. I'll fix that in a
follow up patch. Also the REPL currently doesn't work in a non-interactive
terminal. This seems to be fixed in the Swift fork, so I assume one of our many
REPL downstream changes addresses the issue.

Reviewed By: JDevlieghere

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

2 years ago[compiler-rt][profile] Add padding after binary IDs
Leonard Chan [Thu, 23 Sep 2021 17:29:24 +0000 (10:29 -0700)]
[compiler-rt][profile] Add padding after binary IDs

Some tests with binary IDs would fail with error: no profile can be merged.
This is because raw profiles could have unaligned headers when emitting binary
IDs. This means padding should be emitted after binary IDs are emitted to
ensure everything else is aligned. This patch accounts for that padding in
__llvm_write_binary_ids.

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

2 years ago[flang] Implement READ(SIZE=) and INQUIRE(IOLENGTH=) in runtime
peter klausler [Mon, 20 Sep 2021 17:52:39 +0000 (10:52 -0700)]
[flang] Implement READ(SIZE=) and INQUIRE(IOLENGTH=) in runtime

Count input characters corresponding to formatted edit descriptors
for READ(SIZE=); count output bytes for INQUIRE(IOLENGTH=).

The I/O APIs GetSize() and GetLength() were adjusted to return
std::size_t as function results.

Basic unit tests were added (and others fixed).

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

2 years ago[libc++] Remove unused macro in __config
Louis Dionne [Wed, 22 Sep 2021 20:50:46 +0000 (16:50 -0400)]
[libc++] Remove unused macro in __config

That macro was being defined but not used anywhere in libc++, so it
must be safe to remove it.

As a fly-by fix, also remove mentions of this macro in other places
in LLVM, to make sure they were not depending on the value defined in
libc++.

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

2 years ago[ARM] Extra tests for unpredicated qr MVE intrinsics.
David Green [Thu, 23 Sep 2021 17:07:08 +0000 (18:07 +0100)]
[ARM] Extra tests for unpredicated qr MVE intrinsics.

2 years ago[fir][NFC] Remove fir.cmpf replaced by mlir.cmpf
Valentin Clement [Thu, 23 Sep 2021 17:04:39 +0000 (19:04 +0200)]
[fir][NFC] Remove fir.cmpf replaced by mlir.cmpf

fir.cmpf op is not necessary anymore as it is replaced by mlir.cmpf.
This patch is part of the upstreaming effort from fir-dev branch.

Reviewed By: jeanPerier

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

Co-authored-by: schweitzpgi
Co-authored-by: jeanPerier
2 years agoRevert "[LiveIntervals] Fix repairOldRegInRange for simple def cases"
Jay Foad [Thu, 23 Sep 2021 16:55:05 +0000 (17:55 +0100)]
Revert "[LiveIntervals] Fix repairOldRegInRange for simple def cases"

This reverts commit 8229cb74125322ff337cfe316ab35c6ebf412bde.

It was failing on buildbots with expensive checks enabled.

2 years ago[fir][NFC] rename canBePointerOrHeapElementType to cannotBePointerOrHeapElementType
Valentin Clement [Thu, 23 Sep 2021 16:49:10 +0000 (18:49 +0200)]
[fir][NFC] rename canBePointerOrHeapElementType to cannotBePointerOrHeapElementType

This patch is part of the upstreaming effort from fir-dev branch.
Rename the function so the name conveys better what it does.

Reviewed By: jeanPerier

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

Co-authored-by: schweitz
Co-authored-by: jeanPerier
2 years ago[JumpThreading] Ignore free instructions
Nikita Popov [Wed, 22 Sep 2021 19:34:24 +0000 (21:34 +0200)]
[JumpThreading] Ignore free instructions

This is basically D108837 but for jump threading. Free instructions
should be ignored for the threading decision. JumpThreading already
skips some free instructions (like pointer bitcasts), but does not
skip various free intrinsics -- in fact, it currently gives them a
fairly large cost of 2.

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

2 years agoResolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion
Fangrui Song [Thu, 23 Sep 2021 16:23:35 +0000 (09:23 -0700)]
Resolve {GlobalValue,GloalIndirectSymol}::getBaseObject confusion

While both GlobalAlias and GlobalIFunc are GlobalIndirectSymbol, their
`getIndirectSymbol()` usage is quite different (GlobalIFunc's resolver
is an entity different from GlobalIFunc itself).

As discussed on https://lists.llvm.org/pipermail/llvm-dev/2020-September/144904.html
("[IR] Modelling of GlobalIFunc"), the name `getBaseObject` is confusing when
used with GlobalIFunc.

To resolve the confusion:

* Move GloalIndirectSymol::getBaseObject to GlobalAlias:: (GlobalIFunc should use `getResolver` instead)
* Change GlobalValue::getBaseObject not to inspect GlobalIFunc. Note: the function has 7 references.
* Add GlobalIFunc::getResolverFunction to peel off potential ConstantExpr indirection
  (`strlen` in `test/LTO/Resolution/X86/ifunc.ll`)

Note: GlobalIFunc::getResolver (like GlobalAlias::getAliasee which does not peel
off ConstantExpr indirection) is kept to be used by ValueEnumerator.

Reviewed By: ibookstein

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

2 years agoRevert "[lldb] [gdb-remote] Refactor getting remote regs to use local vector"
Michał Górny [Thu, 23 Sep 2021 16:16:51 +0000 (18:16 +0200)]
Revert "[lldb] [gdb-remote] Refactor getting remote regs to use local vector"

This reverts commit b03e701c145365ba339657ead54a2e0cc5c02776.  This is
causing regressions when XML support is disabled.

2 years agoRevert "[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs"
Michał Górny [Thu, 23 Sep 2021 16:16:33 +0000 (18:16 +0200)]
Revert "[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs"

This reverts commit 6fbed33d4a7de2229c40e6318f223092d3a23848.
The prerequisite commit is causing regressions.

2 years ago[LiveIntervals] Fix repairOldRegInRange for simple def cases
Jay Foad [Wed, 22 Sep 2021 11:14:18 +0000 (12:14 +0100)]
[LiveIntervals] Fix repairOldRegInRange for simple def cases

The fix applied in D23303 "LiveIntervalAnalysis: fix a crash in repairOldRegInRange"
was over-zealous. It would bail out when the end of the range to be
repaired was in the middle of the first segment of the live range of
Reg, which was always the case when the range contained a single def of
Reg.

This patch fixes it as suggested by Matthias Braun in post-commit review
on the original patch, and tests it by adding -early-live-intervals to
a selection of existing lit tests that now pass.

(Note that D23303 was originally applied to fix a crash in
SILoadStoreOptimizer, but that is now moot since D23814 updated
SILoadStoreOptimizer to run before scheduling so it no longer has to
update live intervals.)

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

2 years ago[libc++] Use CMake interface targets to setup benchmark flags
Louis Dionne [Wed, 12 Aug 2020 21:56:16 +0000 (17:56 -0400)]
[libc++] Use CMake interface targets to setup benchmark flags

This is a re-application of da0592e4c8df which was reverted in
1454018dc1d9 because it was incompatible with older CMakes.
Instead, disable the benchmarks when CMake is too old to
support those idioms.

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

2 years ago[PowerPC] Add range checks for P10 Vector Builtins
Quinn Pham [Mon, 13 Sep 2021 17:30:25 +0000 (12:30 -0500)]
[PowerPC] Add range checks for P10 Vector Builtins

This patch adds range checking for some Power10 altivec builtins and
changes the signature of a builtin to match documentation. For `vec_cntm`,
range checking is done via SemaChecking. For `vec_splati_ins`, the second
argument is masked to extract the 0th bit so that we always receive either a `0`
or a `1`.

Reviewed By: lei, amyk

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

2 years ago[SampleFDO] Remove redundant declarations (NFC)
Kazu Hirata [Thu, 23 Sep 2021 15:58:08 +0000 (08:58 -0700)]
[SampleFDO] Remove redundant declarations (NFC)

Note that these are declared in SampleProfileLoaderBaseUtil.h, which
SampleProfileLoaderBaseImpl.h includes.

2 years ago[RegAlloc] Cast uint8_t to unsigned before printing it.
Craig Topper [Thu, 23 Sep 2021 15:48:23 +0000 (08:48 -0700)]
[RegAlloc] Cast uint8_t to unsigned before printing it.

raw_ostream interprets uint8_t as wanting to print a character
with that ASCII value. In this case the uint8_t is an integer
that we want to print.

2 years ago[clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.
Frederic Cambus [Thu, 23 Sep 2021 15:46:11 +0000 (21:16 +0530)]
[clang] Use portable "#!/usr/bin/env bash" shebang for tools and utils.

Reviewed By: JDevlieghere

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

2 years ago[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs
Michał Górny [Mon, 20 Sep 2021 10:20:17 +0000 (12:20 +0200)]
[lldb] [gdb-remote] Use local regnos for value_regs/invalidate_regs

Switch the gdb-remote client logic to use local (LLDB) register numbers
in value_regs/invalidate_regs rather than remote regnos. This involves
translating regnos received from lldb-server.

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

2 years ago[lldb] [gdb-remote] Refactor getting remote regs to use local vector
Michał Górny [Sat, 18 Sep 2021 18:00:40 +0000 (20:00 +0200)]
[lldb] [gdb-remote] Refactor getting remote regs to use local vector

Refactor remote register getters to collect them into a local
std::vector rather than adding them straight into DynamicRegisterInfo.
The purpose of this change is to lay groundwork for switching value_regs
and invalidate_regs to use local LLDB register numbers rather than
remote numbers.

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

2 years ago[x86] add AVX run to tests of fcmp logic; NFC
Sanjay Patel [Thu, 23 Sep 2021 13:59:47 +0000 (09:59 -0400)]
[x86] add AVX run to tests of fcmp logic; NFC

The ISA before AVX has predicate gaps for both fcmp
codegen alternatives, so that requires a more
complicated fix to get ideal asm in all cases.

2 years agoSupport: Fix missing whitespace in comment for inconvertibleErrorCode(), NFC
Duncan P. N. Exon Smith [Thu, 23 Sep 2021 15:09:26 +0000 (11:09 -0400)]
Support: Fix missing whitespace in comment for inconvertibleErrorCode(), NFC

2 years agoFix buildbot error.
Haojian Wu [Thu, 23 Sep 2021 15:03:40 +0000 (17:03 +0200)]
Fix buildbot error.

-frounding-math is not available for all targets.

2 years agoPass some DataLayout arguments by const-ref
Simon Pilgrim [Thu, 23 Sep 2021 14:35:22 +0000 (15:35 +0100)]
Pass some DataLayout arguments by const-ref

Avoid unnecessary copies, reported by MSVC static analyzer.

2 years ago[AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders
Piotr Sobczak [Fri, 17 Sep 2021 12:12:23 +0000 (14:12 +0200)]
[AMDGPU] Avoid processing functions in amdgpu-propagate-attributes pass for shaders

The pass amdgpu-propagate-attributes ("Early/Late propagate attributes
from kernels to functions") is currently run also for shaders, where
it does nothing. Modify the check so the pass only processes functions
for kernels.

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

2 years ago[Sema] Fix a null pointer reference crash.
Haojian Wu [Thu, 23 Sep 2021 09:01:37 +0000 (11:01 +0200)]
[Sema] Fix a null pointer reference crash.

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

2 years ago[ORC][examples] Fix segfault in LLJITWithTargetProcessControl
Stefan Gränitz [Thu, 23 Sep 2021 14:30:05 +0000 (16:30 +0200)]
[ORC][examples] Fix segfault in LLJITWithTargetProcessControl

Issue reported during review D110260

2 years agoclangd: Do not report inline overrides twice
Christian Kandeler [Thu, 23 Sep 2021 13:45:01 +0000 (15:45 +0200)]
clangd: Do not report inline overrides twice

... in textDocument/references.

Reviewed By: sammccall

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

2 years ago[CostModel][X86] Increase i64 mul cost from 1 to 2
Simon Pilgrim [Thu, 23 Sep 2021 13:48:08 +0000 (14:48 +0100)]
[CostModel][X86] Increase i64 mul cost from 1 to 2

Only the most recent cpus support really 1cy 64-bit multiplies, and the X64 cost table represents a realistic worst case. The 1cy value was also discouraging vectorization when most vXi64 PMULDQ expansions aren't actually slower than scalarization.

Noticed while investigating PR51436.

2 years ago[InstCombine] fold cast of right-shift if high bits are not demanded (2nd try)
Sanjay Patel [Thu, 23 Sep 2021 13:40:01 +0000 (09:40 -0400)]
[InstCombine] fold cast of right-shift if high bits are not demanded (2nd try)

The 1st try at this was reverted because it caused an infinite loop in instcombine.
That should be fixed after:
1cd6b44f267b

(masked) trunc (lshr X, C) --> (masked) lshr (trunc X), C

Narrowing the shift should be better for analysis and can lead
to follow-on transforms as shown.

Attempt at a general proof in Alive2:
https://alive2.llvm.org/ce/z/tRnnSF

Here are a couple of the specific tests:
https://alive2.llvm.org/ce/z/bCnTp-
https://alive2.llvm.org/ce/z/TfaHnb

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

2 years ago[gn build] Port f4abdb0c074b
LLVM GN Syncbot [Thu, 23 Sep 2021 13:34:40 +0000 (13:34 +0000)]
[gn build] Port f4abdb0c074b