platform/upstream/llvm.git
3 years ago[InstCombine] Add a test file that contains safe select transforms (NFC)
Juneyoung Lee [Sat, 16 Jan 2021 10:27:43 +0000 (19:27 +0900)]
[InstCombine] Add a test file that contains safe select transforms (NFC)

3 years agoIntroduce llvm.noalias.decl intrinsic
Jeroen Dobbelaere [Sat, 16 Jan 2021 08:14:18 +0000 (09:14 +0100)]
Introduce llvm.noalias.decl intrinsic

The ``llvm.experimental.noalias.scope.decl`` intrinsic identifies where a noalias
scope is declared. When the intrinsic is duplicated, a decision must
also be made about the scope: depending on the reason of the duplication,
the scope might need to be duplicated as well.

Reviewed By: nikic, jdoerfert

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

3 years agoAArch64: fix regression introduced by fcmp immediate selection.
Amara Emerson [Sat, 16 Jan 2021 06:51:54 +0000 (22:51 -0800)]
AArch64: fix regression introduced by fcmp immediate selection.

Forgot to check if the predicate is safe to commutate operands.

3 years ago[NPM][Inliner] Temporarily remove inline_stats test case for always
Mircea Trofin [Sat, 16 Jan 2021 05:55:58 +0000 (21:55 -0800)]
[NPM][Inliner] Temporarily remove inline_stats test case for always
inline

The stats are printed at InlinePass destruction. When we have 2 of them,
it appears the destruction order of the Passes std::vector of the pass
manager differs in msan builds - example:
http://lab.llvm.org:8011/#/builders/74/builds/2135.

This reproes locally, too.

Temporarily removing the sub-test case, to green the build, and will
follow up with a stat dumping alternative that does not depend on vector
element dtor order.

3 years ago[NFC] Add -std=c11 to attr-availability.c
Douglas Yung [Sat, 16 Jan 2021 05:02:26 +0000 (21:02 -0800)]
[NFC] Add -std=c11 to attr-availability.c

This test will fail with any toolchains that don't default to C11.

Adding this switch to the clang invocation in the test fixes the issue.

Patch by Justice Adams!

Reviewed By: dyung

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

3 years ago[StringExtras] Rename SubsequentDelim to ListSeparator
Kazu Hirata [Sat, 16 Jan 2021 05:00:55 +0000 (21:00 -0800)]
[StringExtras] Rename SubsequentDelim to ListSeparator

This patch renames SubsequentDelim to ListSeparator to clarify the
purpose of the class.

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

3 years ago[AMDGPU] Use llvm::is_contained (NFC)
Kazu Hirata [Sat, 16 Jan 2021 05:00:54 +0000 (21:00 -0800)]
[AMDGPU] Use llvm::is_contained (NFC)

3 years ago[utils] Use llvm::sort (NFC)
Kazu Hirata [Sat, 16 Jan 2021 05:00:52 +0000 (21:00 -0800)]
[utils] Use llvm::sort (NFC)

3 years ago[Inline] Fix a missing character in inline_stats.ll
Mircea Trofin [Sat, 16 Jan 2021 04:28:15 +0000 (20:28 -0800)]
[Inline] Fix a missing character in inline_stats.ll

3 years ago[NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular...
Mircea Trofin [Fri, 15 Jan 2021 21:56:57 +0000 (13:56 -0800)]
[NewPM][Inliner] Move the 'always inliner' case in the same CGSCC pass as 'regular' inliner

Expanding from D94808 - we ensure the same InlineAdvisor is used by both
InlinerPass instances. The notion of mandatory inlining is moved into
the core InlineAdvisor: advisors anyway have to handle that case, so
this change also factors out that a bit better.

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

3 years ago[debugserver] Fix inverted if block that resulted in us using the private entitlements
Jonas Devlieghere [Sat, 16 Jan 2021 01:40:41 +0000 (17:40 -0800)]
[debugserver] Fix inverted if block that resulted in us using the private entitlements

3 years ago[mlir] Fixing potential build break in my previous commit
Thomas Raoux [Sat, 16 Jan 2021 01:32:30 +0000 (17:32 -0800)]
[mlir] Fixing potential build break in my previous commit

3 years ago[mlir][AsmPrinter] Properly escape strings when printing locations
River Riddle [Sat, 16 Jan 2021 00:55:32 +0000 (16:55 -0800)]
[mlir][AsmPrinter] Properly escape strings when printing locations

This fixes errors when location strings contains newlines, or other non-ascii characters.

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

3 years ago[mlir][NFC] Move helper substWithMin into Affine utils
Thomas Raoux [Fri, 15 Jan 2021 22:03:57 +0000 (14:03 -0800)]
[mlir][NFC] Move helper substWithMin into Affine utils

This allow using this helper outside of the linalg canonicalization.

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

3 years ago[flang] Create names to allow access to inaccessible specifics
peter klausler [Fri, 15 Jan 2021 19:52:10 +0000 (11:52 -0800)]
[flang] Create names to allow access to inaccessible specifics

When a reference to a generic interface occurs in a specification
expression that must be emitted to a module file, we have a problem
when the generic resolves to a function whose name is inaccessible
due to being PRIVATE or due to a conflict with another use of the
same name in the scope.  In these cases, construct a new name for
the specific procedure and emit a renaming USE to the module file.
Also, relax enforcement of PRIVATE when analyzing module files.

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

3 years ago[NFC] Disallow unused prefixes under MC/RISCV
Mircea Trofin [Fri, 15 Jan 2021 16:50:59 +0000 (08:50 -0800)]
[NFC] Disallow unused prefixes under MC/RISCV

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

3 years agohwasan: Update register-dump-read.c test to reserve x23 instead of x20.
Peter Collingbourne [Sat, 16 Jan 2021 00:07:21 +0000 (16:07 -0800)]
hwasan: Update register-dump-read.c test to reserve x23 instead of x20.

D90422 changed this test to write a fixed value into register x23
instead of x20, but it did not update the list of reserved registers.
This meant that x23 may have been live across the register write,
although this happens to not be the case with the current compiler.
Fix the problem by updating the reserved register list.

3 years agoRevert "[WebAssembly] Add support for table linking to wasm-ld"
Derek Schuff [Fri, 15 Jan 2021 23:50:41 +0000 (15:50 -0800)]
Revert "[WebAssembly] Add support for table linking to wasm-ld"

This reverts commit 38dfce706f796dc109ea495dd69a8cb4c8fa819d.
CI discovered a bug where the table is exported twice: see
D91870

3 years agoRevert "[WebAssembly] MC layer writes table symbols to object files"
Derek Schuff [Fri, 15 Jan 2021 23:50:22 +0000 (15:50 -0800)]
Revert "[WebAssembly] MC layer writes table symbols to object files"

This reverts commit e9f1ed2306b1b3aedcb1acef2b50e252a77a04b9.

Reverting because it depends on 38dfce706f

3 years ago[SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument
Dávid Bolvanský [Fri, 15 Jan 2021 22:07:29 +0000 (23:07 +0100)]
[SimplifyCFG] Optimize CFG when null is passed to a function with nonnull argument

Example:

```
__attribute__((nonnull,noinline)) char * pinc(char *p)  {
  return ++p;
}

char * foo(bool b, char *a) {
       return pinc(b ? 0 : a);

}
```

optimize to

```
char * foo(bool b, char *a) {
       return pinc(a);

}
```

Reviewed By: jdoerfert

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

3 years ago[ADT][Support] Fix C4146 error from MSVC
Vladislav Vinogradov [Fri, 15 Jan 2021 22:32:38 +0000 (14:32 -0800)]
[ADT][Support] Fix C4146 error from MSVC

Unary minus operator applied to unsigned type, result still unsigned.

Use `~0U` instead of `-1U` and `1 + ~VAL` instead of `-VAL`.

Reviewed By: dblaikie

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

3 years ago[AArch64][GlobalISel] Select immediate fcmp if the zero is on the LHS.
Amara Emerson [Fri, 15 Jan 2021 22:31:03 +0000 (14:31 -0800)]
[AArch64][GlobalISel] Select immediate fcmp if the zero is on the LHS.

3 years agoRevert "Revert "ADT: Fix reference invalidation in SmallVector...""
Duncan P. N. Exon Smith [Fri, 15 Jan 2021 21:53:02 +0000 (13:53 -0800)]
Revert "Revert "ADT: Fix reference invalidation in SmallVector...""

This reverts commit 33be50daa9ce1074c3b423a4ab27c70c0722113a,
effectively reapplying:

260a856c2abcef49c7cb3bdcd999701db3e2af38
3043e5a5c33c4c871f4a1dfd621a8839f9a1f0b3
49142991a685bd427d7e877c29c77371dfb7634c

... with a fix to skip a call to `SmallVector::isReferenceToStorage()`
when we know the parameter had been taken by value for small, POD-like
`T`. See https://reviews.llvm.org/D93779 for the discussion on the
revert.

At a high-level, these commits fix reference invalidation in
SmallVector's push_back, append, insert (one or N), and resize
operations. For more details, please see the original commit messages.

This commit fixes a bug that crept into
`SmallVectorTemplateCommon::reserveForAndGetAddress()` during the review
process after performance analysis was done. That function is now called
`reserveForParamAndGetAddress()`, clarifying that it only works for
parameter values. It uses that knowledge to bypass
`SmallVector::isReferenceToStorage()` when `TakesParamByValue`. This is
`constexpr` and avoids adding overhead for "small enough", trivially
copyable `T`.

Performance could potentially be tuned further by increasing the
threshold for `TakesParamByValue`, which is currently defined as:
```
bool TakesParamByValue = sizeof(T) <= 2 * sizeof(void *);
```
in the POD-like version of SmallVectorTemplateBase (else, `false`).

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

3 years ago[SLP] remove dead code in reduction matching; NFC
Sanjay Patel [Fri, 15 Jan 2021 21:53:15 +0000 (16:53 -0500)]
[SLP] remove dead code in reduction matching; NFC

To get into this block we had: !A || B || C
and we checked C in the first 'if' clause
leaving !A || B. But the 2nd 'if' is checking:
A && !B --> !(!A || B)

3 years agoSkip 'g' packet tests when running on darwin; debugserver doesn't impl
Jason Molenda [Fri, 15 Jan 2021 21:57:59 +0000 (13:57 -0800)]
Skip 'g' packet tests when running on darwin; debugserver doesn't impl

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

3 years ago[mlir][Linalg] Add missing check to canonicalization of GenericOp that are identity...
MaheshRavishankar [Fri, 15 Jan 2021 21:17:30 +0000 (13:17 -0800)]
[mlir][Linalg] Add missing check to canonicalization of GenericOp that are identity ops.

The operantion is an identity if the values yielded by the operation
is the argument of the basic block of that operation. Add this missing check.

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

3 years agoBreakCriticalEdges: do not split the critical edge from a CallBr indirect successor
Nick Desaulniers [Fri, 15 Jan 2021 21:40:20 +0000 (13:40 -0800)]
BreakCriticalEdges: do not split the critical edge from a CallBr indirect successor

Otherwise we'll fail the assertion in SplitBlockPredecessors() related
to splitting the edges from CallBr's.

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1161
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1252

Reviewed By: void, MaskRay, jyknight

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

3 years ago[Sema] turns -Wfree-nonheap-object on by default
Christopher Di Bella [Thu, 7 Jan 2021 23:04:20 +0000 (23:04 +0000)]
[Sema] turns -Wfree-nonheap-object on by default

We'd discussed adding the warning to -Wall in D89988. This patch honours that.

3 years ago[MSVC] Don't add -nostdinc++ -isystem to runtimes builds
Reid Kleckner [Fri, 15 Jan 2021 20:35:42 +0000 (12:35 -0800)]
[MSVC] Don't add -nostdinc++ -isystem to runtimes builds

If the host compiler is MSVC or clang-cl, then the compiler used to
buidl the runtimes will be clang-cl, and it doesn't support either of
those flags.

Worse, because -isystem is a space separated flag, it causes all cmake
try_compile tests to fail, so none of the -Wno-* flags make it to the
compiler in libcxx. I noticed that we weren't passing
-Wno-user-defined-literals to clang-cl and were getting warnings in the
build, and this fixes that for me.

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

3 years ago[GWP-ASan] Add inbuilt options parser.
Mitch Phillips [Fri, 15 Jan 2021 20:57:00 +0000 (12:57 -0800)]
[GWP-ASan] Add inbuilt options parser.

Adds a modified options parser (shamefully pulled from Scudo, which
shamefully pulled it from sanitizer-common) to GWP-ASan. This allows
customers (Android) to parse options strings in a common way.

Depends on D94117.

AOSP side of these patches is staged at:

 - sepolicy (sysprops should only be settable by the shell, in both root and
 unrooted conditions):
 https://android-review.googlesource.com/c/platform/system/sepolicy/+/1517238

 - zygote updates:
 https://android-review.googlesource.com/c/platform/frameworks/base/+/1515009

 - bionic changes to add `gwp_asan.<process_name>` system property, and
 GWP_ASAN_OPTIONS environment variable:
 https://android-review.googlesource.com/c/platform/bionic/+/1514989

Reviewed By: eugenis

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

3 years ago[SimplifyCFG] switchToSelect(): don't forget to insert DomTree edge iff needed
Roman Lebedev [Fri, 15 Jan 2021 17:57:28 +0000 (20:57 +0300)]
[SimplifyCFG] switchToSelect(): don't forget to insert DomTree edge iff needed

DestBB might or might not already be a successor of SelectBB,
and it wasn't we need to ensure that we record the fact in DomTree.

The testcase used to crash in lazy domtree updater mode + non-per-function
domtree validity checks disabled.

3 years ago[SimplifyCFG][BasicBlockUtils] Port SplitBlockPredecessors()/SplitLandingPadPredecess...
Roman Lebedev [Tue, 12 Jan 2021 18:49:56 +0000 (21:49 +0300)]
[SimplifyCFG][BasicBlockUtils] Port SplitBlockPredecessors()/SplitLandingPadPredecessors() to DomTreeUpdater

This is not nice, but it's the best transient solution possible,
and is better than just duplicating the whole function.

The problem is, this function is widely used,
and it is not at all obvious that all the users
could be painlessly switched to operate on DomTreeUpdater,
and somehow i don't feel like porting all those users first.

This function is one of last three that not operate on DomTreeUpdater.

3 years ago[SimplifyCFG] Port SplitBlockAndInsertIfThen() to DomTreeUpdater
Roman Lebedev [Tue, 12 Jan 2021 13:49:32 +0000 (16:49 +0300)]
[SimplifyCFG] Port SplitBlockAndInsertIfThen() to DomTreeUpdater

This is not nice, but it's the best transient solution possible,
and is better than just duplicating the whole function.

The problem is, this function is widely used,
and it is not at all obvious that all the users
could be painlessly switched to operate on DomTreeUpdater,
and somehow i don't feel like porting all those users first.

This function is one of last three that not operate on DomTreeUpdater.

3 years ago[Utils][SimplifyCFG] Port SplitBlock() to DomTreeUpdater
Roman Lebedev [Tue, 12 Jan 2021 17:15:21 +0000 (20:15 +0300)]
[Utils][SimplifyCFG] Port SplitBlock() to DomTreeUpdater

This is not nice, but it's the best transient solution possible,
and is better than just duplicating the whole function.

The problem is, this function is widely used,
and it is not at all obvious that all the users
could be painlessly switched to operate on DomTreeUpdater,
and somehow i don't feel like porting all those users first.

This function is one of last three that not operate on DomTreeUpdater.

3 years ago[Utils] splitBlockBefore() always operates on DomTreeUpdater, so take it, not DomTree
Roman Lebedev [Tue, 12 Jan 2021 16:43:16 +0000 (19:43 +0300)]
[Utils] splitBlockBefore() always operates on DomTreeUpdater, so take it, not DomTree

Even though not all it's users operate on DomTreeUpdater,
it itself internally operates on DomTreeUpdater,
so it must mean everything is fine with that,
so just do that globally.

3 years ago[NFC][SimplifyCFG] Add testcase showing that we fail to preserve DomTree in switchToS...
Roman Lebedev [Fri, 15 Jan 2021 16:44:18 +0000 (19:44 +0300)]
[NFC][SimplifyCFG] Add testcase showing that we fail to preserve DomTree in switchToSelect()

3 years agoRevert "[BasicAA] Handle recursive queries more efficiently"
Reid Kleckner [Fri, 15 Jan 2021 20:27:38 +0000 (12:27 -0800)]
Revert "[BasicAA] Handle recursive queries more efficiently"

This reverts commit a3904cc77f181cff7355357688edfc392a236f5d.
It causes the compiler to crash while building Harfbuzz for ARM in
Chromium, reduced reproducer forthcoming:
https://crbug.com/1167305

3 years ago[CodeView][DebugInfo] Add test case to show that linkage names are not
Amy Huang [Fri, 15 Jan 2021 17:31:10 +0000 (09:31 -0800)]
[CodeView][DebugInfo] Add test case to show that linkage names are not
being added to class types in -gline-tables-only.
Also changed the name of the test file for clarity.
(follow up to D94639)

3 years ago[SLP] remove unused reduction functions; NFC
Sanjay Patel [Fri, 15 Jan 2021 19:34:33 +0000 (14:34 -0500)]
[SLP] remove unused reduction functions; NFC

These were made obsolete by simplifying the code in recent patches.

3 years ago[CodeGen] Removes unwanted optimisation for TargetConstantFP
Craig Topper [Fri, 15 Jan 2021 19:38:51 +0000 (11:38 -0800)]
[CodeGen] Removes unwanted optimisation for TargetConstantFP

This 'FIXME' popped up in the development of an out-of-tree backend.
Quick fix, but first llvm upstream patch, therefore I do not have commit rights, so if approved please commit?

- Test is not included as this came up in an out-of-tree backend (if required, please hint on how to test this).

Patch by simveg (Simon)

Reviewed By: craig.topper

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

3 years agoFix libc++ clang-cl build, swap attribute order
Reid Kleckner [Fri, 15 Jan 2021 16:56:34 +0000 (08:56 -0800)]
Fix libc++ clang-cl build, swap attribute order

Clang insists that __attribute__ attributes precede __declspec
attributes. This is a longstanding known issue:
https://llvm.org/pr24559. Re-order the visibility and deprecation macros
to fix the build.

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

3 years agoGetMacosAlignedVersion() fails if sysctl is not setup
Julian Lettner [Wed, 6 Jan 2021 20:41:40 +0000 (12:41 -0800)]
GetMacosAlignedVersion() fails if sysctl is not setup

`GetMacosAlignedVersion()` fails for ASan-ified launchd because the
sanitizer initialization code runs before `sysctl` has been setup by
launchd.  In this situation, `sysctl kern.osproductversion` returns a
non-empty string that does not match our expectations of a
well-formatted version string.

Retrieving the kernel version (via `sysctl kern.osrelease`) still works,
so we can use it to add a fallback for this corner case.

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

3 years ago[RISCV] Add implementation of targetShrinkDemandedConstant to optimize AND immediates.
Craig Topper [Fri, 15 Jan 2021 18:54:26 +0000 (10:54 -0800)]
[RISCV] Add implementation of targetShrinkDemandedConstant to optimize AND immediates.

SimplifyDemandedBits can remove set bits from immediates from instructions
like AND/OR/XOR. This can prevent them from being efficiently
codegened on RISCV.

This adds an initial version that tries to keep or form 12 bit
sign extended immediates for AND operations to enable use of ANDI.
If that doesn't work we'll try to create a 32 bit sign extended immediate
to use LUI+ADDIW.

More optimizations are possible for different size immediates or
different operations. But this is a good starting point that already
has test coverage.

Reviewed By: frasercrmck

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

3 years ago[mlir] Add Complex dialect.
Alexander Belyaev [Fri, 15 Jan 2021 18:53:15 +0000 (19:53 +0100)]
[mlir] Add Complex dialect.

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

3 years ago[MIPatternMatch] Add m_OneNonDBGUse
Jessica Paquette [Thu, 14 Jan 2021 19:09:46 +0000 (11:09 -0800)]
[MIPatternMatch] Add m_OneNonDBGUse

Add a matcher that checks if the given subpattern has only one non-debug use.

Also improve existing m_OneUse testcase.

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

3 years ago[ARM] Tail predication with constant loop bounds
David Green [Fri, 15 Jan 2021 18:17:31 +0000 (18:17 +0000)]
[ARM] Tail predication with constant loop bounds

The TripCount for a predicated vector loop body will be
ceil(ElementCount/Width). This alters the conversion of an
active.lane.mask to a VCPT intrinsics to match.

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

3 years ago[ARM] Constant tripcount tail predication loop tests. NFC
David Green [Fri, 15 Jan 2021 18:02:07 +0000 (18:02 +0000)]
[ARM] Constant tripcount tail predication loop tests. NFC

3 years ago[DebugInfo][CodeView] Change in line tables only mode to emit type information
Amy Huang [Tue, 12 Jan 2021 00:37:29 +0000 (16:37 -0800)]
[DebugInfo][CodeView] Change in line tables only mode to emit type information
for function scopes, rather than using the qualified name.

In line-tables-only mode, we used to emit qualified names as the display name for functions when using CodeView.
This patch changes to emitting the parent scopes instead, with forward declarations for class types.
The total object file size ends up being slightly smaller than if we use the full qualified names.

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

3 years ago[OpenCL][Docs] Fixed cross-section reference in OpenCLSupport
Anastasia Stulova [Fri, 15 Jan 2021 17:19:16 +0000 (17:19 +0000)]
[OpenCL][Docs] Fixed cross-section reference in OpenCLSupport

Tags: #clang

3 years ago[clangd] Update CC Ranking model with better sampling.
Utkarsh Saxena [Thu, 14 Jan 2021 17:01:25 +0000 (18:01 +0100)]
[clangd] Update CC Ranking model with better sampling.

A better sampling strategy was used to generate the dataset for this
model.
New signals introduced in this model:
- NumNameInContext: Number of words in the context that matches the name
of the candidate.
- FractionNameInContext: Fraction of the words in context matching the
name of the candidate.

We remove the signal `IsForbidden` from the model and down rank
forbidden signals aggresively.

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

3 years ago[flang][driver] Copy test file into a temp dir when testing (nfc)
Andrzej Warzynski [Fri, 15 Jan 2021 16:45:01 +0000 (16:45 +0000)]
[flang][driver] Copy test file into a temp dir when testing (nfc)

The following driver invocation will generate an output file
in the same directory as the input file:

```
flang-new -fc1 -test-io test-input.f90
```

This is the desired behaviour. However, when testing we need to make
sure that we don't pollute the source directory. To this end, copy the
input file into a temporary directory before testing.

This is similar to https://reviews.llvm.org/D94243.

3 years ago[TargetLowering] Don't speculatively call ComputeNumSignBits. NFC
Craig Topper [Fri, 15 Jan 2021 17:05:34 +0000 (09:05 -0800)]
[TargetLowering] Don't speculatively call ComputeNumSignBits. NFC

These methods are recursive so a little costly.

We only look at the result in one place in this function and it's
conditional. We also only need the second call if the first had
enough returned enough sign bits.

3 years ago[flang] Disallow INTENT attribute on procedure dummy arguments
Peter Steinfeld [Fri, 15 Jan 2021 15:04:20 +0000 (07:04 -0800)]
[flang] Disallow INTENT attribute on procedure dummy arguments

C843 states that "An entity with the INTENT attribute shall be a dummy
data object or a dummy procedure pointer."  This change enforces that
and fixes some tests that erroneously violated this rule.

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

3 years ago[X86][SSE] Attempt to fold shuffle(binop(),binop()) -> binop(shuffle(),shuffle())
Simon Pilgrim [Fri, 15 Jan 2021 16:25:05 +0000 (16:25 +0000)]
[X86][SSE] Attempt to fold shuffle(binop(),binop()) -> binop(shuffle(),shuffle())

If this will help us fold shuffles together, then push the shuffle through the merged binops.

Ideally this would be performed in DAGCombiner::visitVECTOR_SHUFFLE but getting an efficient+legal merged shuffle can be tricky - on SSE we can be confident that for 32/64-bit elements vectors shuffles should easily fold.

3 years ago[ARM][Block placement] Check the predecessor exists before processing it
Sam Tebbs [Fri, 15 Jan 2021 14:43:10 +0000 (14:43 +0000)]
[ARM][Block placement] Check the predecessor exists before processing it

Not all machine loops will have a predecessor. so the pass needs to
check it before continuing.

Reviewed By: dmgreen

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

3 years ago[clang][cli] NFC: Promote ParseLangArgs and ParseCodeGenArgs to members
Jan Svoboda [Fri, 15 Jan 2021 14:44:09 +0000 (15:44 +0100)]
[clang][cli] NFC: Promote ParseLangArgs and ParseCodeGenArgs to members

This patch promotes `ParseLangArgs` and `ParseCodeGenArgs` to members of `CompilerInvocation`. That will be useful in the following patch D94682, where we need to access protected members of `LangOptions` and `CodeGenOptions`. Both of those classes already have `friend CompilerInvocation`.

This is cleaner than keeping those functions freestanding and having to specify the exact signature of both in extra `friend` declarations.

Reviewed By: Bigcheese

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

3 years ago[clang][cli] NFC: Parse some LangOpts after the defaults are set
Jan Svoboda [Fri, 15 Jan 2021 14:43:18 +0000 (15:43 +0100)]
[clang][cli] NFC: Parse some LangOpts after the defaults are set

This patch ensures we only parse the necessary options before calling `setLangDefaults` (explained in D94678).

Because neither `LangOpts.CFProtectionBranch` nor `LangOpts.SYCLIsDevice` are used in `setLangDefaults`, this is a NFC.

Reviewed By: Bigcheese

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

3 years ago[clang][cli] NFC: Add PIE parsing for precompiled input and IR
Jan Svoboda [Fri, 15 Jan 2021 14:42:29 +0000 (15:42 +0100)]
[clang][cli] NFC: Add PIE parsing for precompiled input and IR

This patch effectively reverts a small part of D83979.

When we stop parsing `LangOpts` unconditionally in `parseSimpleArgs` (above the diff) and move them back to `ParseLangArgs` (called in `else` branch) in D94682, `LangOpts.PIE` would never get parsed in this `if` branch. This patch ensures this doesn't happen.

Right now, this causes `LangOpts.PIE` to be parsed twice, but that will be immediately corrected in D94682.

Reviewed By: Bigcheese

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

3 years ago[RISCV][NFC] Fix order of parameters in cmov ge/le tests
Michael Munday [Fri, 15 Jan 2021 15:32:31 +0000 (15:32 +0000)]
[RISCV][NFC] Fix order of parameters in cmov ge/le tests

The first parameter should be selected if the condition is true and
the last parameter if the condition is false. Prior to this change
it was the other way round which was confusing.

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

3 years ago[libc] CopyAlignedBlocks can now specify alignment on top of block size
Guillaume Chatelet [Fri, 15 Jan 2021 15:32:02 +0000 (15:32 +0000)]
[libc] CopyAlignedBlocks can now specify alignment on top of block size

This has been requested in D92236

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

3 years ago[mlir] Add better support for f80 and f128
Valentin Clement [Fri, 15 Jan 2021 15:29:37 +0000 (10:29 -0500)]
[mlir] Add better support for f80 and f128

Add builtin f80 and f128 following @schweitz proposition
https://llvm.discourse.group/t/rfc-adding-better-support-for-higher-precision-floating-point/2526/5

Reviewed By: ftynse, rriddle

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

3 years ago[DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - improve shuffle(shuffle(x,y),shuffle...
Simon Pilgrim [Fri, 15 Jan 2021 15:08:17 +0000 (15:08 +0000)]
[DAG] visitVECTOR_SHUFFLE - MergeInnerShuffle - improve shuffle(shuffle(x,y),shuffle(x,y)) merging

MergeInnerShuffle currently attempts to merge shuffle(shuffle(x,y),z) patterns into a single shuffle, using 1 or 2 of the x,y,z ops.

However if we already match 2 ops we might be able to handle the third op if its also a shuffle that references one of the previous ops, allowing us to handle some cases like:

shuffle(shuffle(x,y),shuffle(x,y))
shuffle(shuffle(shuffle(x,z),y),z)
shuffle(shuffle(x,shuffle(x,y)),z)
etc.

This isn't an exhaustive match and is dependent on the order the candidate ops are encountered - if one of the matched ops was a shuffle that was peek-able we don't go back and try to split that, I haven't found much need for that amount of analysis yet.

This is a preliminary patch that will allow us to later improve x86 HADD/HSUB matching - but needs to be reviewed separately as its in generic code and affects existing Thumb2 tests.

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

3 years agoSet option default for enabling memory ssa for new pass manager loop sink pass to...
Jamie Schmeiser [Fri, 15 Jan 2021 14:51:34 +0000 (09:51 -0500)]
Set option default for enabling memory ssa for new pass manager loop sink pass to true.
Summary:
Set the default for the option enabling memory ssa use in the loop sink
pass to true for the new pass manager.
Author: Jamie Schmeiser <schmeise@ca.ibm.com>
Reviewed By: asbirlea (Alina Sbirlea)
Differential Revision: https://reviews.llvm.org/D92486

3 years ago[X86] Add umin knownbits/demandedbits ult test for D94532
Simon Pilgrim [Fri, 15 Jan 2021 14:42:42 +0000 (14:42 +0000)]
[X86] Add umin knownbits/demandedbits ult test for D94532

3 years ago[clang][cli] Parse & generate options necessary for LangOptions defaults manually
Jan Svoboda [Fri, 15 Jan 2021 13:47:55 +0000 (14:47 +0100)]
[clang][cli] Parse & generate options necessary for LangOptions defaults manually

It turns out we need to handle `LangOptions` separately from the rest of the options. `LangOptions` used to be conditionally parsed only when `!(DashX.getFormat() == InputKind::Precompiled || DashX.getLanguage() == Language::LLVM_IR)` and we need to restore this order (for more info, see D94682).

D94682 moves the parsing of marshalled `LangOpts` from `parseSimpleArgs` back to `ParseLangArgs`.

We need to parse marshalled `LangOpts` **after** `ParseLangArgs` calls `setLangDefaults`. This will enable future patches, where values of some `LangOpts` depend on the defaults.

However, two language options (`-finclude-default-header` and `-fdeclare-opencl-builtins`) need to be parsed **before** `ParseLangArgs` calls `setLangDefaults`, because they are necessary for setting up OpenCL defaults correctly.
This patch implements this by removing their marshalling info and manually parsing (and generating) them exactly where necessary.

Reviewed By: Bigcheese

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

3 years ago[OpenCL][Docs] Fixed malformed table in OpenCLSupport
Anastasia Stulova [Fri, 15 Jan 2021 14:25:32 +0000 (14:25 +0000)]
[OpenCL][Docs] Fixed malformed table in OpenCLSupport

 Tags: #clang

3 years ago[SVE] Fix unused variable.
Stephan Herhut [Fri, 15 Jan 2021 14:03:08 +0000 (15:03 +0100)]
[SVE] Fix unused variable.

Introduced by [SVE] Restrict the usage of REINTERPRET_CAST.

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

3 years ago[mlir][linalg] Support generating builders for named op attributes
Lei Zhang [Fri, 15 Jan 2021 13:57:07 +0000 (08:57 -0500)]
[mlir][linalg] Support generating builders for named op attributes

This commit adds support to generate an additional builder for
each named op that has attributes. This gives better experience
when creating the named ops.

Along the way adds support for i64.

Reviewed By: hanchung

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

3 years ago[ARM] Don't run the block placement pass at O0
Sam Tebbs [Fri, 15 Jan 2021 11:42:44 +0000 (11:42 +0000)]
[ARM] Don't run the block placement pass at O0

The block placement pass shouldn't run unless optimisations are enabled.

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

3 years ago[WebAssembly] MC layer writes table symbols to object files
Andy Wingo [Fri, 27 Nov 2020 08:19:46 +0000 (09:19 +0100)]
[WebAssembly] MC layer writes table symbols to object files

Now that the linker handles table symbols, we can allow the frontend to
produce them.

Depends on D91870.

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

3 years ago[X86][AVX] combineHorizOpWithShuffle - support target shuffles in HOP(SHUFFLE(X,Y...
Simon Pilgrim [Fri, 15 Jan 2021 13:41:40 +0000 (13:41 +0000)]
[X86][AVX] combineHorizOpWithShuffle - support target shuffles in HOP(SHUFFLE(X,Y),SHUFFLE(X,Y)) -> SHUFFLE(HOP(X,Y))

Be more aggressive on (AVX2+) folds of lane shuffles of 256-bit horizontal ops by working on target/faux shuffles as well.

3 years ago[lldb][docs] Translate ASCII art to restructured text formatting
Raphael Isemann [Fri, 15 Jan 2021 13:43:26 +0000 (14:43 +0100)]
[lldb][docs] Translate ASCII art to restructured text formatting

This translates most of the old ASCII art in our documentation to the
equivalent in restructured text (which the new version of the LLDB docs
is using).

3 years ago[clangd] Set correct CWD when using compile_flags.txt
Adam Czachorowski [Thu, 14 Jan 2021 17:21:23 +0000 (18:21 +0100)]
[clangd] Set correct CWD when using compile_flags.txt

This fixes a bug where clangd would attempt to set CWD to the
compile_flags.txt file itself.

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

3 years ago[clangd] Make ExpandAutoType not available on template params.
Adam Czachorowski [Thu, 14 Jan 2021 21:41:10 +0000 (22:41 +0100)]
[clangd] Make ExpandAutoType not available on template params.

We cannot expand auto when used inside a template param (C++17 feature),
so do not offer it there.

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

3 years agoRevert "[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference"
Raphael Isemann [Fri, 15 Jan 2021 13:07:45 +0000 (14:07 +0100)]
Revert "[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference"

This reverts commit bab121a1b66e85390cad019ec921febcba35519d. It seems the
docs buildbot doesn't have the required Python headers.

3 years ago[Orc] Fix OrcV2Examples after D94690
Stefan Gränitz [Fri, 15 Jan 2021 12:32:02 +0000 (13:32 +0100)]
[Orc] Fix OrcV2Examples after D94690

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

3 years ago[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference
Raphael Isemann [Fri, 15 Jan 2021 12:24:24 +0000 (13:24 +0100)]
[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python reference

Currently LLDB uses epydoc to generate the Python API reference for the website.
epydoc however is unmaintained since more than a decade and no longer works with
Python 3. Also whatever setup we had once for generating the documentation on
the website server no longer seems to work, so the current website documentation
has been stale since more than a year.

This patch replaces epydoc with sphinx and its automodapi plugin that can
generate Python API references. LLVM already uses sphinx for the rest of the
documentation, so this way we are more consistent with the rest of LLVM. The
only new dependency is the automodapi plugin for sphinx.

This patch effectively does the following things:
* Remove the epydoc code.
* Make a new dummy Python API page in our website that just calls the Sphinx
  command for generated the API documentation.
* Add a mock _lldb module that is only used when generating the Python API.
 This way we don't have to build all of LLDB to generate the API reference.

Some notes:
* The long list of skips is necessary due to boilerplate functions that SWIG
  is generating. Sadly automodapi is not really scriptable from what I can see,
  so we have to blacklist this stuff manually.
* The .gitignore change because automodapi wants a subfolder of our
  documentation directory to place generated documentation files there. The path
  is also what is used on the website, so we can't really workaround this
  (without copying the whole `docs` dir somewhere else when we build).
* We have to use environment variables to pass our build path to our sphinx
  configuration. Sphinx doesn't support passing variables onto that script.

Reviewed By: JDevlieghere

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

3 years ago[NFC][RISCV] Remove useless code in RISCVRegisterInfo.td.
Hsiangkai Wang [Fri, 15 Jan 2021 03:23:18 +0000 (11:23 +0800)]
[NFC][RISCV] Remove useless code in RISCVRegisterInfo.td.

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

3 years ago[Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors
Stefan Gränitz [Fri, 15 Jan 2021 11:26:04 +0000 (12:26 +0100)]
[Orc] Allow LLJITBuilder's CreateObjectLinkingLayer to return errors

It can be useful for an ObjectLinkingLayerCreator to allow callee errors to get propagated to the builder. Specifically, this is the case when the ObjectLayer uses the EHFrameRegistrationPlugin, because it requires a TPCEHFrameRegistrar and instantiation for it may fail (e.g. if the required registration symbols are missing in the target process).

Reviewed By: lhames

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

3 years ago[Orc][NFC] Turn LLJIT member ObjTransformLayer into unique_ptr
Stefan Gränitz [Fri, 15 Jan 2021 11:25:57 +0000 (12:25 +0100)]
[Orc][NFC] Turn LLJIT member ObjTransformLayer into unique_ptr

All other layers in LLJIT are stored as unique_ptr's already. At this point, it is not strictly necessary for ObjTransformLayer, but it makes a follow-up change more straightforward.

Reviewed By: lhames

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

3 years ago[SVE] Restrict the usage of REINTERPRET_CAST.
Paul Walker [Wed, 13 Jan 2021 11:45:54 +0000 (11:45 +0000)]
[SVE] Restrict the usage of REINTERPRET_CAST.

In order to limit the number of combinations of REINTERPRET_CAST,
whilst at the same time prevent overlap with BITCAST, this patch
establishes the following rules:

1. The operand and result element types must be the same.
2. The operand and/or result type must be an unpacked type.

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

3 years ago[RISCV] Optimize Branch Comparisons
Sam Elliott [Fri, 15 Jan 2021 11:20:28 +0000 (11:20 +0000)]
[RISCV] Optimize Branch Comparisons

I noticed in D94450 that there were quite a few places where we generate
the sequence:
```
  xN <- comparison ...
  xN <- xor xN, 1
  bnez xN, symbol
```

Given we know the XOR will be used by BRCOND, which only looks at the lowest
bit, I think we can remove the XOR and just invert the branch condition in
these cases?

The case mostly seems to come up in floating point tests, where there is often
more logic to combine the results of multiple SETCCs, rather than a single
(BRCOND (SETCC ...) ...).

Reviewed By: craig.topper

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

3 years agoDynamicRegisterInfo calculate offsets in separate function
Muhammad Omair Javaid [Fri, 15 Jan 2021 11:12:20 +0000 (16:12 +0500)]
DynamicRegisterInfo calculate offsets in separate function

This patch pull offset calculation logic out of DynamicRegisterInfo::Finalize
into a separate function. We are going to call this function whenever we
update SVE register sizes.

Reviewed By: labath

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

3 years ago[LLDB] Add per-thread register infos shared pointer in gdb-remote
Muhammad Omair Javaid [Fri, 15 Jan 2021 10:33:31 +0000 (15:33 +0500)]
[LLDB] Add per-thread register infos shared pointer in gdb-remote

In gdb-remote process we have register infos defind as a refernce object of
GDBRemoteDynamicRegisterInfo class. In past register infos have remained
constant througout the life time of a process.

This has changed after AArch64 SVE support where register infos will have
per-thread configuration. SVE registers will have per-thread size and can
be updated while running. This patch aims to build up for that support by
changing GDBRemoteDynamicRegisterInfo reference to a shared pointer deinfed
per-thread.

Reviewed By: labath

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

3 years ago[clangd] exclude symbols from document outline which do not originate from the main...
Ilya Golovenko [Fri, 15 Jan 2021 07:47:28 +0000 (10:47 +0300)]
[clangd] exclude symbols from document outline which do not originate from the main file

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

3 years ago[llvm-readobj][test] - Remove excessive YAML fields from tests.
Georgii Rymar [Thu, 14 Jan 2021 09:35:01 +0000 (12:35 +0300)]
[llvm-readobj][test] - Remove excessive YAML fields from tests.

This removes excessive YAML keys from `SHT_GNU_verdef` sections.
Those keys are set by default.

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

3 years ago[yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.
Georgii Rymar [Wed, 13 Jan 2021 14:16:55 +0000 (17:16 +0300)]
[yaml2obj/obj2yaml] - Refine handling of SHT_GNU_verdef sections.

This patch:
1) Makes `Version`, `Flags`, `VersionNdx` and `Hash` fields to be `Optional<>`.
2) Disallows dumping version definitions that have `vd_version != 1`.
   `vd_version` identifies the version of the structure itself.
   (https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html,
    https://docs.oracle.com/cd/E19683-01/816-7777/chapter6-80869/index.html)
3) Stops dumping default values for `Version`, `Flags`, `VersionNdx` and `Hash` fields.
4) Refines testing.

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

3 years ago[ARM][GISel] Treat calls as variadic even if only fixed arguments provided
Oliver Stannard [Wed, 6 Jan 2021 12:12:58 +0000 (12:12 +0000)]
[ARM][GISel] Treat calls as variadic even if only fixed arguments provided

For the ARM hard-float calling convention, calls to variadic functions
need to be treated diffrently, even if only the fixed arguments are
provided.

This fixes GCC-C-execute-pr68390 in the test-suite, which is failing on
the ARM GlobaISel bot.

3 years ago[llvm-nm] - Simplify the code in dumpSymbolNamesFromObject. NFC.
Georgii Rymar [Thu, 14 Jan 2021 11:45:05 +0000 (14:45 +0300)]
[llvm-nm] - Simplify the code in dumpSymbolNamesFromObject. NFC.

It is possible to simplify the logic that extracts symbol names.

D94667 made the `NMSymbol::Name` to be `std::string`,
what allowed this simplification.

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

3 years ago[libc] Allow customization of memcpy via flags.
Guillaume Chatelet [Fri, 15 Jan 2021 09:26:45 +0000 (09:26 +0000)]
[libc] Allow customization of memcpy via flags.

 - Adds LLVM_LIBC_IS_DEFINED macro to libc/src/__support/common.h
 - Adds a few knobs to memcpy to help with experimentations:
   - LLVM_LIBC_MEMCPY_X86_USE_ONLY_REPMOVSB replaces the implementation with a single call to rep;movsb
   - LLVM_LIBC_MEMCPY_X86_USE_REPMOVSB_FROM_SIZE customizes where the usage of rep;movsb

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

3 years ago[llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.
Georgii Rymar [Thu, 14 Jan 2021 10:45:44 +0000 (13:45 +0300)]
[llvm-nm] - Move MachO specific logic out from the dumpSymbolNamesFromObject(). NFC.

`dumpSymbolNamesFromObject` is the method that dumps symbol names.

It has 563 lines, mostly because of huge piece of MachO specific code.
In this patch I move it to separate helper method.

The new size of `dumpSymbolNamesFromObject` is 93 lines. With it it becomes
much easier to maintain it.

I had to change the type of 2 name fields to `std::string`, because MachO logic
uses temporarily buffer strings (e.g `ExportsNameBuffer`, `BindsNameBuffer` etc):

```
  std::string ExportsNameBuffer;
  raw_string_ostream EOS(ExportsNameBuffer);
```

these buffers were moved to `dumpSymbolsFromDLInfoMachO` by this patch and
invalidated after return. Technically, before this patch we had a situation
when local pointers (symbol names) were assigned to members of global static `SymbolList`,
what is dirty by itself.

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

3 years ago[Debuginfo][DW_OP_implicit_pointer] (1/7) Support for DW_OP_LLVM_implicit_pointer
Alok Kumar Sharma [Fri, 15 Jan 2021 08:10:33 +0000 (13:40 +0530)]
[Debuginfo][DW_OP_implicit_pointer] (1/7) Support for DW_OP_LLVM_implicit_pointer

New dwarf operator DW_OP_LLVM_implicit_pointer is introduced (present only in LLVM IR)
This operator is required as it is different than DWARF operator
DW_OP_implicit_pointer in representation and specification (number
and types of operands) and later can not be used as multiple level.

Reviewed By: aprantl

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

3 years ago[libcxx testing] Fix UB in tests for std::lock_guard
Igor Kudrin [Thu, 14 Jan 2021 08:03:44 +0000 (15:03 +0700)]
[libcxx testing] Fix UB in tests for std::lock_guard

If mutex::try_lock() is called in a thread that already owns the mutex,
the behavior is undefined. The patch fixes the issue by creating another
thread, where the call is allowed.

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

3 years ago[AArch64][GlobalISel] Fix fallbacks introduced for G_SITOFP in 8f283cafddfa8d6d01a94b...
Amara Emerson [Fri, 15 Jan 2021 08:57:51 +0000 (00:57 -0800)]
[AArch64][GlobalISel] Fix fallbacks introduced for G_SITOFP in 8f283cafddfa8d6d01a94b48cdc5d25817569e91

If we have an integer->fp convert that has differing sizes, e.g. s32 to s64,
then don't try to convert it to AArch64::G_SITOF since it won't select.

3 years ago[llvm-readobj] - Fix the compilation with GCC < 7.0.
Georgii Rymar [Fri, 15 Jan 2021 08:57:32 +0000 (11:57 +0300)]
[llvm-readobj] - Fix the compilation with GCC < 7.0.

This addressed post commit comments for D93900.

GCC had an issue and requires placing a specialization of
`printUnwindInfo` to a namespace to compile:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56480

3 years ago[Clang] Mutate long-double math builtins into f128 under IEEE-quad
Qiu Chaofan [Fri, 15 Jan 2021 08:40:41 +0000 (16:40 +0800)]
[Clang] Mutate long-double math builtins into f128 under IEEE-quad

Under -mabi=ieeelongdouble on PowerPC, IEEE-quad floating point semantic
is used for long double. This patch mutates call to related builtins
into f128 version on PowerPC. And in theory, this should be applied to
other targets when their backend supports IEEE 128-bit style libcalls.

GCC already has these mutations except nansl, which is not available on
PowerPC along with other variants (nans, nansf).

Reviewed By: RKSimon, nemanjai

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

3 years agoRevert "Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single...
Nikita Popov [Fri, 15 Jan 2021 07:59:17 +0000 (08:59 +0100)]
Revert "Reapply "ADT: Fix reference invalidation in SmallVector::push_back and single-element insert""

This reverts commit 260a856c2abcef49c7cb3bdcd999701db3e2af38.
This reverts commit 3043e5a5c33c4c871f4a1dfd621a8839f9a1f0b3.
This reverts commit 49142991a685bd427d7e877c29c77371dfb7634c.

This change had a larger than anticipated compile-time impact,
possibly because the small value optimization is not working as
intended. See D93779.

3 years ago[WebAssembly] Add support for table linking to wasm-ld
Andy Wingo [Thu, 14 Jan 2021 09:15:56 +0000 (10:15 +0100)]
[WebAssembly] Add support for table linking to wasm-ld

This patch adds support to wasm-ld for linking multiple table references
together, in a manner similar to wasm globals. The indirect function
table is synthesized as needed.

To manage the transitional period in which the compiler doesn't yet
produce TABLE_NUMBER relocations and doesn't residualize table symbols,
the linker will detect object files which have table imports or
definitions, but no table symbols. In that case it will synthesize
symbols for the defined and imported tables.

As a change, relocatable objects are now written with table symbols,
which can cause symbol renumbering in some of the tests. If no object
file requires an indirect function table, none will be written to the
file. Note that for legacy ObjFile inputs, this test is conservative: as
we don't have relocs for each use of the indirecy function table, we
just assume that any incoming indirect function table should be
propagated to the output.

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

3 years ago[AArch64] Add Fujitsu A64FX scheduling model
KAWASHIMA Takahiro [Mon, 4 Jan 2021 02:25:42 +0000 (11:25 +0900)]
[AArch64] Add Fujitsu A64FX scheduling model

Basic support of A64FX was added in D75594 but its scheduling model
was missing. This commit adds the scheduling model. Also, this commit
amends/adds some subtarget parameters of A64FX.

The A64FX Microarchitecture Manual, which is source information of
this commit, is on GitHub.

https://github.com/fujitsu/A64FX/

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

3 years ago[clang][cli] Specify KeyPath prefixes via TableGen classes
Jan Svoboda [Wed, 13 Jan 2021 11:50:19 +0000 (12:50 +0100)]
[clang][cli] Specify KeyPath prefixes via TableGen classes

It turns out we need to handle `LangOptions` separately from the rest of the options. `LangOptions` used to be conditionally parsed only when `!(DashX.getFormat() == InputKind::Precompiled || DashX.getLanguage() == Language::LLVM_IR)` and we need to restore this order (for more info, see D94682).

We could do this similarly to how `DiagnosticOptions` are handled: via a counterpart to the `IsDiag` mix-in (e.g. `IsLang`). These mix-ins would prefix the option key path with the appropriate `CompilerInvocation::XxxOpts` member. However, this solution would be problematic, as we'd now have two kinds of options (`Lang` and `Diag`) with seemingly incomplete key paths in the same file. To understand what `CompilerInvocation` member an option affects, one would need to read the whole option definition and notice the `IsDiag` or `IsLang` class.

Instead, this patch introduces more robust way to handle different kinds of options separately: via the `KeyPathAndMacroPrefix` class. We have one specialization of that class per `CompilerInvocation` member (e.g. `LangOpts`, `DiagnosticOpts`, etc.). Now, instead of specifying a key path with `"LangOpts->UndefPrefixes"`, we use `LangOpts<"UndefPrefixes">`. This keeps the readability intact (you don't have to look for the `IsLang` mix-in, the key path is complete on its own) and allows us to specify a custom macro prefix within `LangOpts`.

Reviewed By: Bigcheese

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