platform/upstream/llvm.git
4 years ago[gn build] (manually) merge 07f8ca6ab19
Nico Weber [Tue, 5 May 2020 10:15:20 +0000 (06:15 -0400)]
[gn build] (manually) merge 07f8ca6ab19

4 years agoForgot to add a -mtriple to a test. NFC
Andrea Di Biagio [Tue, 5 May 2020 09:46:55 +0000 (10:46 +0100)]
Forgot to add a -mtriple to a test. NFC

This should unbreak the clang-ppc64be-linux buildbot.

4 years ago[clangd] NFC: Cleanup unused headers and libraries
Kirill Bobyrev [Tue, 5 May 2020 09:22:59 +0000 (11:22 +0200)]
[clangd] NFC: Cleanup unused headers and libraries

Summary: Extended version of D78843.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years agoReland D78750: [SveEmitter] Add builtins for svdupq and svdupq_lane
Sander de Smalen [Tue, 5 May 2020 08:16:57 +0000 (09:16 +0100)]
Reland D78750: [SveEmitter] Add builtins for svdupq and svdupq_lane

Edit: Changed a few CHECK lines into CHECK-DAG lines.

This reverts commit 90f3f62cb087782fe2608e95d686c29067281b6e.

4 years ago[NFC][CostModel] Add TargetCostKind to relevant APIs
Sam Parker [Tue, 28 Apr 2020 13:11:27 +0000 (14:11 +0100)]
[NFC][CostModel] Add TargetCostKind to relevant APIs

Make the kind of cost explicit throughout the cost model which,
apart from making the cost clear, will allow the generic parts to
calculate better costs. It will also allow some backends to
approximate and correlate the different costs if they wish. Another
benefit is that it will also help simplify the cost model around
immediate and intrinsic costs, where we currently have multiple APIs.

RFC thread:
http://lists.llvm.org/pipermail/llvm-dev/2020-April/141263.html

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

4 years ago[MCA] Fixed a bug where loads and stores were sometimes incorrectly marked as depeden...
Andrea Di Biagio [Mon, 4 May 2020 17:23:04 +0000 (18:23 +0100)]
[MCA] Fixed a bug where loads and stores were sometimes incorrectly marked as depedent. Fixes PR45793.

This fixes a regression introduced by a very old commit 280ac1fd1dc35 (was
llvm-svn 361950).

Commit 280ac1fd1dc35 redesigned the logic in the LSUnit with the goal of
speeding up isReady() queries, and stabilising the LSUnit API (while also making
the load store unit more customisable).

The concept of MemoryGroup (effectively an alias set) was added by that commit
to better describe and track dependencies between memory operations.  However,
that concept was not just used for alias dependencies, but it was also used for
describing memory "order" dependencies (enforced by the memory consistency
model).

Instructions of a same memory group were considered "equivalent" as in:
independent operations that can potentially execute in parallel.  The problem
was that the cost of a dependency (in terms of number of cycles) should have
been different for "order" dependency. Instructions in an order dependency
simply have to have to wait until their predecessors are "issued" to an
underlying pipeline (rather than having to wait until predecessors have beeng
fully executed). For simple "order" dependencies, this was effectively
introducing an artificial delay on the "issue" of independent loads and stores.

This patch fixes the issue and adds a new test named 'independent-load-stores.s'
to a bunch of x86 targets. That test contains the reproducible posted by Fabian
Ritter on PR45793.

I had to rerun the update-mca-tests script on several files. To avoid expected
regressions on some Exynos tests, I have added a -noalias=false flag (to match
the old strict behavior on latencies).

Some tests for processor Barcelona are improved/fixed by this change and they
now show better results.  In a few tests we were incorrectly counting the time
spent by instructions in a scheduler queue.  In one case in particular we now
correctly see a store executed out of order.  That test was affected by the same
underlying issue reported as PR45793.

Reviewers: mattd

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

4 years ago[SanitizerCoverage] Replace the unconditional store with a load, then a conditional...
Pratyai Mazumder [Tue, 5 May 2020 08:19:13 +0000 (01:19 -0700)]
[SanitizerCoverage] Replace the unconditional store with a load, then a conditional store.

Reviewers: vitalybuka, kcc

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[mlir] NFC: update ::build signature in the tutorial document
Alex Zinenko [Tue, 5 May 2020 09:22:14 +0000 (11:22 +0200)]
[mlir] NFC: update ::build signature in the tutorial document

This was missing from the original commit that changed the interface of
`::build` methods to take `OpBuilder &` instead of `Builder *.

4 years ago[WebAssembly] Fix block marker placing after fixUnwindMismatches
Heejin Ahn [Thu, 30 Apr 2020 07:09:59 +0000 (00:09 -0700)]
[WebAssembly] Fix block marker placing after fixUnwindMismatches

Summary:
This fixes a few things that are connected. It is very hard to provide
an independent test case for each of those fixes, because they are
interconnected and sometimes one masks another. The provided test case
triggers some of those bugs below but not all.

---

1. Background:
`placeBlockMarker` takes a BB, and if the BB is a destination of some
branch, it places `end_block` marker there, and computes the nearest
common dominator of all predecessors (what we call 'header') and places
a `block` marker there.

When we first place markers, we traverse BBs from top to bottom. For
example, when there are 5 BBs A, B, C, D, and E and B, D, and E are
branch destinations, if mark the BB given to `placeBlockMarker` with `*`
and draw a rectangle representing the border of `block` and `end_block`
markers, the process is going to look like
```
                       -------
           -----       |-----|
 ---       |---|       ||---||
 |A|       ||A||       |||A|||
 ---  -->  |---|  -->  ||---||
 *B        | B |       || B ||
  C        | C |       || C ||
  D        -----       |-----|
  E         *D         |  D  |
             E         -------
                         *E
```
which means when we first place markers, we go from inner to outer
scopes. So when we place a `block` marker, if the header already
contains other `block` or `try` marker, it has to belong to an inner
scope, so the existing `block`/`try` markers should go _after_ the new
marker. This was the assumption we had.

But after placing all markers we run `fixUnwindMismatches` function.
There we do some control flow transformation and create some branches,
and we call `placeBlockMarker` again to place `block`/`end_block`
markers for those newly created branches. We can't assume that we are
traversing branch destination BBs from top to bottom now because we are
basically inserting some new markers in the middle of existing markers.

Fix:
In `placeBlockMarker`, we don't have the assumption that the BB given is
in the order of top to bottom, and when placing `block` markers,
calculates whether existing `block` or `try` markers are inner or
outer scopes with respect to the current scope.

---

2. Background:
In `fixUnwindMismatches`, when there is a call whose correct unwind
destination mismatches the current destination after initially placing
`try` markers, we wrap that with a new nested `try`/`catch`/`end` and
jump to the correct handler within the new `catch`. The correct handler
code is split as a separate BB from its original EH pad so it can be
branched to. Here's an example:

- Before
```
mbb:
  call @foo       <- Unwind destination mismatch!
wrong-ehpad:
  catch
  ...
cont:
  end_try
  ...
correct-ehpad:
  catch
  [handler code]
```

- After
```
mbb:
  try                (new)
  call @foo
nested-ehpad:        (new)
  catch              (new)
  local.set n / drop (new)
  br %handleri       (new)
nested-end:          (new)
  end_try            (new)
wrong-ehpad:
  catch
  ...
cont:
  end_try
  ...
correct-ehpad:
  catch
  local.set n / drop (new)
handler:             (new)
  end_try
  [handler code]
```

Note that after this transformation, it is possible there are no calls
to actually unwind to `correct-ehpad` here. `call @foo` now
branches to `handler`, and there can be no other calls to unwind to
`correct-ehpad`. In this case `correct-ehpad` does not have any
predecessors anymore.

This can cause a bug in `placeBlockMarker`, because we may need to place
`end_block` marker in `handler`, and `placeBlockMarker` computes the
nearest common dominator of all predecessors. If one of `handler`'s
predecessor (here `correct-ehpad`) does not have any predecessors, i.e.,
no way of reaching it, we cannot correctly compute the common dominator
of predecessors of `handler`, and end up placing no `block`/`end`
markers. This bug actually sometimes masks the bug 1.

Fix:
When we have an EH pad that does not have any predecessors after this
transformation, deletes all its successors, so that its successors don't
have any dangling predecessors.

---

3. Background:
Actually the `handler` BB in the example shown in bug 2 doesn't need
`end_block` marker, despite it being a new branch destination, because
it already has `end_try` marker which can serve the same purpose. I just
put that example there for an illustration purpose. There is a case we
actually need to place `end_block` marker: when the branch dest is the
appendix BB. The appendix BB is created when there is a call that is
supposed to unwind to the caller ends up unwinding to a wrong EH pad. In
this case we also wrap the call with a nested `try`/`catch`/`end`,
create an 'appendix' BB at the very end of the function, and branch to
that BB, where we rethrow the exception to the caller.

Fix:
When we don't actually need to place block markers, we don't.

---

4. In case we fall through to the continuation BB after the catch block,
after extracting handler code in `fixUnwindMismatches` (refer to bug 2
for an example), we now have to add a branch to it to bypass the
handler.
- Before
```
try
  ...
  (falls through to 'cont')
catch
  handler body
end
              <-- cont
```

- After
```
try
  ...
  br %cont    (new)
catch
end
handler body
              <-- cont
```

The problem is, we haven't been placing a new `end_block` marker in the
`cont` BB in this case. We should, and this fixes it. But it is hard to
provide a test case that triggers this bug, because the current
compilation pipeline from .ll to .s does not generate this kind of code;
we always have a `br` after `invoke`. But code without `br` is still
valid, and we can have that kind of code if we have some pipeline
changes or optimizations later. Even mir test cases cannot trigger this
part for now, because we don't encode auxiliary EH-related data
structures (such as `WasmEHFuncInfo`) in mir now. Those functionalities
can be added later, but I don't think we should block this fix on that.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[Target][ARM] Fold or(A, B) more aggressively for I1 vectors
Pierre-vh [Fri, 1 May 2020 13:57:36 +0000 (14:57 +0100)]
[Target][ARM] Fold or(A, B) more aggressively for I1 vectors

This patch makes the folding of or(A, B) into not(and(not(A), not(B)))
more agressive for I1 vector. This only affects Thumb2 MVE and improves
codegen, because it removes a lot of msr/mrs instructions on VPR.P0.

This patch also adds a xor(vcmp) -> !vcmp fold for MVE.

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

4 years ago[Target][ARM] Add PerformVSELECTCombine for MVE Integer Ops
Pierre-vh [Tue, 7 Apr 2020 14:09:56 +0000 (15:09 +0100)]
[Target][ARM] Add PerformVSELECTCombine for MVE Integer Ops

This patch adds an implementation of PerformVSELECTCombine in the
ARM DAG Combiner that transforms vselect(not(cond), lhs, rhs) into
vselect(cond, rhs, lhs).

Normally, this should be done by the target-independent DAG Combiner,
but it doesn't handle the kind of constants that we generate, so we
have to reimplement it here.

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

4 years ago[ELF][ARM] Do not create .ARM.exidx sections for out of range inputs
Peter Smith [Sat, 2 May 2020 10:16:45 +0000 (11:16 +0100)]
[ELF][ARM] Do not create .ARM.exidx sections for out of range inputs

A linker will create .ARM.exidx sections for InputSections that don't
have them. This can cause a relocation out of range error If the
InputSection happens to be extremely far away from the other sections.
This is often the case for the vector table on older ARM CPUs as the only
two places that the table can be placed is 0 or 0xffff0000. We fix this
by removing InputSections that need a linker generated .ARM.exidx
section if that would cause an error.

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

4 years ago[ARM] MVE predcast with const test. NFC
David Green [Tue, 5 May 2020 08:26:28 +0000 (09:26 +0100)]
[ARM] MVE predcast with const test. NFC

4 years ago[LLD] [COFF] Fix a typo in an assert message. NFC.
Martin Storsjö [Tue, 5 May 2020 08:45:36 +0000 (11:45 +0300)]
[LLD] [COFF] Fix a typo in an assert message. NFC.

4 years ago[clang] Fix an uint32_t overflow in large preamble.
Haojian Wu [Tue, 5 May 2020 07:26:12 +0000 (09:26 +0200)]
[clang] Fix an uint32_t overflow in large preamble.

Summary:
I was surprised to see the LocalOffset can exceed uint32_t, but it
does happen and lead to crashes in one of our internal huge TU with a large
preamble.

with this patch, the crash is gone.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[MLIR] Add conversion from AtomicRMWOp -> GenericAtomicRMWOp.
Alexander Belyaev [Tue, 5 May 2020 06:30:30 +0000 (08:30 +0200)]
[MLIR] Add conversion from AtomicRMWOp -> GenericAtomicRMWOp.

Adding this pattern reduces code duplication. There is no need to have a
custom implementation for lowering to llvm.cmpxchg.

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

4 years ago[CodeGen] Fix warnings due to SelectionDAG::getSplatSourceVector
David Sherwood [Tue, 28 Apr 2020 14:55:34 +0000 (15:55 +0100)]
[CodeGen] Fix warnings due to SelectionDAG::getSplatSourceVector

Summary:
I have fixed several places in getSplatSourceVector and isSplatValue
to work correctly with scalable vectors. I added new support for
the ISD::SPLAT_VECTOR DAG node as one of the obvious cases we can
support with scalable vectors. In other places I have tried to do
the sensible thing, such as bail out for vector types we don't yet
support or don't intend to support.

It's not possible to add IR test cases to cover these changes, since
they are currently only ever exercised on certain targets, e.g.
only X86 targets use the result of getSplatSourceVector. I've
assumed that X86 tests already exist to test these code paths for
fixed vectors. However, I have added some AArch64 unit tests that
test the specific functions I have changed.

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

4 years ago[lit] Create one output file when `--output` is specified more than once
Julian Lettner [Tue, 5 May 2020 04:36:20 +0000 (21:36 -0700)]
[lit] Create one output file when `--output` is specified more than once

The argparse 'append' action concatenates multiple occurrences of an
argument (even when we specify `nargs=1` or `nargs='?'`).  This means
that we create multiple identical output files if the `--output`
argument is given more than once.  This isn't useful and we instead want
this to behave like a standard optional argument: last occurrence wins.

4 years ago[PDB] Move stream index tracking to GSIStreamBuilder
Reid Kleckner [Tue, 5 May 2020 03:49:26 +0000 (20:49 -0700)]
[PDB] Move stream index tracking to GSIStreamBuilder

The GSIHashStreamBuilder doesn't need to know the stream index.
Standardize the naming (Idx -> Index in public APIs).

4 years ago[MLIR] Update documentation of cmake best practices
Stephen Neuendorffer [Tue, 5 May 2020 03:32:36 +0000 (20:32 -0700)]
[MLIR] Update documentation of cmake best practices

4 years ago[MLIR] Reapply: Adjust libMLIR building to more closely follow libClang
Stephen Neuendorffer [Mon, 4 May 2020 19:41:43 +0000 (12:41 -0700)]
[MLIR] Reapply: Adjust libMLIR building to more closely follow libClang

This reverts commit ab1ca6e60fc58b857cc5030ca6e024d20d919cb9.

4 years ago[MLIR] Normalize usage of intrinsics_gen
Stephen Neuendorffer [Tue, 5 May 2020 00:11:15 +0000 (17:11 -0700)]
[MLIR] Normalize usage of intrinsics_gen

Portions of MLIR which depend on LLVMIR generally need to depend on
intrinsics_gen, to ensure that tablegen'd header files from LLVM are built
first.  Without this, we get errors, typically about llvm/IR/Attributes.inc
not being found.

Note that previously the Linalg Dialect depended on intrinsics_gen, but it
doesn't need to, since it doesn't use LLVMIR.

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

4 years ago[dsymutil] Thread the VFS through dsymutil (NFC)
Jonas Devlieghere [Tue, 5 May 2020 03:19:15 +0000 (20:19 -0700)]
[dsymutil] Thread the VFS through dsymutil (NFC)

This patch threads the virtual file system through dsymutil.

Currently there is no good way to find out exactly what files are
necessary in order to reproduce a dsymutil link, at least not without
knowledge of how dsymutil's internals.  My motivation for this change is
to add lightweight "reproducers" that automatically gather the input
object files through the FileCollectorFileSystem. The files together
with the YAML mapping will allow us to transparently reproduce a
dsymutil link, even without having to mess with the OSO path prefix.

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

4 years ago[mlir] Add support for merging identical blocks during canonicalization
River Riddle [Tue, 5 May 2020 02:54:36 +0000 (19:54 -0700)]
[mlir] Add support for merging identical blocks during canonicalization

This revision adds support for merging identical blocks, or those with the same operations that branch to the same successors. Operands that mismatch between the different blocks are replaced with new block arguments added to the merged block.

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

4 years ago[mlir] Remove tabs from predecessor comments
Geoffrey Martin-Noble [Tue, 5 May 2020 01:30:48 +0000 (01:30 +0000)]
[mlir] Remove tabs from predecessor comments

This change removes tabs from the comments printed by the asmprinter after basic
block declarations in favor of two spaces. This is currently the only place in
the printed IR that uses tabs.

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

4 years ago[CallGraphUpdater] Removed references to calles when deleting function
Sergey Dmitriev [Tue, 5 May 2020 01:58:59 +0000 (18:58 -0700)]
[CallGraphUpdater] Removed references to calles when deleting function

Summary: Otherwise we can get unaccounted references to call graph nodes.

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[CUDA][HIP] Fix empty ctor/dtor check for union
Yaxun (Sam) Liu [Mon, 4 May 2020 21:27:41 +0000 (17:27 -0400)]
[CUDA][HIP] Fix empty ctor/dtor check for union

union ctor does not call ctors of its data members. union dtor does not call dtors of its data members.
Also union does not have base class.

Currently when clang checks whether union has an empty ctor/dtor, it checks the ctors/dtors of its
data members. This causes incorrectly diagnose device side global variables and shared variables as
having non-empty ctors/dtors.

This patch fixes that.

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

4 years ago[LTO] Suppress emission of empty combined module by default
Zakk Chen [Tue, 28 Apr 2020 03:04:36 +0000 (20:04 -0700)]
[LTO] Suppress emission of empty combined module by default

Summary:
That unless the user requested an output object (--lto-obj-path), the an
unused empty combined module is not emitted.

This changed is helpful for some target (ex. RISCV-V) which encoded the
ABI info in IR module flags (target-abi). Empty unused module has no ABI
info so the linker would get the linking error during merging
incompatible ABIs.

Reviewers: tejohnson, espindola, MaskRay

Subscribers: emaste, inglorion, arichardson, hiraditya, simoncook, MaskRay, steven_wu, dexonsmith, PkmX, dang, lenary, s.egerton, luismarques, llvm-commits

Tags: #llvm

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

4 years agoClarify comment
Adrian Prantl [Tue, 5 May 2020 01:14:55 +0000 (18:14 -0700)]
Clarify comment

4 years ago[mlir][EDSC] Fix off-by-one BlockBuilder insertion point.
Nicolas Vasilache [Mon, 4 May 2020 20:36:47 +0000 (16:36 -0400)]
[mlir][EDSC] Fix off-by-one BlockBuilder insertion point.

Summary:
In the particular case of an insertion in a block without a terminator, the BlockBuilder insertion point should be block->end().

Adding a unit test to exercise this.

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

4 years ago[mlir][IR] Add a Region::getOps method that returns a range of immediately nested...
River Riddle [Tue, 5 May 2020 00:46:06 +0000 (17:46 -0700)]
[mlir][IR] Add a Region::getOps method that returns a range of immediately nested operations

This allows for walking the operations nested directly within a region, without traversing nested regions.

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

4 years ago[mlir][mlir-opt] Disable multithreading when parsing the input module.
River Riddle [Mon, 4 May 2020 18:21:49 +0000 (11:21 -0700)]
[mlir][mlir-opt] Disable multithreading when parsing the input module.

This removes the unnecessary/costly context synchronization when parsing, as the context is guaranteed to not be used by any other threads.

4 years agoUpdate LLDB filespec tests for remove_dots change
Reid Kleckner [Tue, 5 May 2020 00:24:59 +0000 (17:24 -0700)]
Update LLDB filespec tests for remove_dots change

It looks like the new implementation is correct, since there were TODOs
here about getting the new behavior.

I am not sure if "C:..\.." should become "C:" or "C:\", though. The new
output doesn't precisely match the TODO message, but it seems
appropriate given the specification of remove_dots and how .. traversals
work at the root directory.

4 years ago[ORC] Rename SearchOrder operations on JITDylib to LinkOrder.
Lang Hames [Mon, 4 May 2020 23:43:42 +0000 (16:43 -0700)]
[ORC] Rename SearchOrder operations on JITDylib to LinkOrder.

Refering to the link order of a dylib better matches the terminology used in
static compilation. As upcoming patches will increase the number of places where
link order matters (for example when closing JITDylibs) it's better to get this
name change out of the way early.

4 years agoRe-land "Optimize path::remove_dots"
Reid Kleckner [Mon, 4 May 2020 23:23:48 +0000 (16:23 -0700)]
Re-land "Optimize path::remove_dots"

This reverts commit fb5fd74685e728b1d5e68d33e9842bcd734b98e6.
Re-instates commit 53913a65b408ade2956061b4c0aaed6bba907403

The fix is to trim off trailing separators, as in `/foo/bar/` and
produce `/foo/bar`. VFS tests rely on this. I added unit tests for
remove_dots.

4 years ago[PDB] Use the global BumpPtrAllocator
Reid Kleckner [Mon, 4 May 2020 23:05:12 +0000 (16:05 -0700)]
[PDB] Use the global BumpPtrAllocator

Profiling shows that time is spent destroying the allocator member of
PDBLinker, and that is unneeded.

4 years ago[mlir][StandardToSPIRV] Emulate bitwidths not supported for store op.
Hanhan Wang [Mon, 4 May 2020 22:13:46 +0000 (15:13 -0700)]
[mlir][StandardToSPIRV] Emulate bitwidths not supported for store op.

Summary:
As D78974, this patch implements the emulation for store op. The emulation is
done with atomic operations. E.g., if the storing value is i8, rewrite the
StoreOp to:

 1) load a 32-bit integer
 2) clear 8 bits in the loading value
 3) store 32-bit value back
 4) load a 32-bit integer
 5) modify 8 bits in the loading value
 6) store 32-bit value back

The step 1 to step 3 are done by AtomicAnd as one atomic step, and the step 4
to step 6 are done by AtomicOr as another atomic step.

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

4 years ago[mlir] Support big endian in DenseElementsAttr
Haruki Imai [Mon, 4 May 2020 17:59:48 +0000 (17:59 +0000)]
[mlir] Support big endian in DenseElementsAttr

This std::copy_n copies 8 byte data (APInt raw data) by 1 byte from the
beginning of char array. This is no problem in little endian, but the
data is not copied correctly in big endian because the data should be
copied from the end of the char array.

- Example of 4 byte data (such as float32)

Little endian (First 4 bytes):
Address | 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
Data    | 0xcd 0xcc 0x8c 0x3f 0x00 0x00 0x00 0x00

Big endian (Last 4 bytes):
Address | 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
Data    | 0x00 0x00 0x00 0x00 0x3f 0x8c 0xcc 0xcd

In general, when it copies N(N<8) byte data in big endian, the start
address should be incremented by (8 - N) bytes.
The original code has no problem when it includes 8 byte data(such as
 double) even in big endian.

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

4 years ago[lld-macho] Support X86_64_RELOC_SIGNED_{1,2,4}
Fangrui Song [Mon, 4 May 2020 02:25:30 +0000 (19:25 -0700)]
[lld-macho] Support X86_64_RELOC_SIGNED_{1,2,4}

We currently only support extern relocations.
`X86_64_RELOC_SIGNED_{1,2,4}` are like X86_64_RELOC_SIGNED, but with the
implicit addend fixed to 1, 2, and 4, respectively.
See the comment in `lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp RecordX86_64Relocation`.

Reviewed By: int3

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

4 years ago[RegisterCoalescer] Extend a subrange if needed when filling range gap
Krzysztof Parzyszek [Wed, 15 Apr 2020 22:09:17 +0000 (17:09 -0500)]
[RegisterCoalescer] Extend a subrange if needed when filling range gap

Register live ranges may have had gaps that after coalescing should be
removed. This is done by adding a new segment to the range, and merging
it with neighboring segments. When doing so, do not assume that each
subrange of the register ended at the same index. If a subrange ended
earlier, adding this segment could make the live range invalid.
Instead, if the subrange is not live at the start of the segment,
extend it first.

4 years ago[lldb/Expression] Make Language() const, NFC
Vedant Kumar [Mon, 4 May 2020 19:59:39 +0000 (12:59 -0700)]
[lldb/Expression] Make Language() const, NFC

Allow Language() to be called from const methods within UserExpression.

4 years ago[lldb] Fix -Wdtor-name warnings
Jonas Devlieghere [Mon, 4 May 2020 21:31:38 +0000 (14:31 -0700)]
[lldb] Fix -Wdtor-name warnings

Fix warning: ISO C++ requires the name after '::~' to be found in the
same scope as the name before '::~' [-Wdtor-name]

4 years ago[x86] add test for shift+op+concat; NFC
Sanjay Patel [Mon, 4 May 2020 21:26:54 +0000 (17:26 -0400)]
[x86] add test for shift+op+concat; NFC

D79360 could change this kind of sequence.

4 years ago[arm64] Remove an old special case that's not needed anymore.
Davide Italiano [Mon, 4 May 2020 21:16:17 +0000 (14:16 -0700)]
[arm64] Remove an old special case that's not needed anymore.

Debug info generation & codegen now steps onto the correct line.

4 years ago[cmake] restrict object library dependency generation to PUBLIC libraries
Stephen Neuendorffer [Mon, 4 May 2020 21:08:23 +0000 (14:08 -0700)]
[cmake] restrict object library dependency generation to PUBLIC libraries

Previous patch broken flang, which has some yet-to-be resolved cyclic
dependencies.   This patch fixes the breakage by restricting the dependencies
which are generated to public libraries, which is probably more sensible anyway.

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

4 years ago[lldb/DataFormatters] Delete GetStringPrinterEscapingHelper
Vedant Kumar [Thu, 9 Apr 2020 23:53:58 +0000 (16:53 -0700)]
[lldb/DataFormatters] Delete GetStringPrinterEscapingHelper

Summary:
Languages can have different ways of formatting special characters.
E.g. when debugging C++ code a string might look like "\b", but when
debugging Swift code the same string would look like "\u{8}".

To make this work, plugins override GetStringPrinterEscapingHelper.
However, because there's a large amount of subtly divergent work done in
each override, we end up with large amounts of duplicated code. And all
the memory smashers fixed in one copy of the logic (see D73860) don't
get fixed in the others.

IMO the GetStringPrinterEscapingHelper is overly general and hard to
use. I propose deleting it and replacing it with an EscapeStyle enum,
which can be set as needed by each plugin.

A fix for some swift-lldb memory smashers falls out fairly naturally
from this deletion (https://github.com/apple/llvm-project/pull/1046). As
the swift logic becomes really tiny, I propose moving it upstream as
part of this change. I've added unit tests to cover it.

rdar://61419673

Reviewers: JDevlieghere, davide

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

4 years agoRevert "[lldb/Expression] Make Language() const, NFC"
Vedant Kumar [Mon, 4 May 2020 21:03:22 +0000 (14:03 -0700)]
Revert "[lldb/Expression] Make Language() const, NFC"

This reverts commit 88d9e4326f48041056c4db3506d30574c6e1d83c. Revert an
accidental commit.

4 years ago[lldb/Expression] Make Language() const, NFC
Vedant Kumar [Mon, 4 May 2020 19:59:39 +0000 (12:59 -0700)]
[lldb/Expression] Make Language() const, NFC

Allow Language() to be called from const methods within UserExpression.

4 years ago[Verifier] Constrain where DILocations may be nested
Vedant Kumar [Fri, 1 May 2020 04:38:11 +0000 (21:38 -0700)]
[Verifier] Constrain where DILocations may be nested

Summary:
Constrain which metadata nodes are allowed to be, or contain,
DILocations. This ensures that logic for updating DILocations in a
Module is complete.

Currently, !llvm.loop metadata is the only odd duck which contains
nested DILocations. This has caused problems in the past: some passes
forgot to visit the nested locations, leading to subtly broken debug
info and late verification failures.

If there's a compelling reason for some future metadata to nest
DILocations, we'll need to introduce a generic API for updating the
locations attached to an Instruction before relaxing this check.

Reviewers: aprantl, dsanders

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[LLDB] Fix overloaded operator new cases in TestCppOperators.py which currently work...
shafik [Mon, 4 May 2020 20:46:31 +0000 (13:46 -0700)]
[LLDB] Fix overloaded operator new cases in TestCppOperators.py which currently work by accident

The overloaded new operator in TestCppOperators.py are working by accident because of how
we currently deal with artificial methods.

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

4 years ago[ARM] Complex LSR test showing inefficient codegen. NFC
David Green [Mon, 4 May 2020 17:14:30 +0000 (18:14 +0100)]
[ARM] Complex LSR test showing inefficient codegen. NFC

4 years agoTry to make `duplicate_os_log_reports.cpp` more reliable.
Dan Liew [Mon, 4 May 2020 20:47:00 +0000 (13:47 -0700)]
Try to make `duplicate_os_log_reports.cpp` more reliable.

It looks like some bots are failing with os log not giving any
output. This might be due to the system under test being heavy
load so the 2 minute window might not be large enough. This
patch makes the window larger in the hope that this test will
be more reliable.

rdar://problem/62141527

4 years agoRevert "[SveEmitter] Add builtins for svdupq and svdupq_lane"
Sander de Smalen [Mon, 4 May 2020 20:31:45 +0000 (21:31 +0100)]
Revert "[SveEmitter] Add builtins for svdupq and svdupq_lane"

It seems this patch broke some buildbots, so reverting until I
have had a chance to investigate.

This reverts commit 6b90a6887d25e3375bb916a3ed09f7ccec819d0c.

4 years agoReject operations between vectors and enum types.
Erich Keane [Mon, 4 May 2020 20:09:28 +0000 (13:09 -0700)]
Reject operations between vectors and enum types.

There are some lookup oddities with these as reported in PR45780, and
GCC doesn't support these behaviors at all.  To be more consistent with
GCC and prevent the crashes caused by our lookup issues, nip the problem
in the bud and prohibit enums here.

4 years ago[lit] Disable test on Windows
Julian Lettner [Mon, 4 May 2020 20:06:56 +0000 (13:06 -0700)]
[lit] Disable test on Windows

abhinavgaba reported that that the custom-result-category.py test hangs
on a Windows build bot [1].  Disable it for now.

[1] https://reviews.llvm.org/D78164#2018178

4 years ago[JITLink] Fix missing ADDITIONAL_HEADER_DIRS for the LLVMJITLink component.
Lang Hames [Mon, 4 May 2020 19:13:26 +0000 (12:13 -0700)]
[JITLink] Fix missing ADDITIONAL_HEADER_DIRS for the LLVMJITLink component.

Also adds target_link_libraries.

Thanks to @jcmac for spotting this.

4 years ago[JITLink] Fix a typo in a comment.
Lang Hames [Mon, 4 May 2020 19:12:40 +0000 (12:12 -0700)]
[JITLink] Fix a typo in a comment.

Thanks to @jcmac for pointing this out.

4 years agoRevert "[MLIR] Adjust libMLIR building to more closely follow libClang"
Stephen Neuendorffer [Mon, 4 May 2020 19:38:45 +0000 (12:38 -0700)]
Revert "[MLIR] Adjust libMLIR building to more closely follow libClang"

This reverts commit 4f0f436749c264c16eb226c9b9b132e07e3650a6.

This seems to show some compile dependence problems, and also breaks flang.

4 years ago[SveEmitter] Add builtins for svdupq and svdupq_lane
Sander de Smalen [Mon, 4 May 2020 19:17:57 +0000 (20:17 +0100)]
[SveEmitter] Add builtins for svdupq and svdupq_lane

* svdupq builtins that duplicate scalars to every quadword of a vector
  are defined using builtins for svld1rq (load and replicate quadword).
* svdupq builtins that duplicate boolean values to fill a predicate vector
  are defined using `svcmpne`.

Reviewers: SjoerdMeijer, efriedma, ctetreau

Reviewed By: efriedma

Tags: #clang

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

4 years ago[ARM] Fix tail call validity checking for varargs calls.
Eli Friedman [Thu, 30 Apr 2020 00:44:11 +0000 (17:44 -0700)]
[ARM] Fix tail call validity checking for varargs calls.

If a varargs function is calling a non-varargs function, or vice versa,
make sure we use the correct "varargs" bit for each.

Fixes https://bugs.llvm.org/show_bug.cgi?id=45234

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

4 years ago[x86] add tests for concat of casts; NFC
Sanjay Patel [Mon, 4 May 2020 19:09:10 +0000 (15:09 -0400)]
[x86] add tests for concat of casts; NFC

4 years agoDescriptive symbol names for machine basic block sections.
Snehasish Kumar [Mon, 4 May 2020 19:02:57 +0000 (19:02 +0000)]
Descriptive symbol names for machine basic block sections.

Today symbol names generated for machine basic block sections use a
unary encoding to reduce bloat. This is essential when every basic block
in the binary is assigned a symbol however with basic block clusters
(rG05192e585ce175b55f2a26b83b4ed7882785c8e6) when we only need to
generate a few non-temporary symbols we can assign more descriptive
names making them more user friendly. With this change -

Cold cluster section for function foo is named "foo.cold"
Exception cluster section for function foo is named "foo.eh"
Other cluster sections identified by their ids are named "foo.ID"
Using this format works well with existing tools. It will demangle as
expected and works with existing symbolizers, profilers and debuggers
out of the box.

$ c++filt _Z3foov.cold
foo() [clone .cold]

$ c++filt _Z3foov.eh
foo() [clone .eh]

$c++filt _Z3foov.1234
foo() [clone 1234]

Tests for basicblock-sections are updated with some cleanup where
appropriate.

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

4 years ago[flang] Fix x87 binary->decimal
peter klausler [Mon, 4 May 2020 18:41:39 +0000 (11:41 -0700)]
[flang] Fix x87 binary->decimal

Summary:
Fix decimal formatting of 80-bit x87 values; the calculation ofnearest neighbor values failed to account for the explicitmost significant bit in that format.

Replace MultiplyByRounded with MultiplyBy in binary->decimal conversions,
since rounding won't happen and the name was misleading; then remove
dead code, and migrate LoseLeastSignificantDigit() from one source file
to another where it's still needed.

Reviewers: tskeith, sscalpone, jdoerfert, DavidTruby

Reviewed By: tskeith

Subscribers: llvm-commits, flang-commits

Tags: #flang, #llvm

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

4 years ago[llvm-objdump][ARM] Print inline relocations when dumping ARM data
Fangrui Song [Sat, 2 May 2020 05:52:42 +0000 (22:52 -0700)]
[llvm-objdump][ARM] Print inline relocations when dumping ARM data

Fixes PR44357

For ARM ELF, regions covered by data mapping symbols `$d` are dumped as `.byte`, `.short` or `.word` but inline relocations are not printed. This patch merges its loop into the normal instruction printing loop so that inline relocations are printed.

Reviewed By: nickdesaulniers

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

4 years ago[SveEmitter] Add builtins for Int & FP reductions
Sander de Smalen [Mon, 4 May 2020 16:58:49 +0000 (17:58 +0100)]
[SveEmitter] Add builtins for Int & FP reductions

This patch adds integer builtins for:
- svaddv, svandv, sveorv,
  svmaxv, svminv, svorv.

And FP builtins for:
- svadda, svaddv, svmaxv, svmaxnmv,
  svminv, svminnmv

4 years ago[MLIR] Adjust libMLIR building to more closely follow libClang
Valentin Churavy [Thu, 23 Apr 2020 23:41:14 +0000 (16:41 -0700)]
[MLIR] Adjust libMLIR building to more closely follow libClang

- Exports MLIR targets to be used out-of-tree.
- mimicks `add_clang_library` and `add_flang_library`.
- Fixes libMLIR.so

After https://reviews.llvm.org/D77515 libMLIR.so was no longer containing
any object files. We originally had a cludge there that made it work with
the static initalizers and when switchting away from that to the way the
clang shlib does it, I noticed that MLIR doesn't create a `obj.{name}` target,
and doesn't export it's targets to `lib/cmake/mlir`.

This is due to MLIR using `add_llvm_library` under the hood, which adds
the target to `llvmexports`.

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

[MLIR] Fix libMLIR.so and LLVM_LINK_LLVM_DYLIB

Primarily, this patch moves all mlir references to LLVM libraries into
either LLVM_LINK_COMPONENTS or LINK_COMPONENTS.  This enables magic in
the llvm cmake files to automatically replace reference to LLVM components
with references to libLLVM.so when necessary.  Among other things, this
completes fixing libMLIR.so, which has been broken for some configurations
since D77515.

Unlike previously, the pattern is now that mlir libraries should almost
always use add_mlir_library.  Previously, some libraries still used
add_llvm_library.  However, this confuses the export of targets for use
out of tree because libraries specified with add_llvm_library are exported
by LLVM.  Instead users which don't need/can't be linked into libMLIR.so
can specify EXCLUDE_FROM_LIBMLIR

A common error mode is linking with LLVM libraries outside of LINK_COMPONENTS.
This almost always results in symbol confusion or multiply defined options
in LLVM when the same object file is included as a static library and
as part of libLLVM.so.  To catch these errors more directly, there's now
mlir_check_all_link_libraries.

To simplify usage of add_mlir_library, we assume that all mlir
libraries depend on LLVMSupport, so it's not necessary to separately specify
it.

tested with:
BUILD_SHARED_LIBS=on,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB,
BUILD_SHARED_LIBS=off + LLVM_BUILD_LLVM_DYLIB + LLVM_LINK_LLVM_DYLIB.

By: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Differential Revision: https://reviews.llvm.org/D79067

[MLIR] Move from using target_link_libraries to LINK_LIBS

This allows us to correctly generate dependencies for derived targets,
such as targets which are created for object libraries.

By: Stephen Neuendorffer <stephen.neuendorffer@xilinx.com>
Differential Revision: https://reviews.llvm.org/D79243

Three commits have been squashed to avoid intermediate build breakage.

4 years ago[libc] Include object files from alias entrypoints also in entrypoint libraries.
Siva Chandra Reddy [Thu, 30 Apr 2020 17:46:49 +0000 (10:46 -0700)]
[libc] Include object files from alias entrypoints also in entrypoint libraries.

Reviewers: abrachet

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

4 years agoA test commit as a new contributor to verify commit access is OK.
Denys Petrov [Mon, 4 May 2020 18:36:18 +0000 (21:36 +0300)]
A test commit as a new contributor to verify commit access is OK.

4 years ago[PowerPC][AIX][NFC] Remove spills and reloads from arg passing test.
Sean Fertile [Fri, 1 May 2020 17:40:52 +0000 (13:40 -0400)]
[PowerPC][AIX][NFC] Remove spills and reloads from arg passing test.

4 years ago[ARM] isHardwareLoopProfitable debug messages. NFC
David Green [Sat, 2 May 2020 21:29:57 +0000 (22:29 +0100)]
[ARM] isHardwareLoopProfitable debug messages. NFC

4 years ago[DebugInfo][CodeView] Include namespace into emitted globals
Alexandre Ganea [Mon, 4 May 2020 17:13:19 +0000 (13:13 -0400)]
[DebugInfo][CodeView] Include namespace into emitted globals

Before this patch, global variables didn't have their namespace prepended in the Codeview debug symbol stream. This prevented Visual Studio from displaying them in the debugger (they appeared as 'unspecified error')

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

4 years ago[libc++] Always enable local submodule visibility in the test suite
Louis Dionne [Mon, 4 May 2020 17:01:39 +0000 (13:01 -0400)]
[libc++] Always enable local submodule visibility in the test suite

When building with modules, always enable local submodule visibility.
It used to be disabled on Apple platforms, but it seems like we want
to use the same flags on Apple and Linux now (see https://reviews.llvm.org/D74892).

4 years ago[lldb/test] Fix wrong target command failure message on Windows
Med Ismail Bennani [Mon, 4 May 2020 17:17:10 +0000 (19:17 +0200)]
[lldb/test] Fix wrong target command failure message on Windows

This patch fixes the test failure happening on Windows introduced by
`015117411e11458f9816ba4359246132164a4297`.

Since the failure message comes from the OS, the test needs to support both
UNIX and Windows messages.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years agoTest commit. Modified comment to add a period at the end.
Zarko [Mon, 4 May 2020 17:06:21 +0000 (13:06 -0400)]
Test commit. Modified comment to add a period at the end.

4 years ago[llvm][dfsan][NFC] Factor out fcn initialization
Zola Bridges [Sat, 2 May 2020 23:53:34 +0000 (16:53 -0700)]
[llvm][dfsan][NFC] Factor out fcn initialization

Summary:
Moving these function initializations into separate functions makes it easier
to read the runOnModule function. There is also precedent in the sanitizer code:
asan has a function ModuleAddressSanitizer::initializeCallbacks(Module &M). I
thought it made sense to break the initializations into two sets. One for the
compiler runtime functions and one for the event callbacks.

Tested with: check-all

Reviewed By: morehouse

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

4 years ago[libc++] NFC: Remove unnecessary scope
Louis Dionne [Mon, 4 May 2020 16:31:17 +0000 (12:31 -0400)]
[libc++] NFC: Remove unnecessary scope

The double-braces were initially to escape Python string formatting, but
that string isn't sent through Python string formatting.

4 years agoLet clang print registered targets for --version
Yaxun (Sam) Liu [Thu, 30 Apr 2020 21:41:54 +0000 (17:41 -0400)]
Let clang print registered targets for --version

We need a way to know supported targets by clang since
people may use clang as assembler and they want to
choose the clang which supports their target.

This patch let clang print registered targets when
--version option is passed to clang.

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

4 years ago[libc++] Translate the modules-support Lit feature to the DSL
Louis Dionne [Fri, 17 Apr 2020 18:04:04 +0000 (14:04 -0400)]
[libc++] Translate the modules-support Lit feature to the DSL

4 years ago[AMDGPU] fix copies between 32 and 16 bit
Stanislav Mekhanoshin [Wed, 29 Apr 2020 20:00:51 +0000 (13:00 -0700)]
[AMDGPU] fix copies between 32 and 16 bit

This a hack to fix illegal 32 to 16 bit copies.
The problem is when we make 16 bit subregs legal it creates
a huge amount of failures which can only be resolved at once
without a temporary hack like this.

The next step is to change operands, instruction definitions
and patterns until this hack is not needed.

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

4 years ago[cmake] Ensure that LINK_LIBS are dependencies for object library targets
Stephen Neuendorffer [Fri, 1 May 2020 00:16:59 +0000 (17:16 -0700)]
[cmake] Ensure that LINK_LIBS are dependencies for object library targets

In MLIR, it is common for automatically generated headers to be included
in many places.  To avoid tracking these dependencies explicitly in
cmake, they are treated as part of a library which 'owns' the generated
header.  Users of the generated header link against the owning library.
However, object libraries don't actually 'link', so this dependence gets
lost.  This patch adds an explicit dependence for these generated headers
when creating object library targets to ensure that generated headers
are appropriately generated

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

4 years ago[libc++] NFC: Remove outdated #if comment
Louis Dionne [Mon, 4 May 2020 15:39:16 +0000 (11:39 -0400)]
[libc++] NFC: Remove outdated #if comment

4 years ago[SVE] Remove invalid usage of getNumElements in Instructions
Christopher Tetreault [Mon, 4 May 2020 15:29:08 +0000 (08:29 -0700)]
[SVE] Remove invalid usage of getNumElements in Instructions

Summary:
Remove invalid usage of VectorType::getNumElements in
ShuffleVectorInst::isValidOperands identified by test case
llvm::Analysis/ConstantFolding/vscale-shufflevector.ll. The tested
conditions hold for both fixed width and scalable vectors; use
getElementCount().

Reviewers: efriedma, sdesmalen, c-rhodes, spatel

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[lldb/Host] Improve error messages on unowned read files
Med Ismail Bennani [Thu, 23 Apr 2020 13:43:54 +0000 (15:43 +0200)]
[lldb/Host] Improve error messages on unowned read files

When trying to read a core file that is not owned by the user running lldb
and that doesn't have read permission on the file, lldb shows a misleading
error message:

```
Unable to find process plug-in for core file
```

This is due to the fact that currently, lldb doesn't check the file
ownership. And when trying to to open and read a core file, the syscall
fails, which prevents a process to be created.

Since lldb already have a portable `open` syscall interface, lets take
advantage of that and delegate the error handling to the syscall
itself. This way, no matter if the file exists or if the user has proper
ownership, lldb will always try to open the file, and behave accordingly
to the error code returned.

rdar://42630030

https://reviews.llvm.org/D78712

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[mlir][Linalg] Mostly NFC - Refactor Linalg patterns and transformations.
Nicolas Vasilache [Sat, 2 May 2020 05:03:37 +0000 (01:03 -0400)]
[mlir][Linalg] Mostly NFC - Refactor Linalg patterns and transformations.

Linalg transformations are currently exposed as DRRs.
Unfortunately RewriterGen does not play well with the line of work on named linalg ops which require variadic operands and results.
Additionally, DRR is arguably not the right abstraction to expose compositions of such patterns that don't rely on SSA use-def semantics.

This revision abandons DRRs and exposes manually written C++ patterns.

Refactorings and cleanups are performed to uniformize APIs.
This refactoring will allow replacing the currently manually specified Linalg named ops.

A collateral victim of this refactoring is the `tileAndFuse` DRR, and the one associated test, which will be revived at a later time.

Lastly, the following 2 tests do not add value and are altered:
- a dot_perm tile + interchange test does not test anything new and is removed
- a dot tile + lower to loops does not need 2-D tiling and is trimmed.

4 years ago[ELF] Don't advance sh_offset for an empty section whose PT_LOAD is removed (due...
Fangrui Song [Fri, 1 May 2020 16:50:37 +0000 (09:50 -0700)]
[ELF] Don't advance sh_offset for an empty section whose PT_LOAD is removed (due to p_memsz=0)

removeEmptyPTLoad() removes empty (p_memsz=0) PT_LOAD segments.  In
assignFileOffsets(), setFileOffset() unnecessarily advances file offsets
for containing empty sections.

This is exposed by arm Linux kernel's multi_v5_defconfig
(see https://bugs.llvm.org/show_bug.cgi?id=45632)

```
ld.lld (max-page-size=65536):
  [34] .init.data        PROGBITS        c0c24000 c34000 0128ac 00  WA  0   0 4096
  [35] .text_itcm        PROGBITS        fffe0000 c50000 000000 00  WA  0   0  1
  [36] .data_dtcm        PROGBITS        fffe8000 c58000 000000 00  WA  0   0  1
  [37] .data             PROGBITS        c0c38000 c58000 0647a0 00  WA  0   0 32

arm-linux-gnueabi-ld (max-page-size=65536):
  [23] .init.data        PROGBITS        c0c12000 c22000 0128ac 00  WA  0   0 4096
  [24] .text_itcm        PROGBITS        fffe0000 ca2558 000000 00   W  0   0  1
  [25] .data_dtcm        PROGBITS        fffe8000 ca2558 000000 00   W  0   0  1
  [26] .data             PROGBITS        c0c26000 c36000 0647a0 00  WA  0   0 32
```

This patch clears OutputSection::ptLoad if ptLoad is removed by
removeEmptyPTLoad(). Conceptually this removes "dangling" references.

Reviewed By: psmith

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

4 years ago[libc++] Translate compiler-identification Lit features to the new DSL
Louis Dionne [Fri, 17 Apr 2020 18:00:39 +0000 (14:00 -0400)]
[libc++] Translate compiler-identification Lit features to the new DSL

4 years ago[flang] Fixed a crash
Pete Steinfeld [Sat, 2 May 2020 03:47:59 +0000 (20:47 -0700)]
[flang] Fixed a crash

Summary:
I found a small test case that caused a crash when derived type
definitions have parameters without definitions.

Reviewers: tskeith, klausler, DavidTruby

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoFix LABEL match for test case for D72841 #pragma float_control
Melanie Blower [Mon, 4 May 2020 14:25:23 +0000 (07:25 -0700)]
Fix LABEL match for test case for D72841 #pragma float_control

4 years ago[InstCombine] Fold (mul(abs(x),abs(x))) -> (mul(x,x)) (PR39476)
Simon Pilgrim [Mon, 4 May 2020 14:21:52 +0000 (15:21 +0100)]
[InstCombine] Fold (mul(abs(x),abs(x))) -> (mul(x,x)) (PR39476)

This patch adds support for discarding integer absolutes (abs + nabs variants) from self-multiplications.

ABS Alive2: http://volta.cs.utah.edu:8080/z/rwcc8W
NABS Alive2: http://volta.cs.utah.edu:8080/z/jZXUwQ

This is an InstCombine version of D79304 - I'm not sure yet if we'll need that after this.

Reviewed By: @lebedev.ri and @xbolva00

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

4 years ago[X86][SSE] Move some VZEXT_MOVL combines into combineTargetShuffle. NFC.
Simon Pilgrim [Mon, 4 May 2020 14:03:50 +0000 (15:03 +0100)]
[X86][SSE] Move some VZEXT_MOVL combines into combineTargetShuffle. NFC.

Minor cleanup of combineShuffle by moving some of the low hanging fruit (load + scalar_to_vector folds).

4 years ago[libc++] NFC: Print Lit available features in sorted order
Louis Dionne [Mon, 4 May 2020 14:11:49 +0000 (10:11 -0400)]
[libc++] NFC: Print Lit available features in sorted order

This makes it easier to diff them between bot runs.

4 years ago[MLIR] Add complex numbers to standard dialect
Frederik Gossen [Mon, 4 May 2020 12:19:04 +0000 (12:19 +0000)]
[MLIR] Add complex numbers to standard dialect

Add `CreateComplexOp`, `ReOp`, and `ImOp` to the standard dialect.
This is the first step to support complex numbers.

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

4 years ago[COFF] Avoid allocating temporary vectors during ICF
Reid Kleckner [Sat, 2 May 2020 20:28:56 +0000 (13:28 -0700)]
[COFF] Avoid allocating temporary vectors during ICF

Heap profiling with ETW shows that LLD performs 4,053,721 heap
allocations over its lifetime, and ~800,000 of them come from
assocEquals. These vectors are created just to do a comparison, so fuse
the comparison into the loop and avoid the allocation.

ICF is overall a small portion of the time spent linking, and I did not
measure overall throughput improvements from this change above the noise
threshold. However, these show up in the heap profiler, and the work is
done, so we might as well land it if the code is clear enough.

Reviewed By: hans

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

4 years ago[SelectionDAGBuilder] Stop setting alignment to one for hidden sret values
Alex Richardson [Fri, 29 Mar 2019 12:13:56 +0000 (12:13 +0000)]
[SelectionDAGBuilder] Stop setting alignment to one for hidden sret values

We allocated a suitably aligned frame index so we know that all the values
have ABI alignment.
For MIPS this avoids using pair of lwl + lwr instructions instead of a
single lw. I found this when compiling CHERI pure capability code where
we can't use the lwl/lwr unaligned loads/stores and and were to falling
back to a byte load + shift + or sequence.

This should save a few instructions for MIPS and possibly other backends
that don't have fast unaligned loads/stores.
It also improves code generation for CodeGen/X86/pr34653.ll and
CodeGen/WebAssembly/offset.ll since they can now use aligned loads.

Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D78999

4 years ago[MIPS] Add a baseline test showing current inefficient hidden sret lowering
Alex Richardson [Fri, 29 Mar 2019 12:06:40 +0000 (12:06 +0000)]
[MIPS] Add a baseline test showing current inefficient hidden sret lowering

SelectionDAGBuilder currently doesn't propagate the known alignment of
the sret parameter. This is inefficient for MIPS and highly inefficient for
our out-of-tree CHERI-extended MIPS since we don't have lwl/lwr so fall back
to byte loads for align == 1.

4 years ago[AMDGPU] Enable carry out ADD/SUB operations divergence driven instruction selection.
alex-t [Thu, 23 Apr 2020 17:55:36 +0000 (20:55 +0300)]
[AMDGPU] Enable carry out ADD/SUB operations divergence driven instruction selection.

Summary: This change enables all kind of carry out ISD opcodes to be selected according to the node divergence.

Reviewers: rampitec, arsenm, vpykhtin

Reviewed By: rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

4 years ago[lldb/DWARF] Remove dead code in DWARFDebugInfoEntry
Pavel Labath [Mon, 4 May 2020 13:18:59 +0000 (15:18 +0200)]
[lldb/DWARF] Remove dead code in DWARFDebugInfoEntry

The dumping code is not used by anyone, and is a source of
inconsistencies with the llvm dwarf parser, as dumping is implemented at
a different level (DWARFDie) there.

4 years ago[ELF] Move SHF_LINK_ORDER till OutputSection addresses are known
Peter Smith [Wed, 22 Apr 2020 19:28:52 +0000 (20:28 +0100)]
[ELF] Move SHF_LINK_ORDER till OutputSection addresses are known

Sections with the SHF_LINK_ORDER flag must be ordered in the same relative
order as the Sections they have a link to. When using a linker script an
arbitrary expression may be used for the virtual address of the
OutputSection. In some cases the virtual address does not monotonically
increase as the OutputSection index increases, so if we base the ordering
of the SHF_LINK_ORDER sections on the index then we can get the order
wrong. We fix this by moving SHF_LINK_ORDER resolution till after we have
created OutputSection virtual addresses.

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

4 years ago[libc++] Define a few Lit features using the new DSL
Louis Dionne [Sun, 3 May 2020 17:26:23 +0000 (13:26 -0400)]
[libc++] Define a few Lit features using the new DSL

This commit migrates some of the Lit features from config.py to the new
DSL. This simplifies config.py and is a first step towards defining all
the features using the DSL instead of the complex logic in config.py.

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

4 years ago[AArch64] Add NVIDIA Carmel support
Raul Tambre [Mon, 4 May 2020 10:45:35 +0000 (11:45 +0100)]
[AArch64] Add NVIDIA Carmel support

Summary:
NVIDIA's Carmel ARM64 cores are used in Tegra194 chips found in Jetson AGX Xavier, DRIVE AGX Xavier and DRIVE AGX Pegasus.

References:
* https://devblogs.nvidia.com/nvidia-jetson-agx-xavier-32-teraops-ai-robotics/#h.huq9xtg75a5e
* NVIDIA Xavier Series System-on-Chip Technical Reference Manual 1.3 (https://developer.nvidia.com/embedded/downloads#?search=Xavier%20Series%20SoC%20Technical%20Reference%20Manual)

Reviewers: sdesmalen, paquette

Reviewed By: sdesmalen

Subscribers: llvm-commits, ianshmean, kristof.beyls, hiraditya, jfb, danielkiss, cfe-commits, t.p.northover

Tags: #clang, #llvm

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