platform/upstream/llvm.git
3 years agoRevert "Revert "[clangd] Implement textDocument/implementation (Xref layer)""
Utkarsh Saxena [Wed, 18 Nov 2020 17:13:11 +0000 (18:13 +0100)]
Revert "Revert "[clangd] Implement textDocument/implementation (Xref layer)""

This reverts commit 0016ab6f3632968e52eb83de021908f0c94bbb10.

Fix: Consume error from Expected<T>.

3 years ago[VP] Non-signalling llvm.vp.* intrinsics are speculatable
Simon Moll [Wed, 18 Nov 2020 16:51:46 +0000 (17:51 +0100)]
[VP] Non-signalling llvm.vp.* intrinsics are speculatable

This is specifically required by the upcoming ExpandVectorPredication
pass (D78203) to recognize llvm.vp.* intrinsics that may ignore their
predicates.

3 years agolld/MachO: Move MachOOptTable to DriverUtils.cpp, remove DriverUtils.h
Nico Weber [Wed, 18 Nov 2020 17:31:47 +0000 (12:31 -0500)]
lld/MachO: Move MachOOptTable to DriverUtils.cpp, remove DriverUtils.h

This makes lld/MachO look more like lld/COFF and lld/ELF, as discussed
in D91640.

3 years ago[AMDGPU] Fix v3f16 interaction with image store workaround
Sebastian Neubauer [Thu, 5 Nov 2020 14:09:56 +0000 (15:09 +0100)]
[AMDGPU] Fix v3f16 interaction with image store workaround

In some cases, the wrong amount of registers was reserved.

Also enable more v3f16 tests.

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

3 years ago[libc++] Implements multiline regex support.
Mark de Wever [Wed, 18 Nov 2020 17:09:13 +0000 (18:09 +0100)]
[libc++] Implements multiline regex support.

This resolves LWG2503.

3 years agoRevert "[clangd] Implement textDocument/implementation (Xref layer)"
Utkarsh Saxena [Wed, 18 Nov 2020 17:04:20 +0000 (18:04 +0100)]
Revert "[clangd] Implement textDocument/implementation (Xref layer)"

This reverts commit 43243208fa6fafe8b91e42c82bc56db9d99f76d3.

3 years agoHazardRecognizer - Fix definition/declaration argument name mismatches. NFCI.
Simon Pilgrim [Wed, 18 Nov 2020 16:45:25 +0000 (16:45 +0000)]
HazardRecognizer - Fix definition/declaration argument name mismatches. NFCI.

Consistently use SUnit *SU (or drop the argname entirely if not used like the other HazardRecognizer methods).

Silences cppcheck warnings.

3 years agoFix unused variable warning. NFCI.
Simon Pilgrim [Wed, 18 Nov 2020 16:23:04 +0000 (16:23 +0000)]
Fix unused variable warning. NFCI.

We're just performing a null pointer check, we don't need the actual variable.

3 years ago[SystemZ][NFC] Group SystemZ tests in SystemZ folder
Abhina Sreeskantharajan [Wed, 18 Nov 2020 16:48:28 +0000 (11:48 -0500)]
[SystemZ][NFC] Group SystemZ tests in SystemZ folder

This patch creates a SystemZ folder in clang/test/CodeGen to contain systemz-related lit tests.

Reviewed By: muiez

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

3 years ago[OpenMP] [DOCS] Update OMP5.1 feature status table [NFC]
dreachem [Wed, 18 Nov 2020 16:43:43 +0000 (10:43 -0600)]
[OpenMP] [DOCS] Update OMP5.1 feature status table [NFC]

Adding features in OpenMP 5.1 specification, as documented in feature change history, to the 5.1 table. I alphabetized the rows of the table according to the category. For deprecating master construct, I just used 'other' as the category.

Reviewed By: jdoerfert

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

3 years agolld: Make tests depend on llvm-symbolizer after bc98034040
Nico Weber [Wed, 18 Nov 2020 16:42:46 +0000 (11:42 -0500)]
lld: Make tests depend on llvm-symbolizer after bc98034040

Fixes test failures when building just `check-lld` in a clean build dir.

3 years ago[llvm] fix global_downgraded_to_static test
Mikhail Goncharov [Wed, 18 Nov 2020 16:19:03 +0000 (17:19 +0100)]
[llvm] fix global_downgraded_to_static test

after 9aa789820027 https://reviews.llvm.org/D90930

3 years ago[NFC] Use [MC]Register for Hexagon target
Gaurav Jain [Thu, 5 Nov 2020 03:10:29 +0000 (19:10 -0800)]
[NFC] Use [MC]Register for Hexagon target

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

3 years ago[clangd] Implement textDocument/implementation (Xref layer)
Utkarsh Saxena [Wed, 18 Nov 2020 10:57:36 +0000 (11:57 +0100)]
[clangd] Implement textDocument/implementation (Xref layer)

Xref layer changes for textdocument/implementation (https://microsoft.github.io/language-server-protocol/specification#textDocument_implementation)

This currently shows all functions (implementations) that overrides a virtual function.

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

3 years agoSpeculativeExecution: Allow speculating more instruction types
Piotr Sobczak [Wed, 18 Nov 2020 09:01:25 +0000 (10:01 +0100)]
SpeculativeExecution: Allow speculating more instruction types

Support more instructions in SpeculativeExecution pass:
- ExtractValue
- InsertValue
- Trunc
- Freeze

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

3 years ago[DAGCombiner] Precommit Sext Tests for D91589
Simon Pilgrim [Wed, 18 Nov 2020 15:55:52 +0000 (15:55 +0000)]
[DAGCombiner] Precommit Sext Tests for D91589

Patch by: @laytonio (Layton Kifer)

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

3 years ago[OPENMP]Fix PR48174: compile-time crash with target enter data on a global struct.
Alexey Bataev [Tue, 17 Nov 2020 21:55:59 +0000 (13:55 -0800)]
[OPENMP]Fix PR48174:  compile-time crash with target enter data on a global struct.

The compiler should treat array subscript with base pointer as a first
pointer in complex data, it is used only for member expression with base
pointer.

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

3 years ago[libc][obvious] Fix fdim[f|l] signatures in stdc spec.
Siva Chandra Reddy [Wed, 18 Nov 2020 15:28:51 +0000 (07:28 -0800)]
[libc][obvious] Fix fdim[f|l] signatures in stdc spec.

3 years ago[AMDGPU] Fix and extend vccz workarounds
Jay Foad [Tue, 17 Nov 2020 11:52:52 +0000 (11:52 +0000)]
[AMDGPU] Fix and extend vccz workarounds

We have workarounds for two different cases where vccz can get out of
sync with the value in vcc. This fixes them in two ways:

1. Fix the case where the def of vcc was in a previous basic block, by
pessimistically assuming that vccz might be incorrect at a basic block
boundary.

2. Fix the handling of pre-existing waitcnt instructions by calling
generateWaitcntInstBefore before examining ScoreBrackets to determine
whether there's an outstanding smem read operation.

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

3 years ago[Reassociate] Don't convert add-like-or's into add's if they appear to be part of...
Roman Lebedev [Wed, 18 Nov 2020 14:21:04 +0000 (17:21 +0300)]
[Reassociate] Don't convert add-like-or's into add's if they appear to be part of load-combining idiom

As Wei Mi is reporting in post-commit review
  https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20201116/853479.html
teaching -reassociate about add-like-or's (70472f3) results in breaking apart
load widening patterns, and reassociating them.

For now, simply exclude any such `or` that appears to be a root of
load widening idiom from the or->add transformation.

Note that the heuristic is greedy, it doesn't ensure that loads
can *actually* be widened into a single load.

3 years ago[NFC][Reassociate] Add patterns where `or` is part of load reduction idiom
Roman Lebedev [Wed, 18 Nov 2020 14:14:26 +0000 (17:14 +0300)]
[NFC][Reassociate] Add patterns where `or` is part of load reduction idiom

As Wei Mi is reporting in post-commit review:
  https://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20201116/853479.html
teaching -reassociate about add-like-or's (70472f3) results in breaking apart
load widening patterns, and reassociating them.

While that's great, it prevents the actual load widening in backend,
and that is not good. We should have load widening in middle-end,
but for now we should at least not regress the naive patterns..

3 years ago[AST] Enhance the const expression evaluator to support error-dependent exprs.
Haojian Wu [Wed, 18 Nov 2020 14:48:06 +0000 (15:48 +0100)]
[AST] Enhance the const expression evaluator to support error-dependent exprs.

Fix a crash when evaluating a constexpr function which contains
recovery-exprs. https://bugs.llvm.org/show_bug.cgi?id=46837

Would be nice to have constant expression evaluator support general template
value-dependent expressions, but it requires more work.

This patch is a good start I think, to handle the error-only
value-dependent expressions.

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

3 years ago[X86] Add broadcast merge test case for PR48215
Simon Pilgrim [Wed, 18 Nov 2020 14:06:19 +0000 (14:06 +0000)]
[X86] Add broadcast merge test case for PR48215

3 years agoFix unused variables in release build
Mikhail Goncharov [Wed, 18 Nov 2020 14:10:57 +0000 (15:10 +0100)]
Fix unused variables in release build

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

3 years ago[AMDGPU] Rename pseudo S_WAITCNT_IDLE to S_WAIT_IDLE. NFC.
Jay Foad [Wed, 18 Nov 2020 14:03:43 +0000 (14:03 +0000)]
[AMDGPU] Rename pseudo S_WAITCNT_IDLE to S_WAIT_IDLE. NFC.

3 years ago[ConstraintElimination] Refactor constraint extraction (NFC).
Florian Hahn [Tue, 17 Nov 2020 17:38:19 +0000 (17:38 +0000)]
[ConstraintElimination] Refactor constraint extraction (NFC).

This patch generalizes the extraction of a constraint for a given
condition. It allows decompose to return a vector of c * X pairs, which
allows de-composing multiple instructions in the future.

It also adds more clarifying comments.

3 years ago[clangd] Remove the trailing "." in add-using message.
Haojian Wu [Wed, 18 Nov 2020 13:43:15 +0000 (14:43 +0100)]
[clangd] Remove the trailing "." in add-using message.

to be consistent witih other code actions.

Reviewed By: adamcz

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

3 years ago[SystemZ] Use ISD::ABS opcode during isel.
Jonas Paulsson [Wed, 18 Nov 2020 10:40:18 +0000 (11:40 +0100)]
[SystemZ] Use ISD::ABS opcode during isel.

The SystemZISD::IABS node is no longer needed since ISD::ABS can be used
instead.

Review: Ulrich Weigand
Differential Revision: https://reviews.llvm.org/D91697

3 years ago[lldb][NFC] Don't let Process inherit from UserID
Raphael Isemann [Wed, 18 Nov 2020 13:30:06 +0000 (14:30 +0100)]
[lldb][NFC] Don't let Process inherit from UserID

I noticed that Process is inheriting from UserID to store its PID value. This patch
replaces this with a dedicated field in the Process class. This is NFC, but has some
small effects on the code using Process:
* `GetID()` now returns a `lldb::pid_t` like all other process code instead of `lldb::user_id_t`. Both are typedefs for `uint64_t`, so no change in behaviour.
* The equality operators defined for UserID no longer accept Process instances.
* Removes the inherited method `Process::Clear()` which didn't actually clear anything beside the PID value.

We maybe should also remove the getters/setters to `S/GetPID` or something like that. I can update all the code for that
in a follow-up NFC commit.

Reviewed By: labath

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

3 years ago[ARM][LowOverheadLoops] Merge VCMP and VPST across VPT blocks
Sam Tebbs [Fri, 6 Nov 2020 13:35:35 +0000 (13:35 +0000)]
[ARM][LowOverheadLoops] Merge VCMP and VPST across VPT blocks

This patch adds support for combining a VPST with a dangling VCMP from a
previous VPT block.

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

3 years agoFix typo for hasAnyOverloadedOperatorName; NFC
Keishi Hattori [Wed, 18 Nov 2020 12:48:59 +0000 (07:48 -0500)]
Fix typo for hasAnyOverloadedOperatorName; NFC

3 years agoRemove unportable test
Stephen Kelly [Wed, 18 Nov 2020 12:40:52 +0000 (12:40 +0000)]
Remove unportable test

The default content of translation unit varies too much between
platforms.

3 years agoAdd sysroot/lib to library search path of baremetal toolchain.
Hafiz Abid Qadeer [Wed, 18 Nov 2020 12:16:40 +0000 (12:16 +0000)]
Add sysroot/lib to library search path of baremetal toolchain.

Baremetal toolchain is not adding sysroot/lib to the library
search path. This is forcing the user to do it manually. This commit
fixes this shortcoming by adding the sysroot/lib to library search path
if sysroot is not empty.

Reviewed By: jroelofs

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

3 years ago[SLP] Use the minimum alignment of the load bundle when forming a masked.gather
Benjamin Kramer [Wed, 18 Nov 2020 11:50:24 +0000 (12:50 +0100)]
[SLP] Use the minimum alignment of the load bundle when forming a masked.gather

Instead of the first load. That works when vectorizing contiguous loads,
but not for gathers.

Fixes a miscompile introduced in fcad8d3635cff61a2749dcef94c0d51fa1e3e413.

3 years ago[Matrix] Adjust matrix pointer type for inline asm arguments.
Florian Hahn [Wed, 18 Nov 2020 11:32:45 +0000 (11:32 +0000)]
[Matrix] Adjust matrix pointer type for inline asm arguments.

Matrix types in memory are represented as arrays, but accessed through
vector pointers, with the alignment specified on the access operation.

For inline assembly, update pointer arguments to use vector pointers.
Otherwise there will be a mis-match if the matrix is also an
input-argument which is represented as vector.

Reviewed By: nickdesaulniers

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

3 years ago[sanitizer] Fix typo in log messages
Seonghyun Park [Wed, 18 Nov 2020 11:40:45 +0000 (03:40 -0800)]
[sanitizer] Fix typo in log messages

Fix typo in log messages

Reviewed By: vitalybuka

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

3 years ago[lldb] Fix a couple of remote llgs tests
David Spickett [Tue, 17 Nov 2020 11:56:45 +0000 (11:56 +0000)]
[lldb] Fix a couple of remote llgs tests

init_llgs_test no longer takes an argument
but these two were not updated.

Also fix some mistakes in TestAutoInstallMainExecutable
to get it passing again.

Reviewed By: JDevlieghere, labath

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

3 years ago[IndVars] Support different types of ExitCount when optimizing exit conds
Max Kazantsev [Wed, 18 Nov 2020 10:56:34 +0000 (17:56 +0700)]
[IndVars] Support different types of ExitCount when optimizing exit conds

In some cases we can handle IV and iter count of different types. It's a typical situation
after IV have been widened. This patch adds support for such cases, when legal.

Differential Revision: https://reviews.llvm.org/D88528
Reviewed By: skatkov

3 years ago[clang][cli] Port Migrator option flags to new option parsing system
Jan Svoboda [Wed, 18 Nov 2020 09:10:17 +0000 (10:10 +0100)]
[clang][cli] Port Migrator option flags to new option parsing system

Depends on D83406

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[lldb] [test] Un-XFAIL tests on freebsd/i386
Michał Górny [Tue, 17 Nov 2020 18:06:33 +0000 (19:06 +0100)]
[lldb] [test] Un-XFAIL tests on freebsd/i386

Restrict i386-specific XFAIL on a few tests to non-FreeBSD systems,
as they pass on FreeBSD.

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

3 years ago[lldb] [test] Un-XFAIL TestMultipleDebuggers.py
Michał Górny [Tue, 17 Nov 2020 11:04:13 +0000 (12:04 +0100)]
[lldb] [test] Un-XFAIL TestMultipleDebuggers.py

This test is flaky, and for the time being we do not mark them as XFAIL.

3 years ago[lldb] [test] Mark command-process-connect.test XFAIL
Michał Górny [Tue, 17 Nov 2020 10:39:48 +0000 (11:39 +0100)]
[lldb] [test] Mark command-process-connect.test XFAIL

We are still investigating why 'process connect' does not work while
'gdb-remote' does.

Signed-off-by: Michał Górny <mgorny@moritz.systems>
3 years ago[lldb] [test] Pass -mmmx to x86-gp-write test explicitly
Michał Górny [Tue, 17 Nov 2020 00:04:59 +0000 (01:04 +0100)]
[lldb] [test] Pass -mmmx to x86-gp-write test explicitly

Pass -mmmx explicitly to fix build failure with FreeBSD's clang on i386.

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

3 years ago[tsan] Add pthread_cond_clockwait interceptor
Vitaly Buka [Wed, 18 Nov 2020 07:43:08 +0000 (23:43 -0800)]
[tsan] Add pthread_cond_clockwait interceptor

Fixes https://github.com/google/sanitizers/issues/1259

Reviewed By: dvyukov

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

3 years ago[mlir] Simplify code generated by ConvertToLLVMPattern::getStridedElementPtr().
Christian Sigg [Tue, 17 Nov 2020 09:22:46 +0000 (10:22 +0100)]
[mlir] Simplify code generated by ConvertToLLVMPattern::getStridedElementPtr().

Make the interface match the one of ConvertToLLVMPattern::getDataPtr() (to be removed in a separate change).

Reviewed By: ftynse

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

3 years ago[clang][cli] Remove NormalizerRetTy and use the decltype of the KeyPath instead
Jan Svoboda [Mon, 16 Nov 2020 14:59:35 +0000 (15:59 +0100)]
[clang][cli] Remove NormalizerRetTy and use the decltype of the KeyPath instead

Depends on D83315

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[NFC][POwerPC] Added testcases of constant-i64.
Esme-Yi [Wed, 18 Nov 2020 10:13:16 +0000 (10:13 +0000)]
[NFC][POwerPC] Added testcases of constant-i64.

3 years ago[NFC] Add missing dependency in the IR unittests
Andrzej Warzynski [Wed, 18 Nov 2020 10:08:36 +0000 (10:08 +0000)]
[NFC] Add missing dependency in the IR unittests

This missing dependency has caused build failures when
`BUILD_SHARED_LIBS` is set to `ON`. The breaking change was introduced
here:
  * https://reviews.llvm.org/D91324

Failing buildbot:
  * http://lab.llvm.org:8011/#/builders/66/builds/555

3 years agoReland "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16...
Georgii Rymar [Wed, 18 Nov 2020 08:59:49 +0000 (11:59 +0300)]
Reland "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32 types." (https://reviews.llvm.org/D90930).

This reverts reverting commit fc40a03323a4b265ccbed34a07e281b13c5e8367
and fixes LLD (MachO/wasm) tests that failed previously.

3 years ago[Analysis] CGSCCPassManager.cpp - fix Wshadow warnings. NFCI.
Simon Pilgrim [Wed, 18 Nov 2020 09:05:34 +0000 (09:05 +0000)]
[Analysis] CGSCCPassManager.cpp - fix Wshadow warnings. NFCI.

3 years ago[clang][cli] Turn arcmt-* options into a single option
Jan Svoboda [Mon, 16 Nov 2020 13:30:54 +0000 (14:30 +0100)]
[clang][cli] Turn arcmt-* options into a single option

- The new option, -arcmt-action, is a simple enum based option.
- The driver is modified to translate the existing -ccc-acmt-* options accordingly
Depends on D83298

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[mlir] Introduce support for parametric side-effects
Alex Zinenko [Sun, 15 Nov 2020 14:25:01 +0000 (15:25 +0100)]
[mlir] Introduce support for parametric side-effects

The side effect infrastructure is based on the Effect and Resource class
templates, instances of instantiations of which are constructed as
thread-local singletons. With this scheme, it is impossible to further
parameterize either of those, or the EffectInstance class that contains
pointers to an Effect and Resource instances. Such a parameterization is
necessary to express more detailed side effects, e.g. those of a loop or
a function call with affine operations inside where it is possible to
precisely specify the slices of accessed buffers.

Include an additional Attribute to EffectInstance class for further
parameterization. This allows to leverage the dialect-specific
registration and uniquing capabilities of the attribute infrastructure
without requiring Effect or Resource instantiations to be attached to a
dialect themselves.

Split out the generic part of the side effect Tablegen classes into a
separate file to avoid generating built-in MemoryEffect interfaces when
processing any .td file that includes SideEffectInterfaceBase.td.

Reviewed By: rriddle

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

3 years ago[clang][cli] Add ability to make fixups to CompilerInvocation after option parsing
Jan Svoboda [Mon, 16 Nov 2020 11:17:29 +0000 (12:17 +0100)]
[clang][cli] Add ability to make fixups to CompilerInvocation after option parsing

Depends on D83211

Reviewed By: Bigcheese

Original patch by Daniel Grumberg.

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

3 years ago[libcxx] Add missing _LIBCPP_FUNC_VIS on a few win32 locale functions
Martin Storsjö [Thu, 12 Nov 2020 08:57:03 +0000 (10:57 +0200)]
[libcxx] Add missing _LIBCPP_FUNC_VIS on a few win32 locale functions

These functions are called directly from the public installed
headers, and thus need to be exported in DLL builds, just like
some other functions in the same header (e.g. snprintf_l).

This fixes e.g. test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp
in mingw configurations.

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

3 years ago[lldb] Python3 byte<->string issue in patch-crashlog.py
Raphael Isemann [Wed, 18 Nov 2020 08:58:02 +0000 (09:58 +0100)]
[lldb] Python3 byte<->string issue in patch-crashlog.py

3 years agoRevert "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16...
Georgii Rymar [Wed, 18 Nov 2020 08:55:03 +0000 (11:55 +0300)]
Revert "[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32 types."

This reverts commit 65fd17c241e22e1671e81efdb683687369c2feb3.

It breaks LLD/MachO tests that seems use obj2yaml the check the output.

3 years agoSpeculativeExecution: Allow speculating more instruction types
Piotr Sobczak [Tue, 17 Nov 2020 14:38:44 +0000 (15:38 +0100)]
SpeculativeExecution: Allow speculating more instruction types

Support more instructions in SpeculativeExecution pass:
- ExtractElement
- InsertElement
- ShuffleVector

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

3 years ago[clangd] Call hierarchy (Protocol layer)
Nathan Ridge [Tue, 10 Nov 2020 05:20:38 +0000 (00:20 -0500)]
[clangd] Call hierarchy (Protocol layer)

The protocol is based on the spec found here:
https://microsoft.github.io/language-server-protocol/specifications/specification-3-16/#textDocument_prepareCallHierarchy

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

3 years ago[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32...
Georgii Rymar [Fri, 6 Nov 2020 10:39:55 +0000 (13:39 +0300)]
[lib/Support/YAMLTraits] - Don't print leading zeroes when dumping Hex8/Hex16/Hex32 types.

When we produce an YAML output, we also print leading zeroes currently.
An output might look like this:

```
- Name:    .dynsym
  Type:    SHT_DYNSYM
  Address: 0x0000000000001000
  EntSize: 0x0000000000000018
```

There are probably no reason to print leading zeroes.
It just makes harder to read values. This patch stops printing them.
The output becomes like:

```
- Name:    .dynsym
  Type:    SHT_DYNSYM
  Address: 0x1000
  EntSize: 0x18
```

This affects obj2yaml mostly, but also dsymutil and llvm-xray tools output.

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

3 years agotest commit
Thorsten Schütt [Wed, 18 Nov 2020 08:20:37 +0000 (09:20 +0100)]
test commit

add whitespace

3 years ago[NFC][tsan] Prepepare for more interceptors which use cond_wait()
Vitaly Buka [Mon, 16 Nov 2020 13:16:45 +0000 (05:16 -0800)]
[NFC][tsan] Prepepare for more interceptors which use cond_wait()

3 years ago[test] Make scc-pass-printer.ll work with NPM
Arthur Eubanks [Wed, 18 Nov 2020 07:53:21 +0000 (23:53 -0800)]
[test] Make scc-pass-printer.ll work with NPM

Pin some legacy PM specific RUN lines to legacy PM.

3 years ago[mlir] Get array from the dense elements attribute with buffer protocol.
zhanghb97 [Sun, 8 Nov 2020 01:28:35 +0000 (09:28 +0800)]
[mlir] Get array from the dense elements attribute with buffer protocol.

- Add `mlirElementsAttrGetType` C API.
- Add `def_buffer` binding to PyDenseElementsAttribute.
- Implement the protocol to access the buffer.

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

3 years ago[X86] Use GF2P8AFFINEQB to implement vector bitreverse.
Craig Topper [Wed, 18 Nov 2020 05:34:34 +0000 (21:34 -0800)]
[X86] Use GF2P8AFFINEQB to implement vector bitreverse.

We can use GF2P8AFFINEQB to reverse bits in a byte. Shuffles are needed to reverse the bytes in elements larger than i8. LegalizeVectorOps takes care of inserting the shuffle for the larger element size.

We already have Custom lowering for v16i8 with SSSE3, v32i8 with AVX, and v64i8 with AVX512BW.

I think we might be able to use this for scalars too by moving into a vector and back. But I'll save that for a follow up as its a little more involved.

Reviewed By: RKSimon, pengfei

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

3 years ago[test] Pin size-remarks.ll to legacy PM
Arthur Eubanks [Wed, 18 Nov 2020 07:47:49 +0000 (23:47 -0800)]
[test] Pin size-remarks.ll to legacy PM

This tests legacy PM specific stuff.

3 years ago[JumpThreading] Make -print-lvi-after-jump-threading work with NPM
Arthur Eubanks [Wed, 18 Nov 2020 07:14:33 +0000 (23:14 -0800)]
[JumpThreading] Make -print-lvi-after-jump-threading work with NPM

3 years agoAdd CalibratedQuantizedType to quant dialect
Tei Jeong [Wed, 18 Nov 2020 06:14:02 +0000 (22:14 -0800)]
Add CalibratedQuantizedType to quant dialect

This type supports a calibrated type with min, max provided.

This will be used for importing calibration values of intermediate tensors (e.g. LSTM) which can't be imported with QuantStats op.

This type was initially suggested in the following RFC: https://llvm.discourse.group/t/rfc-a-proposal-for-implementing-quantization-transformations-in-mlir/655

Reviewed By: stellaraccident

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

3 years ago[clangd] Add OverridenBy Relation to index.
Utkarsh Saxena [Tue, 17 Nov 2020 11:15:31 +0000 (12:15 +0100)]
[clangd] Add OverridenBy Relation to index.

This was previously explored in reviews.llvm.org/D69094.

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

3 years ago[mlir][Python] Make DenseElementsAttr loading be int size agnostic.
Stella Laurenzo [Wed, 11 Nov 2020 18:21:53 +0000 (10:21 -0800)]
[mlir][Python] Make DenseElementsAttr loading be int size agnostic.

* I had missed the note about "Standard size" in the docs. On Windows, the 'l' types are 32bit.
* This fixes the only failing MLIR-Python test on Windows.

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

3 years agoADT: Share an implementation for single-element insert in SmallVector, NFC
Duncan P. N. Exon Smith [Wed, 18 Nov 2020 02:06:21 +0000 (18:06 -0800)]
ADT: Share an implementation for single-element insert in SmallVector, NFC

Factor out `SmallVectorImple::insert_one_impl`, a common implementation
for `insert(iterator, T&&)` and `insert(iterator, T const&)`. This is
just a clean up and has no functionality change.

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

3 years ago[DCE] Always get TargetLibraryInfo
Arthur Eubanks [Sat, 14 Nov 2020 07:34:11 +0000 (23:34 -0800)]
[DCE] Always get TargetLibraryInfo

I don't see any reason not to unconditionally retrieve TLI, it's fairly
cheap.

Fixes calls-errno.ll under NPM.

Reviewed By: asbirlea

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

3 years ago[libc++] Revert switch-based std::variant implementation again.
Eric Fiselier [Tue, 17 Nov 2020 22:34:23 +0000 (17:34 -0500)]
[libc++] Revert switch-based std::variant implementation again.

These changes cause substantial binary size increases for non-opt builds.
For example, the visit.pass.cpp test grows from 20k to 420k.

Further work will be done to re-land this patch without the size increases,
but that work is proving too tricky to fix forward.

This patch fully reverts:

35d226911165a9aae1f01f521a0019f1a9c0a25f

And it partially reverts:

bb43a0cd4adc4f1fa12e0d2fd1fe9aa6b5c00e34

The latter of which added XFAIL's to new variant tests
because the new implementation needlessly makes non-throwing code
paths in variant invoke throwing code.

This means the reverted change also breaks source backwards compat
with code compiled on OS X targeting older system dylibs. There is no
need for this to be the case. We should fix it before recommitting.

Reviewed as:
https://reviews.llvm.org/D91662

3 years ago[gn build] Port 6a89cb8136f
LLVM GN Syncbot [Wed, 18 Nov 2020 03:04:01 +0000 (03:04 +0000)]
[gn build] Port 6a89cb8136f

3 years ago[NewPM] Disable PreservedCFGChecker and add regression unit tests
Yevgeny Rouban [Wed, 18 Nov 2020 02:44:16 +0000 (09:44 +0700)]
[NewPM] Disable PreservedCFGChecker and add regression unit tests

The design of the PreservedCFG Checker (landed with the commit
28012e00d80b9) has a fundamental flaw which makes it incorrect.
The checker is based on the PreservedAnalyses result returned
by functional passes: if CFGAnalyses is in the returned
PreservedAnalyses set, then the checker asserts that the CFG
snapshot saved before the pass is equal to the CFG snapshot
taken after the the pass. The problem is in passes that change
CFG and invalidate CFGAnalyses on their own. Such passes do not
return CFGanalyses in the returned PreservedAnalyses. So the
checker mistakenly expects CFG unchanged. As an example see the
class TestSimplifyCFGInvalidatingAnalysisPass in the new tests.

It is interesting that the bug was not found in LLVM. That is
because the CFG checker ran only if CFGAnalyses was checked
incorrectly:
  if (!PassPA.allAnalysesInSetPreserved<CFGAnalyses>())
    return;

but must be checked as follows:
  auto PAC = PA.getChecker<PreservedCFGCheckerAnalysis>();
  if (!(PAC.preserved() ||
        PAC.preservedSet<AllAnalysesOn<Function>>() ||
        PAC.preservedSet<CFGAnalyses>())
    return;

A fully redesigned checker will be sent as a separate follow-up
patch.

Reviewed By: Serguei Katkov, Jakub Kuderski

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

3 years agoRevert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations...
Artem Dergachev [Wed, 18 Nov 2020 02:59:01 +0000 (18:59 -0800)]
Revert "Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."""

This reverts commit 41bcc05e2a4e3062eb12ac6e071bc835decc38f5.

3 years ago[gn build] Port 41bcc05e2a4
LLVM GN Syncbot [Wed, 18 Nov 2020 02:45:24 +0000 (02:45 +0000)]
[gn build] Port 41bcc05e2a4

3 years agoRevert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to...
Artem Dergachev [Mon, 16 Nov 2020 01:26:22 +0000 (17:26 -0800)]
Revert "Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis.""

This reverts commit 77bb3ebebbca13f0648beb433fbd1b06ba95a19c.

3 years ago[CFGuard] Add address-taken IAT tables and delay-load support
Andrew Paverd [Wed, 18 Nov 2020 02:02:13 +0000 (18:02 -0800)]
[CFGuard] Add address-taken IAT tables and delay-load support

This patch adds support for creating Guard Address-Taken IAT Entry Tables (.giats$y sections) in object files, matching the behavior of MSVC. These contain lists of address-taken imported functions, which are used by the linker to create the final GIATS table.
Additionally, if any DLLs are delay-loaded, the linker must look through the .giats tables and add the respective load thunks of address-taken imports to the GFIDS table, as these are also valid call targets.

Reviewed By: rnk

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

3 years ago[NFC][Test] Add more tests for IEEE Longdouble for PowerPC
QingShan Zhang [Wed, 18 Nov 2020 02:12:01 +0000 (02:12 +0000)]
[NFC][Test] Add more tests for IEEE Longdouble for PowerPC

3 years agoset the alignment of mlir::AttributeStorage to 64 bit explicitly to fix 32 bit platform
daquexian [Wed, 18 Nov 2020 01:29:43 +0000 (17:29 -0800)]
set the alignment of mlir::AttributeStorage to 64 bit explicitly to fix 32 bit platform

On some platform (like WebAssembly), alignof(mlir::AttributeStorage) is 4 instead of 8. As a result, it makes the program crashes since PointerLikeTypeTraits<mlir::Attribute>::NumLowBitsAvailable is 3.

So I explicitly set the alignment of mlir::AttributeStoarge to 64 bits, and set PointerLikeTypeTraits<mlir::Attribute>::NumLowBitsAvailable according to it.

I also fixed an another related error (alignof(NamedAttribute) -> alignof(DictionaryAttributeStorage)) based on reviewer's comments.

Reviewed By: dblaikie, rriddle

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

3 years ago[Frontend] Add flag to allow PCM generation despite compiler errors
Ben Barham [Wed, 18 Nov 2020 01:25:50 +0000 (17:25 -0800)]
[Frontend] Add flag to allow PCM generation despite compiler errors

As with precompiled headers, it's useful for indexers to be able to
continue through compiler errors in dependent modules.

Resolves rdar://69816264

Reviewed By: akyrtzi

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

3 years agoRevert "[IR] add fn attr for no_stack_protector; prevent inlining on mismatch"
Nick Desaulniers [Wed, 18 Nov 2020 01:17:44 +0000 (17:17 -0800)]
Revert "[IR] add fn attr for no_stack_protector; prevent inlining on mismatch"

This reverts commit b7926ce6d7a83cdf70c68d82bc3389c04009b841.

Going with a simpler approach.

3 years agoRevert "[BitCode] decode nossp fn attr"
Nick Desaulniers [Wed, 18 Nov 2020 01:17:36 +0000 (17:17 -0800)]
Revert "[BitCode] decode nossp fn attr"

This reverts commit 0b11d018cc2f2c6bea5dac8dc72140cdb502ca02.

Going with a simpler approach.

3 years ago[CMake] Fix ExtensionDependencies.inc with multiple extensions
Arthur Eubanks [Tue, 17 Nov 2020 17:24:38 +0000 (09:24 -0800)]
[CMake] Fix ExtensionDependencies.inc with multiple extensions

When polly is enabled and LLVM_BYE_LINK_INTO_TOOLS=ON is on, ExtensionDependencies.inc does not compile.

$ ninja tools/llvm-config/CMakeFiles/llvm-config.dir/llvm-config.cpp.o
tools/llvm-config/ExtensionDependencies.inc:8:1: error: excess elements in struct initializer
{{"Bye", {"Bye",nullptr}}},

ExtensionDependencies.inc pre-patch:
  std::array<ExtensionDescriptor, 2> AvailableExtensions{
  {{"Polly", {"support", "core", ...,nullptr}}},
  {{"Bye", {"Bye",nullptr}}},
  };

ExtensionDependencies.inc with this patch:
  std::array<ExtensionDescriptor, 2> AvailableExtensions{
  ExtensionDescriptor{"Polly", {"support", "core", ...,nullptr}},
  ExtensionDescriptor{"Bye", {"Bye",nullptr}},
  };

Reviewed By: Meinersbur

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

3 years ago[gn build] Use forward slashes for goma directory
Arthur Eubanks [Wed, 18 Nov 2020 01:09:45 +0000 (17:09 -0800)]
[gn build] Use forward slashes for goma directory

gn generates improper compile_commands.json files by not escaping
backslashes.

3 years ago[mlir][Linalg] Add dependence type to LinalgDependenceGraphElem.
MaheshRavishankar [Wed, 18 Nov 2020 00:32:31 +0000 (16:32 -0800)]
[mlir][Linalg] Add dependence type to LinalgDependenceGraphElem.

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

3 years ago[lld][WebAssembly] Implement --unresolved-symbols
Sam Clegg [Fri, 1 May 2020 16:14:59 +0000 (09:14 -0700)]
[lld][WebAssembly] Implement --unresolved-symbols

This is a more full featured version of ``--allow-undefined``.
The semantics of the different methods are as follows:

report-all:

   Report all unresolved symbols.  This is the default.  Normally the
   linker will generate an error message for each reported unresolved
   symbol but the option ``--warn-unresolved-symbols`` can change this
   to a warning.

ignore-all:

   Resolve all undefined symbols to zero.  For data and function
   addresses this is trivial.  For direct function calls, the linker
   will generate a trapping stub function in place of the undefined
   function.

import-functions:

   Generate WebAssembly imports for any undefined functions.  Undefined
   data symbols are resolved to zero as in `ignore-all`.  This
   corresponds to the legacy ``--allow-undefined`` flag.

The plan is to followup with a new mode called `import-dynamic` which
allows for statically linked binaries to refer to both data and
functions symbols from the embedder.

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

3 years ago[gn build] Port f8f6d6455f9
LLVM GN Syncbot [Wed, 18 Nov 2020 00:02:29 +0000 (00:02 +0000)]
[gn build] Port f8f6d6455f9

3 years agoRevert "Revert "[analyzer] NFC: Move IssueHash to libAnalysis.""
Artem Dergachev [Mon, 16 Nov 2020 00:06:32 +0000 (16:06 -0800)]
Revert "Revert "[analyzer] NFC: Move IssueHash to libAnalysis.""

This reverts commit 662ed9e67adace3d011f42478bc8bcb1773a2821.

3 years agohonor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake
Robert Underwood [Tue, 17 Nov 2020 23:44:00 +0000 (17:44 -0600)]
honor Python2_EXECUTABLE and Python3_EXECUTABLE when they are passed to cmake

CMake's find_package(Python3) and find_package(Python2) packages have a PYTHON_EXECUTABLE, Python2_EXECUTABLE, and Python3_EXECUTABLE cmake variables which control which version of python is built against.  As far as I can tell, the rest of LLVM honors these variables. This can cause the build process to fail when  if the automatically selected version of Python can't run due to modifications of LD_LIBRARY_PATH when using spack.  The corresponding Spack issue is https://github.com/spack/spack/issues/19908.  The corresponding LLVM issue is 48180

I believe an appropriate fix is to add the variables to the list of PASSTHROUGH_VARIABLES in cmake/Modules/AddCompilerRT.cmake, and this fixed compilation errors for me.

This bug affects distributions like Gentoo and package managers like Spack which allow for combinatorial versioning.

Reviewed By: Meinersbur

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

3 years ago[libc] Add implementations of ldexp[f|l].
Siva Chandra Reddy [Thu, 5 Nov 2020 06:34:06 +0000 (22:34 -0800)]
[libc] Add implementations of ldexp[f|l].

The rounding behavior of NormalFloat to float format has been changed
to round to nearest. Also, a bug in NormalFloat to subnormal number
conversion has been fixed.

Reviewed By: lntue

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

3 years agoFix assertions and bad warnings on extremely wide bit-fields.
Richard Smith [Tue, 17 Nov 2020 21:59:07 +0000 (13:59 -0800)]
Fix assertions and bad warnings on extremely wide bit-fields.

We used to produce a bogus warning if the width couldn't be represented
in 32 bits, and assert if it couldn't be represented in 64 bits.

3 years agoFix a pair of tests that would fail on a win32 box
Erich Keane [Tue, 17 Nov 2020 22:28:52 +0000 (14:28 -0800)]
Fix a pair of tests that would fail on a win32 box

The tests don't specify a triple in some cases, since they shouldn't be
necessary, so I've updated the tests to detect via macro when they are
running on win32 to give the slightly altered diagnostic.

3 years ago[gn build] Port 8fb4417d82b
LLVM GN Syncbot [Tue, 17 Nov 2020 21:45:53 +0000 (21:45 +0000)]
[gn build] Port 8fb4417d82b

3 years ago[LLVMFronted][tests] Add basic OpenMP parsing tests.
Michael Kruse [Tue, 17 Nov 2020 21:42:44 +0000 (15:42 -0600)]
[LLVMFronted][tests] Add basic OpenMP parsing tests.

As noticed in D91470, some of the functions of LLVMFrontend, are not tested within the library itself (but indirectly by its users clang and flang). In particular, the file OMP.cpp which is generated by tablegen was not tested at all.

Add tests for the parsing helpers in OMP.cpp. These are not meant to be exhaustive tests, just to ensure that we have some basic tests for all API functions.

Reviewed By: clementval

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

3 years ago[llvm-symbolizer] Add inline stack traces for Windows.
Amy Huang [Tue, 15 Sep 2020 16:38:42 +0000 (09:38 -0700)]
[llvm-symbolizer] Add inline stack traces for Windows.

This adds inline stack frames for symbolizing on Windows.

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

3 years ago[mlir] [sparse] start of sparse tensor compiler support
Aart Bik [Tue, 17 Nov 2020 20:13:18 +0000 (12:13 -0800)]
[mlir] [sparse] start of sparse tensor compiler support

As discussed in https://llvm.discourse.group/t/mlir-support-for-sparse-tensors/2020
this CL is the start of sparse tensor compiler support in MLIR. Starting with a
"dense" kernel expressed in the Linalg dialect together with per-dimension
sparsity annotations on the tensors, the compiler automatically lowers the
kernel to sparse code using the methods described in Fredrik Kjolstad's thesis.

Many details are still TBD. For example, the sparse "bufferization" is purely
done locally since we don't have a global solution for propagating sparsity
yet. Furthermore, code to input and output the sparse tensors is missing.
Nevertheless, with some hand modifications, the generated MLIR can be
easily converted into runnable code already.

Reviewed By: nicolasvasilache, ftynse

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

3 years ago[SVE] Take constant fold fast path for splatted vscale vectors
Christopher Tetreault [Tue, 17 Nov 2020 20:25:21 +0000 (12:25 -0800)]
[SVE] Take constant fold fast path for splatted vscale vectors

This should be a perfectly reasonable operation for scalable vectors.
Currently, it only works for zeroinitializer values of
ScalableVectorType, but the fundamental operation is sound and it should
be possible to make it work for other splats

Reviewed By: david-arm

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

3 years ago[OpenMP] Use explicit type casting in kmp_atomic.cpp
Hansang Bae [Fri, 30 Oct 2020 20:32:55 +0000 (15:32 -0500)]
[OpenMP] Use explicit type casting in kmp_atomic.cpp

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

3 years ago[flang] Fix FIR test failures
Peter Steinfeld [Tue, 17 Nov 2020 19:55:29 +0000 (11:55 -0800)]
[flang] Fix FIR test failures

When doing out-of-tree builds, FIR tests were failing.  I made a change
similar to the one by @jurahul to fix this.

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