platform/upstream/llvm.git
4 years ago[libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'
Louis Dionne [Fri, 17 Apr 2020 14:29:15 +0000 (10:29 -0400)]
[libc++/abi/unwind] Rename Lit features for no exceptions to 'no-exceptions'

Instead of having different names for the same Lit feature accross code
bases, use the same name everywhere. This NFC commit is in preparation
for a refactor where all three projects will be using the same Lit
feature detection logic, and hence it won't be convenient to use
different names for the feature.

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

4 years ago[SveEmitter] Implement builtins for gathers/scatters
Andrzej Warzynski [Tue, 7 Apr 2020 10:09:01 +0000 (11:09 +0100)]
[SveEmitter] Implement builtins for gathers/scatters

This patch adds builtins for:
  * regular, first-faulting and non-temporal gather loads
  * regular and non-temporal scatter stores

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

4 years ago[InstCombine] Negator: shufflevector is negatible
Roman Lebedev [Wed, 22 Apr 2020 11:58:39 +0000 (14:58 +0300)]
[InstCombine] Negator: shufflevector is negatible

All these folds are correct as per alive-tv

4 years ago[NFC][InstCombine] Add shuffle negation tests
Roman Lebedev [Wed, 22 Apr 2020 11:57:57 +0000 (14:57 +0300)]
[NFC][InstCombine] Add shuffle negation tests

4 years ago[AMDGPU] Add 192-bit register classes
Jay Foad [Thu, 16 Apr 2020 16:02:19 +0000 (17:02 +0100)]
[AMDGPU] Add 192-bit register classes

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

4 years ago[AMDGPU] Add missing AReg classes
Jay Foad [Fri, 17 Apr 2020 08:25:37 +0000 (09:25 +0100)]
[AMDGPU] Add missing AReg classes

Add 96-bit, 160-bit and 256-bit AReg classes to match VReg and SReg.
NFC as far as I know, but it may avoid weird legalization problems.

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

4 years ago[libc++ testing] Fix unused variable warning turned error
David Zarzycki [Wed, 22 Apr 2020 11:45:47 +0000 (07:45 -0400)]
[libc++ testing] Fix unused variable warning turned error

4 years ago[LLD][ELF][ARM] Replace adr, ldr with .inst .reloc in test [NFC]
Peter Smith [Wed, 22 Apr 2020 10:57:13 +0000 (11:57 +0100)]
[LLD][ELF][ARM] Replace adr, ldr with .inst .reloc in test [NFC]

After D78301 MC no longer emits a relocation for this case. Change to use
.inst and .reloc to synthesize the same instruction and relocation. One
more test case I missed.

4 years ago[llvm-objdump] Look in all viable sections for call/branch targets
James Henderson [Mon, 20 Apr 2020 13:23:01 +0000 (14:23 +0100)]
[llvm-objdump] Look in all viable sections for call/branch targets

Prior to this patch, llvm-objdump would only look in the last section
(according to the section header table order) that matched an address
for a symbol when identifying the target symbol of a call or branch
operation. If there are multiple sections with the same address, due to
some of them being empty, it did not look in those, even if the symbol
couldn't be found in the first section looked in.

This patch causes llvm-objdump to look in all sections for possible
candidate symbols. If there are multiple possible symbols, it picks one
from a non-empty section, if possible (as that is more likely to be the
"real" symbol since functions can't really be in emptiy sections),
before falling back to those in empty sections. If all else fails, it
falls back to absolute symbols as it did before.

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

Reviewed by: grimar, Higuoxing

4 years ago[NFC][llvm][X86] Adding missing -mtiple to X86 test.
Lucas Prates [Wed, 22 Apr 2020 10:31:41 +0000 (11:31 +0100)]
[NFC][llvm][X86] Adding missing -mtiple to X86 test.

The modified test was missing the specification of the intended triple
in its run line, assuming X86 is the default.

4 years ago[AArch64][SVE] Add SVE intrinsic for LD1RQ
Kerry McLaughlin [Wed, 22 Apr 2020 08:38:48 +0000 (09:38 +0100)]
[AArch64][SVE] Add SVE intrinsic for LD1RQ

Summary:
Adds the following intrinsic for contiguous load & replicate:
  - @llvm.aarch64.sve.ld1rq

The LD1RQ intrinsic only needs the SImmS16XForm added by this
patch. The others (SImmS2XForm, SImmS3XForm & SImmS4XForm)
were added for consistency.

Reviewers: andwar, sdesmalen, efriedma, cameron.mcinally, dancgr, rengolin

Reviewed By: sdesmalen

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, danielkiss, cfe-commits, llvm-commits

Tags: #llvm

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

4 years agoMake some static class members constexpr
Benjamin Kramer [Wed, 22 Apr 2020 10:09:37 +0000 (12:09 +0200)]
Make some static class members constexpr

This allows them to be ODR used in C++17 mode. NFC.

4 years ago[yaml2obj] - Program headers: add an additional check for `Offset`
Georgii Rymar [Thu, 16 Apr 2020 13:41:28 +0000 (16:41 +0300)]
[yaml2obj] - Program headers: add an additional check for `Offset`

The `Offset` field is used to set the file offset of a program header.
In a normal object it should not be greater than the minimal offset
of sections included into segment.

This patch adds a check for that and adds tests.

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

4 years ago[yaml2obj] - Change how p_offset is calculated when creating segments. NFCI.
Georgii Rymar [Fri, 17 Apr 2020 12:06:04 +0000 (15:06 +0300)]
[yaml2obj] - Change how p_offset is calculated when creating segments. NFCI.

This depends on D78361 and simplifies the computation of the `p_offset`.

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

4 years ago[obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.
Georgii Rymar [Tue, 7 Apr 2020 15:20:51 +0000 (18:20 +0300)]
[obj2yaml] - Fix the issue with dumping empty sections when dumping program headers.

Imagine we have:

```
ProgramHeaders:
  - Type:  PT_LOAD
    Flags: [ PF_W, PF_R ]
    Sections:
      - Section: .bar
    VAddr: 0x2000
Sections:
  - Name:    .foo
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
    Address: 0x1000
  - Name:    .bar
    Type:    SHT_PROGBITS
    Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
    Address: 0x2000
```

Both `.foo` and `.bar` share the same starting file offset,
but `VA(.foo)` < `VA(PT_LOAD)`, we should not include it into segment.

This patch fixes the issue.

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

4 years ago[ARM][MVE] Tail-predication: some more comments and debug messages. NFC.
Sjoerd Meijer [Wed, 22 Apr 2020 09:17:28 +0000 (10:17 +0100)]
[ARM][MVE] Tail-predication: some more comments and debug messages. NFC.

Finding the loop tripcount is the first crucial step in preparing a loop for
tail-predication, and this adds a debug message if a tripcount cannot be found.

And while I was at it, I added some more comments here and there.

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

4 years ago[clangd] Remove vscode plugin: now https://github.com/clangd/vscode-clangd
Sam McCall [Tue, 21 Apr 2020 23:28:49 +0000 (01:28 +0200)]
[clangd] Remove vscode plugin: now https://github.com/clangd/vscode-clangd

Summary:
Moving this out of the monorepo for consistency with other editor plugins.
There's no version lock with clangd itself, and we never ran tests with lit.

The first version from the new repo has been published.

Reviewers: hokein

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[Driver][docs] Document option -mtune as a no-op.
Sjoerd Meijer [Wed, 22 Apr 2020 07:49:02 +0000 (08:49 +0100)]
[Driver][docs] Document option -mtune as a no-op.

This documents that option -mtune is accepted for compatibility with GCC,
currently it has no effect, and thus does not currently perform any CPU type
specific tuning.

Corresponding discussion on the cfe dev list:
http://lists.llvm.org/pipermail/cfe-dev/2020-April/065169.html

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

4 years ago[AMDGPU] Remove obsolete special case for 1024-bit vector types. NFC.
Jay Foad [Wed, 22 Apr 2020 08:05:24 +0000 (09:05 +0100)]
[AMDGPU] Remove obsolete special case for 1024-bit vector types. NFC.

4 years ago[AMDGPU] Simplify definition of VReg and AReg classes. NFC.
Jay Foad [Tue, 21 Apr 2020 10:50:49 +0000 (11:50 +0100)]
[AMDGPU] Simplify definition of VReg and AReg classes. NFC.

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

4 years ago[MLIR] Use nested symbol to identify kernel in `LaunchFuncOp`.
Frederik Gossen [Tue, 21 Apr 2020 10:16:41 +0000 (10:16 +0000)]
[MLIR] Use nested symbol to identify kernel in `LaunchFuncOp`.

Summary:
Use a nested symbol to identify the kernel to be invoked by a `LaunchFuncOp` in the GPU dialect.
This replaces the two attributes that were used to identify the kernel module and the kernel within seperately.

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

4 years ago[MLIR] Use `kernel` as a short hand for `gpu.kernel` attribute.
Frederik Gossen [Tue, 21 Apr 2020 07:11:10 +0000 (07:11 +0000)]
[MLIR] Use `kernel` as a short hand for `gpu.kernel` attribute.

Summary:
Use the shortcu `kernel` for the `gpu.kernel` attribute of `gpu.func`.
The parser supports this and test cases are easier to read.

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

4 years ago[NFC] Test changes
Sam Parker [Tue, 21 Apr 2020 14:57:28 +0000 (15:57 +0100)]
[NFC] Test changes

Add some more targets for the ARM cost model tests and add some tests
for icmps and bitcasts.

4 years ago[MLIR] Fix test case for kernel attribute.
Frederik Gossen [Tue, 21 Apr 2020 07:00:37 +0000 (07:00 +0000)]
[MLIR] Fix test case for kernel attribute.

Summary:
Fix a broken test case in the `invalid.mlir` lit test case.
`expect` was missing its `e`.

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

4 years ago[llvm] [X86] Make test more robust against different builds
aartbik [Wed, 22 Apr 2020 03:43:00 +0000 (20:43 -0700)]
[llvm] [X86] Make test more robust against different builds

Summary:
Rationale:
Using the --debug-only flag requires a debug build. Also, the debug output is not always consistent over different builds.
This change avoids all problems by just testing the generated assembly for AVX.

Reviewers: craig.topper, mehdi_amini, nicolasvasilache

Reviewed By: craig.topper

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lldb] Fix modules build by adding missing include
Raphael Isemann [Wed, 22 Apr 2020 07:14:06 +0000 (09:14 +0200)]
[lldb] Fix modules build by adding missing include

This header is using FileSpec so we should at least include the forward header.

4 years ago[VE] Update shift operation instructions
Kazushi (Jam) Marukawa [Wed, 22 Apr 2020 07:09:16 +0000 (09:09 +0200)]
[VE] Update shift operation instructions

Summary:
Changing all mnemonic to match assembly instructions to simplify mnemonic
naming rules. This time update all shift operation instructions.  This also
corrects instruction's operation kinds.

Reviewed By: simoll

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

4 years ago[VE] Add alternative names to registers
Kazushi (Jam) Marukawa [Wed, 22 Apr 2020 07:07:28 +0000 (09:07 +0200)]
[VE] Add alternative names to registers

Summary:
VE uses identical names "%s0-63" to all generic registers.  Change to use
alternative name mechanism among all generic registers instead of hard-
coding them.

Reviewed By: arsenm

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

4 years ago[CallSite removal] Remove unneeded includes of CallSite.h. NFC
Craig Topper [Wed, 22 Apr 2020 07:03:59 +0000 (00:03 -0700)]
[CallSite removal] Remove unneeded includes of CallSite.h. NFC

4 years ago[MLIR] Verify there are no side-effecting ops in GenericAtomicRMWOp body.
Alexander Belyaev [Wed, 22 Apr 2020 07:02:00 +0000 (09:02 +0200)]
[MLIR] Verify there are no side-effecting ops in GenericAtomicRMWOp body.

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

4 years ago[MLIR] Add extra locking during cubin generation.
Stephan Herhut [Tue, 21 Apr 2020 19:21:37 +0000 (21:21 +0200)]
[MLIR] Add extra locking during cubin generation.

We also need to lock the LLVMDialect mutex when initializing
LLVM targets or destroying llvm modules concurrently. Added another
scoped lock to that effect.

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

4 years ago[MLIR] Update documentation for loop.parallel.
Alexander Belyaev [Tue, 21 Apr 2020 14:00:28 +0000 (16:00 +0200)]
[MLIR] Update documentation for loop.parallel.

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

4 years ago[Attributor] Replace AccessKind2Accesses map with an "array map"
Johannes Doerfert [Sat, 18 Apr 2020 01:47:38 +0000 (20:47 -0500)]
[Attributor] Replace AccessKind2Accesses map with an "array map"

The number of different access location kinds we track is relatively
small (8 so far). With this patch we replace the DenseMap that mapped
from index (0-7) to the access set pointer with an array of access set
pointers. This reduces memory consumption.

No functional change is intended.

---

Single run of the Attributor module and then CGSCC pass (oldPM)
for SPASS/clause.c (~10k LLVM-IR loc):

Before:
```
calls to allocation functions: 472499 (215654/s)
temporary memory allocations: 77794 (35506/s)
peak heap memory consumption: 35.28MB
peak RSS (including heaptrack overhead): 125.46MB
total memory leaked: 269.04KB
```

After:
```
calls to allocation functions: 472270 (308673/s)
temporary memory allocations: 77578 (50704/s)
peak heap memory consumption: 32.70MB
peak RSS (including heaptrack overhead): 121.78MB
total memory leaked: 269.04KB
```

Difference:
```
calls to allocation functions: -229 (346/s)
temporary memory allocations: -216 (326/s)
peak heap memory consumption: -2.58MB
peak RSS (including heaptrack overhead): 0B
total memory leaked: 0B
```

---

4 years ago[Attributor] Run IRPosition::verify only with EXPENSIVE_CHECKS
Johannes Doerfert [Tue, 21 Apr 2020 16:13:20 +0000 (11:13 -0500)]
[Attributor] Run IRPosition::verify only with EXPENSIVE_CHECKS

4 years ago[CallSite removal][Target] Replace CallSite with CallBase. NFC
Craig Topper [Wed, 22 Apr 2020 06:29:17 +0000 (23:29 -0700)]
[CallSite removal][Target] Replace CallSite with CallBase. NFC

In some cases just delete an unneeded include.

4 years ago[PowerPC] Exploit RLDIMI for OR with large immediates
Qiu Chaofan [Fri, 17 Apr 2020 07:08:58 +0000 (15:08 +0800)]
[PowerPC] Exploit RLDIMI for OR with large immediates

This patch exploits rldimi instruction for patterns like
`or %a, 0b000011110000`, which saves number of instructions when the
operand has only one use, compared with `li-ori-sldi-or`.

Reviewed By: nemanjai

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

4 years ago[CallSite removal][TargetTransformInfoImpl] Replace CallSite with CallBase. NFC
Craig Topper [Tue, 21 Apr 2020 07:55:35 +0000 (00:55 -0700)]
[CallSite removal][TargetTransformInfoImpl] Replace CallSite with CallBase. NFC

4 years ago[libc][NFC] Cleanup dependencies in src/signal and test/src/signal.
Siva Chandra Reddy [Tue, 21 Apr 2020 16:58:12 +0000 (09:58 -0700)]
[libc][NFC] Cleanup dependencies in src/signal and test/src/signal.

Reviewers: abrachet

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

4 years ago[DebugInfo] Simplify DWARFUnit::determineStringOffsetsTableContribution(). NFC.
Igor Kudrin [Wed, 22 Apr 2020 05:11:17 +0000 (12:11 +0700)]
[DebugInfo] Simplify DWARFUnit::determineStringOffsetsTableContribution(). NFC.

The method is called from only one place and the call is already guarded
by a condition which checks that IsDWO is false.

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

4 years agoAdd `//` before the banner displayed in `--print-ir-before/after-all`
Mehdi Amini [Wed, 22 Apr 2020 00:31:59 +0000 (00:31 +0000)]
Add `//` before the banner displayed in `--print-ir-before/after-all`

This is making the output file (when the stream is a file) a valid MLIR
file.

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

4 years ago[TargetPassConfig] Run MachineVerifier after more passes.
Eli Friedman [Wed, 22 Apr 2020 04:00:19 +0000 (21:00 -0700)]
[TargetPassConfig] Run MachineVerifier after more passes.

We were disabling verification for no reason in a bunch of places; just
turn it on.

At this point, there are two key places where we don't run verification:
during register allocation, and after addPreEmitPass.  Regalloc probably
isn't worth messing with; it has its own invariants, and verifying
afterwards is probably good enough.  For after addPreEmitPass, it's
probably worth investigating improvements.

4 years ago[xray] Avoid text relocations in trampolines for ARM/AArch64
Ian Levesque [Tue, 21 Apr 2020 22:37:39 +0000 (18:37 -0400)]
[xray] Avoid text relocations in trampolines for ARM/AArch64

Summary: Switch to pc-relative lookup of the xray handler function to avoid text relocations.

Reviewers: MaskRay, dberris, johnislarry

Subscribers: kristof.beyls, danielkiss, #sanitizers

Tags: #sanitizers

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

4 years ago[xray] Use hidden symbol visibility for xray trampolines
Ian Levesque [Tue, 21 Apr 2020 22:18:23 +0000 (18:18 -0400)]
[xray] Use hidden symbol visibility for xray trampolines

Summary: We load multiple copies of the trampolines into memory when instrumenting DSOs.  Hidden visibility prevents conflicts in this scenario.

Reviewers: MaskRay, dberris, johnislarry

Subscribers: #sanitizers

Tags: #sanitizers

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

4 years ago[Frontend] Drop unneeded CC1 options
Fangrui Song [Wed, 22 Apr 2020 01:27:40 +0000 (18:27 -0700)]
[Frontend] Drop unneeded CC1 options

4 years agoFixIrreducible: don't crash when moving a child loop
Sameer Sahasrabuddhe [Wed, 22 Apr 2020 01:57:26 +0000 (07:27 +0530)]
FixIrreducible: don't crash when moving a child loop

Summary:
When an irreducible SCC is converted into a new natural loop, existing
loops included in that SCC now become children of the new loop. The
logic that moves these loops from the parent loop to the new loop
invoked undefined behaviour when it modified the container that it was
iterating over. Fixed this by first extracting all the loops that are
to be removed from the parent.

Fixes bug 45623.

Reviewed By: arsenm

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

4 years agoAdd missing call to `__sanitizer::InitializePlatformEarly()` in UBSan's standalone...
Dan Liew [Tue, 21 Apr 2020 01:52:26 +0000 (18:52 -0700)]
Add missing call to `__sanitizer::InitializePlatformEarly()` in UBSan's standalone init.

Summary:
While working on rdar://problem/62083617 I noticed this call was
missing.

This is a no-op for all platforms except Darwin. For Darwin this
means the `use_xnu_fast_mmap` flag is initialized as it was intended
when using UBSan in standalone mode.

Reviewers: vitalybuka, vsk, kubamracek, yln, samsonov

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years agoAdd missing call to `Symbolizer::LateInitialize()` in UBSan's standalone init.
Dan Liew [Tue, 21 Apr 2020 01:27:43 +0000 (18:27 -0700)]
Add missing call to `Symbolizer::LateInitialize()` in UBSan's standalone init.

Summary:
This fixes symbolization in Standalone UBSan mode for the Darwin simulators.

861b69faee5df8d4e13ef316c7474a10e4069e81 (rdar://problem/58789439) tried to fix
symbolization for all sanitizers on Darwin simulators but unfortunately it only
fixed the problem for TSan.

For UBSan in standalone mode the fix wasn't sufficient because UBSan's
standalone init doesn't call `Symbolizer::LateInitialize()` like ASan
and TSan do. This meant that `AtosSymbolizerProcess::LateInitialize()`
was never being called before
`AtosSymbolizerProcess::StartSymbolizerSubprocess()` which breaks an
invariant we expect to hold.

The missing call to `Symbolizer::LateInitialize()` during UBSan's
standalone init seems like an accidently omission so this patch simply
adds it.

rdar://problem/62083617

Reviewers: vitalybuka, kubamracek, yln, samsonov

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years ago[PowerPC] Add clang -msvr4-struct-return for 32-bit ELF
Justin Hibbits [Tue, 21 Apr 2020 20:36:08 +0000 (15:36 -0500)]
[PowerPC] Add clang -msvr4-struct-return for 32-bit ELF

Summary:

Change the default ABI to be compatible with GCC.  For 32-bit ELF
targets other than Linux, Clang now returns small structs in registers
r3/r4.  This affects FreeBSD, NetBSD, OpenBSD.  There is no change for
32-bit Linux, where Clang continues to return all structs in memory.

Add clang options -maix-struct-return (to return structs in memory) and
-msvr4-struct-return (to return structs in registers) to be compatible
with gcc.  These options are only for PPC32; reject them on PPC64 and
other targets.  The options are like -fpcc-struct-return and
-freg-struct-return for X86_32, and use similar code.

To actually return a struct in registers, coerce it to an integer of the
same size.  LLVM may optimize the code to remove unnecessary accesses to
memory, and will return i32 in r3 or i64 in r3:r4.

Fixes PR#40736

Patch by George Koehler!

Reviewed By: jhibbits, nemanjai
Differential Revision: https://reviews.llvm.org/D73290

4 years agoMake SmallVector assert if it cannot grow.
Andrew Browne [Mon, 6 Apr 2020 21:42:57 +0000 (14:42 -0700)]
Make SmallVector assert if it cannot grow.

Context:

  /// Double the size of the allocated memory, guaranteeing space for at
  /// least one more element or MinSize if specified.
  void grow(size_t MinSize = 0) { this->grow_pod(MinSize, sizeof(T)); }

  void push_back(const T &Elt) {
    if (LLVM_UNLIKELY(this->size() >= this->capacity()))
      this->grow();
    memcpy(reinterpret_cast<void *>(this->end()), &Elt, sizeof(T));
    this->set_size(this->size() + 1);
  }

When grow is called in push_back() without a MinSize specified, this is
relying on the guarantee of space for at least one more element.

There is an edge case bug where the SmallVector is already at its maximum size
and push_back() calls grow() with default MinSize of zero. Grow is unable to
provide space for one more element, but push_back() assumes the additional
element it will be available. This can result in silent memory corruption, as
this->end() will be an invalid pointer and the program may continue executing.

Another alternative to fix would be to remove the default argument from
grow(), which would mean several changing grow() to grow(this->size()+1)
in several places.

No test case added because it would require allocating ~4GB.

Reviewers: echristo

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoget rid of PythonInteger::GetInteger()
Lawrence D'Anna [Tue, 21 Apr 2020 23:53:47 +0000 (16:53 -0700)]
get rid of PythonInteger::GetInteger()

Summary:
One small step in my long running quest to improve python exception handling in
LLDB.  Replace GetInteger() which just returns an int with As<long long> and
friends, which return Expected types that can track python exceptions

Reviewers: labath, jasonmolenda, JDevlieghere, vadimcn

Reviewed By: labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[gn build] Port 23609331472
LLVM GN Syncbot [Tue, 21 Apr 2020 23:36:07 +0000 (23:36 +0000)]
[gn build] Port 23609331472

4 years agoReland "Implement some functions in NativeSession." with fixes so that
Amy Huang [Tue, 21 Apr 2020 21:25:32 +0000 (14:25 -0700)]
Reland "Implement some functions in NativeSession." with fixes so that
the tests pass on Linux.

Summary:
This change implements readFromExe, and calculating VA and RVA, which
are some of the functionalities that will be used for native PDB reading
for llvm symbolizer.

bug: https://bugs.llvm.org/show_bug.cgi?id=41795

4 years ago[llvm][NFC][CallSite] Remove CallSite from FunctionAttrs
Mircea Trofin [Tue, 21 Apr 2020 20:13:23 +0000 (13:13 -0700)]
[llvm][NFC][CallSite] Remove CallSite from FunctionAttrs

Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoReapply: Make header inclusion order from umbrella dirs deterministic
Bruno Cardoso Lopes [Tue, 21 Apr 2020 22:30:54 +0000 (15:30 -0700)]
Reapply: Make header inclusion order from umbrella dirs deterministic

Sort the headers by name before adding the includes in
collectModuleHeaderIncludes. This makes the include order for building
umbrellas deterministic across different filesystems and also guarantees
that the ASTWriter always dump top headers in the same order.

There's currently no good way to test for this behavior.

This was first introduced in r289478 and reverted few times because of
ASANifed test failures on open source bots (both from LLVM and Swift).

Finally reproduced the problem in a Linux machine and use std::sort as a
fix, since we are not dealing with POD-like types.

rdar://problem/28116411

4 years ago[ELF] Fix a null pointer dereference when relocating a Local-Exec TLS relocation...
Fangrui Song [Tue, 21 Apr 2020 21:44:03 +0000 (14:44 -0700)]
[ELF] Fix a null pointer dereference when relocating a Local-Exec TLS relocation for a lazy symbol

If there is no SHF_TLS section, there will be no PT_TLS and Out::tlsPhdr may be a nullptr.
If the symbol referenced by an R_TLS is lazy, we should treat the symbol as undefined.

Also reorganize tls-in-archive.s and tls-weak-undef.s . They do not test what they intended to test.

4 years agoDisable a Darwin test under LSan.
Dan Liew [Tue, 21 Apr 2020 22:13:15 +0000 (15:13 -0700)]
Disable a Darwin test under LSan.

* Changing source lines seems to cause us to hit rdar://problem/62132428.
* Even if I workaround the above issue sometimes the source line in the dylib reported by atos is off by one.

It's simpler to just disable the test for now.

rdar://problem/61793759

4 years ago[lldb/Test] Add decorator to the right method
Jonas Devlieghere [Tue, 21 Apr 2020 22:05:32 +0000 (15:05 -0700)]
[lldb/Test] Add decorator to the right method

4 years ago[lldb/Test] Add skipIfReproducer for tests that diverge during replay
Jonas Devlieghere [Tue, 21 Apr 2020 21:36:31 +0000 (14:36 -0700)]
[lldb/Test] Add skipIfReproducer for tests that diverge during replay

Add the skipIfReproducer decorator to the remaining tests that fail to
replay because the GDB remote packets diverge during replay. This is
*not* expected and should be fixed, but figuring out exactly what caused
the divergence has proven pretty difficult to track down.

I've marked these tests as skipped for now so we can get clean results
and detect new regressions. I have no evidence to believe that these
failures have the same root cause, so I've not assigned them a PR.

4 years ago[lldb/Test] Add skipIfReproducer for tests that are not expected to work
Jonas Devlieghere [Tue, 21 Apr 2020 21:34:18 +0000 (14:34 -0700)]
[lldb/Test] Add skipIfReproducer for tests that are not expected to work

Some tests are not expected to work with reproducers, for example tests
that completely circumvent the reproducers (i.e. using the side_effects
Python module) or that rely on changes to the file system.

4 years ago[gn build] Port 352fef3f11f
LLVM GN Syncbot [Tue, 21 Apr 2020 21:22:08 +0000 (21:22 +0000)]
[gn build] Port 352fef3f11f

4 years ago[gn build] Port 060efd24c7f
LLVM GN Syncbot [Tue, 21 Apr 2020 21:22:07 +0000 (21:22 +0000)]
[gn build] Port 060efd24c7f

4 years agoRevert "Implement some NativeSession functions" along with some
Amy Huang [Tue, 21 Apr 2020 21:14:32 +0000 (14:14 -0700)]
Revert "Implement some NativeSession functions" along with some
followup fixes.

This reverts commits
a6d8a055e92eb4853805d1ad1be0b1a6523524ef
4927ae085807731eb4052e0a682443fe9399b512
1e1f5eb7c978da3b062daaf3c32c459704e65a55

4 years ago[OpenMP] target_data_begin: fail on device alloc fail
Joel E. Denny [Tue, 21 Apr 2020 20:27:39 +0000 (16:27 -0400)]
[OpenMP] target_data_begin: fail on device alloc fail

Without this patch, target_data_begin continues after an illegal
mapping or an out-of-memory error on the device.  With this patch, it
terminates the runtime with an error instead.

The new test exercises only illegal mappings.  I didn't think of a
good way to exercise out-of-memory errors from the test suite.

Reviewed By: jdoerfert

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

4 years ago[OpenMP] Add scaffolding for negative runtime tests
Joel E. Denny [Tue, 21 Apr 2020 20:27:32 +0000 (16:27 -0400)]
[OpenMP] Add scaffolding for negative runtime tests

Without this patch, the openmp project's test suites do not appear to
have support for negative tests.  However, D78170 needs to add a test
that an expected runtime failure occurs.

This patch makes `not` visible in all of the openmp project's test
suites.  In all but `libomptarget/test`, it should be possible for a
test author to insert `not` before a use of the lit substitution for
running a test program.  In `libomptarget/test`, that substitution is
target-specific, and its value is `echo` when the target is not
available.  In that case, inserting `not` before a lit substitution
would expect an `echo` fail, so this patch instead defines a separate
lit substitution for expected runtime fails.

Reviewed By: jdoerfert, Hahnfeld

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

4 years ago[lld-macho] Add basic support for linking against dylibs
Jez Ng [Tue, 21 Apr 2020 20:37:57 +0000 (13:37 -0700)]
[lld-macho] Add basic support for linking against dylibs

This diff implements:

* dylib loading (much of which is being restored from @pcc and @ruiu's
  original work)
* The GOT_LOAD relocation, which allows us to load non-lazy dylib
  symbols
* Basic bind opcode emission, which tells `dyld` how to populate the GOT

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

4 years ago[SVE] Remove VectorType::getBitWidth()
Christopher Tetreault [Tue, 21 Apr 2020 20:02:23 +0000 (13:02 -0700)]
[SVE] Remove VectorType::getBitWidth()

Summary:
* VectorType::getBitWidth() is just an unsafe version of
getPrimitiveSizeInBits() that assumes all vectors are fixed width.

Reviewers: efriedma, sdesmalen, huntergr, craig.topper

Reviewed By: efriedma

Subscribers: tschuett, hiraditya, rkruppe, psnobl, llvm-commits

Tags: #llvm

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

4 years ago[Attributor] Remove dependence edges eagerly
Johannes Doerfert [Tue, 21 Apr 2020 18:57:19 +0000 (13:57 -0500)]
[Attributor] Remove dependence edges eagerly

If we have a dependence between an abstract attribute A to an abstract
attribute B such hat changes in A should trigger an update of B, we do
not need to keep the dependence around once the update was triggered. If
the dependence is still required the update will reinsert it into the
dependence map, if it is not we avoid triggering B in the future. This
replaces the "recompute interval" mechanism we used before to prune
stale dependences.

Number of required iterations is generally down, compile time for the
module pass (not really the CGSCC pass) is down quite a bit.

There is one test change which looks like an artifact in the undefined
behavior AA that needs to be looked at.

4 years ago[Attributor][NFC] Track the number of created AAs in the statistics
Johannes Doerfert [Fri, 17 Apr 2020 01:32:06 +0000 (20:32 -0500)]
[Attributor][NFC] Track the number of created AAs in the statistics

4 years ago[Attributor][PM] Introduce `-attributor-enable={none,cgscc,module,all}`
Johannes Doerfert [Sat, 18 Apr 2020 02:43:54 +0000 (21:43 -0500)]
[Attributor][PM] Introduce `-attributor-enable={none,cgscc,module,all}`

The old command line option `-attributor-disable` was too coarse grained
as we want to measure the effects of the module or cgscc pass without
the other as well.

Since `none` is the default there is no real functional change.

Reviewed By: lebedev.ri

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

4 years ago[Attributor][NFC] Remove obsolete option from tests
Johannes Doerfert [Sat, 18 Apr 2020 02:09:16 +0000 (21:09 -0500)]
[Attributor][NFC] Remove obsolete option from tests

Since D76871 it is sufficient to run `opt -atributor` or
`-attributor-cgscc`.

4 years agoFix `-Wpedantic` warnings. NFC.
Michael Liao [Tue, 21 Apr 2020 20:09:17 +0000 (16:09 -0400)]
Fix `-Wpedantic` warnings. NFC.

4 years ago[hip] Claim builtin type `__float128` supported if the host target supports it.
Michael Liao [Mon, 20 Apr 2020 19:15:05 +0000 (15:15 -0400)]
[hip] Claim builtin type `__float128` supported if the host target supports it.

Reviewers: tra, yaxunl

Subscribers: jvesely, nhaehnle, kerbowa, cfe-commits

Tags: #clang

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

4 years agoC++2a -> C++20 in some identifiers; NFC.
Aaron Ballman [Tue, 21 Apr 2020 19:37:19 +0000 (15:37 -0400)]
C++2a -> C++20 in some identifiers; NFC.

4 years ago[NativeSession] Fix unchecked Expected type
Amy Huang [Tue, 21 Apr 2020 19:34:42 +0000 (12:34 -0700)]
[NativeSession] Fix unchecked Expected type
(followup to https://reviews.llvm.org/D78128)

4 years ago[Flang] fix dependency issues after D78215
Valentin Clement [Tue, 21 Apr 2020 19:27:35 +0000 (20:27 +0100)]
[Flang] fix dependency issues after D78215

Patch D78215 changes various dependencies in the CMakeLists.txt. This
results in error while compiling. This patch fixes the issue.

Reviewers: DavidTruby

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

4 years ago[libc++abi] Add a rate limiter when logging dynamic_cast errors
Louis Dionne [Thu, 16 Apr 2020 20:59:35 +0000 (16:59 -0400)]
[libc++abi] Add a rate limiter when logging dynamic_cast errors

This upstreams a fix that Howard made a long time ago, where so many
errors would be logged that applications were becoming sluggish. With
this patch, the first three errors will be printed, and after that the
printing frequency decreases exponentially.

_LIBCXX_DYNAMIC_FALLBACK is only enabled on Apple platforms, so this
should be NFC for other platforms.

rdar://14996273

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

4 years agoAMDGPU: Use Register
Matt Arsenault [Tue, 21 Apr 2020 19:06:53 +0000 (15:06 -0400)]
AMDGPU: Use Register

4 years ago[ARM] Fix MIR tests with invalid live-ins.
Eli Friedman [Tue, 21 Apr 2020 01:43:52 +0000 (18:43 -0700)]
[ARM] Fix MIR tests with invalid live-ins.

A register can't be live if it isn't defined; fix issues in various
testcases.

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

4 years ago[AArch64] Fix MIR tests with invalid live-ins.
Eli Friedman [Tue, 21 Apr 2020 01:27:07 +0000 (18:27 -0700)]
[AArch64] Fix MIR tests with invalid live-ins.

A register can't be live if it isn't defined; fix issues in various
testcases.

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

4 years agoFix Solaris build of ubsan.
Evgenii Stepanov [Mon, 20 Apr 2020 18:53:26 +0000 (11:53 -0700)]
Fix Solaris build of ubsan.

Summary: Broken in D78325.

Reviewers: ro

Subscribers: mgorny, fedor.sergeev, #sanitizers, llvm-commits

Tags: #sanitizers

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

4 years agoFix `-Wparentheses` warnings. NFC.
Michael Liao [Tue, 21 Apr 2020 19:02:25 +0000 (15:02 -0400)]
Fix `-Wparentheses` warnings. NFC.

4 years ago[XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations
Fangrui Song [Tue, 21 Apr 2020 18:52:51 +0000 (11:52 -0700)]
[XRay] xray_fn_idx: set SHF_WRITE to avoid text relocations

In a future change we should properly fix xray_fn_idx to use PC-relative
addresses as well, but for now let's keep absolute addresses until sled
addresses are all fixed.

4 years ago[InstCombine] Negator - sink sinkable negations
Roman Lebedev [Tue, 21 Apr 2020 18:24:36 +0000 (21:24 +0300)]
[InstCombine] Negator - sink sinkable negations

Summary:
As we have discussed previously (e.g. in D63992 / D64090 / [[ https://bugs.llvm.org/show_bug.cgi?id=42457 | PR42457 ]]), `sub` instruction
can almost be considered non-canonical. While we do convert `sub %x, C` -> `add %x, -C`,
we sparsely do that for non-constants. But we should.

Here, i propose to interpret `sub %x, %y` as `add (sub 0, %y), %x` IFF the negation can be sinked into the `%y`

This has some potential to cause endless combine loops (either around PHI's, or if there are some opposite transforms).
For former there's `-instcombine-negator-max-depth` option to mitigate it, should this expose any such issues
For latter, if there are still any such opposing folds, we'd need to remove the colliding fold.
In any case, reproducers welcomed!

Reviewers: spatel, nikic, efriedma, xbolva00

Reviewed By: spatel

Subscribers: xbolva00, mgorny, hiraditya, reames, llvm-commits

Tags: #llvm

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

4 years agoFix build. NFC.
Michael Liao [Tue, 21 Apr 2020 18:58:52 +0000 (14:58 -0400)]
Fix build. NFC.

4 years ago[PDB] Change llvm/object/COFF.h to llvm/Object/COFF.h after D78128
Fangrui Song [Tue, 21 Apr 2020 18:53:56 +0000 (11:53 -0700)]
[PDB] Change llvm/object/COFF.h to llvm/Object/COFF.h after D78128

4 years agoImplement some functions in NativeSession.
Amy Huang [Tue, 14 Apr 2020 00:53:12 +0000 (17:53 -0700)]
Implement some functions in NativeSession.

Summary:
This change implements readFromExe, and calculating VA and RVA, which
are some of the functionalities that will be used for native PDB reading
for llvm symbolizer.

bug: https://bugs.llvm.org/show_bug.cgi?id=41795

Reviewers: hans, amccarth, rnk

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoBit-pack some pairs. No functionlity change intended.
Benjamin Kramer [Tue, 21 Apr 2020 18:09:30 +0000 (20:09 +0200)]
Bit-pack some pairs. No functionlity change intended.

4 years ago[CallSite] Fix build breakage after D78538
Fangrui Song [Tue, 21 Apr 2020 18:33:40 +0000 (11:33 -0700)]
[CallSite] Fix build breakage after D78538

4 years ago[lldb/Scripts] proc.returncode is set in proc.communicate
Jonas Devlieghere [Tue, 21 Apr 2020 18:29:47 +0000 (11:29 -0700)]
[lldb/Scripts] proc.returncode is set in proc.communicate

Make sure proc.returncode has been assigned before we compare it to 0.

4 years ago[Analysis] recognize the 'null' pointer constant as not poison
Sanjay Patel [Tue, 21 Apr 2020 18:22:13 +0000 (14:22 -0400)]
[Analysis] recognize the 'null' pointer constant as not poison

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

4 years ago[InstCombine] add tests for logic-of-icmps; NFC
Sanjay Patel [Tue, 21 Apr 2020 16:50:12 +0000 (12:50 -0400)]
[InstCombine] add tests for logic-of-icmps; NFC

4 years ago[mlir] Remove braces to avoid ambiguous constructor of operand range
River Riddle [Tue, 21 Apr 2020 18:20:13 +0000 (11:20 -0700)]
[mlir] Remove braces to avoid ambiguous constructor of operand range

4 years ago[llvm] [X86] Fixed type bug in vselect for AVX masked load
aartbik [Tue, 21 Apr 2020 17:27:05 +0000 (10:27 -0700)]
[llvm] [X86] Fixed type bug in vselect for AVX masked load

Summary:
Bugzilla issue 45563
https://bugs.llvm.org/show_bug.cgi?id=45563

Reviewers: nicolasvasilache, mehdi_amini, craig.topper

Reviewed By: craig.topper

Subscribers: RKSimon, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[llvm][NFC][CallSite] Remove CallSite from DeadArgumentElimination
Mircea Trofin [Tue, 21 Apr 2020 05:09:47 +0000 (22:09 -0700)]
[llvm][NFC][CallSite] Remove CallSite from DeadArgumentElimination

Summary: Also capitalized some induction variables, to match coding style.

Reviewers: dblaikie, craig.topper

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Transforms] getOrEnforceKnownAlignment - fix MSVC result of 32-bit shift implicitly...
Simon Pilgrim [Tue, 21 Apr 2020 17:32:00 +0000 (18:32 +0100)]
[Transforms] getOrEnforceKnownAlignment - fix MSVC result of 32-bit shift implicitly converted to 64 bits warning. NFCI

We don't overflow here so we can use a U64 shift directly.

4 years ago[libc][Take 2] Propagate entrypoint deps to downstream targets.
Siva Chandra Reddy [Tue, 21 Apr 2020 17:10:58 +0000 (10:10 -0700)]
[libc][Take 2] Propagate entrypoint deps to downstream targets.

This reverts commit a8086ba4ac85152d8407630e56e9ee5c8b46a214.
Setting couple of target properties to an empty string was missed in the
previous commit.

4 years ago[AArch64] FMLA/FMLS patterns improvement.
Pavel Iliin [Wed, 15 Apr 2020 22:46:23 +0000 (23:46 +0100)]
[AArch64] FMLA/FMLS patterns improvement.

FMLA/FMLS f16 indexed patterns added.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45467
Removed redundant v2f32 vector_extract indexed pattern since
Instruction Selection is able to match v4f32 instead.

4 years ago[NFC][InstCombine] sub-of-negatible.ll: some more test cases
Roman Lebedev [Tue, 21 Apr 2020 17:13:57 +0000 (20:13 +0300)]
[NFC][InstCombine] sub-of-negatible.ll: some more test cases

4 years ago[libc++] Do not enable assertions in the dylib in the Apple cache
Louis Dionne [Tue, 21 Apr 2020 17:11:03 +0000 (13:11 -0400)]
[libc++] Do not enable assertions in the dylib in the Apple cache

It turns out that all this time, we've actually been building without
assertions enabled in the dylib. This commit updates the Apple CMake
cache to make it consistent with reality.

4 years ago[libc] Revert "Propagate entrypoint deps to downstream targets."
Siva Chandra Reddy [Tue, 21 Apr 2020 17:09:25 +0000 (10:09 -0700)]
[libc] Revert "Propagate entrypoint deps to downstream targets."

This reverts commit 20cb440ea210597bf223505604bb5f2220a067c6 as the
target llvmlibc seems to be failing on the bots.