lldb.git
7 months 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

7 months 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.

7 months 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

7 months 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

7 months 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

7 months 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.

7 months 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

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

7 months 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

7 months 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

7 months 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

7 months 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

7 months 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

7 months 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.

7 months 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

7 months 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

7 months 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

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

7 months 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.

7 months 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

7 months 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.

7 months 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

7 months 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.

7 months 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.

7 months 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.

7 months 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.

7 months 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.

7 months 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

7 months 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.

7 months 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

7 months 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.

7 months 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

7 months 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`

7 months 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

7 months 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)

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

7 months 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

7 months 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

7 months 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

7 months 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

7 months 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).

7 months 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.

7 months 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

7 months 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

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

7 months 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

7 months 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

7 months 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)

7 months 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

7 months 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

7 months 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

7 months agoNFC: (re-apply) Fix some post-review nits for the Tosa dialect.
Stella Laurenzo [Sat, 7 Nov 2020 17:37:18 +0000 (09:37 -0800)]
NFC: (re-apply) Fix some post-review nits for the Tosa dialect.

This reverts commit 330398052d049f90e6cfac80ab8b765b158a3e61.

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

7 months ago[BasicAA] Unify struct/other offset (NFC)
Nikita Popov [Sat, 7 Nov 2020 17:29:47 +0000 (18:29 +0100)]
[BasicAA] Unify struct/other offset (NFC)

The distinction between StructOffset and OtherOffset has been
originally introduced by 82069c44ca39df9d506e16bfb0ca2481866dd0bb,
which applied different reasoning to both offset kinds. However,
this distinction was not actually correct, and has been fixed by
c84e77aeaefccb8d0c4c508b8017dcad80607f53. Since then, we only ever
consider the sum StructOffset + OtherOffset, so we may as well
store it in that form directly.

7 months agoRevert "NFC: Fix some post-review nits for the Tosa dialect."
Stella Laurenzo [Sat, 7 Nov 2020 17:35:49 +0000 (09:35 -0800)]
Revert "NFC: Fix some post-review nits for the Tosa dialect."

* Introduced issue in debug builds.

This reverts commit b5fcd06105dec2a7b0e4114d6ad4524fc54498c5.

7 months ago[BasicAA] Use smul_ov helper (NFCI)
Nikita Popov [Sat, 7 Nov 2020 16:48:41 +0000 (17:48 +0100)]
[BasicAA] Use smul_ov helper (NFCI)

Instead of performing the multiplication in double the bit width
and using active bits to determine overflow, use the existing
smul_ov() APInt method to detect overflow.

The smul_ov() implementation is not particularly efficient, but
it's still better than doing this a wide, usually 128-bit, type.

7 months ago[mlir][Python] Adapt to include property change in pybind11 v2.6.
Stella Laurenzo [Sat, 7 Nov 2020 17:05:51 +0000 (09:05 -0800)]
[mlir][Python] Adapt to include property change in pybind11 v2.6.

Reviewed By: mehdi_amini

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

7 months agoNFC: Fix some post-review nits for the Tosa dialect.
Stella Laurenzo [Sat, 7 Nov 2020 16:54:31 +0000 (08:54 -0800)]
NFC: Fix some post-review nits for the Tosa dialect.

* Moved various loose functions to either the mlir::tosa namespace or made static
* Fixed an unused variable warning in TosaMakeBroadcastable.cpp.

7 months agoTOSA MLIR Dialect
Suraj Sudhir [Sat, 7 Nov 2020 16:35:27 +0000 (08:35 -0800)]
TOSA MLIR Dialect

This is the TOSA MLIR Dialect described in the following MLIR RFC: https://llvm.discourse.group/t/rfc-tosa-dialect-in-mlir/1971/24

Reviewed By: stellaraccident

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

7 months ago[clang] Fix length threshold for MicrosoftMangle md5 hash
Melanie Blower [Sat, 7 Nov 2020 15:40:24 +0000 (07:40 -0800)]
[clang] Fix length threshold for MicrosoftMangle md5 hash

Reviewers: rnk, dblaikie

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

7 months ago[clang] Improve Microsoft mangling lit test with dblaikie's suggestions
Melanie Blower [Sat, 7 Nov 2020 15:32:34 +0000 (07:32 -0800)]
[clang] Improve Microsoft mangling lit test with dblaikie's suggestions

7 months ago[CaptureTracking] Add statistics (NFC)
Nikita Popov [Sat, 7 Nov 2020 11:25:55 +0000 (12:25 +0100)]
[CaptureTracking] Add statistics (NFC)

Add basic statistics on the number of pointers that have been
determined to maybe capture / not capture.

7 months ago[CaptureTracking] Early abort on too many uses (NFCI)
Nikita Popov [Sat, 7 Nov 2020 10:47:31 +0000 (11:47 +0100)]
[CaptureTracking] Early abort on too many uses (NFCI)

If there are too many uses, we should directly return -- there's
no point in inspecting the remaining uses in the worklist, as we
have to conservatively assume a capture anyway. This also means
that tooManyUses() gets called exactly once, rather than
potentially many times.

This restores the behavior prior to e9832dfdf366ddffba68164adb6855d17c9f87c1,
where this was accidentally changed while moving the AddUses logic
into a closure, thus making the return a return from the closure
rather than the whole function.

7 months ago[CaptureTrackingTest] Add missing override marker (NFC)
Nikita Popov [Sat, 7 Nov 2020 10:44:02 +0000 (11:44 +0100)]
[CaptureTrackingTest] Add missing override marker (NFC)

7 months ago[CaptureTracking] Correctly handle multiple uses in one instruction
Nikita Popov [Sat, 7 Nov 2020 10:19:27 +0000 (11:19 +0100)]
[CaptureTracking] Correctly handle multiple uses in one instruction

If the same value is used multiple times in the same instruction,
CaptureTracking may end up reporting the wrong use as being captured,
and/or report the same use as being captured multiple times.

Make sure that all checks take the use operand number into account,
rather than performing unreliable comparisons against the used value.

I'm not sure whether this can cause any problems in practice, but
at least some capture trackers (ArgUsesTracker, AACaptureUseTracker)
do care about which call argument is captured.

7 months ago[MLIR][SPIRVToLLVM] Added module name conversion
George Mitenkov [Sat, 7 Nov 2020 09:27:03 +0000 (12:27 +0300)]
[MLIR][SPIRVToLLVM] Added module name conversion

Since SPIR-V module has an optional name, this patch
makes a change to pass it to `ModuleOp` during conversion.

Reviewed By: ftynse

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

7 months ago[CaptureTracking] Avoid duplicate shouldExplode() check (NFCI)
Nikita Popov [Sat, 7 Nov 2020 09:13:49 +0000 (10:13 +0100)]
[CaptureTracking] Avoid duplicate shouldExplode() check (NFCI)

We check shouldExplore() before adding uses to the worklist, so
uses that should not be explored will not reach captured() in the
first place.

7 months ago[DWARFLinker] Use union to reduce sizeof(WorklistItem) (NFC)
Jonas Devlieghere [Sat, 7 Nov 2020 07:22:29 +0000 (23:22 -0800)]
[DWARFLinker] Use union to reduce sizeof(WorklistItem) (NFC)

Reduce the size of the WorklistItem struct by using a struct.

7 months ago[BranchProbabilityInfo] Simplify getEdgeProbability (NFC)
Kazu Hirata [Sat, 7 Nov 2020 06:47:22 +0000 (22:47 -0800)]
[BranchProbabilityInfo] Simplify getEdgeProbability (NFC)

The patch simplifies BranchProbabilityInfo::getEdgeProbability by
handling two cases separately, depending on whether we have edge
probabilities.

- If we have edge probabilities, then add up probabilities for
  successors being equal to Dst.

- Otherwise, return the number of ocurrences divided by the total
  number of successors.

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

7 months ago[test] Fix Other/new-pass-manager.ll with has different behaviors whether or not...
Fangrui Song [Sat, 7 Nov 2020 06:19:37 +0000 (22:19 -0800)]
[test] Fix Other/new-pass-manager.ll with has different behaviors whether or not Polly is enabled

after D89158

7 months ago[test] Fix Other/new-pass-manager.ll & clang/test/Misc/loop-opt-setup.c
Fangrui Song [Sat, 7 Nov 2020 05:55:10 +0000 (21:55 -0800)]
[test] Fix Other/new-pass-manager.ll & clang/test/Misc/loop-opt-setup.c

7 months agoRevert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"
Atmn Patel [Sat, 7 Nov 2020 05:31:35 +0000 (00:31 -0500)]
Revert "[LoopDeletion] Allows deletion of possibly infinite side-effect free loops"

This reverts commit 0b17c6e4479d62bd4ff05c48d6cdf340b198832f. This patch
causes a compile-time error in SCEV.

7 months agoRevert "[CodeGen] Fixes sanitizer test"
Atmn Patel [Sat, 7 Nov 2020 05:29:42 +0000 (00:29 -0500)]
Revert "[CodeGen] Fixes sanitizer test"

This reverts commit b1878b4641e06baa754ce6e3e0387b1e7d7dc143. This does
fix the test but it means that ac73b73c1652 is not implemented
correctly. Reverting for now, and will be reverting the commit that
causes this to fail.

7 months agoAsmPrinter/Dwarf*: Use llvm::Register instead of unsigned
Fangrui Song [Sat, 7 Nov 2020 05:00:28 +0000 (21:00 -0800)]
AsmPrinter/Dwarf*: Use llvm::Register instead of unsigned

7 months ago[CodeGen] Fixes sanitizer test
Atmn Patel [Sat, 7 Nov 2020 04:50:55 +0000 (23:50 -0500)]
[CodeGen] Fixes sanitizer test

By turning the loop into an infinite one, the loop can't be deleted
anymore so the test will continue to pass.

7 months ago[OpenMP] Fix -Wmisleading-indentation after D84192
Fangrui Song [Sat, 7 Nov 2020 04:09:43 +0000 (20:09 -0800)]
[OpenMP] Fix -Wmisleading-indentation after D84192

7 months ago[AsmPrinter] Rename ByteStreamer::EmitInt8 to emitInt8
Fangrui Song [Sat, 7 Nov 2020 04:02:56 +0000 (20:02 -0800)]
[AsmPrinter] Rename ByteStreamer::EmitInt8 to emitInt8

to be consistent with other emit*

7 months ago[LoopDeletion] Fixes failing test
Atmn Patel [Sat, 7 Nov 2020 03:36:47 +0000 (22:36 -0500)]
[LoopDeletion] Fixes failing test

The commit 0b17c6e4479d62bd4ff05c48d6cdf340b198832f occasionally causes this test to
fail, this fixes it.

7 months ago[DWARFLinker] Add CompileUnit::getInfo helper that takes a DWARFDie (NFC)
Jonas Devlieghere [Sat, 7 Nov 2020 03:35:06 +0000 (19:35 -0800)]
[DWARFLinker] Add CompileUnit::getInfo helper that takes a DWARFDie (NFC)

Eliminate the need to go through the DIE index by passing the DIE to
CompileUnit::getInfo directly.

Before:

  unsigned Idx = Unit->getOrigUnit().getDIEIndex(Die);
  CompileUnit::DIEInfo &Info = Unit->getInfo(Idx);

After:

  CompileUnit::DIEInfo &Info = Unit->getInfo(Die);

7 months ago[LoopDeletion] Allows deletion of possibly infinite side-effect free loops
Atmn Patel [Sun, 25 Oct 2020 22:24:48 +0000 (18:24 -0400)]
[LoopDeletion] Allows deletion of possibly infinite side-effect free loops

From C11 and C++11 onwards, a forward-progress requirement has been
introduced for both languages. In the case of C, loops with non-constant
conditionals that do not have any observable side-effects (as defined by
6.8.5p6) can be assumed by the implementation to terminate, and in the
case of C++, this assumption extends to all functions. The clang
frontend will emit the `mustprogress` function attribute for C++
functions (D86233, D85393, D86841) and emit the loop metadata
`llvm.loop.mustprogress` for every loop in C11 or later that has a
non-constant conditional.

This patch modifies LoopDeletion so that only loops with
the `llvm.loop.mustprogress` metadata or loops contained in functions
that are required to make progress (`mustprogress` or `willreturn`) are
checked for observable side-effects. If these loops do not have an
observable side-effect, then we delete them.

Loops without observable side-effects that do not satisfy the above
conditions will not be deleted.

Reviewed By: jdoerfert

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

7 months ago[OpenMP5.0] map item can be non-contiguous for target update
cchen [Sat, 7 Nov 2020 03:03:55 +0000 (21:03 -0600)]
[OpenMP5.0] map item can be non-contiguous for target update

In order not to modify the `tgt_target_data_update` information but still be
able to pass the extra information for non-contiguous map item (offset,
count, and stride for each dimension), this patch overload `arg` when
the maptype is set as `OMP_MAP_DESCRIPTOR`. The origin `arg` is for
passing the pointer information, however, the overloaded `arg` is an
array of descriptor_dim:

struct descriptor_dim {
  int64_t offset;
  int64_t count;
  int64_t stride
};

and the array size is the same as dimension size. In addition, since we
have count and stride information in descriptor_dim, we can replace/overload the
`arg_size` parameter by using dimension size.

For supporting `stride` in array section, we use a dummy dimension in
descriptor to store the unit size. The formula for counting the stride
in dimension D_n: `unit size * (D_0 * D_1 ... * D_n-1) * D_n.stride`.

Demonstrate how it works:
```
double arr[3][4][5];

D0: { offset = 0, count = 1, stride = 8 }                                // offset, count, dimension size always be 0, 1, 1 for this extra dimension, stride is the unit size
D1: { offset = 0, count = 2, stride = 8 * 1 * 2 = 16 }                   // stride = unit size * (product of dimension size of D0) * D1.stride = 4 * 1 * 2 = 8
D2: { offset = 2, count = 2, stride = 8 * (1 * 5) * 1 = 40  }            // stride = unit size * (product of dimension size of D0, D1) * D2.stride = 4 * 5 * 1 = 20
D3: { offset = 0, count = 2, stride = 8 * (1 * 5 * 4) * 2 = 320 }        // stride = unit size * (product of dimension size of D0, D1, D2) * D3.stride = 4 * 25 * 2 = 200

// X here means we need to offload this data, therefore, runtime will transfer
// data from offset 80, 96, 120, 136, 400, 416, 440, 456
// Runtime patch: https://reviews.llvm.org/D82245
// OOOOO OOOOO OOOOO
// OOOOO OOOOO OOOOO
// XOXOO OOOOO XOXOO
// XOXOO OOOOO XOXOO
```

Reviewed By: ABataev

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

7 months ago[libomptarget] Add support for target update non-contiguous
cchen [Sat, 7 Nov 2020 02:54:49 +0000 (20:54 -0600)]
[libomptarget] Add support for target update non-contiguous

This patch is the runtime support for https://reviews.llvm.org/D84192.

In order not to modify the tgt_target_data_update information but still be
able to pass the extra information for non-contiguous map item (offset,
count, and stride for each dimension), this patch overload arg when
the maptype is set as OMP_TGT_MAPTYPE_DESCRIPTOR. The origin arg is for
passing the pointer information, however, the overloaded arg is an
array of descriptor_dim:

```
struct descriptor_dim {
  int64_t offset;
  int64_t count;
  int64_t stride
};
```

and the array size is the dimension size. In addition, since we
have count and stride information in descriptor_dim, we can replace/overload the
arg_size parameter by using dimension size.

Reviewed By: grokos

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

7 months agoDon't link any LLVM/MLIR library to the C API unit-test
Mehdi Amini [Sat, 7 Nov 2020 01:34:43 +0000 (01:34 +0000)]
Don't link any LLVM/MLIR library to the C API unit-test

The tests are intended to exercise the public C API and will link to a
specific shared library exposing only the C API, this library itself may
link to libMLIR.so.
If we link some LLVM library statically in the test themselves, we end
up with duplicated cl::opt registrations in LLVM. A possible setup if
these libraries were needed could be to link libMLIR.so directly when
available and link statically when it isn't available (in which case the
libary exposing the C API would be statically link and isolated from the
cl::opt registry, hopefully).

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

7 months ago[Inliner] Handle `mustprogress` functions
Atmn Patel [Fri, 6 Nov 2020 05:10:23 +0000 (00:10 -0500)]
[Inliner] Handle `mustprogress` functions

When inlining `mustprogress` functions, if the caller or the callee has
the attribute, we drop the function attribute. The loops that have the
`llvm.loop.mustprogress` metadata keep their metadata. We do not need to
add new loop metadata to inlined functions because the patch in D86841
already adds the relevant loop metadata in all of the necessary places.

Reviewed By: jdoerfert

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

7 months ago[test] -mtriple=x86_64-* -> -mtriple=x86_64
Fangrui Song [Sat, 7 Nov 2020 00:49:51 +0000 (16:49 -0800)]
[test] -mtriple=x86_64-* -> -mtriple=x86_64

7 months ago[mlir][Python] Fix cmake typo keeping the extension from installing.
Stella Laurenzo [Sat, 7 Nov 2020 00:47:26 +0000 (16:47 -0800)]
[mlir][Python] Fix cmake typo keeping the extension from installing.

7 months ago[libc] Extend WrapperGen to emit aliases.
Siva Chandra Reddy [Fri, 6 Nov 2020 23:43:45 +0000 (15:43 -0800)]
[libc] Extend WrapperGen to emit aliases.

Reviewed By: michaelrj

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

7 months ago[llvm-cov] Fix missing slash in -path-equivalence
Zequan Wu [Fri, 6 Nov 2020 22:53:57 +0000 (14:53 -0800)]
[llvm-cov] Fix missing slash in -path-equivalence

7 months ago[AArch64] Add driver tests for HiSilicon's TSV110
Elvina Yakubova [Fri, 6 Nov 2020 22:50:43 +0000 (01:50 +0300)]
[AArch64] Add driver tests for HiSilicon's TSV110

7 months ago[mlir][Linalg] Canonicalize duplicate args.
Sean Silva [Thu, 5 Nov 2020 02:29:08 +0000 (18:29 -0800)]
[mlir][Linalg] Canonicalize duplicate args.

I ran into this pattern when converting elementwise ops like
`addf %arg0, %arg : tensor<?xf32>` to linalg. Redundant arguments can
also easily arise from linalg-fusion-for-tensor-ops.

Also, fix some small bugs in the logic in
LinalgStructuredOpsInterface.td.

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

7 months agoRevert "Allow running back-deployment testing against libc++abi"
Louis Dionne [Fri, 6 Nov 2020 22:26:42 +0000 (17:26 -0500)]
Revert "Allow running back-deployment testing against libc++abi"

This reverts commit 4d79ef814aedb63, which broke a few build bots.
I'm reverting until I have time to investigate.

7 months ago[AArch64] Add pipeline model for HiSilicon's TSV110
Elvina Yakubova [Fri, 6 Nov 2020 22:22:35 +0000 (01:22 +0300)]
[AArch64] Add pipeline model for HiSilicon's TSV110

This patch adds the scheduling and cost model for TSV110.

Reviewed by: SjoerdMeijer, bryanpkc

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

7 months ago[TableGen] Use llvm::is_contained (NFC)
Kazu Hirata [Fri, 6 Nov 2020 22:18:00 +0000 (14:18 -0800)]
[TableGen] Use llvm::is_contained (NFC)

7 months ago[ms] [llvm-ml] Allow arbitrary strings as integer constants
Eric Astor [Fri, 6 Nov 2020 20:18:15 +0000 (15:18 -0500)]
[ms] [llvm-ml] Allow arbitrary strings as integer constants

MASM interprets strings in expression contexts as integers expressed in big-endian base-256, treating each character as its ASCII representation.

This completely eliminates the need to special-case single-character strings.

Reviewed By: thakis

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

7 months ago[LoopDeletion] Remove dead loops with no exit blocks
Atmn Patel [Sun, 25 Oct 2020 22:30:09 +0000 (18:30 -0400)]
[LoopDeletion] Remove dead loops with no exit blocks

Currently, LoopDeletion refuses to remove dead loops with no exit blocks
because it cannot statically determine the control flow after it removes
the block. This leads to miscompiles if the loop is an infinite loop and
should've been removed.

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

7 months ago[llvm-objcopy][MachO] Skip sections with zero offset
Alexander Shaposhnikov [Fri, 6 Nov 2020 21:10:41 +0000 (13:10 -0800)]
[llvm-objcopy][MachO] Skip sections with zero offset

Some binaries can contain regular sections with zero offset and zero size.
This diff makes llvm-objcopy's handling of such sections consistent with
cctools's strip (which doesn't modify them),
previously the tool would allocate file space for them.

Test plan: make check-all

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

7 months ago[debuginfo-tests] Skip optnone-loops.cpp on Darwin
Jonas Devlieghere [Fri, 6 Nov 2020 21:04:55 +0000 (13:04 -0800)]
[debuginfo-tests] Skip optnone-loops.cpp on Darwin

This is failing on GreenDragon:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/24745/

7 months agoAdd new matchers for dependent names in templates
Stephen Kelly [Sat, 31 Oct 2020 00:41:16 +0000 (00:41 +0000)]
Add new matchers for dependent names in templates

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

7 months agoFix gcc warning by removing extra `;` after a macro (NFC)
Mehdi Amini [Fri, 6 Nov 2020 20:46:09 +0000 (20:46 +0000)]
Fix gcc warning by removing extra `;` after a macro (NFC)

7 months ago[obj2yaml] [yaml2obj] Add yaml support for SHT_LLVM_BB_ADDR_MAP section.
Rahman Lavaee [Fri, 6 Nov 2020 20:44:24 +0000 (12:44 -0800)]
[obj2yaml] [yaml2obj] Add yaml support for SHT_LLVM_BB_ADDR_MAP section.

YAML support allows us to better test the feature in the subsequent patches. The implementation is quite similar to the .stack_sizes section.

Reviewed By: jhenderson, grimar

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

7 months ago[clangd] Set the User option for clang-tidy to mimick its behaviour
Nathan James [Fri, 6 Nov 2020 19:58:19 +0000 (19:58 +0000)]
[clangd] Set the User option for clang-tidy to mimick its behaviour

Probably not essential as afaik only one check uses this field. but still good to have consistent behaviour.

Reviewed By: sammccall

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