platform/upstream/llvm.git
3 years ago[JITLink][ELF] PCRel32GOTLoad edge offset can be smaller three
Stefan Gränitz [Sat, 24 Oct 2020 14:53:06 +0000 (16:53 +0200)]
[JITLink][ELF] PCRel32GOTLoad edge offset can be smaller three

Offset is 2 for MOVL instruction in test ELF_x86-64_common. This should fix the test failures.

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

3 years ago[Flang][Driver] Add infrastructure for basic frontend actions and file I/O
Caroline Concatto [Sat, 24 Oct 2020 11:33:19 +0000 (12:33 +0100)]
[Flang][Driver] Add infrastructure for basic frontend actions and file I/O

This patch introduces the dependencies required to read and manage input files
provided by the command line option. It also adds the infrastructure to create
and write to output files. The output is sent to either stdout or a file
(specified with the `-o` flag).

Separately, in order to be able to test the code for file I/O, it adds
infrastructure to create frontend actions. As a basic testable example, it adds
the `InputOutputTest` FrontendAction. The sole purpose of this action is to
read a file from the command line and print it either to stdout or the output
file.  This action is run by using the `-test-io` flag also introduced in this
patch (available for `flang-new` and `flang-new -fc1`). With this patch:
```
flang-new -test-io input-file.f90
```
will read input-file.f90 and print it in the output file.

The `InputOutputTest` frontend action has been introduced primarily to
facilitate testing. It is hidden from users (i.e. it's only displayed with
`--help-hidden`). Currently Clang doesn’t have an equivalent action.

`-test-io` is used to trigger the InputOutputTest action in the Flang frontend
driver. This patch makes sure that “flang-new” forwards it to “flang-new -fc1"
by creating a preprocessor job. However, in Flang.cpp, `-test-io` is passed to
“flang-new -fc1” without `-E`. This way we make sure that the preprocessor is
_not_ run in the frontend driver. This is the desired behaviour: `-test-io`
should only read the input file and print it to the output stream.

co-authored-by: Andrzej Warzynski <andrzej.warzynski@arm.com>

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

3 years ago[NPM] Port -loop-versioning-licm to NPM
TaWeiTu [Sat, 24 Oct 2020 13:50:33 +0000 (21:50 +0800)]
[NPM] Port -loop-versioning-licm to NPM

Reviewed By: aeubanks

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

3 years agoRevert "[jitlink][ELF] Add zero-fill blocks for symbols in section SHN_COMMON"
Stefan Gränitz [Sat, 24 Oct 2020 13:41:48 +0000 (15:41 +0200)]
Revert "[jitlink][ELF] Add zero-fill blocks for symbols in section SHN_COMMON"

This reverts commit e9955b0843cc1e5876430f3f051494d4197419f3. Cannot reproduce the buildbot failures yet. Reverting in the meantime.

3 years ago[LoopVersioning] Form dedicated exits for versioned loop to preserve simplify form
TaWeiTu [Sat, 24 Oct 2020 13:39:42 +0000 (21:39 +0800)]
[LoopVersioning] Form dedicated exits for versioned loop to preserve simplify form

The exit blocks of the versioned and non-versioned loops are not dedicated and thus the two loops are not in simplify form.
Insert dummy exit blocks after loop versioning with `formDedicatedExits()` to preserve the simplify form for subsequence passes.

Reviewed By: aeubanks

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

3 years ago[jitlink][ELF] Add zero-fill blocks for symbols in section SHN_COMMON
Stefan Gränitz [Sat, 24 Oct 2020 12:27:19 +0000 (14:27 +0200)]
[jitlink][ELF] Add zero-fill blocks for symbols in section SHN_COMMON

Symbols with special section index SHN_COMMON (0xfff2) haven't been handled so far and caused an invalid section error.

This is a more or less straightforward use of the code commented out at the end of the function. I checked with the ELF spec, that the symbol value gives the alignment.

Reviewed By: lhames

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

3 years ago[JITLink][ELF] PCRel32GOTLoad relocations are resolved like regular PCRel32 ones
Stefan Gränitz [Fri, 23 Oct 2020 19:52:12 +0000 (21:52 +0200)]
[JITLink][ELF] PCRel32GOTLoad relocations are resolved like regular PCRel32 ones

The difference is that the former are indirect and go to the GOT while the latter go to the target directly. This info can be used to relax indirect ones that don't need the GOT (because the target is in range). We check for this optimization beforehand. For formal correctness and to avoid confusion, we should only change the relocation kind if we actually apply the relaxation.

3 years agoFix some signed/unsigned comparison gcc warnings from D87930
Simon Pilgrim [Sat, 24 Oct 2020 11:51:51 +0000 (12:51 +0100)]
Fix some signed/unsigned comparison gcc warnings from D87930

3 years ago[InstCombine] narrowFunnelShift - fold trunc/zext or(shl(a,x),lshr(b,sub(bw,x)))...
Simon Pilgrim [Sat, 24 Oct 2020 11:42:43 +0000 (12:42 +0100)]
[InstCombine] narrowFunnelShift - fold trunc/zext or(shl(a,x),lshr(b,sub(bw,x))) -> fshl(a,b,x) (PR35155)

As discussed on PR35155, this extends narrowFunnelShift (recently renamed from narrowRotate) to support basic funnel shift patterns.

Unlike matchFunnelShift we don't include the computeKnownBits limitation as extracting the pattern from the zext/trunc layers should be a indicator of reasonable funnel shift codegen, in D89139 we demonstrated how to efficiently promote funnel shifts to wider types.

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

3 years ago[DAG] Add BuildVectorSDNode::getRepeatedSequence helper to recognise multi-element...
Simon Pilgrim [Sat, 24 Oct 2020 11:23:09 +0000 (12:23 +0100)]
[DAG] Add BuildVectorSDNode::getRepeatedSequence helper to recognise multi-element splat patterns

Replace the X86 specific isSplatZeroExtended helper with a generic BuildVectorSDNode method.

I've just used this to simplify the X86ISD::BROADCASTM lowering so far (and remove isSplatZeroExtended), but we should be able to use this in more places to lower to complex broadcast patterns.

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

3 years ago[LegalizeTypes] Legalize vector rotate operations
Simon Pilgrim [Sat, 24 Oct 2020 10:30:32 +0000 (11:30 +0100)]
[LegalizeTypes] Legalize vector rotate operations

Lower vector rotate operations as long as the legalization occurs outside of LegalizeVectorOps.

This fixes https://bugs.llvm.org/show_bug.cgi?id=47320

Patch By: @rsanthir.quic (Ryan Santhirarajan)

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

3 years ago[BasicAA] Avoid duplicate cache lookup (NFCI)
Nikita Popov [Sat, 24 Oct 2020 08:15:30 +0000 (10:15 +0200)]
[BasicAA] Avoid duplicate cache lookup (NFCI)

Rather than performing the cache lookup with both possible orders
for the locations, use the same canonicalization as the other
AliasCache lookups in BasicAA.

3 years ago[BasicAA] Fix caching in the presence of phi cycles
Nikita Popov [Fri, 23 Oct 2020 18:50:05 +0000 (20:50 +0200)]
[BasicAA] Fix caching in the presence of phi cycles

Any time we insert a block into VisitedPhiBBs, previously cached
values may no longer be valid for the recursive alias queries. As
such, perform them using an empty AAQueryInfo.

Note that if we recurse to the same phi, the block will already
be inserted, so we reuse the old AAQueryInfo, and thus still
protect against infinite recursion.

This problem can appear with with an without BatchAA, but is more
likely to occur with BatchAA, as more values are cached.

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

3 years ago[SystemZ] Define MaxInstLength to have the value of 6.
Jonas Paulsson [Fri, 23 Oct 2020 18:45:54 +0000 (20:45 +0200)]
[SystemZ] Define MaxInstLength to have the value of 6.

This value had the default value of 4 which caused branch relaxation to fail.

Review: Ulrich Weigand

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

3 years ago[lldb] [Process/NetBSD] Use XStateRegSet for all FPU registers
Michał Górny [Wed, 14 Oct 2020 07:57:33 +0000 (09:57 +0200)]
[lldb] [Process/NetBSD] Use XStateRegSet for all FPU registers

Unify the x86 regset API to use XStateRegSet for all FPU registers,
therefore eliminating the legacy API based on FPRegSet.  This makes
the code a little bit simpler but most notably, it provides future
compatibility for register caching.

Since the NetBSD kernel takes care of providing compatibility with
pre-XSAVE processors, PT_{G,S}ETXSTATE can be used on systems supporting
only FXSAVE or even plain FSAVE (and unlike PT_{G,S}ETXMMREGS, it
clearly indicates that XMM registers are not supported).

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

3 years ago[lldb] Fix building with GCC 7. NFC.
Martin Storsjö [Sat, 24 Oct 2020 06:32:11 +0000 (09:32 +0300)]
[lldb] Fix building with GCC 7. NFC.

3 years ago[AMDGPU] Cleanup AMDGPUUsage.rst
Tony [Thu, 22 Oct 2020 07:15:41 +0000 (07:15 +0000)]
[AMDGPU] Cleanup AMDGPUUsage.rst

- Layout and typo improvements.
- Add memory spaces section.
- reStructure syntax fixes.

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

3 years ago[flang] Fix pimpl idiom for IntrinsicProcTable.
Michael Kruse [Sat, 24 Oct 2020 03:59:57 +0000 (22:59 -0500)]
[flang] Fix pimpl idiom for IntrinsicProcTable.

The class IntrinsicProcTable uses the pimpl idiom and manages its own pointer-to-implementation.  However, it violates the rule-of-five and does not implement a move-constructor or assignment-operator. Due to differences between compilers in implementation copy elision, these may or may not be used. Due to the missing user implementation for resource handling, using the results in runtime errors.

Fix my using `std::unique_ptr` instead of custom resource management.

Reviewed By: klausler

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

3 years ago[llvm/DebugInfo] Emit DW_OP_implicit_value when tuning for LLDB
Med Ismail Bennani [Fri, 23 Oct 2020 02:17:07 +0000 (04:17 +0200)]
[llvm/DebugInfo] Emit DW_OP_implicit_value when tuning for LLDB

This patch enables emitting DWARF `DW_OP_implicit_value` opcode when
tuning debug information for LLDB (`-debugger-tune=lldb`).

This will also propagate to Darwin platforms, since they use LLDB tuning
as a default.

rdar://67406059

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
3 years ago[NFC][UBSAN] Refine CHECK pattern in test
Vitaly Buka [Sat, 24 Oct 2020 04:09:07 +0000 (21:09 -0700)]
[NFC][UBSAN] Refine CHECK pattern in test

As-is it was failed by unrelated linker warning with filename in the
output.

3 years agohwasan: Disable operator {new,delete} interceptors when interceptors are disabled.
Peter Collingbourne [Tue, 20 Oct 2020 21:36:34 +0000 (14:36 -0700)]
hwasan: Disable operator {new,delete} interceptors when interceptors are disabled.

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

3 years ago[flang][msvc] Fix lambda capture ambiguity. NFC.
Michael Kruse [Sat, 24 Oct 2020 03:24:22 +0000 (22:24 -0500)]
[flang][msvc] Fix lambda capture ambiguity. NFC.

Patch D88695 introduces a new local variable inside a lambda with the same name as a variable outside of it. In some of the if constexpr regions, msvc prioritizes the outer declaration and emits the error.
```
C:\Users\meinersbur\src\llvm-project\flang\lib\Evaluate\fold-implementation.h(1200): error C3493: 'context' cannot be implicitly captured because no default capture mode has been specified
```

This is fixed by giving the inner variable a different name.

Reviewed By: klausler

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

3 years ago[flang][windows] Support platform-specific path separator.
Michael Kruse [Fri, 23 Oct 2020 14:50:30 +0000 (09:50 -0500)]
[flang][windows] Support platform-specific path separator.

Remove the assumption that the path separator is `/`. Use functions from `llvm::sys::path` instead.

Reviewed By: isuruf, klausler

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

3 years ago[llvm-cov] don't include all source files when provided source files are filtered out
Zequan Wu [Wed, 14 Oct 2020 01:40:45 +0000 (18:40 -0700)]
[llvm-cov] don't include all source files when provided source files are filtered out

When all provided source files are filtered out either due to `--ignore-filename-regex` or not part of binary, don't generate coverage reults for all source files. Because if users want to generate coverage results for all source files, they don't even need to provid selected source files or `--ignore-filename-regex`.

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

3 years agofix lldb for recent libDebugInfoDWARF API change
David Blaikie [Sat, 24 Oct 2020 02:19:36 +0000 (19:19 -0700)]
fix lldb for recent libDebugInfoDWARF API change

3 years ago[NFC][UBSAN] Avoid "not FileCheck" in tests
Vitaly Buka [Sat, 24 Oct 2020 01:53:33 +0000 (18:53 -0700)]
[NFC][UBSAN] Avoid "not FileCheck" in tests

It's not clear if "not FileCheck" succeeded because
input is empty or because input does not match "CHECK:"
pattern.

3 years agoHeaderSearch: Simplify use of FileEntryRef in HeaderSearch::LookupFile, NFC
Duncan P. N. Exon Smith [Thu, 15 Oct 2020 21:17:55 +0000 (17:17 -0400)]
HeaderSearch: Simplify use of FileEntryRef in HeaderSearch::LookupFile, NFC

Simplify `HeaderSearch::LookupFile`. Instead of deconstructing a
`FileEntryRef` into a name and `FileEntry` and then rebuilding it later,
use it as is. This helps to unblock making the constructor of
`FileEntryRef` private to `FileManager`.

Differential Revision:

3 years agollvm-dwarfdump: Support verbose printing DW_OP_convert to print the CU local offset...
David Blaikie [Sat, 24 Oct 2020 00:51:56 +0000 (17:51 -0700)]
llvm-dwarfdump: Support verbose printing DW_OP_convert to print the CU local offset before the resolved absolute offset

3 years agoclangd: Stop calling FileEntryRef::FileEntryRef
Duncan P. N. Exon Smith [Thu, 15 Oct 2020 23:29:10 +0000 (19:29 -0400)]
clangd: Stop calling FileEntryRef::FileEntryRef

In `ReplayPreamble::replay`, use `getFileRef` instead of `getFile`, and
then use that `FileEntryRef` later to avoid needing
`FileEntryRef::FileEntryRef`. The latter is going to become private to
`FileManager` in a later commit.

3 years agoAdd CMake dependency from MLIRJitRunner on all dialects
Mehdi Amini [Sat, 24 Oct 2020 01:22:38 +0000 (01:22 +0000)]
Add CMake dependency from MLIRJitRunner on all dialects

This dependency was already existing indirectly, but is now more direct
since the registration relies on a inline function. This fixes the
link of the tools with BFD.

3 years agoFileManager: Reorder declarations of FileEntry and FileEntryRef, NFC
Duncan P. N. Exon Smith [Fri, 16 Oct 2020 01:03:49 +0000 (21:03 -0400)]
FileManager: Reorder declarations of FileEntry and FileEntryRef, NFC

This reduces noise in a future patch, but shouldn't change anything
otherwise.

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

3 years ago[AutoFDO] Remove a broken assert in merging inlinee samples
Hongtao Yu [Fri, 23 Oct 2020 06:17:45 +0000 (23:17 -0700)]
[AutoFDO] Remove a broken assert in merging inlinee samples

Duplicated callsites share the same callee profile if the original callsite was inlined. The sharing also causes the profile of callee's callee to be shared. This breaks the assert introduced ealier by D84997 in a tricky way.

To illustrate, I'm using an abstract example. Say we have three functions `A`, `B` and `C`. A calls B twice and B calls C once. Some optimize performed prior to the sample profile loader duplicates first callsite to `B` and the program may look like

```
A()
{
  B();  // with nested profile B1 and C1
  B();  // duplicated, with nested profile B1 and C1
  B();  // with nested profile B2 and C2
}
```

For some reason, the sample profile loader inliner then decides to only inline the first callsite in `A` and transforms `A` into

```
A()
{
  C();  // with nested profile C1
  B();  // duplicated, with nested profile B1 and C1
  B();  // with nested profile B2 and C2.
}
```

Here is what happens next:

1. Failing to inline the callsite `C()` results in `C1`'s samples returned to `C`'s base (outlined) profile. In the meantime, `C1`'s head samples are updated to `C1`'s entry sample. This also affects the profile of the middle callsite which shares `C1` with the first callsite.
2. Failing to inline the middle callsite results in `B1` returned to `B`'s base profile, which in turn will cause `C1` merged into `B`'s base profile. Note that the nest `C` profile in `B`'s base has a non-zero head sample count now. The value actually equals to `C1`'s entry count.
3. Failing to inline last callsite results in `B2` returned to `B`'s base profile. Note that the nested `C` profile in `B`'s base now has an entry count equal to the sum of that of `C1` and `C2`, with the head count equal to that of `C1`. This will trigger the assert later on.
        4. Compiling `B` using `B`'s base profile. Failing to inline `C` there triggers the returning of the nested `C` profile. Since the nested `C` profile has a non-zero head count, the returning doesn't go through. Instead, the assert goes off.

It's good that `C1` is only returned once, based on using a non-zero head count to ensure an inline profile is only returned once. However C2 is never returned. While it seems hard to solve this perfectly within the current framework, I'm just removing the broken assert. This should be reasonably fixed by the upcoming CSSPGO work where counts returning is based on context-sensitivity and a distribution factor for callsite probes.

The simple example is extracted from one of our internal services. In reality, why the original callsite `B()` and duplicate one having different inline behavior is a magic. It has to do with imperfect counts in profile and extra complicated inlining that makes the hotness for them different.

Reviewed By: wenlei

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

3 years agoRemove unused verifyRegStateMapping() function in RegAllocFast (NFC)
Mehdi Amini [Sat, 24 Oct 2020 00:36:51 +0000 (00:36 +0000)]
Remove unused verifyRegStateMapping() function in RegAllocFast (NFC)

This fixes compiler warning when building with assertions.

3 years agoRemove global dialect registration
Mehdi Amini [Fri, 23 Oct 2020 20:19:35 +0000 (20:19 +0000)]
Remove global dialect registration

This has been deprecated for >1month now and removal was announced in:

https://llvm.discourse.group/t/rfc-revamp-dialect-registration/1559/11

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

3 years agoTopologically sort the library to link to mlir-cpu-runner which is required with...
Mehdi Amini [Sat, 24 Oct 2020 00:34:58 +0000 (00:34 +0000)]
Topologically sort the library to link to mlir-cpu-runner which is required with some linkers like BFD (NFC)

3 years agoFix a few warnings from GCC (NFC)
Mehdi Amini [Sat, 24 Oct 2020 00:22:48 +0000 (00:22 +0000)]
Fix a few warnings from GCC (NFC)

3 years ago[intel-pt] Disable/Enable tracing to guarantee the trace is correct
Walter Erquinigo [Fri, 23 Oct 2020 23:28:29 +0000 (16:28 -0700)]
[intel-pt] Disable/Enable tracing to guarantee the trace is correct

As mentioned in the comment inside the code, the Intel documentation
states that the internal CPU buffer is flushed out to RAM only when tracing is
disabled. Otherwise, the buffer on RAM might be stale.

This diff disables tracing when the trace buffer is going to be read. This is a
quite safe operation, as the reading is done when the inferior is paused at a
breakpoint, so we are not losing any packets because there's no code being
executed.

After the reading is finished, tracing is enabled back.

It's a bit hard to write a test for this now, but Greg Clayton and I will
refactor the PT support and writing tests for it will be easier. However
I tested it manually by doing a script that automates
the following flow

```
(lldb) b main
Breakpoint 1: where = a.out`main + 15 at main.cpp:4:7, address = 0x000000000040050f
(lldb) r
Process 3078226 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x000000000040050f a.out`main at main.cpp:4:7
(lldb) processor-trace start
(lldb) b 5
Breakpoint 2: where = a.out`main + 22 at main.cpp:5:12, address = 0x0000000000400516
(lldb) c
Process 3078226 resuming
Process 3078226 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 2.1
frame #0: 0x0000000000400516 a.out`main at main.cpp:5:12
(lldb) processor-trace show-instr-log
thread #1: tid=3078226
0x40050f <+15>: movl $0x0, -0x8(%rbp)

>>> Before, some runs of the script up to this point lead to empty traces

(lldb) b 6
Breakpoint 3: where = a.out`main + 42 at main.cpp:6:14, address = 0x000000000040052a
(lldb) c
Process 3092991 resuming
Process 3092991 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 3.1
frame #0: 0x000000000040052a a.out`main at main.cpp:6:14
(lldb) processor-trace show-instr-log thread #1: tid=3092991
0x40050f <+15>: movl $0x0, -0x8(%rbp)
0x400516 <+22>: movl $0x0, -0xc(%rbp)
0x40051d <+29>: cmpl $0x2710, -0xc(%rbp) ; imm = 0x2710
0x400524 <+36>: jge 0x400546 ; <+70> at main.cpp
0x400524 <+36>: jge 0x400546 ; <+70> at main.cpp

>>> The trace was re-enabled correctly and includes the instruction of the
first reading.
```
Those instructions correspond to these lines
```
3 int main() {
4 int z = 0;
5 for (int i = 0; i < 10000; i++) {
6 z += fun(z)
...
```

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

3 years agoDon't allow structured binding declarations to decompose a
Richard Smith [Fri, 23 Oct 2020 23:13:49 +0000 (16:13 -0700)]
Don't allow structured binding declarations to decompose a
lambda-expression's captures.

The built-in structured binding rules for classes require that all
fields can be accessed by name, and the fields introduced for lambda
captures are unnamed, so decomposing a capturing lambda is ill-formed.

3 years ago[Hexagon] Handle selection between HVX vector predicates
Krzysztof Parzyszek [Fri, 23 Oct 2020 23:05:06 +0000 (18:05 -0500)]
[Hexagon] Handle selection between HVX vector predicates

Make sure that (select i1 q0 q1) is handled properly.

3 years ago[libFuzzer] Added -print_full_coverage flag.
Max Moroz [Fri, 23 Oct 2020 18:07:30 +0000 (11:07 -0700)]
[libFuzzer] Added -print_full_coverage flag.

-print_full_coverage=1 produces a detailed branch coverage dump when run on a single file.
Uses same infrastructure as -print_coverage flag, but prints all branches (regardless of coverage status) in an easy-to-parse format.
Usage: For internal use with machine learning fuzzing models which require detailed coverage information on seed files to generate mutations.

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

3 years ago[MemProf] Attempt to debug avr bot failure
Teresa Johnson [Fri, 23 Oct 2020 22:57:38 +0000 (15:57 -0700)]
[MemProf] Attempt to debug avr bot failure

Reverts the XFAIL added in b67a2aef8ac9fd9c10666a05d72d909315140dcb,
which had no effect.

Adjust the test to make sure all output is dumped to stderr, so that
hopefully I can get a better idea of where/why this is failing.

Remove some redundant checking while here.

3 years ago[StructurizeCFG][NewPM] Port -structurizecfg to NPM
Arthur Eubanks [Thu, 8 Oct 2020 05:07:30 +0000 (22:07 -0700)]
[StructurizeCFG][NewPM] Port -structurizecfg to NPM

This doesn't support -structurizecfg-skip-uniform-regions since that
would require porting LegacyDivergenceAnalysis.

The NPM doesn't support adding a non-analysis pass as a dependency of
another, so I had to add -lowerswitch to some tests or pin them to the
legacy PM.

This is the only RegionPass in tree, so I simply copied the logic for
finding all Regions from the legacy PM's RGManager into
StructurizeCFG::run().

Reviewed By: arsenm

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

3 years ago[Inliner][NPM] Properly pass callee AAResults
Arthur Eubanks [Fri, 16 Oct 2020 19:08:59 +0000 (12:08 -0700)]
[Inliner][NPM] Properly pass callee AAResults

Fixes noalias-calls.ll under NPM.

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

3 years ago[test] Simplify pr33641_remove_arg_dbgvalue.ll
Arthur Eubanks [Wed, 21 Oct 2020 15:46:25 +0000 (08:46 -0700)]
[test] Simplify pr33641_remove_arg_dbgvalue.ll

This makes it pass under the NPM.
The legacy PM pass ran passes on SCCs in a different order, causing
argpromotion to not trigger on @bar().

Reviewed By: rnk

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

3 years ago[llvm-install-name-tool] Add -prepend_rpath option
Keith Smiley [Fri, 23 Oct 2020 22:00:25 +0000 (15:00 -0700)]
[llvm-install-name-tool] Add -prepend_rpath option

This diff adds the option -prepend_rpath which inserts an rpath as
the first rpath in the binary.

Test plan: make check-all

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

3 years ago[CodeGen] Emit destructor calls to destruct non-trivial C struct
Akira Hatanaka [Fri, 23 Oct 2020 21:21:34 +0000 (14:21 -0700)]
[CodeGen] Emit destructor calls to destruct non-trivial C struct
temporaries created by conditional and assignment operators

rdar://problem/64989559

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

3 years ago[RISCV] Use the commercial name for scheduling model (NFC)
Evandro Menezes [Thu, 8 Oct 2020 21:20:24 +0000 (16:20 -0500)]
[RISCV] Use the commercial name for scheduling model (NFC)

Use the commercial name for the scheduling model for the SiFive 7 Series.

3 years agoPR47954 / DR2126: permit temporary objects that are lifetime-extended by
Richard Smith [Fri, 23 Oct 2020 21:27:24 +0000 (14:27 -0700)]
PR47954 / DR2126: permit temporary objects that are lifetime-extended by
variables that are usable in constant expressions to themselves be
usable in constant expressions.

3 years agoRevert "Remove global dialect registration"
Mehdi Amini [Fri, 23 Oct 2020 21:26:32 +0000 (21:26 +0000)]
Revert "Remove global dialect registration"

This reverts commit b22e2e4c6e420b78a8a4c307f0cf002f51af9590.

Investigating broken builds

3 years ago[SVE] Lower fixed length VECREDUCE_SEQ_FADD operation
Cameron McInally [Fri, 23 Oct 2020 20:56:40 +0000 (15:56 -0500)]
[SVE] Lower fixed length VECREDUCE_SEQ_FADD operation

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

3 years agoAdd a mlir natvis file for debugging with Visual Studio
Kirsten Lee [Fri, 23 Oct 2020 21:14:53 +0000 (14:14 -0700)]
Add a mlir natvis file for debugging with Visual Studio

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

3 years agoGC-parseable element atomic memcpy/memmove
Artur Pilipenko [Fri, 2 Oct 2020 03:05:23 +0000 (20:05 -0700)]
GC-parseable element atomic memcpy/memmove

This change introduces a GC parseable lowering for element atomic
memcpy/memmove intrinsics. This way runtime can provide an
implementation which can take a safepoint during copy operation.

See "GC-parseable element atomic memcpy/memmove" thread on llvm-dev
for the background and details:
https://groups.google.com/g/llvm-dev/c/NnENHzmX-b8/m/3PyN8Y2pCAAJ

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

3 years ago[flang] An erroneous type bound procedure was causing a call to CHECK()
Peter Steinfeld [Fri, 23 Oct 2020 20:10:41 +0000 (13:10 -0700)]
[flang] An erroneous type bound procedure was causing a call to CHECK()

I added a test to verify that the associated symbol did not have errors before
doing the anaylsis of a call to a component ref along with a test that
triggers the original problem.

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

3 years ago[mlir][Vector] Introduce UnrollVectorOptions to control vector unrolling.
MaheshRavishankar [Fri, 23 Oct 2020 19:56:12 +0000 (12:56 -0700)]
[mlir][Vector] Introduce UnrollVectorOptions to control vector unrolling.

The current pattern for vector unrolling takes the native shape to
unroll to at pattern instantiation time, but the native shape might
defer based on the types of the operand. Introduce a
UnrollVectorOptions struct which allows for using a function that will
return the native shape based on the operation. Move other options of
unrolling like `filterConstraints` into this struct.

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

3 years agoRemove global dialect registration
Mehdi Amini [Fri, 23 Oct 2020 20:19:35 +0000 (20:19 +0000)]
Remove global dialect registration

This has been deprecated for >1month now and removal was announced in:

https://llvm.discourse.group/t/rfc-revamp-dialect-registration/1559/11

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

3 years agoFix typo in diagnostic name.
Richard Smith [Fri, 23 Oct 2020 19:43:49 +0000 (12:43 -0700)]
Fix typo in diagnostic name.

No functionality change intended.

3 years ago[Asan][Windows] Fix asan stack traces on Windows.
Amy Huang [Fri, 23 Oct 2020 20:14:14 +0000 (13:14 -0700)]
[Asan][Windows] Fix asan stack traces on Windows.

While implementing inline stack traces on Windows I noticed that the stack
traces in many asan tests included an inlined frame that shouldn't be there.

Currently we get the PC and then do a stack unwind and use the PC to
find the beginning of the stack trace.
In the failing tests the first thing in the stack trace is inside an inline
call site that shouldn't be in the stack trace, so replace it with the PC.

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

3 years agoFix shared build. NFC.
Michael Liao [Fri, 23 Oct 2020 19:50:24 +0000 (15:50 -0400)]
Fix shared build. NFC.

3 years ago[mlir] Link with pthreads in AsyncRuntime
Eugene Zhulenev [Thu, 22 Oct 2020 20:35:49 +0000 (13:35 -0700)]
[mlir] Link with pthreads in AsyncRuntime

AsyncRuntime must be explicitly linked with LLVM pthreads

Reviewed By: mehdi_amini

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

3 years ago[libc++] NFC: Remove unused includes from the test suite
Louis Dionne [Thu, 15 Oct 2020 21:55:41 +0000 (17:55 -0400)]
[libc++] NFC: Remove unused includes from the test suite

- <iostream> include from a <chrono> test
- <regex> include from the filesystem tests

3 years ago[AArch64] Add vector compare/select cost-model tests.
Florian Hahn [Fri, 23 Oct 2020 18:42:16 +0000 (19:42 +0100)]
[AArch64] Add vector compare/select cost-model tests.

3 years ago[lldb] Move copying of files into reproducer out of process
Jonas Devlieghere [Fri, 23 Oct 2020 19:31:33 +0000 (12:31 -0700)]
[lldb] Move copying of files into reproducer out of process

For performance reasons the reproducers don't copy the files captured by
the file collector eagerly, but wait until the reproducer needs to be
generated.

This is a problematic when LLDB crashes and we have to do all this
signal-unsafe work in the signal handler. This patch uses a similar
trick to clang, which has the driver invoke a new cc1 instance to do all
this work out-of-process.

This patch moves the writing of the mapping file as well as copying over
the reproducers into a separate process spawned when lldb crashes.

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

3 years ago[libc++] Clean up unused CI files
Louis Dionne [Fri, 23 Oct 2020 19:20:35 +0000 (15:20 -0400)]
[libc++] Clean up unused CI files

Those were useful during CI experimentation, but are not used anymore.

3 years ago[mlir][vector] Add folder for ExtractStridedSliceOp
Thomas Raoux [Fri, 23 Oct 2020 19:07:25 +0000 (12:07 -0700)]
[mlir][vector] Add folder for ExtractStridedSliceOp

Add folder for the case where ExtractStridedSliceOp source comes from a chain
of InsertStridedSliceOp. Also add a folder for the trivial case where the
ExtractStridedSliceOp is a no-op.

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

3 years agoUnconditionally #include <future>
Geoffrey Martin-Noble [Fri, 23 Oct 2020 19:15:38 +0000 (19:15 +0000)]
Unconditionally #include <future>

This unbreaks building with `LLVM_ENABLE_THREADS=0`. Since
https://github.com/llvm/llvm-project/commit/069919c9ba33 usage of
`std::promise` is not guarded by `LLVM_ENABLE_THREADS`, so this header
must be unconditionally included.

Reviewed By: lhames

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

3 years ago[libc++] Refactor the run-buildbot script to make it more modular, and run the benchmarks
Louis Dionne [Fri, 23 Oct 2020 14:02:14 +0000 (10:02 -0400)]
[libc++] Refactor the run-buildbot script to make it more modular, and run the benchmarks

As a fly-by fix, unbreak the benchmarks on Apple platforms.

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

3 years ago[mlir][vector] Add folding for ExtractOp with ShapeCastOp source
Thomas Raoux [Fri, 23 Oct 2020 18:53:38 +0000 (11:53 -0700)]
[mlir][vector] Add folding for ExtractOp with ShapeCastOp source

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

3 years ago[gn build] Add missing comma
Arthur Eubanks [Fri, 23 Oct 2020 19:01:23 +0000 (12:01 -0700)]
[gn build] Add missing comma

3 years agoSourceManager: Simplify by inlining what remains of ComputeLineNumbers, NFC
Duncan P. N. Exon Smith [Thu, 22 Oct 2020 02:31:15 +0000 (22:31 -0400)]
SourceManager: Simplify by inlining what remains of ComputeLineNumbers, NFC

Use `LineOffsetMapping:get` directly and remove/inline the helper
`ComputeLineNumbers`, simplifying the callers.

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

3 years ago[IR] add fn attr for no_stack_protector; prevent inlining on mismatch
Nick Desaulniers [Fri, 23 Oct 2020 18:41:17 +0000 (11:41 -0700)]
[IR] add fn attr for no_stack_protector; prevent inlining on mismatch

It's currently ambiguous in IR whether the source language explicitly
did not want a stack a stack protector (in C, via function attribute
no_stack_protector) or doesn't care for any given function.

It's common for code that manipulates the stack via inline assembly or
that has to set up its own stack canary (such as the Linux kernel) would
like to avoid stack protectors in certain functions. In this case, we've
been bitten by numerous bugs where a callee with a stack protector is
inlined into an __attribute__((__no_stack_protector__)) caller, which
generally breaks the caller's assumptions about not having a stack
protector. LTO exacerbates the issue.

While developers can avoid this by putting all no_stack_protector
functions in one translation unit together and compiling those with
-fno-stack-protector, it's generally not very ergonomic or as
ergonomic as a function attribute, and still doesn't work for LTO. See also:
https://lore.kernel.org/linux-pm/20200915172658.1432732-1-rkir@google.com/
https://lore.kernel.org/lkml/20200918201436.2932360-30-samitolvanen@google.com/T/#u

Typically, when inlining a callee into a caller, the caller will be
upgraded in its level of stack protection (see adjustCallerSSPLevel()).
By adding an explicit attribute in the IR when the function attribute is
used in the source language, we can now identify such cases and prevent
inlining.  Block inlining when the callee and caller differ in the case that one
contains `nossp` when the other has `ssp`, `sspstrong`, or `sspreq`.

Fixes pr/47479.

Reviewed By: void

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

3 years ago[lldb] Fix use of undefined type 'lldb_private::UtilityFunction'
Jonas Devlieghere [Fri, 23 Oct 2020 18:46:45 +0000 (11:46 -0700)]
[lldb] Fix use of undefined type 'lldb_private::UtilityFunction'

We were returning the default constructed unique_pointer from
TypeSystem.h for which the compiler does not have a definition. Move the
implementation into the cpp file.

3 years ago[AIX] Let alloca return 16 bytes alignment
Xiangling Liao [Fri, 23 Oct 2020 18:09:14 +0000 (14:09 -0400)]
[AIX] Let alloca return 16 bytes alignment

On AIX, to support vector types, which should always be 16 bytes aligned,
we set alloca to return 16 bytes aligned memory space.

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

3 years ago[AMDGPU] Fixed isLegalRegOperand() with physregs
Stanislav Mekhanoshin [Fri, 23 Oct 2020 18:06:18 +0000 (11:06 -0700)]
[AMDGPU] Fixed isLegalRegOperand() with physregs

This does not change anything at the moment, but needed for
D89170. In that change I am probing a physical SGPR to see if
it is legal. RC is SReg_32, but DRC for scratch instructions
is SReg_32_XEXEC_HI and test fails.

That is sufficient just to check if DRC contains a register
here in case of physreg. Physregs also do not use subregs
so the subreg handling below is irrelevant for these.

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

3 years ago[AIX][cmake] Adjust management of `-G` for linking
Hubert Tong [Fri, 23 Oct 2020 18:25:22 +0000 (14:25 -0400)]
[AIX][cmake] Adjust management of `-G` for linking

The change in 0ba98433971f changed the behaviour of the build when
using an XL build compiler because `-G` is not a pure linker option:
it also implies `-shared`. This was accounted for in the base CMake
configuration, so an analysis of the change from 0ba98433971f in
relation to a build using Clang (where `-shared` is introduced by CMake)
would not identify the issue. This patch resolves this particular issue
by adding `-shared` alongside `-Wl,-G`.

At the same time, the investigation reveals that several aspects of the
various build configurations are not operating in the manner originally
intended.

The other issue related to the `-G` linker option in the build is that
the removal of it (to avoid unnecessary use of run-time linking) is not
effective for the build using the Clang compiler. This patch addresses
this by adjusting the regular expressions used to remove the broadly-
applied `-G`.

Finally, the issue of specifying the export list with `-Wl,` instead of
a compiler option is flagged with a FIXME comment.

Reviewed By: daltenty, amyk

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

3 years ago[MemProf] XFAIL test on avr until issue can be debugged
Teresa Johnson [Fri, 23 Oct 2020 18:28:11 +0000 (11:28 -0700)]
[MemProf] XFAIL test on avr until issue can be debugged

For unknown reasons, this test started failing only on the
llvm-avr-linux bot after 5c20d7db9f2791367b9311130eb44afecb16829c:
http://lab.llvm.org:8011/#/builders/112/builds/365

The error message is not helpful, and I have an email out to the bot
owner to help with debugging. XFAIL it on avr for now.

3 years ago[BasicAA] Add additional phi cycle test (NFC)
Nikita Popov [Fri, 23 Oct 2020 18:30:27 +0000 (20:30 +0200)]
[BasicAA] Add additional phi cycle test (NFC)

This is a variation of the BatchAA problem that also applies
without BatchAA. We may have a cached result from earlier in
the same query.

3 years ago[NFC] Use [MC]Register in RegAllocGreedy
Mircea Trofin [Thu, 22 Oct 2020 17:30:30 +0000 (10:30 -0700)]
[NFC] Use [MC]Register in RegAllocGreedy

This was initiated from the uses of MCRegUnitIterator, so while likely
not exhaustive, it's a step forward.

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

3 years ago[PowerPC] Add intrinsics for MMA
Baptiste Saleil [Tue, 13 Oct 2020 19:19:15 +0000 (14:19 -0500)]
[PowerPC] Add intrinsics for MMA

This patch adds support for MMA intrinsics.

Authored by: Baptiste Saleil

Reviewed By: #powerpc, bsaleil, amyk

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

3 years ago[PhiValues] Use SetVector to avoid non-determinism
Nikita Popov [Thu, 22 Oct 2020 21:49:08 +0000 (23:49 +0200)]
[PhiValues] Use SetVector to avoid non-determinism

I'm not sure whether this can cause actual non-determinism in the
compiler output, but at least it causes non-determinism in the
statistics collected by BasicAA.

Use SetVector to have a predictable iteration order.

3 years ago[mlir] Add FuncOp::eraseResults
Sean Silva [Fri, 23 Oct 2020 01:56:53 +0000 (18:56 -0700)]
[mlir] Add FuncOp::eraseResults

I just found I needed this in an upcoming patch, and it seems generally
useful to have.

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

3 years ago[ELF] Don't error on R_PPC64_REL24/R_PPC64_REL24_NOTOC referencing __tls_get_addr...
Fangrui Song [Fri, 23 Oct 2020 17:37:24 +0000 (10:37 -0700)]
[ELF] Don't error on R_PPC64_REL24/R_PPC64_REL24_NOTOC referencing __tls_get_addr for missing R_PPC64_TLSGD/R_PPC64_TLSLD

This partially reverts D85994.

In glibc, elf/dl-sym.c calls the raw `__tls_get_addr` by specifying the
tls_index parameter. Such a call does not have a pairing R_PPC64_TLSGD/R_PPC64_TLSLD.
This is legitimate. Since we cannot distinguish the benign case from cases due
to toolchain issues, we have to be permissive.

Acked by Stefan Pintilie

3 years ago[MLInliner] Disable always inliner in bounds tests
Mircea Trofin [Fri, 23 Oct 2020 17:20:12 +0000 (10:20 -0700)]
[MLInliner] Disable always inliner in bounds tests

That changes the threshold calculation.

3 years agoSourceManager: Make LastLineNoContentCache and ContentCache::SourceLineCache mutable...
Duncan P. N. Exon Smith [Wed, 21 Oct 2020 21:48:28 +0000 (17:48 -0400)]
SourceManager: Make LastLineNoContentCache and ContentCache::SourceLineCache mutable, NFC

Avoid some noisy `const_cast`s by making `ContentCache::SourceLineCache`
and `SourceManager::LastLineNoContentCache` both mutable.

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

3 years ago[AArch64][GlobalISel] Introduce a new post-isel optimization pass.
Amara Emerson [Wed, 14 Oct 2020 06:41:32 +0000 (23:41 -0700)]
[AArch64][GlobalISel] Introduce a new post-isel optimization pass.

There are two optimizations here:

1. Consider the following code:
 FCMPSrr %0, %1, implicit-def $nzcv
 %sel1:gpr32 = CSELWr %_, %_, 12, implicit $nzcv
 %sub:gpr32 = SUBSWrr %_, %_, implicit-def $nzcv
 FCMPSrr %0, %1, implicit-def $nzcv
 %sel2:gpr32 = CSELWr %_, %_, 12, implicit $nzcv
This kind of code where we have 2 FCMPs each feeding a CSEL can happen
when we have a single IR fcmp being used by two selects. During selection,
to ensure that there can be no clobbering of nzcv between the fcmp and the
csel, we have to generate an fcmp immediately before each csel is
selected.

However, often we can essentially CSE these together later in MachineCSE.
This doesn't work though if there are unrelated flag-setting instructions
in between the two FCMPs. In this case, the SUBS defines NZCV
but it doesn't have any users, being overwritten by the second FCMP.

Our solution here is to try to convert flag setting operations between
a interval of identical FCMPs, so that CSE will be able to eliminate one.

2. SelectionDAG imported patterns for arithmetic ops currently select the
flag-setting ops for CSE reasons, and add the implicit-def $nzcv operand
to those instructions. However if those impdef operands are not marked as
dead, the peephole optimizations are not able to optimize them into non-flag
setting variants. The optimization here is to find these dead imp-defs and
mark them as such.

This pass is only enabled when optimizations are enabled.

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

3 years ago[gn build] Port dbbc4f4e226
LLVM GN Syncbot [Fri, 23 Oct 2020 17:06:41 +0000 (17:06 +0000)]
[gn build] Port dbbc4f4e226

3 years ago[CUDA] Extract CUDA version from cuda.h if version.txt is not found
Artem Belevich [Tue, 20 Oct 2020 22:11:38 +0000 (15:11 -0700)]
[CUDA] Extract CUDA version from cuda.h if version.txt is not found

If CUDA version can not be determined based on version.txt file, attempt to find
CUDA_VERSION macro in cuda.h.

This is a follow-up to D89752,

Differntial Revision: https://reviews.llvm.org/D89832

3 years ago[CUDA] Improve clang's ability to detect recent CUDA versions.
Artem Belevich [Mon, 19 Oct 2020 23:41:51 +0000 (16:41 -0700)]
[CUDA] Improve clang's ability to detect recent CUDA versions.

CUDA-11.1 does not carry version.txt which causes clang to assume that it's
CUDA-7.0, which used to be the only CUDA version w/o version.txt.

In order to tell CUDA-7.0 apart from the new versions, clang now probes for the
presence of libdevice.10.bc which is not present in the old CUDA versions.

This should keep Clang working for CUDA-11.1.

PR47332: https://bugs.llvm.org/show_bug.cgi?id=47332

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

3 years ago[lldb] Redesign Target::GetUtilityFunctionForLanguage API
Jonas Devlieghere [Fri, 23 Oct 2020 16:26:11 +0000 (09:26 -0700)]
[lldb] Redesign Target::GetUtilityFunctionForLanguage API

This patch redesigns the Target::GetUtilityFunctionForLanguage API:

 - Use a unique_ptr instead of a raw pointer for the return type.
 - Wrap the result in an llvm::Expected instead of using a Status object as an I/O parameter.
 - Combine the action of "getting" and "installing" the UtilityFunction as they always get called together.
 - Pass std::strings instead of const char* and std::move them where appropriate.

There's more room for improvement but I think this tackles the most
prevalent issues with the current API.

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

3 years agoThese compiler-rt tests should be UNSUPPORTED instead of XFAIL.
Alex Orlov [Fri, 23 Oct 2020 16:57:18 +0000 (20:57 +0400)]
These compiler-rt tests should be UNSUPPORTED instead of XFAIL.

These compiler-rt tests should be UNSUPPORTED instead of XFAIL, which seems to be the real intent of the authors.

Reviewed By: vvereschaka

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

3 years agoSourceManager: Encapsulate line number mapping into SrcMgr::LineOffsetMapping
Duncan P. N. Exon Smith [Wed, 21 Oct 2020 21:32:43 +0000 (17:32 -0400)]
SourceManager: Encapsulate line number mapping into SrcMgr::LineOffsetMapping

Put the guts of `ComputeLineNumbers` into `LineOffsetMapping::get` and
`LineOffsetMapping::LineOffsetMapping`.  As a drive-by, store the number
of lines directly in the bump-ptr-allocated array.

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

3 years agoRevert "[CGSCC] Detect devirtualization in more cases"
Arthur Eubanks [Fri, 23 Oct 2020 16:53:52 +0000 (09:53 -0700)]
Revert "[CGSCC] Detect devirtualization in more cases"

This reverts commit 3024fe5b55ed72633915f613bd5e2826583c396f.

Causes major compile time regressions:
https://llvm-compile-time-tracker.com/compare.php?from=3b8d8954bf2c192502d757019b9fe434864068e9&to=3024fe5b55ed72633915f613bd5e2826583c396f&stat=instructions

3 years agoAdded utility to launch tests on a target remotely.
Alex Orlov [Fri, 23 Oct 2020 16:49:00 +0000 (20:49 +0400)]
Added utility to launch tests on a target remotely.

Runs an executable on a remote host.
This is meant to be used as an executor when running the LLVM and the Libraries tests on a target.

Reviewed By: vvereschaka

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

3 years agoRe-apply "[JITLink][ELF] Add support for ELF::R_X86_64_REX_GOTPCRELX relocation"
Lang Hames [Fri, 23 Oct 2020 06:24:40 +0000 (23:24 -0700)]
Re-apply "[JITLink][ELF] Add support for ELF::R_X86_64_REX_GOTPCRELX relocation"

This re-applies e2fceec2fd1 with fixes. Apparently we already *do* support
relaxation for ELF, so we need to make sure the test case allocates a slab at
a fixed address, and that the R_X86_64_REX_GOTPCRELX test references an external
that is guaranteed to be out of range.

3 years ago[AArch64][SVE] Fix umin/umax lowering to handle out of range imm.
Huihui Zhang [Fri, 23 Oct 2020 16:29:43 +0000 (09:29 -0700)]
[AArch64][SVE] Fix umin/umax lowering to handle out of range imm.

Immediate must be in an integer range [0,255] for umin/umax instruction.
Extend pattern matching helper SelectSVEArithImm() to take in value type
bitwidth when checking immediate value is in range or not.

Reviewed By: sdesmalen

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

3 years agoSourceManager: Clarify that FileInfo always has a ContentCache, NFC
Duncan P. N. Exon Smith [Fri, 16 Oct 2020 14:21:50 +0000 (10:21 -0400)]
SourceManager: Clarify that FileInfo always has a ContentCache, NFC

It turns out that `FileInfo` *always* has a ContentCache. Clarify that
in the code:
- Update the private version of `SourceManager::createFileID` to take a
  `ContentCache&` instead of `ContentCache*`, and rename it to
  `createFileIDImpl` for clarity.
- Change `FileInfo::getContentCache` to return a reference.

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

3 years ago[PowerPC] Fix the Predicates for enabling pcrelative-memops and PLXVP/PSTXVP definitions
Victor Huang [Fri, 23 Oct 2020 16:31:05 +0000 (11:31 -0500)]
[PowerPC] Fix the Predicates for enabling pcrelative-memops and PLXVP/PSTXVP definitions

In this patch, Predicates fix added for the following:
* disable prefix-instrs will disable pcrelative-memops
* set two predicates PairedVectorMemops and PrefixInstrs for PLXVP/PSTXVP definitions

Differential Revision: https://reviews.llvm.org/D89727
Reviewed by: amyk, steven.zhang

3 years ago[gn build] Port 00255f41929
LLVM GN Syncbot [Fri, 23 Oct 2020 16:19:55 +0000 (16:19 +0000)]
[gn build] Port 00255f41929

3 years ago[AMDGPU] Fix access beyond the end of the basic block in execMayBeModifiedBeforeAnyUse.
vpykhtin [Wed, 14 Oct 2020 11:47:18 +0000 (14:47 +0300)]
[AMDGPU] Fix access beyond the end of the basic block in execMayBeModifiedBeforeAnyUse.

I was wrong in thinking that MRI.use_instructions return unique instructions and mislead Jay in his previous patch D64393.

First loop counted more instructions than it was in reality and the second loop went beyond the basic block with that counter.

I used Jay's previous code that relied on MRI.use_operands to constrain the number of instructions to check among.
modifiesRegister is inlined to reduce the number of passes over instruction operands and added assert on BB end boundary.

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

3 years ago[clangd] Fix remote-server build and add it to check-clangd
Kadir Cetinkaya [Fri, 23 Oct 2020 14:36:52 +0000 (16:36 +0200)]
[clangd] Fix remote-server build and add it to check-clangd

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

3 years ago[WebAssembly] Implementation of (most) table instructions
Paulo Matos [Fri, 23 Oct 2020 15:36:06 +0000 (08:36 -0700)]
[WebAssembly] Implementation of (most) table instructions

Implementation of instructions table.get, table.set, table.grow,
table.size, table.fill, table.copy.

Missing instructions are table.init and elem.drop as they deal with
element sections which are not yet implemented.

Added more tests to tables.s

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