platform/upstream/llvm.git
3 years ago[mlir][linalg] Cleanup LinalgOp usage in promotion.
Tobias Gysi [Thu, 3 Jun 2021 11:00:36 +0000 (11:00 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in promotion.

Replace the uses of deprecated Structured Op Interface methods in Promotion.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[LLDB] Skip TestDataFormatterStdUniquePtr.py on arm/linux
Muhammad Omair Javaid [Thu, 3 Jun 2021 09:52:18 +0000 (14:52 +0500)]
[LLDB] Skip TestDataFormatterStdUniquePtr.py on arm/linux

TestDataFormatterStdUniquePtr.py fails on lldb arm/aarch64 linux
buildbot but not reproducible on test machine. Skipping for now.

3 years ago[LLDB] Skip TestDataFormatterStdUniquePtr.py on arm/linux
Muhammad Omair Javaid [Thu, 3 Jun 2021 09:52:18 +0000 (14:52 +0500)]
[LLDB] Skip TestDataFormatterStdUniquePtr.py on arm/linux

TestDataFormatterStdUniquePtr.py fails on lldb arm/aarch64 linux
buildbot but not reproducible on test machine. Skipping for now.

3 years ago[RISCV] Reserve an emergency spill slot for any RVV spills
Fraser Cormack [Wed, 26 May 2021 16:56:26 +0000 (17:56 +0100)]
[RISCV] Reserve an emergency spill slot for any RVV spills

This patch addresses an issue in which fixed-length (VLS) vector RVV
code could fail to reserve an emergency spill slot for their frame index
elimination. This is because we were previously only reserving a spill
slot when there were `scalable-vector` frame indices being used.
However, fixed-length codegen uses regular-type frame indices if it
needs to spill.

This patch does the fairly brute-force method of checking ahead of time
whether the function contains any RVV spill instructions, in which case
it reserves one slot. Note that the second RVV slot is still only
reserved for `scalable-vector` frame indices.

This unfortunately causes quite a bit of churn in existing tests, where
we chop and change stack offsets for spill slots.

Reviewed By: craig.topper

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in generalization.
Tobias Gysi [Thu, 3 Jun 2021 09:20:32 +0000 (09:20 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in generalization.

Replace the uses of deprecated Structured Op Interface methods in Generalization.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[mlir] Split linalg reshape ops into expand/collapse.
Alexander Belyaev [Thu, 3 Jun 2021 09:33:56 +0000 (11:33 +0200)]
[mlir] Split linalg reshape ops into expand/collapse.

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

3 years ago[CodeGen] Fix a scalable-vector crash in VSELECT legalization
Fraser Cormack [Wed, 2 Jun 2021 16:58:29 +0000 (17:58 +0100)]
[CodeGen] Fix a scalable-vector crash in VSELECT legalization

The `DAGTypeLegalizer::WidenVSELECTMask` function is not (yet) ready for
scalable vector types, and has numerous places in which it tries to grab
either the fixed size or number of elements of its types.

I believe that it should be possible to update this method to properly
account for scalable-vector types, but we don't have test cases for
that; RISC-V bails out early on as it has legal i1 vector masks. As
such, this patch just prevents it from crashing.

Reviewed By: craig.topper

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

3 years ago[lldb][NFC] Remove unused 'using ArrayRef' in RegisterValueTest
Raphael Isemann [Thu, 3 Jun 2021 09:17:36 +0000 (11:17 +0200)]
[lldb][NFC] Remove unused 'using ArrayRef' in RegisterValueTest

3 years agoAdd -fno-visibility-inlines-hidden option
Yi Kong [Wed, 2 Jun 2021 17:05:18 +0000 (01:05 +0800)]
Add -fno-visibility-inlines-hidden option

This allows overriding -fvisibility-inlines-hidden.

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

3 years ago[clang][ARM] Remove arm2/3/6/7m CPU names
David Spickett [Mon, 24 May 2021 14:16:42 +0000 (14:16 +0000)]
[clang][ARM] Remove arm2/3/6/7m CPU names

These legacy CPUs are known to clang but not llvm.
Their use was ignored by llvm and it would print a
warning saying it did not recognise them.

However because some of them are default CPUs for their
architecture, you would get those warnings even if you didn't
choose a cpu explicitly.
(now those architectures will default to a "generic" CPU)

Information is thin on the ground for these older chips
so this is the best I could find:
https://en.wikichip.org/wiki/acorn/microarchitectures/arm2
https://en.wikichip.org/wiki/acorn/microarchitectures/arm3
https://en.wikichip.org/wiki/arm_holdings/microarchitectures/arm6
https://en.wikichip.org/wiki/arm_holdings/microarchitectures/arm7

Final part of fixing https://bugs.llvm.org/show_bug.cgi?id=50454.

Reviewed By: efriedma

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

3 years ago[ValueTypes] Fix scalable-vector changeExtendedVectorTypeToInteger
Fraser Cormack [Wed, 2 Jun 2021 16:26:25 +0000 (17:26 +0100)]
[ValueTypes] Fix scalable-vector changeExtendedVectorTypeToInteger

The attached tests check for the regression in DAGCombiner's
`visitVSELECT`, which may call this method.

Reviewed By: craig.topper

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

3 years ago[clang][clangd] Use reverse header map lookup in suggestPathToFileForDiagnostics
Dmitry Polukhin [Thu, 27 May 2021 08:20:35 +0000 (01:20 -0700)]
[clang][clangd] Use reverse header map lookup in suggestPathToFileForDiagnostics

Summary:
suggestPathToFileForDiagnostics is actively used in clangd for converting
an absolute path to a header file to a header name as it should be spelled
in the sources. Current approach converts absolute path to relative path.
This diff implements missing logic that makes a reverse lookup from the
relative path to the key in the header map that should be used in the sources.

Prerequisite diff: https://reviews.llvm.org/D103229

Test Plan: check-clang

Reviewers: dexonsmith, bruno, rsmith

Subscribers: cfe-commits

Tasks:

Tags: #clang

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

3 years agoRevert "[Fuchsia] Use libc++abi on Windows in Fuchsia toolchain"
Petr Hosek [Thu, 3 Jun 2021 08:17:48 +0000 (01:17 -0700)]
Revert "[Fuchsia] Use libc++abi on Windows in Fuchsia toolchain"

This reverts commit b5dd421a3afa02907777fddf61073274e2a4aa9a which
broke Fuchsia downstream builders.

3 years ago[mlir-reduce] Create MlirReduceLib
Chia-hung Duan [Thu, 3 Jun 2021 07:51:49 +0000 (15:51 +0800)]
[mlir-reduce] Create MlirReduceLib

Move the core reducer algorithm into a library so that it'll be easier
for porting to different projects.

Depends On D101046

Reviewed By: jpienaar, rriddle

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

3 years ago[NFC][scudo] Avoid integer overflow in test
Vitaly Buka [Thu, 3 Jun 2021 07:06:45 +0000 (00:06 -0700)]
[NFC][scudo] Avoid integer overflow in test

releasePagesToOS may shrink RSS below the value stored on start.

3 years ago[DFSan] Properly set argument ABI attributes
Arthur Eubanks [Mon, 31 May 2021 16:18:44 +0000 (09:18 -0700)]
[DFSan] Properly set argument ABI attributes

Calls must properly match argument ABI attributes with the callee.

Found via D103412.

Reviewed By: morehouse

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

3 years ago[clang] Fix fail of OpenMP/tile_codegen_tile_for.cpp.
Michael Kruse [Thu, 3 Jun 2021 01:47:54 +0000 (20:47 -0500)]
[clang] Fix fail of OpenMP/tile_codegen_tile_for.cpp.

Clang's version string can be customized using CLANG_VENDOR which the
test did not consider. Change the test to accept any version string.

3 years agoFix "control reaches end of non-void function" warnings on ppc64le
Zhaomo Yang [Thu, 3 Jun 2021 00:15:41 +0000 (00:15 +0000)]
Fix "control reaches end of non-void function" warnings on ppc64le

Warnings can be found here: https://lab.llvm.org/buildbot/#/builders/76/builds/2640

Reviewed By: ymandel

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

3 years ago[AArch64] Add regression test for missed bfi optimization.
Eli Friedman [Thu, 3 Jun 2021 00:23:58 +0000 (17:23 -0700)]
[AArch64] Add regression test for missed bfi optimization.

(See https://reviews.llvm.org/D60358 for the transform that breaks this
case.)

3 years ago[clangd] Improve resolution of static method calls in HeuristicResolver
Nathan Ridge [Mon, 19 Apr 2021 07:25:57 +0000 (03:25 -0400)]
[clangd] Improve resolution of static method calls in HeuristicResolver

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

3 years agoFix llvm/test/tools/llvm-dwp/X86/type_dedup_v5.test
James Y Knight [Thu, 3 Jun 2021 00:17:49 +0000 (20:17 -0400)]
Fix llvm/test/tools/llvm-dwp/X86/type_dedup_v5.test

It was writing files to the source dir after
316da543af14fb4b40ef0377fe770f430745f5ea.

3 years agoRecommit "Fix tmp files being left on Windows builds." with a fix for
Amy Huang [Wed, 2 Jun 2021 16:49:12 +0000 (09:49 -0700)]
Recommit "Fix tmp files being left on Windows builds." with a fix for
incorrect std::string use. (Also remove redundant call to
RemoveFileOnSignal.)

Clang writes object files by first writing to a .tmp file and then
renaming to the final .obj name. On Windows, if a compile is killed
partway through the .tmp files don't get deleted.

Currently it seems like RemoveFileOnSignal takes care of deleting the
tmp files on Linux, but on Windows we need to call
setDeleteDisposition on tmp files so that they are deleted when
closed.

This patch switches to using TempFile to create the .tmp files we write
when creating object files, since it uses setDeleteDisposition on Windows.
This change applies to both Linux and Windows for consistency.

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

This reverts commit 20797b129f844d4b12ffb2b12cf33baa2d42985c.

3 years ago[InstrProfiling] Delete linkage/visibility toggling for Windows
Fangrui Song [Wed, 2 Jun 2021 23:49:54 +0000 (16:49 -0700)]
[InstrProfiling] Delete linkage/visibility toggling for Windows

The linkage/visibility of `__profn_*` variables are derived
from the profiled functions.

    extern_weak => linkonce
    available_externally => linkonce_odr
    internal => private
    extern => private
    _ => unchanged

The linkage/visibility of `__profc_*`/`__profd_*` variables are derived from
`__profn_*` with linkage/visibility wrestling for Windows.

The changes can be folded to the following without changing semantics.

```
if (TT.isOSBinFormatCOFF() && !NeedComdat) {
  Linkage = GlobalValue::InternalLinkage;
  Visibility = GlobalValue::DefaultVisibility;
}
```

That said, I think we can just delete the code block.

An extern/internal function will now use private `__profc_*`/`__profd_*`
variables, instead of internal ones. This saves some symbol table entries.

A non-comdat {linkonce,weak}_odr function will now use hidden external
`__profc_*`/`__profd_*` variables instead of internal ones.  There is potential
object file size increase because such symbols need `/INCLUDE:` directives.
However such non-comdat functions are rare (note that non-comdat weak
definitions don't prevent duplicate definition error).

The behavior changes match ELF.

Reviewed By: rnk

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

3 years ago[profile] Add -fprofile-instr-generate tests for weak definition and various linkages
Fangrui Song [Wed, 2 Jun 2021 23:12:08 +0000 (16:12 -0700)]
[profile] Add -fprofile-instr-generate tests for weak definition and various linkages

3 years ago[MC] Delete unneeded MCAsmParser &Parser
Fangrui Song [Wed, 2 Jun 2021 23:10:18 +0000 (16:10 -0700)]
[MC] Delete unneeded MCAsmParser &Parser

3 years ago[MC] Change "unexpected tokens" to "expected newline" and remove unneeded "in .xxx...
Fangrui Song [Wed, 2 Jun 2021 23:08:05 +0000 (16:08 -0700)]
[MC] Change "unexpected tokens" to "expected newline" and remove unneeded "in .xxx directive"

3 years ago[coro] Preserve scope line for compiler generated functions
Dave Lee [Thu, 13 May 2021 16:04:29 +0000 (09:04 -0700)]
[coro] Preserve scope line for compiler generated functions

Coro-split functions with an active suspend point have their scope line set to
the line of the suspend point. However for compiler generated functions, this
results in debug info with unconventional results: a file named
`<compiler-generated>` with a non-zero line number. The convention for
`<compiler-generated>` is that the line number is zero.

This change propagates the scope line only for non-compiler generated
functions.

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

3 years ago[PowerPC] [GlobalISel] Implementation of formal arguments lowering in the IRTranslato...
Anshil Gandhi [Wed, 2 Jun 2021 22:46:39 +0000 (16:46 -0600)]
[PowerPC] [GlobalISel] Implementation of formal arguments lowering in the IRTranslator for the PPC backend

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

3 years ago[libc++] Enable tests for the experimental library by default
Louis Dionne [Sat, 8 May 2021 16:03:53 +0000 (12:03 -0400)]
[libc++] Enable tests for the experimental library by default

This matches the fact that we build the experimental library by default.
Otherwise, by default we'd be building the library but not testing it,
which is inconsistent.

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

3 years agoRevert "Differential Revision: https://reviews.llvm.org/D99812"
Anshil Gandhi [Wed, 2 Jun 2021 22:36:00 +0000 (16:36 -0600)]
Revert "Differential Revision: https://reviews.llvm.org/D99812"

This reverts commit c729f2a48a6ef6b20554494c5630082c89c3680c.

3 years ago[Clang][OpenMP] Emit dependent PreInits before directive.
Michael Kruse [Wed, 2 Jun 2021 14:12:32 +0000 (09:12 -0500)]
[Clang][OpenMP] Emit dependent PreInits before directive.

The PreInits of a loop transformation (atm moment only tile) include the computation of the trip count. The trip count is needed by any loop-associated directives that consumes the transformation-generated loop. Hence, we must ensure that the PreInits of consumed loop transformations are emitted with the consuming directive.

This is done by addinging the inner loop transformation's PreInits to the outer loop-directive's PreInits. The outer loop-directive will consume the de-sugared AST such that the inner PreInits are not emitted twice. The PreInits of a loop transformation are still emitted directly if its generated loop(s) are not associated with another loop-associated directive.

Reviewed By: ABataev

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

3 years ago[Fuchsia] Use libc++abi on Windows in Fuchsia toolchain
Petr Hosek [Wed, 2 Jun 2021 21:17:16 +0000 (14:17 -0700)]
[Fuchsia] Use libc++abi on Windows in Fuchsia toolchain

Don't use vcruntime, this makes our toolchain more hermetic and avoids
some compiler errors we've encountered in compiler-rt.

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

3 years ago[NFC] Test commit. Fix typos.
Amy Zhuang [Wed, 2 Jun 2021 20:45:01 +0000 (13:45 -0700)]
[NFC] Test commit. Fix typos.

3 years ago[clangd] Drop optional on ExternalIndexSpec
Kadir Cetinkaya [Mon, 12 Apr 2021 15:21:21 +0000 (17:21 +0200)]
[clangd] Drop optional on ExternalIndexSpec

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

3 years agoAdd a .mailmap entry for my two email addresses
Reid Kleckner [Wed, 2 Jun 2021 21:09:50 +0000 (14:09 -0700)]
Add a .mailmap entry for my two email addresses

I'm using rnk@google.com as the canonical email for now, but I guess I
can always update .mailmap in the future.

3 years ago[NFC][trace][intel-pt] small test fixes
Walter Erquinigo [Wed, 2 Jun 2021 21:05:33 +0000 (14:05 -0700)]
[NFC][trace][intel-pt] small test fixes

These tests started failing after a change in the disassembler. The fix
is pretty simple though.

3 years ago[X86][SSE] combineScalarToVector - only reuse broadcasts for scalar_to_vector if...
Simon Pilgrim [Wed, 2 Jun 2021 21:05:14 +0000 (22:05 +0100)]
[X86][SSE] combineScalarToVector - only reuse broadcasts for scalar_to_vector if the source operands scalar types match

We were hitting an issue when the scalar_to_vector source was being implicitly truncated (in this case to i8 to vXi1) but we were also using the i8 source in a broadcast to a vXi8 value.

Fixes PR50374

3 years ago[clangd][Protocol] Drop optional from WorkspaceEdit::changes
Kadir Cetinkaya [Tue, 1 Jun 2021 11:23:59 +0000 (13:23 +0200)]
[clangd][Protocol] Drop optional from WorkspaceEdit::changes

This is causing weird code patterns in various places and I can't see
any difference between None and empty change list. Neither in the current use
cases nor in the spec.

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

3 years ago[clangd] TUScheduler uses last active file for file-less queries
Kadir Cetinkaya [Tue, 1 Jun 2021 18:00:08 +0000 (20:00 +0200)]
[clangd] TUScheduler uses last active file for file-less queries

This enables requests like workspaceSymbols to be dispatched using the
file user was most recently operating on. A replacement for D103179.

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

3 years ago[SYCL] Fix __builtin_sycl_unique_stable_name to work on windows/spir
Erich Keane [Wed, 2 Jun 2021 19:50:52 +0000 (12:50 -0700)]
[SYCL] Fix __builtin_sycl_unique_stable_name to work on windows/spir

In the case where the device is an itanium target, and the host is a
windows target, we were getting the names wrong, since in the itanium
case we filter by lambda-signature.

The fix is to always filter by the signature rather than just on
non-windows builds. I considered doing the reverse (that is, checking
the aux-triple), but doing so would result in duplicate lambda mangling
numbers (from linux reusing the same number for different signatures).

3 years ago[CodeGen][NFC] Remove unused virtual function
Min-Yih Hsu [Fri, 28 May 2021 16:35:20 +0000 (09:35 -0700)]
[CodeGen][NFC] Remove unused virtual function

`TargetFrameLowering::emitCalleeSavedFrameMoves` with 4 arguments is not
used anywhere in CodeGen. Thus it shouldn't be exposed as a virtual
function. NFC.

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

3 years agoDifferential Revision: https://reviews.llvm.org/D99812
Anshil Gandhi [Wed, 2 Jun 2021 20:05:02 +0000 (14:05 -0600)]
Differential Revision: https://reviews.llvm.org/D99812

3 years agoPR50337, PR50561: Fix determination of whether a template parameter list
Richard Smith [Wed, 2 Jun 2021 19:57:18 +0000 (12:57 -0700)]
PR50337, PR50561: Fix determination of whether a template parameter list
contains constrained parameters.

3 years ago[gn build] Port 05d164b25c40
LLVM GN Syncbot [Wed, 2 Jun 2021 19:59:40 +0000 (19:59 +0000)]
[gn build] Port 05d164b25c40

3 years agoRevert "[libc++] NFC: Move unwrap_iter to its own header"
Louis Dionne [Wed, 2 Jun 2021 19:58:27 +0000 (15:58 -0400)]
Revert "[libc++] NFC: Move unwrap_iter to its own header"

This reverts commit 924ea3bb53 *again*, this time because it broke the
LLDB build with modules. We need to figure out what's up with the libc++
modules build once and for all.

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

3 years ago[mlir][NFC] Split the non-templated bits out of IROperand into a base class
River Riddle [Wed, 2 Jun 2021 19:48:09 +0000 (12:48 -0700)]
[mlir][NFC] Split the non-templated bits out of IROperand into a base class

This removes the need to define the derived Operand class before the derived
Value class. The major benefit of this refactoring is that we no longer need
the OpaqueValue class, as OpOperand can now be defined after Value. As part of
this refactoring the BlockOperand and OpOperand classes are moved out of
UseDefLists.h and to more suitable locations in BlockSupport and Value. After
this change, UseDefLists.h is almost entirely composed of generic use def utilities.

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

3 years ago[llvm-dwp] Add support for rnglists and loclists
Kim-Anh Tran [Wed, 2 Jun 2021 19:31:35 +0000 (12:31 -0700)]
[llvm-dwp] Add support for rnglists and loclists

This patch updates llvm-dwp to include rnglists and loclists
when parsing debug sections.

Reviewed By: dblaikie

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

3 years ago[llvm-dwp] Add support for DWARFv5 type units ...
Kim-Anh Tran [Wed, 2 Jun 2021 19:24:08 +0000 (12:24 -0700)]
[llvm-dwp] Add support for DWARFv5 type units                                                                                                                                                                ...

This patch adds support for DWARFv5 type units: parsing from
the .debug_info section, and writing index to the type unit index.
Previously, the type units were part of the .debug_types section
which is no longer used in DWARFv5.

Reviewed By: dblaikie

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

3 years ago[llvm-dwp] Adding support for v5 index writing
Kim-Anh Tran [Wed, 2 Jun 2021 19:07:53 +0000 (12:07 -0700)]
[llvm-dwp] Adding support for v5 index writing

This patch adds general support for DWARFv5 index writing.
In particular, this means only allowing inputs with one version,
either DWARFv5 or DWARFv4.

This patch adds the .debug_macro section as an example,
but the DWARFv5 type support and loc and rangelists are still
missing (and upcoming).

Reviewed By: dblaikie

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

3 years ago[mlir] Resolve TODO and use the pass argument instead of the TypeID for registration
River Riddle [Wed, 2 Jun 2021 19:06:32 +0000 (12:06 -0700)]
[mlir] Resolve TODO and use the pass argument instead of the TypeID for registration

This simplifies various pieces of code that interact with the pass registry, e.g. this removes the need to register passes to get accurate pass pipelines descriptions when generating crash reproducers.

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

3 years agoRemove unused function from a previous iteration of unique-stable-name
Erich Keane [Wed, 2 Jun 2021 18:40:17 +0000 (11:40 -0700)]
Remove unused function from a previous iteration of unique-stable-name

3 years ago[mlir-lsp] Avoid empty range diagnostic
Jacques Pienaar [Wed, 2 Jun 2021 19:07:19 +0000 (12:07 -0700)]
[mlir-lsp] Avoid empty range diagnostic

3 years ago[mlir] Add support for filtering patterns based on debug names and labels
River Riddle [Wed, 2 Jun 2021 18:43:01 +0000 (11:43 -0700)]
[mlir] Add support for filtering patterns based on debug names and labels

This revision allows for attaching "debug labels" to patterns, and provides to FrozenRewritePatternSet for  filtering patterns based on these labels (in addition to the debug name of the pattern). This will greatly simplify the ability to write tests targeted towards specific patterns (in cases where many patterns may interact),  will also simplify debugging pattern application by observing how application changes when enabling/disabling specific patterns.

To enable better reuse of pattern rewrite options between passes, this revision also adds a new PassUtil.td file to the Rewrite/ library that will allow for passes to easily hook into a common interface for pattern debugging. Two options are used to seed this utility, `disable-patterns` and `enable-patterns`, which are used to enable the filtering behavior indicated above.

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

3 years ago[SDAG] allow cast folding for vector sext-of-setcc with signed compare
Sanjay Patel [Wed, 2 Jun 2021 19:01:04 +0000 (15:01 -0400)]
[SDAG] allow cast folding for vector sext-of-setcc with signed compare

This extends 434c8e013a2c and ede3982792df to handle signed
predicates by sign-extending the setcc operands.

This is not shown directly in https://llvm.org/PR50055 ,
but the pattern is visible by changing the unsigned convert
to signed in the source code.

3 years ago[llvm-dwp] Skip type unit debug info sections
Kim-Anh Tran [Wed, 2 Jun 2021 18:48:02 +0000 (11:48 -0700)]
[llvm-dwp] Skip type unit debug info sections

This patch makes llvm-dwp skip debug info sections that may not be encoding a compile unit.
In DWARF5, debug info sections are also used for type units. As in preparation to support type units,
make llvm-dwp aware of other uses of debug info sections but skip them for now.

The patch first records all .debug_info sections, then goes through them one by one and records
the cu debug info section for writing the index unit, and copies that section to the final dwp output
info section. If it's not a compile unit, skip.

Reviewed By: dblaikie

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

3 years agoFix dfsan handling of musttail calls.
Andrew Browne [Wed, 2 Jun 2021 05:51:46 +0000 (22:51 -0700)]
Fix dfsan handling of musttail calls.

Without this change, a callsite like:
  [[clang::musttail]] return func_call(x);
will cause an error like:
  fatal error: error in backend: failed to perform tail call elimination
  on a call site marked musttail
due to DFSan inserting instrumentation between the musttail call and
the return.

Reviewed By: stephan.yichao.zhao

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

3 years ago[NFC] Remove variable that was set but not used.
Stefan Pintilie [Wed, 2 Jun 2021 18:16:15 +0000 (13:16 -0500)]
[NFC] Remove variable that was set but not used.

The buildbot ppc64le-lld-multistage-test has been failing because the variable
Tag in Waymaking.h is set but not used. This patch removes that varaible.

3 years ago[x86] add signed compare variant test for PR50055; NFC
Sanjay Patel [Wed, 2 Jun 2021 18:14:29 +0000 (14:14 -0400)]
[x86] add signed compare variant test for PR50055; NFC

3 years ago[mlir-lsp] Report range of potential identifier starting at location of diagnostic
Jacques Pienaar [Wed, 2 Jun 2021 17:49:53 +0000 (10:49 -0700)]
[mlir-lsp] Report range of potential identifier starting at location of diagnostic

Currently the diagnostics reports the file:line:col, but some LSP
frontends require a non-empty range. Report either the range of an
identifier that starts at location, or a range of 1. Expose the id
location to range helper and reuse here.

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

3 years ago[SampleFDO] New hierarchical discriminator for FS SampleFDO (ProfileData part)
Rong Xu [Thu, 27 May 2021 18:34:22 +0000 (11:34 -0700)]
[SampleFDO] New hierarchical discriminator for FS SampleFDO (ProfileData part)

This patch was split from https://reviews.llvm.org/D102246
[SampleFDO] New hierarchical discriminator for Flow Sensitive SampleFDO
This is mainly for ProfileData part of change. It will load
FS Profile when such profile is detected. For an extbinary format profile,
create_llvm_prof tool will add a flag to profile summary section.
For other format profiles, the users need to use an internal option
(-profile-isfs) to tell the compiler that the profile uses FS discriminators.

This patch also simplified the bit API used by FS discriminators.

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

3 years agoImprove performance when parsing symbol tables in mach-o files.
Greg Clayton [Wed, 2 Jun 2021 04:52:31 +0000 (21:52 -0700)]
Improve performance when parsing symbol tables in mach-o files.

Some larger projects were loading quite slowly with the current LLDB on macOS and macOS simulator builds. I did some instrument traces and found 3 main culprits:
- a LLDB timer that was put into a function that was called too often
- a std::set that was keeping track of the address of symbols that were already added
- a unnamed function generator in ObjectFile that was going slow due to allocations

In order to see this in action I ran the latest LLDB on a large application with many frameworks using the following method:

(lldb) script import time; start_time = time.perf_counter()
(lldb) file Large.app
(lldb) script print(time.perf_counter() - start_time)

I first range "sudo purge" to clear the system file caches to simulate a cold startup of the debugger, followed by two iterations with warm file caches.

Prior to this fix I was seeing the following timings:

17.68 (cold)
14.56 (warm 1)
14.52 (warm 2)

After this fix I was seeing:

11.32 (cold)
8.43 (warm 1)
8.49 (warm 2)

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

3 years agoFix -Wsign-compare warning (NFC)
Mehdi Amini [Wed, 2 Jun 2021 17:28:19 +0000 (17:28 +0000)]
Fix -Wsign-compare warning (NFC)

3 years agoAdd matchers for gtest's ASSERT_THAT, EXPECT_THAT, ON_CALL and EXPECT_CALL
Zhaomo Yang [Wed, 2 Jun 2021 13:24:24 +0000 (13:24 +0000)]
Add matchers for gtest's ASSERT_THAT, EXPECT_THAT, ON_CALL and EXPECT_CALL

This patch adds support for matching gtest's ASSERT_THAT, EXPECT_THAT, ON_CALL and EXPECT_CALL macros.

Reviewed By: ymandel, hokein

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

3 years ago[MLIR] Fix Standalone dialect test to work in out-of-tree builds
Krzysztof Drewniak [Wed, 2 Jun 2021 17:21:17 +0000 (17:21 +0000)]
[MLIR] Fix Standalone dialect test to work in out-of-tree builds

When LLVM and MLIR are built as subprojects (via add_subdirectory),
the CMake configuration that indicates where the MLIR libraries are is
not necessarily in the same cmake/ directory as LLVM's configuration.
This patch removes that assumption about where MLIRConfig.cmake is
located.

(As an additional none, the %llvm_lib_dir substitution was never
defined, and so find_package(MLIR) in the build was succeeding for
other reasons.)

Reviewed By: stephenneuendorffer

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

3 years ago[lldb] Preserve type sugar when using SBValue::Dereference on C++ references
Raphael Isemann [Wed, 2 Jun 2021 17:22:23 +0000 (19:22 +0200)]
[lldb] Preserve type sugar when using SBValue::Dereference on C++ references

When checking for type properties we usually want to strip all kind of type
sugar from the type. For example, sugar like Clang's ElaboratedType or typedefs
rarely influence the fundamental behaviour of a type such as its byte size.

However we always need to preserve type sugar for everything else as it does
matter for users that their variable of type `size_t` instead of `unsigned long`
for example.

This patch fixes one such bug when trying to use the SBValue API to dereference
a type.

Reviewed By: werat, shafik

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

3 years ago[SDAG] allow more cast folding for vector sext-of-setcc
Sanjay Patel [Wed, 2 Jun 2021 16:55:46 +0000 (12:55 -0400)]
[SDAG] allow more cast folding for vector sext-of-setcc

This is a follow-up to D103280 that eases the use restrictions,
so we can handle the motivating case from:
https://llvm.org/PR50055

The loop code is adapted from similar use checks in
ExtendUsesToFormExtLoad() and SliceUpLoad(). I did not see an
easier way to filter out non-chain uses of load values.

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

3 years ago[x86] add test for sext-of-setcc; NFC
Sanjay Patel [Tue, 1 Jun 2021 20:07:29 +0000 (16:07 -0400)]
[x86] add test for sext-of-setcc; NFC

D103462

3 years agoFix CMake error: TableGen targets must be in the DEPENDS list instead of LINK_LIBS
Mehdi Amini [Wed, 2 Jun 2021 17:13:51 +0000 (17:13 +0000)]
Fix CMake error: TableGen targets must be in the DEPENDS list instead of LINK_LIBS

3 years agoAdd missing CMake dependency for mlir/lib/Reducer (NFC)
Mehdi Amini [Wed, 2 Jun 2021 16:55:09 +0000 (16:55 +0000)]
Add missing CMake dependency for mlir/lib/Reducer (NFC)

The `OptReductionPass.cpp` file depends on the TableGen generated
`mlir/Reducer/Passes.h.inc` file.

3 years agoRemove redundant comparisons (NFC)
Adrian Prantl [Wed, 2 Jun 2021 16:52:45 +0000 (09:52 -0700)]
Remove redundant comparisons (NFC)

3 years ago[OpenMP] Fix improper printf format specifier
Peyton, Jonathan L [Wed, 2 Jun 2021 16:03:48 +0000 (11:03 -0500)]
[OpenMP] Fix improper printf format specifier

3 years ago[libcxx][NFC] Tidy up calculation of __nbuf in num_put::do_put, and add comments
Daniel McIntosh [Wed, 2 Jun 2021 15:44:07 +0000 (11:44 -0400)]
[libcxx][NFC] Tidy up calculation of __nbuf in num_put::do_put, and add comments

In 07ef8e679621 and 3ed9f6ebdeeb, `__nbuf` started to diverge from the amount
of space that was actually needed for the buffer. For 32-bit longs for example,
we allocate a buffer that is one larger than needed. Moreover, it is no longer
clear exactly where the extra +1 or +2 comes from - they're just numbers pulled
from thin air. This PR cleans up how `__nbuf` is calculated, and adds comments
to further clarify where each part comes from.

Specifically, it corrects the underestimation of the max size buffer needed
that the above two commits had to compensate for. The root cause looks to be
the use of signed type parameters to numeric_limits<>::digits. Since digits
only counts non-sign bits, the calculation was acting as though (for a signed
64-bit type) the longest value we would print was 2^63 in octal. However,
printing in octal treats values as unsigned, so it is actually 2^64. Thus,
using unsigned types and changing the final +2 to a +1 is probably a better
option.

Reviewed By: #libc, ldionne, Mordante

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

3 years ago[lld/mac] try to fix tests after a5645513dba
Nico Weber [Wed, 2 Jun 2021 15:33:08 +0000 (11:33 -0400)]
[lld/mac] try to fix tests after a5645513dba

My linux system doesn't like the `grep` for some reason,
but FileCheck seems to work.

3 years ago[OpenMP] Use new task type/flag for taskwait depend events.
Hansang Bae [Thu, 27 May 2021 22:29:35 +0000 (17:29 -0500)]
[OpenMP] Use new task type/flag for taskwait depend events.

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

3 years ago[lld/mac] Implement -dead_strip
Nico Weber [Fri, 7 May 2021 21:10:05 +0000 (17:10 -0400)]
[lld/mac] Implement -dead_strip

Also adds support for live_support sections, no_dead_strip sections,
.no_dead_strip symbols.

Chromium Framework 345MB unstripped -> 250MB stripped
(vs 290MB unstripped -> 236M stripped with ld64).

Doing dead stripping is a bit faster than not, because so much less
data needs to be processed:

    % ministat lld_*
    x lld_nostrip.txt
    + lld_strip.txt
        N           Min           Max        Median           Avg        Stddev
    x  10      3.929414       4.07692     4.0269079     4.0089678   0.044214794
    +  10     3.8129408     3.9025559     3.8670411     3.8642573   0.024779651
    Difference at 95.0% confidence
            -0.144711 +/- 0.0336749
            -3.60967% +/- 0.839989%
            (Student's t, pooled s = 0.0358398)

This interacts with many parts of the linker. I tried to add test coverage
for all added `isLive()` checks, so that some test will fail if any of them
is removed. I checked that the test expectations for the most part match
ld64's behavior (except for live-support-iterations.s, see the comment
in the test). Interacts with:
- debug info
- export tries
- import opcodes
- flags like -exported_symbol(s_list)
- -U / dynamic_lookup
- mod_init_funcs, mod_term_funcs
- weak symbol handling
- unwind info
- stubs
- map files
- -sectcreate
- undefined, dylib, common, defined (both absolute and normal) symbols

It's possible it interacts with more features I didn't think of,
of course.

I also did some manual testing:
- check-llvm check-clang check-lld work with lld with this patch
  as host linker and -dead_strip enabled
- Chromium still starts
- Chromium's base_unittests still pass, including unwind tests

Implemenation-wise, this is InputSection-based, so it'll work for
object files with .subsections_via_symbols (which includes all
object files generated by clang). I first based this on the COFF
implementation, but later realized that things are more similar to ELF.
I think it'd be good to refactor MarkLive.cpp to look more like the ELF
part at some point, but I'd like to get a working state checked in first.

Mechanical parts:
- Rename canOmitFromOutput to wasCoalesced (no behavior change)
  since it really is for weak coalesced symbols
- Add noDeadStrip to Defined, corresponding to N_NO_DEAD_STRIP
  (`.no_dead_strip` in asm)

Fixes PR49276.

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

3 years ago[lld/mac] Implement -needed_framework, -needed_library, -needed-l
Nico Weber [Wed, 2 Jun 2021 15:06:42 +0000 (11:06 -0400)]
[lld/mac] Implement -needed_framework, -needed_library, -needed-l

These allow overriding dead_strip_dylibs.

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

3 years ago[lld/mac] Don't strip explicit dylib also mentioned in LC_LINKER_OPTION
Nico Weber [Wed, 2 Jun 2021 12:54:36 +0000 (08:54 -0400)]
[lld/mac] Don't strip explicit dylib also mentioned in LC_LINKER_OPTION

Noticed by Jez in D103499.

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

3 years ago[LoopStrengthReduce] Ensure that debug intrinsics do not affect LSR's output
Stephen Tozer [Thu, 27 May 2021 16:03:32 +0000 (17:03 +0100)]
[LoopStrengthReduce] Ensure that debug intrinsics do not affect LSR's output

During Loop Strength Reduce, if the terminating condition for the loop
is not immediately adjacent to the terminating branch and it has more
than one use, a clone of the condition will be created just before the
terminating branch and will be used as the branch condition. Currently,
whether the instructions are "immediately adjacent" is determined by
checking whether the next instruction after the condition is the
terminating branch; this is incorrect however, as the presence of a
debug intrinsic between the two will result in a change to the output.
This is fixed by using getNextNonDebugInstruction() instead.

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

3 years ago[lld/mac] Address review feedback and improve a comment
Nico Weber [Wed, 2 Jun 2021 13:35:06 +0000 (09:35 -0400)]
[lld/mac] Address review feedback and improve a comment

I forgot to move the message() call around as requested in D103428
before committing that change. Move it now.

Also, improve the ordinal uniq'ing comment. I hadn't realized that the
distinct-but-identical files happen with --reproduce and not in general.

No behavior change.

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

3 years ago[coro async] Add the swiftasync attribute to the resume partial function
Arnold Schwaighofer [Wed, 19 May 2021 16:59:13 +0000 (09:59 -0700)]
[coro async] Add the swiftasync attribute to the resume partial function

Transfer the swiftasync attribute to the resume partial function according to
suspend.async specification. It's first argument denotes which argument is the
async context.

rdar://71499498

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

3 years ago[clang] Implement the using_if_exists attribute
Erik Pilkington [Mon, 31 May 2021 15:24:52 +0000 (11:24 -0400)]
[clang] Implement the using_if_exists attribute

This attribute applies to a using declaration, and permits importing a
declaration without knowing if that declaration exists. This is useful
for libc++ C wrapper headers that re-export declarations in std::, in
cases where the base C library doesn't provide all declarations.

This attribute was proposed in http://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html.

rdar://69313357

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

3 years ago[clangd] Add support for the `defaultLibrary` semantic token modifier
David Goldman [Thu, 29 Apr 2021 17:03:10 +0000 (13:03 -0400)]
[clangd] Add support for the `defaultLibrary` semantic token modifier

This allows us to differentiate symbols from the system (e.g. system
includes or sysroot) differently than symbols defined in the user's
project, which can be used by editors to display them differently.

This is currently based on `FileCharacteristic`, but we can
consider alternatives such as `Sysroot` and file paths in the future.

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

3 years agoFix comments in test cuda-kernel-call.cu
Yaxun (Sam) Liu [Wed, 2 Jun 2021 14:21:16 +0000 (10:21 -0400)]
Fix comments in test cuda-kernel-call.cu

3 years agoAdd getDemandedBits for uses.
Qunyan Mangus [Wed, 2 Jun 2021 14:07:40 +0000 (10:07 -0400)]
Add getDemandedBits for uses.

Add getDemandedBits method for uses so we can query demanded bits for each use.  This can help getting better use information. For example, for the code below
define i32 @test_use(i32 %a) {
  %1 = and i32 %a, -256
  %2 = or i32 %1, 1
  %3 = trunc i32 %2 to i8 (didn't optimize this to 1 for illustration purpose)
  ... some use of %3
  ret %2
}
if we look at the demanded bit of %2 (which is all 32 bits because of the return), we would conclude that %a is used regardless of how its return is used. However, if we look at each use separately, we will see that the demanded bit of %2 in trunc only uses the lower 8 bits of %a which is redefined, therefore %a's usage depends on how the function return is used.

Reviewed By: RKSimon

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

3 years ago[AArch64][NFC] Fix failing cost-model test
Irina Dobrescu [Wed, 2 Jun 2021 13:59:21 +0000 (14:59 +0100)]
[AArch64][NFC] Fix failing cost-model test

3 years ago[LV] Build and cost VPlans for scalable VFs.
Sander de Smalen [Wed, 2 Jun 2021 13:10:59 +0000 (14:10 +0100)]
[LV] Build and cost VPlans for scalable VFs.

This patch uses the calculated maximum scalable VFs to build VPlans,
cost them and select a suitable scalable VF.

Reviewed By: paulwalker-arm

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

3 years ago[compiler-rt][lsan] Increase libdl_deadlock test timeout
David Spickett [Wed, 2 Jun 2021 13:30:37 +0000 (13:30 +0000)]
[compiler-rt][lsan] Increase libdl_deadlock test timeout

We have been seeing this test fail intermittently on our
2 stage AArch64 bot.

As far back as https://lab.llvm.org/buildbot/#/builders/53/builds/2694

Likely due to a lack of resources at certain times on the
shared machine. Up the time limit to give us some more room.

(this limit only applies to the watchdog thread, so if the
test passes then it won't take 20s)

3 years ago[PowerPC][AIX} FIx AIX bootstrap build.
Sean Fertile [Tue, 1 Jun 2021 17:39:02 +0000 (13:39 -0400)]
[PowerPC][AIX} FIx AIX bootstrap build.

A recent patch:
https://reviews.llvm.org/rGe0921655b1ff8d4ba7c14be59252fe05b705920e
changed clangs AIX bitfield handling to use 4-byte bitfield containers,
matching XLs behavior. This change triggers static assert failures when
bootstrapping. Change the macro we check to enable bitfield packing on
AIX to `__clang__` which is defined by both xlclang and clang.

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

3 years ago[LV] NFC: Remove redundant isLegalMasked(Gather|Scatter) functions.
Sander de Smalen [Tue, 1 Jun 2021 20:05:33 +0000 (21:05 +0100)]
[LV] NFC: Remove redundant isLegalMasked(Gather|Scatter) functions.

This NFC change follows from conversation in D102437, where it was discussed
to remove these functions as a separate patch.

3 years ago[LV] NFC: Replace custom getMemInstValueType by llvm::getLoadStoreType.
Sander de Smalen [Tue, 1 Jun 2021 14:30:00 +0000 (15:30 +0100)]
[LV] NFC: Replace custom getMemInstValueType by llvm::getLoadStoreType.

llvm::getLoadStoreType was added recently and has the same implementation
as 'getMemInstValueType' in LoopVectorize.cpp. Since there is no
value in having two implementations, this patch removes the custom LV
implementation in favor of the generic one defined in Instructions.h.

3 years ago[TTI] NFC: Change getIntImmCodeSizeCost to return InstructionCost.
Daniil Fukalov [Thu, 20 May 2021 13:57:19 +0000 (16:57 +0300)]
[TTI] NFC: Change getIntImmCodeSizeCost to return InstructionCost.

This patch migrates the TTI cost interfaces to return an InstructionCost.

See this patch for the introduction of the type: https://reviews.llvm.org/D91174
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2020-November/146408.html

Reviewed By: sdesmalen

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

3 years ago[compiler-rt][asan] Enable unwind-tables for Arm Linux
David Spickett [Tue, 1 Jun 2021 14:54:33 +0000 (14:54 +0000)]
[compiler-rt][asan] Enable unwind-tables for Arm Linux

Since https://reviews.llvm.org/D102046 some tests have
been falling back to fast unwinding on our Thumb bot.

This fails because fast unwinding does not work on Thumb.
By adding the extra information we ensure this does not happen
during testing, but the built library can still fast unwind
as a last resort.

Since there are some situations it can work in, like if
eveything is built with clang. During testing we've got gcc
built system libs and clang built tests.

The same change was made for sanitizer-common in
https://reviews.llvm.org/D96337.

Reviewed By: zatrazz

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

3 years ago[mlir][linalg] Update result position calculation in the Structured Op Interface...
Tobias Gysi [Wed, 2 Jun 2021 12:29:50 +0000 (12:29 +0000)]
[mlir][linalg] Update result position calculation in the Structured Op Interface (NFC).

Remove two unused methods and replace the implementation of getResultsPositionInLoopsToShapeMap. The patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[mlir][linalg] Cleanup LinalgOp usage in fusion on tensors (NFC).
Tobias Gysi [Wed, 2 Jun 2021 11:55:38 +0000 (11:55 +0000)]
[mlir][linalg] Cleanup LinalgOp usage in fusion on tensors (NFC).

Replace the uses of deprecated Structured Op Interface methods in FusionOnTensors.cpp. This patch is based on https://reviews.llvm.org/D103394.

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

3 years ago[RISCV][NFC] Add '+mattr=+experimental-v' to RVV test
Fraser Cormack [Wed, 2 Jun 2021 10:39:53 +0000 (11:39 +0100)]
[RISCV][NFC] Add '+mattr=+experimental-v' to RVV test

3 years ago[AArch64] Optimise bitreverse lowering in ISel
Irina Dobrescu [Tue, 25 May 2021 18:19:52 +0000 (19:19 +0100)]
[AArch64] Optimise bitreverse lowering in ISel

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

3 years ago[AMDGPU][Libomptarget][NFC] Remove bunch of dead structs
Pushpinder Singh [Wed, 2 Jun 2021 07:24:06 +0000 (07:24 +0000)]
[AMDGPU][Libomptarget][NFC] Remove bunch of dead structs

Dropped structs are atmi_machine_t, atmi_device_t and atmi_memory_t

Reviewed By: JonChesterfield

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

3 years ago[lld/mac] Implement -reexport_framework, -reexport_library, -reexport-l
Nico Weber [Wed, 2 Jun 2021 00:17:04 +0000 (20:17 -0400)]
[lld/mac] Implement -reexport_framework, -reexport_library, -reexport-l

These are slightly easier-to-use versions of -sub_library and -sub_umbrella.

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

3 years ago[AMDGPU][Libomptarget][NFC] Remove atmi_place_t
Pushpinder Singh [Wed, 2 Jun 2021 07:22:40 +0000 (07:22 +0000)]
[AMDGPU][Libomptarget][NFC] Remove atmi_place_t

atmi_place_t has been replaced with int DeviceId.

Reviewed By: JonChesterfield

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

3 years ago[mailmap] Use my chromium address as my canonical email address
Nico Weber [Wed, 2 Jun 2021 10:34:39 +0000 (06:34 -0400)]
[mailmap] Use my chromium address as my canonical email address