platform/upstream/llvm.git
3 years ago[AMDGPU] Add amdgpu_gfx calling convention
Sebastian Neubauer [Wed, 16 Sep 2020 12:38:54 +0000 (14:38 +0200)]
[AMDGPU] Add amdgpu_gfx calling convention

Add a calling convention called amdgpu_gfx for real function calls
within graphics shaders. For the moment, this uses the same calling
convention as other calls in amdgpu, with registers excluded for return
address, stack pointer and stack buffer descriptor.

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

3 years ago[NFC] Remove string parameter of annotation attribute from AST childs.
Tyker [Mon, 9 Nov 2020 14:06:14 +0000 (15:06 +0100)]
[NFC] Remove string parameter of annotation attribute from AST childs.
this simplifies using annotation attributes when using clang as library

3 years ago[testing] Add exhaustive ULT/UGT vector CTPOP to AArch64 and PPC
David Zarzycki [Mon, 9 Nov 2020 15:23:08 +0000 (10:23 -0500)]
[testing] Add exhaustive ULT/UGT vector CTPOP to AArch64 and PPC

This to help review the impact of https://reviews.llvm.org/D89952 which
allows targets to fine tune what SelectionDAG does when vector CTPOP is
not legal.

3 years ago[ARM][MachineOutliner] Emit more CFI instructions
Momchil Velikov [Mon, 9 Nov 2020 11:48:32 +0000 (11:48 +0000)]
[ARM][MachineOutliner] Emit more CFI instructions

This patch make the outliner emit CFI instructions in a few more
places:

  * after LR is restored, but before the return in an outlined
  function

  * around save/restore of LR to/from a register at calls to outlined
  functions

  * around save/restore of LR to/from the stack at calls to outlined
  functions

The latter two only when the function does NOT spill LR. If the
function spills LR, then outliner generated saves/restores around
calls are not considered interesting for unwinding the frame.

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

3 years ago[X86] Remove some unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 15:01:30 +0000 (15:01 +0000)]
[X86] Remove some unused check-prefixes

3 years ago[X86] Replace X32 check-prefix with X86 and remove unused X64 common prefix
Simon Pilgrim [Mon, 9 Nov 2020 14:45:48 +0000 (14:45 +0000)]
[X86] Replace X32 check-prefix with X86 and remove unused X64 common prefix

We try to use X32 for gnux32 triple tests

3 years ago[ARM][LowOverheadLoops] Merge a VCMP and the new VPST into a VPT
Sam Tebbs [Fri, 30 Oct 2020 13:30:58 +0000 (13:30 +0000)]
[ARM][LowOverheadLoops] Merge a VCMP and the new VPST into a VPT

There were cases where a VCMP and a VPST were merged even if the VCMP
didn't have the same defs of its operands as the VPST. This is fixed by
adding RDA checks for the defs. This however gave rise to cases where
the new VPST created would precede the un-merged VCMP and so would fail
a predicate mask assertion since the VCMP wasn't predicated. This was
solved by converting the VCMP to a VPT instead of inserting the new
VPST.

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

3 years ago[mlir] Fix bug in use of rewiter for AtomicRMWOp.
Tres Popp [Mon, 9 Nov 2020 14:55:08 +0000 (15:55 +0100)]
[mlir] Fix bug in use of rewiter for AtomicRMWOp.

The legalization did not forward the listener which prevents dynamic
legalization and prevents rollbacks. This handled that and then changed
the associated pass to support all other std ops to support partial
conversion.

Previously, this lowering was failing, but due to the
initial bug, the op's modifications were not reverted, and thus the
pattern matching succeeded.

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

3 years ago[LoopFlatten] FlattenInfo bookkeeping. NFC.
Sjoerd Meijer [Mon, 9 Nov 2020 14:33:52 +0000 (14:33 +0000)]
[LoopFlatten] FlattenInfo bookkeeping. NFC.

Introduce struct FlattenInfo to group some of the bookkeeping. Besides this
being a bit of a clean-up, it is a prep step for next additions (D90640). I
could take things a bit further, but thought this was a good first step also
not to make this change too large.

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

3 years ago[gn build] Port 9ca6fc4e095
LLVM GN Syncbot [Mon, 9 Nov 2020 14:31:09 +0000 (14:31 +0000)]
[gn build] Port 9ca6fc4e095

3 years ago[clang-format] avoid introducing multiline comments
Krasimir Georgiev [Mon, 9 Nov 2020 14:26:02 +0000 (15:26 +0100)]
[clang-format] avoid introducing multiline comments

In C++ with -Werror=comment, multiline comments are not allowed.
clang-format could accidentally introduce multiline comments when reflowing.
This adapts clang-format to not introduce multiline comments by not allowing a
break after `\`. Note that this does not apply to comment lines that already are
multiline comments, such as comments in macros.

Reviewed By: sammccall

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

3 years agoAdd a new altera kernel name restriction check to clang-tidy.
Frank Derry Wanye [Mon, 9 Nov 2020 14:20:35 +0000 (09:20 -0500)]
Add a new altera kernel name restriction check to clang-tidy.

The altera kernel name restriction check finds kernel files and include
directives whose filename is "kernel.cl", "Verilog.cl", or "VHDL.cl".
Such kernel file names cause the Altera Offline Compiler to generate
intermediate design files that have the same names as certain internal
files, which leads to a compilation error.

As per the "Guidelines for Naming the Kernel" section in the "Intel FPGA
SDK for OpenCL Pro Edition: Programming Guide."

This reverts the reversion from 43a38a65233039b5e71797a644d41a890f8d7f2b.

3 years ago[mlir] Add initial Python bindings for DenseInt/FPElementsAttr
Alex Zinenko [Fri, 6 Nov 2020 10:59:22 +0000 (11:59 +0100)]
[mlir] Add initial Python bindings for DenseInt/FPElementsAttr

Enumerating elements in these classes is necessary to enable custom
operand accessors for variadic operands.

Depends On D90919

Reviewed By: stellaraccident

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

3 years ago[VPlan] Print result value for loads in VPWidenMemoryInst (NFC).
Florian Hahn [Mon, 9 Nov 2020 13:52:54 +0000 (13:52 +0000)]
[VPlan] Print result value for loads in VPWidenMemoryInst (NFC).

For loads, print the result value.

3 years ago[VPlan] Add isStore helper to VPWidenMemoryInstructionRecipe (NFC).
Florian Hahn [Mon, 9 Nov 2020 13:50:58 +0000 (13:50 +0000)]
[VPlan] Add isStore helper to VPWidenMemoryInstructionRecipe (NFC).

Move logic to check if the recipe is a store to a helper for easier
reuse.

3 years ago[mlir] Expose operation attributes to Python bindings
Alex Zinenko [Fri, 6 Nov 2020 10:25:41 +0000 (11:25 +0100)]
[mlir] Expose operation attributes to Python bindings

Operations in a MLIR have a dictionary of attributes attached. Expose
those to Python bindings through a pseudo-container that can be indexed
either by attribute name, producing a PyAttribute, or by a contiguous
index for enumeration purposes, producing a PyNamedAttribute.

Depends On D90917

Reviewed By: stellaraccident

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

3 years ago[llvm-mca] Add branch forms of ALU instructions to Cortex-A57 test
Evgeny Leviant [Mon, 9 Nov 2020 13:53:50 +0000 (16:53 +0300)]
[llvm-mca] Add branch forms of ALU instructions to Cortex-A57 test

3 years ago[AMDGPU] Remove unused DisableDecoder machinery. NFC.
Jay Foad [Mon, 9 Nov 2020 13:51:40 +0000 (13:51 +0000)]
[AMDGPU] Remove unused DisableDecoder machinery. NFC.

This has been unused since D24738.

3 years ago[VPlan] Use VPValue def for VPWidenCall.
Florian Hahn [Mon, 9 Nov 2020 13:29:41 +0000 (13:29 +0000)]
[VPlan] Use VPValue def for VPWidenCall.

This patch turns VPWidenCall into a VPValue and uses it
during VPlan construction and codegeneration instead of the plain IR
reference where possible.

Reviewed By: dmgreen

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

3 years ago[clang-tidy] Remove bad assert after 3b9b90a1
Nathan James [Mon, 9 Nov 2020 13:21:55 +0000 (13:21 +0000)]
[clang-tidy] Remove bad assert after 3b9b90a1

Forgot to remove it on push, just there to help debugging

3 years ago[AMDGPU][MC] Added tests for checking error position
Dmitry Preobrazhensky [Mon, 9 Nov 2020 12:46:27 +0000 (15:46 +0300)]
[AMDGPU][MC] Added tests for checking error position

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

Reviewers: arsenm, rampitec

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

3 years ago[ARM] Remove kill flags between VCMP and insertion point
David Green [Mon, 9 Nov 2020 13:17:53 +0000 (13:17 +0000)]
[ARM] Remove kill flags between VCMP and insertion point

When we fold a VCMP into a VPST instruction any kill flags between the
old VCMP position and the new insertion point need to be removed, in
order to keep the verifier happy.

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

3 years ago[ARM][AArch64] Adding Neoverse V1 CPU support
Lucas Prates [Wed, 28 Oct 2020 11:07:17 +0000 (11:07 +0000)]
[ARM][AArch64] Adding Neoverse V1 CPU support

Add support for the Neoverse V1 CPU to the ARM and AArch64 backends.

This is based on patches from Mark Murray and Victor Campos.

Reviewed By: dmgreen

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

3 years ago[InterleavedAccess] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 13:12:10 +0000 (13:12 +0000)]
[InterleavedAccess] Remove unused check-prefixes

Just use default CHECK

3 years ago[ConstProp] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 13:08:56 +0000 (13:08 +0000)]
[ConstProp] Remove unused check-prefixes

Just use default CHECK and remove duplicate RUN

3 years ago[CodeGenPrepare] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 13:01:48 +0000 (13:01 +0000)]
[CodeGenPrepare] Remove unused check-prefixes

3 years ago[llvm][AArch64] Simplify (and (sign_extend..) #bitmask).
Francesco Petrogalli [Mon, 9 Nov 2020 11:37:25 +0000 (11:37 +0000)]
[llvm][AArch64] Simplify (and (sign_extend..) #bitmask).

Fold

    VT = (and (sign_extend NarrowVT to VT) #bitmask)

into

    VT = (zero_extend NarrowVT)

With this combine, the test replaces a sign extended load + an
unsigned extention with a zero extended load to render one of the
operands of the last multiplication.

  BEFORE                       |  AFTER
    f_i16_i32:                 |    f_i16_i32:
         .fnstart              |           .fnstart
         ldrsh   r0, [r0]      |           ldrh    r1, [r1]
         ldrsh   r1, [r1]      |           ldrsh   r0, [r0]
         smulbb  r0, r1, r0    |           smulbb  r0, r0, r1
         uxth    r1, r1        |           mul     r0, r0, r1
         mul     r0, r0, r1    |           bx      lr
         bx      lr            |

Reviewed By: resistor

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

3 years ago[VPlan] Add printOperands helper to VPUser (NFC).
Florian Hahn [Mon, 9 Nov 2020 12:10:03 +0000 (12:10 +0000)]
[VPlan] Add printOperands helper to VPUser (NFC).

Factor out the code for printing operands of a VPUser so it can be
re-used when printing other recipes.

3 years ago[lld] Provide a hook to customize undefined symbols error handling
serge-sans-paille [Mon, 19 Oct 2020 11:21:23 +0000 (13:21 +0200)]
[lld] Provide a hook to customize undefined symbols error handling

This is a follow up to https://reviews.llvm.org/D87758, implementing the missing
symbol part, as done by binutils.

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

3 years ago[LoopVectorize] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 12:14:09 +0000 (12:14 +0000)]
[LoopVectorize] Remove unused check-prefixes

3 years ago[LoopVectorize][AMDGPU] Regenerate packed-math test checks
Simon Pilgrim [Mon, 9 Nov 2020 12:12:48 +0000 (12:12 +0000)]
[LoopVectorize][AMDGPU] Regenerate packed-math test checks

3 years ago[MemCpyOpt] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 11:38:39 +0000 (11:38 +0000)]
[MemCpyOpt] Remove unused check-prefixes

Just use default CHECK

3 years ago[NewGVN] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 11:29:29 +0000 (11:29 +0000)]
[NewGVN] Remove unused check-prefixes

3 years ago[clangd] Handle duplicate enum constants in PopulateSwitch tweak
Nathan James [Mon, 9 Nov 2020 12:14:51 +0000 (12:14 +0000)]
[clangd] Handle duplicate enum constants in PopulateSwitch tweak

If an enum has different names for the same constant, make sure only the first one declared gets added into the switch. Failing to do so results in a compiler error as 2 case labels can't represent the same value.

```
lang=c
enum Numbers{
One,
Un = One,
Two,
Deux = Two,
Three,
Trois = Three
};

// Old behaviour
switch (<Number>) {
  case One:
  case Un:
  case Two:
  case Duex:
  case Three:
  case Trois: break;
}

// New behaviour
switch (<Number>) {
  case One:
  case Two:
  case Three: break;
}
```

Reviewed By: sammccall

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

3 years ago[LLDB][test] - Update one more test after the yaml2obj change.
Georgii Rymar [Mon, 9 Nov 2020 11:55:16 +0000 (14:55 +0300)]
[LLDB][test] - Update one more test after the yaml2obj change.

I've missed this one.

3 years ago[InstCombine] Fix constant-folding of overflowing arithmetic ops on vectors
LemonBoy [Mon, 9 Nov 2020 11:39:34 +0000 (14:39 +0300)]
[InstCombine] Fix constant-folding of overflowing arithmetic ops on vectors

Feeding vector values to `InstCombiner::OptimizeOverflowCheck` produces a scalar boolean flag if it proves the overflow check can be eliminated.
This causes `InstCombiner::CreateOverflowTuple` to crash as it correctly expects a vector of i1 values instead.

Reviewed By: lebedev.ri

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

3 years agoReland "Precommit LTO pipeline test"
Sanne Wouda [Tue, 3 Nov 2020 19:34:27 +0000 (19:34 +0000)]
Reland "Precommit LTO pipeline test"

Target Pass Configuration does not always run, so we can't check for it.

3 years ago[SLPVectorizer][X86] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 10:56:46 +0000 (10:56 +0000)]
[SLPVectorizer][X86] Remove unused check-prefixes

3 years ago[lldb] [Host/freebsd] Set Arg0 for 'platform process list -v'
Michał Górny [Sun, 8 Nov 2020 09:44:54 +0000 (10:44 +0100)]
[lldb] [Host/freebsd] Set Arg0 for 'platform process list -v'

Same fix as in NetBSD (a6712889f5f1702dfa535718abe400d1a83174c5).

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

3 years agoRevert "[lldb] [Host/freebsd] Set Arg0 for 'platform process list -v'"
Michał Górny [Mon, 9 Nov 2020 11:08:19 +0000 (12:08 +0100)]
Revert "[lldb] [Host/freebsd] Set Arg0 for 'platform process list -v'"

Accidentally referenced the wrong diff.

This reverts commit fce8e758892f0b650762513680adc06cea53d6e3.

3 years ago[lldb][test] - Update test cases after yaml2obj change.
Georgii Rymar [Mon, 9 Nov 2020 10:52:58 +0000 (13:52 +0300)]
[lldb][test] - Update test cases after yaml2obj change.

The format of program header descriptions was changed by D90458.

3 years ago[SimplifyCFG] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 10:36:46 +0000 (10:36 +0000)]
[SimplifyCFG] Remove unused check-prefixes

3 years ago[Scalarizer] Remove unused check-prefixes
Simon Pilgrim [Mon, 9 Nov 2020 10:27:52 +0000 (10:27 +0000)]
[Scalarizer] Remove unused check-prefixes

3 years ago[llvm] [Support] Fix segv if argv0 is null in getMainExecutable()
Michał Górny [Sat, 7 Nov 2020 21:03:29 +0000 (22:03 +0100)]
[llvm] [Support] Fix segv if argv0 is null in getMainExecutable()

When LLDB Python bindings are used and stack backtraces are enabled
for logging, getMainExecutable() is called with argv0 being null.
This caused the fallback function getprogpath() (used on FreeBSD, NetBSD
and Linux) to segfault.  Make it handle null executable name gracefully.

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

3 years ago[lldb] [Host/freebsd] Set Arg0 for 'platform process list -v'
Michał Górny [Sun, 8 Nov 2020 09:44:54 +0000 (10:44 +0100)]
[lldb] [Host/freebsd] Set Arg0 for 'platform process list -v'

Same fix as in NetBSD (a6712889f5f1702dfa535718abe400d1a83174c5).

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

3 years ago[lldb] [test] Extend watchpoint test to wait for thread to start
Michał Górny [Sun, 8 Nov 2020 13:08:54 +0000 (14:08 +0100)]
[lldb] [test] Extend watchpoint test to wait for thread to start

TestWatchpointMultipleThreads currently accounts for two scenarios:
setting the watchpoint before a new thread starts (presumably, verifying
that it will be propagated to the new thread) and setting it after
the thread starts (presumably, verifying that a new watchpoint is set
on all threads).  However, the latter test currently assumes that
the thread will be reported to the debugger before the breakpoint is
hit.  This is not the case on FreeBSD and NetBSD.

On NetBSD, new threads do not inherit debug registers from their parent
threads.  Instead, LLDB copies them manually after the new thread is
reported.  Since the thread is actually reported after the second
breakpoint location, both tests effectively check the same behavior
(i.e. watchpoint being set before the new thread is reported).

On FreeBSD, new threads inherit debug registers and we seem to hit
an interesting race condition.  While the thread is reported after
the breakpoint is hit, the kernel seems to construct it and copy
the debug register before that happens.  As a result, setting
the watchpoint at the second breakpoint location modifies the debug
registers of the first thread after they have been copied to the second
thread but before the debugger is aware of it.  Therefore,
the watchpoint is not propagated to the second thread and the test
fails.

Extend the test to cover all three possible scenarios: setting
watchpoint before the thread is lanched, after it is launched but before
it is guaranteed to have started and after it has actually started.  Add
a second barrier to account for the last case.  This should ensure that
the second assumption (i.e. that the watchpoint is set on all currently
known threads) is actually tested on FreeBSD and NetBSD.

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

3 years ago[lldb] [Process/FreeBSDRemote] Handle exec() from inferior
Michał Górny [Fri, 6 Nov 2020 14:32:43 +0000 (15:32 +0100)]
[lldb] [Process/FreeBSDRemote] Handle exec() from inferior

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

3 years ago[yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list.
Georgii Rymar [Fri, 30 Oct 2020 12:54:03 +0000 (15:54 +0300)]
[yaml2obj] - ProgramHeaders: introduce FirstSec/LastSec instead of Sections list.

Imagine we have a YAML declaration of few sections: `foo1`, `<unnamed 2>`, `foo3`, `foo4`.

To put them into segment we can do (1*):

```
Sections:
 - Section: foo1
 - Section: foo4
```

or we can use (2*):

```
Sections:
 - Section: foo1
 - Section: foo3
 - Section: foo4
```

or (3*) :

```
Sections:
 - Section: foo1
## "(index 2)" here is a name that we automatically created for a unnamed section.
 - Section: (index 2)
 - Section: foo3
 - Section: foo4
```

It looks really confusing that we don't have to list all of sections.

At first I've tried to make this rule stricter and report an error when there is a gap
(i.e. when a section is included into segment, but not listed explicitly).
This did not work perfect, because such approach conflicts with unnamed sections/fills (see (3*)).

This patch drops "Sections" key and introduces 2 keys instead: `FirstSec` and `LastSec`.
Both are optional.

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

3 years agoRecommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements...
Georgii Rymar [Mon, 9 Nov 2020 09:18:18 +0000 (12:18 +0300)]
Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt.

This is recommit for D90903 with fixes for BB:
1) Used std::move<> when returning Expected<> (http://lab.llvm.org:8011/#/builders/112/builds/913)
2) Fixed the name of temporarily file in the file-headers.test (http://lab.llvm.org:8011/#/builders/36/builds/1269)
   (a local old temporarily file was used before)

For creating `ELFObjectFile` instances we have the factory method
`ELFObjectFile<ELFT>::create(MemoryBufferRef Object)`.

The problem of this method is that it scans the section header to locate some sections.
When a file is truncated or has broken fields in the ELF header, this approach does
not allow us to create the `ELFObjectFile` and dump the ELF header.

This is https://bugs.llvm.org/show_bug.cgi?id=40804

This patch suggests a solution - it allows to delay scaning sections in the
`ELFObjectFile<ELFT>::create`. It now allows user code to call an object
initialization (`initContent()`) later. With that it is possible,
for example, for dumpers just to dump the file header and exit.
By default initialization is still performed as before, what helps to keep
the logic of existent callers untouched.

I've experimented with different approaches when worked on this patch.
I think this approach is better than doing initialization of sections (i.e. scan of them)
on demand, because normally users of `ELFObjectFile` API expect to work with a valid object.
In most cases when a section header table can't be read (because of an error), we don't
have to continue to work with object. So we probably don't need to implement a more complex API.

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

3 years ago[lldb] Fix DW_AT_decl_file from DW_AT_specification from a different CU
Jan Kratochvil [Mon, 9 Nov 2020 09:11:38 +0000 (10:11 +0100)]
[lldb] Fix DW_AT_decl_file from DW_AT_specification from a different CU

This would be reproducible in future DWZ category of the testsuite as:
  Failed Tests (1):
    lldb-api :: python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py

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

3 years ago[MergeFunctions] fix function attribute comparison in FunctionComparator
Tim Northover [Mon, 9 Nov 2020 09:19:11 +0000 (09:19 +0000)]
[MergeFunctions] fix function attribute comparison in FunctionComparator

The comparison of AttributeSets stopped after seeing a matching type attribute.
Subsequent mismatching attributes were not detected causing a crash.

3 years ago[NFC][Test] Add tests for constant pool on PowerPC
QingShan Zhang [Mon, 9 Nov 2020 09:17:28 +0000 (09:17 +0000)]
[NFC][Test] Add tests for constant pool on PowerPC

3 years agoRevert "[llvm-readelf/obj] - Allow dumping of ELF header even if some elements are...
Georgii Rymar [Mon, 9 Nov 2020 08:50:50 +0000 (11:50 +0300)]
Revert "[llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt."

This reverts commit ea8a0b8b29eb08d3f0f6ac40942a2d8e98ab57ee.

It broke BBots.
http://lab.llvm.org:8011/#/builders/14/builds/1439
http://lab.llvm.org:8011/#/builders/112/builds/913

3 years ago[llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt.
Georgii Rymar [Tue, 3 Nov 2020 11:02:01 +0000 (14:02 +0300)]
[llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt.

For creating `ELFObjectFile` instances we have the factory method
`ELFObjectFile<ELFT>::create(MemoryBufferRef Object)`.

The problem of this method is that it scans the section header to locate some sections.
When a file is truncated or has broken fields in the ELF header, this approach does
not allow us to create the `ELFObjectFile` and dump the ELF header.

This is https://bugs.llvm.org/show_bug.cgi?id=40804

This patch suggests a solution - it allows to delay scaning sections in the
`ELFObjectFile<ELFT>::create`. It now allows user code to call an object
initialization (`initContent()`) later. With that it is possible,
for example, for dumpers just to dump the file header and exit.
By default initialization is still performed as before, what helps to keep
the logic of existent callers untouched.

I've experimented with different approaches when worked on this patch.
I think this approach is better than doing initialization of sections (i.e. scan of them)
on demand, because normally users of `ELFObjectFile` API expect to work with a valid object.
In most cases when a section header table can't be read (because of an error), we don't
have to continue to work with object. So we probably don't need to implement a more complex API.

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

3 years ago[yaml2obj] - Implement BBAddrMapSection::getEntries(). NFC.
Georgii Rymar [Mon, 9 Nov 2020 08:11:57 +0000 (11:11 +0300)]
[yaml2obj] - Implement BBAddrMapSection::getEntries(). NFC.

This allows to use the generic fields validation
mechanism that we have.

The behavior (i.e. an error reported) remains the same.

3 years ago[clangd] Don't run clang-tidy AST traversal if there are no checks.
Sam McCall [Fri, 6 Nov 2020 22:38:08 +0000 (23:38 +0100)]
[clangd] Don't run clang-tidy AST traversal if there are no checks.

While here, clean up ParsedAST::build a bit:
 - remove FIXMEs that were fixed long ago by ReplayPreamble
 - remove redundant if, ClangTidyContext is not actually optional

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

3 years ago[GlobalsAA] Teach to handle `addrspacecast`.
Michael Liao [Mon, 26 Oct 2020 16:17:42 +0000 (12:17 -0400)]
[GlobalsAA] Teach to handle `addrspacecast`.

3 years agoFix debug_abbrev emitter to only assign table id once
António Afonso [Mon, 9 Nov 2020 02:09:32 +0000 (18:09 -0800)]
Fix debug_abbrev emitter to only assign table id once

While generating yamls for my tests I noticed that the new debug_abbrev format (with multiple table support) was incorrectly assigning id's to the table because it was generating one per abbrev entry in the table. For instance, the first table would get id 4 when 5 abbrev entries existed in the table. By itself this is not a problem but the corresponding debug_info sections were still referencing id 0. This was introduced here: https://reviews.llvm.org/D83116.

Maybe a better fix is to actually correctly calculate the table id when emitting debug info? From a quick glance it seems to me the ID is just being calculated as the distance between the first DWARFAbbreviationDeclarationSet and the one the debug info entry points to, which means it's just its index and not the actual table id that was generated when emitting the debug_abbrev tables. With my fix I guess this is fine but on the diff that introduced this Pavel mentioned that he would like to have some sort of unique id between them but not necessarily +1 increasing, but for that to work we need to actually find the table ID, I guess by going directly to Y.DebugAbbrev but to honest I have no idea how to link the DWARFAbbreviationDeclarationSet and the Y.DebugAbbrev, so I just did this simple fix.

I also realized there's barely any tests for MachO so it might useful to invest on that if the tool is being reworked on.

Reviewed By: Higuoxing, jhenderson

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

3 years ago[mlir][CAPI] Proposal: Always building a libMLIRPublicAPI.so (re-apply).
Stella Laurenzo [Mon, 9 Nov 2020 00:49:36 +0000 (16:49 -0800)]
[mlir][CAPI] Proposal: Always building a libMLIRPublicAPI.so (re-apply).

Re-applies the reverted https://reviews.llvm.org/D90824 now that the link issue on BFD has been resolved.

This reverts commit bb9b5d39712e39e15b22b36e8138075cea0cd7b5.

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

3 years ago[IR] [TableGen] Cleanup pass over the IR TableGen files.
Paul C. Anagnostopoulos [Fri, 6 Nov 2020 14:59:33 +0000 (09:59 -0500)]
[IR] [TableGen] Cleanup pass over the IR TableGen files.

This patch includes intrinsics for AMDGPU.

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

3 years ago[NFC][LoopIdiom] Add basic test coverage for 'left-shift until bittest` idiom
Roman Lebedev [Tue, 3 Nov 2020 17:19:45 +0000 (20:19 +0300)]
[NFC][LoopIdiom] Add basic test coverage for 'left-shift until bittest` idiom

3 years ago[clang-tidy] Fix build for gcc5.3 after d725f1ce
Nathan James [Sun, 8 Nov 2020 17:25:18 +0000 (17:25 +0000)]
[clang-tidy] Fix build for gcc5.3 after d725f1ce

3 years ago[NFC][tests] Replace use of GNUisms in usage of diff
Hubert Tong [Sun, 8 Nov 2020 17:05:29 +0000 (12:05 -0500)]
[NFC][tests] Replace use of GNUisms in usage of diff

... the POSIX options suffice.

This maintains compatibility with the system `diff` on platforms
like AIX.

3 years ago[InstSimplify] allow vector folds for (Pow2C << X) == NonPow2C
Sanjay Patel [Sun, 8 Nov 2020 14:49:31 +0000 (09:49 -0500)]
[InstSimplify] allow vector folds for (Pow2C << X) == NonPow2C

Existing pre-conditions seem to be correct:
https://rise4fun.com/Alive/lCLB

  Name: non-zero C1
  Pre: !isPowerOf2(C1) && isPowerOf2(C2) && C1 != 0
  %sub = shl i8 C2, %X
  %cmp = icmp eq i8 %sub, C1
  =>
  %cmp = false

  Name: one == C2
  Pre: !isPowerOf2(C1) && isPowerOf2(C2) && C2 == 1
  %sub = shl i8 C2, %X
  %cmp = icmp eq i8 %sub, C1
  =>
  %cmp = false

  Name: nuw
  Pre: !isPowerOf2(C1) && isPowerOf2(C2)
  %sub = shl nuw i8 C2, %X
  %cmp = icmp eq i8 %sub, C1
  =>
  %cmp = false

  Name: nsw
  Pre: !isPowerOf2(C1) && isPowerOf2(C2)
  %sub = shl nsw i8 C2, %X
  %cmp = icmp eq i8 %sub, C1
  =>
  %cmp = false

3 years ago[InstSimplify] add tests for icmp with power-of-2 operand; NFC
Sanjay Patel [Sun, 8 Nov 2020 14:09:45 +0000 (09:09 -0500)]
[InstSimplify] add tests for icmp with power-of-2 operand; NFC

3 years ago[SLPVectorizer][X86] Remove unused check-prefixes
Simon Pilgrim [Sun, 8 Nov 2020 14:03:55 +0000 (14:03 +0000)]
[SLPVectorizer][X86] Remove unused check-prefixes

3 years ago[GVN] Remove unused check-prefixes
Simon Pilgrim [Sun, 8 Nov 2020 13:36:42 +0000 (13:36 +0000)]
[GVN] Remove unused check-prefixes

3 years ago[InstCombine] Fix malformed CHECK32/64 test checks.
Simon Pilgrim [Sun, 8 Nov 2020 13:34:07 +0000 (13:34 +0000)]
[InstCombine] Fix malformed CHECK32/64 test checks.

3 years ago[InstCombine] Remove unused check-prefixes
Simon Pilgrim [Sun, 8 Nov 2020 13:33:21 +0000 (13:33 +0000)]
[InstCombine] Remove unused check-prefixes

Just use default CHECK

3 years ago[PhaseOrdering] Remove unused check-prefixes
Simon Pilgrim [Sun, 8 Nov 2020 13:30:18 +0000 (13:30 +0000)]
[PhaseOrdering] Remove unused check-prefixes

Just use default CHECK in most cases.

3 years ago[PhaseOrdering][X86] Remove unused check-prefixes
Simon Pilgrim [Sun, 8 Nov 2020 13:20:17 +0000 (13:20 +0000)]
[PhaseOrdering][X86] Remove unused check-prefixes

Just use default CHECK

3 years ago[DSE] Don't dereference a dyn_cast<> result - use cast<> instead. NFCI.
Simon Pilgrim [Sun, 8 Nov 2020 13:07:45 +0000 (13:07 +0000)]
[DSE] Don't dereference a dyn_cast<> result - use cast<> instead. NFCI.

We were relying on the dyn_cast<> succeeding - better use cast<> and have it assert that its the correct type than dereference a null result.

3 years agoDon't dereference a dyn_cast<> result - use cast<> instead. NFCI.
Simon Pilgrim [Sun, 8 Nov 2020 13:06:07 +0000 (13:06 +0000)]
Don't dereference a dyn_cast<> result - use cast<> instead. NFCI.

We were relying on the dyn_cast<> succeeding - better use cast<> and have it assert that its the correct type than dereference a null result.

3 years ago[InstCombine] foldSelectFunnelShift - block poison in funnel shift value
Simon Pilgrim [Sun, 8 Nov 2020 12:58:14 +0000 (12:58 +0000)]
[InstCombine] foldSelectFunnelShift - block poison in funnel shift value

As raised by @nlopes on D90382 - if this is not a rotate then the select was blocking poison from the 'shift-by-zero' non-TVal, but a funnel shift won't - so freeze it.

3 years ago[KnownBits] isNonZero() - avoid expensive countPopulation call. NFC.
Simon Pilgrim [Sun, 8 Nov 2020 10:30:29 +0000 (10:30 +0000)]
[KnownBits] isNonZero() - avoid expensive countPopulation call. NFC.

We can just check for a null value.

3 years ago[LoopInterchange] Skip non SCEV-able operands in cost function.
Florian Hahn [Sun, 8 Nov 2020 11:37:36 +0000 (11:37 +0000)]
[LoopInterchange] Skip non SCEV-able operands in cost function.

This fixes a crash when trying to get a SCEV expression for operands
that are not SCEV-able.

3 years ago[Reg2Mem] add support for the new pass manager
Pedro Tammela [Thu, 5 Nov 2020 19:03:08 +0000 (19:03 +0000)]
[Reg2Mem] add support for the new pass manager

This patch refactors the pass to accomodate the new pass manager
boilerplate.

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

3 years agoRevert "[NewPM] Provide method to run all pipeline callbacks, used for -O0"
Arthur Eubanks [Sun, 8 Nov 2020 08:18:42 +0000 (00:18 -0800)]
Revert "[NewPM] Provide method to run all pipeline callbacks, used for -O0"

This reverts commit ae38540042668675dd16c642d850115f217ea59f.
As well as some follow-up test fixes.

The original change causes new-pass-manager.ll to fail when polly is enabled.

3 years ago[X86] Improve lowering of fptoui
Craig Topper [Sun, 8 Nov 2020 06:44:53 +0000 (22:44 -0800)]
[X86] Improve lowering of fptoui

Invert the select condition when masking in the sign bit of a fptoui operation. Also, rather than lowering the sign mask to select/xor and expecting the select to get cleaned up later, directly lower to shift/xor.

Patch by Layton Kifer!

Reviewed By: craig.topper

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

3 years ago[RISCV] Remove assertsexti32 from a couple B extension isel patterns that don't deman...
Craig Topper [Sun, 8 Nov 2020 06:42:50 +0000 (22:42 -0800)]
[RISCV] Remove assertsexti32 from a couple B extension isel patterns that don't demanded the sign extended bits.

3 years ago[llvm-objcopy][MachO] Minor refactoring of MachOLayoutBuilder
Alexander Shaposhnikov [Sun, 8 Nov 2020 03:58:19 +0000 (19:58 -0800)]
[llvm-objcopy][MachO] Minor refactoring of MachOLayoutBuilder

Move the implementation of getStringTableBuilderKind into
MachOLayoutBuilder.cpp. NFC.

Test plan: make check-all

3 years ago[ELF] --warn-backrefs-exclude: use toString to match the documentation
Fangrui Song [Sun, 8 Nov 2020 04:17:41 +0000 (20:17 -0800)]
[ELF] --warn-backrefs-exclude: use toString to match the documentation

The pattern should patch `a.a(a.o)` instead of `a.a`

3 years ago[ELF] Test R_*_SIZE for non-SHF_ALLOC sections
Fangrui Song [Sun, 8 Nov 2020 03:03:50 +0000 (19:03 -0800)]
[ELF] Test R_*_SIZE for non-SHF_ALLOC sections

3 years ago[Mem2Reg] Use llvm::count instead of std::count (NFC)
Kazu Hirata [Sun, 8 Nov 2020 04:18:47 +0000 (20:18 -0800)]
[Mem2Reg] Use llvm::count instead of std::count (NFC)

3 years ago[JumpThreading] Fix function names (NFC)
Kazu Hirata [Sun, 8 Nov 2020 03:35:02 +0000 (19:35 -0800)]
[JumpThreading] Fix function names (NFC)

3 years agoRemove TOSA test passes from non test registration.
Stella Laurenzo [Sun, 8 Nov 2020 02:32:35 +0000 (18:32 -0800)]
Remove TOSA test passes from non test registration.

* Wires them in the same way that peer-dialect test passes are registered.
* Fixes the build for -DLLVM_INCLUDE_TESTS=OFF.

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

3 years ago[llvm-objcopy][MachO] Fix adding multiple sections
Cornelius Aschermann [Sun, 8 Nov 2020 02:12:51 +0000 (18:12 -0800)]
[llvm-objcopy][MachO] Fix adding multiple sections

This diff fixes missing fields initialization (Size, VMSize).
Previously this resulted in broken binaries when multiple sections
were added in one tool's invocatation.

Test plan: make check-all

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

3 years ago[AMDGPU] SIWholeQuadMode fix mode insertion when SCC always defined
Carl Ritson [Sun, 8 Nov 2020 02:14:54 +0000 (11:14 +0900)]
[AMDGPU] SIWholeQuadMode fix mode insertion when SCC always defined

Fix a crash when SCC is defined until end of block and mode change
must be inserted in SCC live region.

Reviewed By: mceier

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

3 years agoInclude the generated documentation for list of ops in the TOSA dialect
Mehdi Amini [Sun, 8 Nov 2020 00:08:47 +0000 (00:08 +0000)]
Include the generated documentation for list of ops in the TOSA dialect

3 years agoFix dumping of explicit template specializations
Stephen Kelly [Sat, 7 Nov 2020 22:25:00 +0000 (22:25 +0000)]
Fix dumping of explicit template specializations

This was missing from commit 7efe07a1 (Traverse-ignore explicit template
instantiations, 2020-11-06).

3 years ago[RISCV] Add test cases showing missed opportunities to use sbset/sbclr/sbinv/sbext...
Craig Topper [Sat, 7 Nov 2020 22:20:28 +0000 (14:20 -0800)]
[RISCV] Add test cases showing missed opportunities to use sbset/sbclr/sbinv/sbext when the shift amount isn't masked to log2(xlen) bits. NFC

Out of bounds shifts are undefined and these instructions mask
their shift amount before use. So we don't need to see a mask
in order to select the instructions.

3 years ago[docs] Adding a Support Policy
Renato Golin [Wed, 4 Nov 2020 13:15:59 +0000 (13:15 +0000)]
[docs] Adding a Support Policy

As discussed in the mailing list [1-4], we need a separation of support
tiers when requiring support from the whole community versus a
sub-community. Essentially, if a sub-community is active enough and
takes maintenance into their own internal costs without affecting other
parts of the community's maintenance costs, then code that is not
immediately relevant to all parts (ie. not released, actively tested,
etc) can still find its way into the LLVM main repository without major
pain points.

The main benefit is to reduce the maintenance cost that those
sub-communities have outside of LLVM (for example, in duplicating common
code, applying the same patches on top of multiple user repositories or
downstream projects).

This document outlines the components and responsibilities of the
sub-communities with regards to maintenance costs and how they affect
the rest of the community.

It also adds an addendum on removal policies, which expand the existing
"new target removal" policy into something more generic, to encompass
any piece of code, scripts or documents in the repository.

[1] http://lists.llvm.org/pipermail/llvm-dev/2020-October/146249.html
[2] http://lists.llvm.org/pipermail/llvm-dev/2020-November/146335.html
[3] http://lists.llvm.org/pipermail/llvm-dev/2020-October/146138.html
[4] http://lists.llvm.org/pipermail/llvm-dev/2020-November/146298.html

3 years ago[RISCV] Use (not X) in instead of (xor X, -1) in isel patterns to improve readability...
Craig Topper [Sat, 7 Nov 2020 19:50:52 +0000 (11:50 -0800)]
[RISCV] Use (not X) in instead of (xor X, -1) in isel patterns to improve readability. NFC

3 years ago[gn build] Port d725f1ce531
LLVM GN Syncbot [Sat, 7 Nov 2020 19:18:18 +0000 (19:18 +0000)]
[gn build] Port d725f1ce531

3 years ago[clang-tidy] Use vfs::FileSystem when getting config
Nathan James [Sat, 7 Nov 2020 19:18:01 +0000 (19:18 +0000)]
[clang-tidy] Use vfs::FileSystem when getting config

The config providers that look for configuration files currently take a pointer to a FileSystem in the constructor.
For some reason this isn't actually used when trying to read those configuration files, Essentially it just follows the behaviour of the real filesystem.
Using clang-tidy standalone this doesn't cause any issue.
But if its used as a library and the user wishes to use say an `InMemoryFileSystem` it will try to read the files from the disc instead.

Reviewed By: aaron.ballman

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

3 years agoAdd missing dependency to TOSA library: fix build with -DBUILD_SHARED_LIBS=ON
Mehdi Amini [Sat, 7 Nov 2020 18:57:50 +0000 (18:57 +0000)]
Add missing dependency to TOSA library: fix build with -DBUILD_SHARED_LIBS=ON

3 years agoRefactor TOSA Dialect CMake to use add_mlir_dialect/add_mlir_interface (NFC)
Mehdi Amini [Sat, 7 Nov 2020 18:49:52 +0000 (18:49 +0000)]
Refactor TOSA Dialect CMake to use add_mlir_dialect/add_mlir_interface (NFC)

3 years ago[DWARFLinker] Convert analyzeContextInfo to a work list (NFC)
Jonas Devlieghere [Sat, 7 Nov 2020 18:45:17 +0000 (10:45 -0800)]
[DWARFLinker] Convert analyzeContextInfo to a work list (NFC)

Convert analyzeContextInfo to a work list using the same approach I used
to remove the recursion from lookForDIEsToKeep. This fixes the crash
reported in https://llvm.org/PR48029.

Tested using the reproducer attached to PR48029 as well as by comparing
the clang MD5 hashes before and after the change (with and without
gmodules).

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

3 years ago[lldb] [test] Use skipUnlessDarwin for tests specific to Darwin
Michał Górny [Sat, 7 Nov 2020 16:12:57 +0000 (17:12 +0100)]
[lldb] [test] Use skipUnlessDarwin for tests specific to Darwin

Use skipUnlessDarwin decorator for tests that are specific to Darwin,
instead of skipIf... for all other platforms.  This should make it clear
that these tests are not supposed to work elsewhere.  It will also make
these tests stop repeatedly popping up while I look for tests that could
be fixed on the platform in question.

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

3 years ago[lldb] [test] Un-skip one of TestRaise signals on fbsd
Michał Górny [Sat, 7 Nov 2020 17:24:32 +0000 (18:24 +0100)]
[lldb] [test] Un-skip one of TestRaise signals on fbsd