platform/upstream/llvm.git
3 years ago[libObject,llvm-readelf/obj] - Don't use @@ when printing versions of undefined symbols.
Georgii Rymar [Fri, 22 Jan 2021 09:26:42 +0000 (12:26 +0300)]
[libObject,llvm-readelf/obj] - Don't use @@ when printing versions of undefined symbols.

A default version (@@) is only available for defined symbols.

Currently we use "@@" for undefined symbols too.
This patch fixes the issue and improves our test case.

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

3 years ago[RISCV] Adjust RISCVInstrInfoVSDPatterns.td for different pseudo instructions for...
Craig Topper [Tue, 26 Jan 2021 08:43:42 +0000 (00:43 -0800)]
[RISCV] Adjust RISCVInstrInfoVSDPatterns.td for different pseudo instructions for different FPR.

Move the Suffix string into the VTypeInfo class so we don't need a helper class to get to it.

Adjust pseudo naming scheme for FPRs to put F16/F32/F64 in
place of F in the pseudo instruction name rather than as a suffix.
This avoids special cases like VFMERGE from the original patch.

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

3 years ago[NFC] Refine some uninitialized used variables.
Freddy Ye [Tue, 26 Jan 2021 08:40:04 +0000 (16:40 +0800)]
[NFC] Refine some uninitialized used variables.

These warning are reported by static code analysis tool: Klocwork

Reviewed By: pengfei

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

3 years ago[clangd] Fix filename completion at the end of file
Kadir Cetinkaya [Tue, 26 Jan 2021 06:08:53 +0000 (07:08 +0100)]
[clangd] Fix filename completion at the end of file

Fixes https://github.com/clangd/clangd/issues/433

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

3 years ago[clang][cli] Accept strings instead of options in ImpliedByAnyOf
Jan Svoboda [Tue, 26 Jan 2021 08:21:55 +0000 (09:21 +0100)]
[clang][cli] Accept strings instead of options in ImpliedByAnyOf

To be able to refer to constant keypaths (e.g. `defvar cplusplus = LangOpts<"CPlusPlus">`) inside `ImpliedByAnyOf`, let's accept strings instead of `Option` instances.

This somewhat weakens the guarantees that we're referring to an existing (option) record, but we can still use the option.KeyPath syntax to simulate this.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Port GNU language options to marshalling system
Jan Svoboda [Tue, 26 Jan 2021 08:08:08 +0000 (09:08 +0100)]
[clang][cli] Port GNU language options to marshalling system

Port some GNU-related language options to the marshalling system for automatic command line parsing and generation.

Reviewed By: dexonsmith

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

3 years ago[clang][cli] Store LangStandard::Kind in LangOptions
Jan Svoboda [Tue, 26 Jan 2021 07:52:31 +0000 (08:52 +0100)]
[clang][cli] Store LangStandard::Kind in LangOptions

The `LangStandard::Kind` parsed from command line arguments is used to set up some `LangOption` defaults, but isn't stored anywhere.

To be able to generate `-std=` (in future patch), we need `CompilerInvocation` to not forget it.

This patch demonstrates another use-case: using `LangStd` to set up defaults of marshalled options.

Reviewed By: dexonsmith

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

3 years ago[RISCV] Define different pseudo instructions for different FPR.
Hsiangkai Wang [Fri, 22 Jan 2021 14:38:11 +0000 (22:38 +0800)]
[RISCV] Define different pseudo instructions for different FPR.

When spilling, the spill size will depend on the size of register class.
For .vf vector instructions, it may spill the floating point scalar
argument. In order to use the correct load/store instructions for
spilling, we need to provide the correct floating point register class
for the .vf vector pseudo instructions.

In this commit, we define the .vf pseudo instructions as three
different kinds of pseudo instructions for half/float/double. For
example, PseudoVFADD_M1 will become as PseudoVFADD_F16_M1,
PseudoVFADD_F32_M1, and PseudoVFADD_F64_M1.

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

3 years ago[clang][cli] NFC: Simplify BoolOption API
Jan Svoboda [Tue, 26 Jan 2021 07:27:40 +0000 (08:27 +0100)]
[clang][cli] NFC: Simplify BoolOption API

The `Bool{,F,G}Option` TableGen classes were designed after `Opt{In,Out}FFlag`, which put marshalling info on only one of the boolean options. To encode which record is supposed to carry the marshalling info (and be visible on -cc1 command-line), we used the `ChangedBy` and `ResetBy` classes.

However, we need to put marshalling info on both records anyways (see D93008 for details). This means we don't really need the distinction between `ChangedBy/ResetBy + BoolOption` and `FlagDef + BoolOptionBase` anymore.

This patch reduces the number of ways one can encode the marshalling information for pairs of boolean flags. Regardless of whether the key path value defaults to a statically known boolean, or a result of an expression, one can always use the new `BoolOption` and `PosFlag<SetTrue>, NegFlag<SetFalse>` syntax.

Reviewed By: dexonsmith

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

3 years agoAdd vp2intersect to AVX512 dialect.
Matthias Springer [Tue, 26 Jan 2021 07:31:20 +0000 (07:31 +0000)]
Add vp2intersect to AVX512 dialect.

Adds vp2intersect to the AVX512 dialect and defines a lowering to the
LLVM dialect.

Author: Matthias Springer <springerm@google.com>

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

3 years agoRevert "[WebAssembly] MC layer writes table symbols to object files"
Sam Clegg [Tue, 26 Jan 2021 06:09:45 +0000 (22:09 -0800)]
Revert "[WebAssembly] MC layer writes table symbols to object files"

This reverts commit d806618636f8a82bfc3f620e1fad83af4d2a2575.
Review: https://reviews.llvm.org/D92215

We had issues where older versions of wasm-ld were crashing on object
files containing a table symbol.  We decided that the best strategy
going forward is to only generate these symbol if refernece types is
enabled.  Without reference types enabled we should never geneate a
table symbol or a TABLE_NUMBER relocation.

This revert is in addition to the one already reverted in
https://reviews.llvm.org/D95005.

The plan is to re-land these in updated form after the llvm 12 branch.

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

3 years ago[Object][WebAssembly] Update format of error messages
Sam Clegg [Fri, 22 Jan 2021 15:46:28 +0000 (07:46 -0800)]
[Object][WebAssembly] Update format of error messages

Error message should start with lowercase in accordance with
https://llvm.org/docs/CodingStandards.html#error-and-warning-messages

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

3 years ago[mlir][Python] Fix comments of 'getCapsule' and 'createFromCapsule'
zhanghb97 [Tue, 26 Jan 2021 02:40:21 +0000 (10:40 +0800)]
[mlir][Python] Fix comments of 'getCapsule' and 'createFromCapsule'

The `getCapsule` and `createFromCapsule` comments incorrectly state the `PyMlirContext` and `MlirContext` in `PyLocation`, `PyAttribute`, and `PyType` classes.

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

3 years ago[OpenMP] Add source location information to the libomptarget profile
Johannes Doerfert [Sat, 23 Jan 2021 01:04:44 +0000 (19:04 -0600)]
[OpenMP] Add source location information to the libomptarget profile

In much of the libomptarget interface we have an ident_t object now, if
it is not null we can use it to improve the profile output. For now, we
simply use the ident_t "source information string" as generated by the
FE.

Reviewed By: tianshilei1992

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

3 years ago[OpenMP][FIX] Enforce a function boundary for a new data environment
Johannes Doerfert [Fri, 8 Jan 2021 16:30:28 +0000 (10:30 -0600)]
[OpenMP][FIX] Enforce a function boundary for a new data environment

Whenever we enter a new OpenMP data environment we want to enter a
function to simplify reasoning. Later we probably want to remove the
entire specialization wrt. the if clause and pass the result to the
runtime, for now this should fix PR48686.

Reviewed By: ABataev

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

3 years ago[RISCV] Update V extension to v1.0-draft 08a0b464.
Hsiangkai Wang [Wed, 13 Jan 2021 06:38:30 +0000 (14:38 +0800)]
[RISCV] Update V extension to v1.0-draft 08a0b464.

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

3 years ago[RISCV] Implement vlsegff intrinsics.
Hsiangkai Wang [Sun, 24 Jan 2021 05:37:38 +0000 (13:37 +0800)]
[RISCV] Implement vlsegff intrinsics.

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

3 years ago[AMDGPU] Forward-declare MachineIRBuilder (NFC)
Kazu Hirata [Tue, 26 Jan 2021 03:24:01 +0000 (19:24 -0800)]
[AMDGPU] Forward-declare MachineIRBuilder (NFC)

AMDGPULegalizerInfo.h needs MachineIRBuilder but relies on a forward
declaration of MachineIRBuilder in LegalizerInfo.h.  This patch adds a
forward declaration right in AMDGPULegalizerInfo.h.

While we are at it, this patch removes the one in LegalizerInfo.h,
where it is unnecessary.

3 years ago[StackSafety] Use ListSeparator (NFC)
Kazu Hirata [Tue, 26 Jan 2021 03:23:59 +0000 (19:23 -0800)]
[StackSafety] Use ListSeparator (NFC)

3 years ago[TableGen] Use llvm::append_range (NFC)
Kazu Hirata [Tue, 26 Jan 2021 03:23:57 +0000 (19:23 -0800)]
[TableGen] Use llvm::append_range (NFC)

3 years ago[OpenMP] Added the support for hidden helper task in RTL
Shilei Tian [Tue, 26 Jan 2021 03:14:52 +0000 (22:14 -0500)]
[OpenMP] Added the support for hidden helper task in RTL

The basic design is to create an outer-most parallel team. It is not a regular team because it is only created when the first hidden helper task is encountered, and is only responsible for the execution of hidden helper tasks.  We first use `pthread_create` to create a new thread, let's call it the initial and also the main thread of the hidden helper team. This initial thread then initializes a new root, just like what RTL does in initialization. After that, it directly calls `__kmpc_fork_call`. It is like the initial thread encounters a parallel region. The wrapped function for this team is, for main thread, which is the initial thread that we create via `pthread_create` on Linux, waits on a condition variable. The condition variable can only be signaled when RTL is being destroyed. For other work threads, they just do nothing. The reason that main thread needs to wait there is, in current implementation, once the main thread finishes the wrapped function of this team, it starts to free the team which is not what we want.

Two environment variables, `LIBOMP_NUM_HIDDEN_HELPER_THREADS` and `LIBOMP_USE_HIDDEN_HELPER_TASK`, are also set to configure the number of threads and enable/disable this feature. By default, the number of hidden helper threads is 8.

Here are some open issues to be discussed:
1. The main thread goes to sleeping when the initialization is finished. As Andrey mentioned, we might need it to be awaken from time to time to do some stuffs. What kind of update/check should be put here?

Reviewed By: jdoerfert

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

3 years agoRevert "[libomptarget][cuda] Gracefully handle missing cuda library"
Jon Chesterfield [Tue, 26 Jan 2021 03:14:53 +0000 (03:14 +0000)]
Revert "[libomptarget][cuda] Gracefully handle missing cuda library"

This reverts commit fafd45c01f3a49a40b09a31e9ea82efc87f3ab35.

3 years ago[Test][AArch64] Add s32 legalizer test for UADDE/USUBE
Cassie Jones [Tue, 26 Jan 2021 03:04:42 +0000 (22:04 -0500)]
[Test][AArch64] Add s32 legalizer test for UADDE/USUBE

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

3 years ago[Test][AArch64] Move overflow add/sub tests to their own file. NFC
Cassie Jones [Tue, 26 Jan 2021 03:02:31 +0000 (22:02 -0500)]
[Test][AArch64] Move overflow add/sub tests to their own file. NFC

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

3 years ago[JITLink] Disable ELF_ehframe_basic.s test on Windows.
Lang Hames [Tue, 26 Jan 2021 02:56:29 +0000 (13:56 +1100)]
[JITLink] Disable ELF_ehframe_basic.s test on Windows.

This test is failing on some windows bots with an error claiming that it is not
producing output. This appears to be a spurious failure, so I'm disabling on
windows while we investigate rather than reverting.

3 years ago[PowerPC] Do not emit HW loop with half precision operations
Nemanja Ivanovic [Tue, 26 Jan 2021 02:55:42 +0000 (20:55 -0600)]
[PowerPC] Do not emit HW loop with half precision operations

If a loop has any operations on half precision values, there will be calls to
library functions on Power8. Even on Power9, there is a small subset of
instructions that are actually supported for the type.

This patch disables HW loops whenever any operations on the type are found
(other than the handfull of supported ones when compiling for Power9). Fixes a
few PR's opened by Julia:

https://bugs.llvm.org/show_bug.cgi?id=48785
https://bugs.llvm.org/show_bug.cgi?id=48786
https://bugs.llvm.org/show_bug.cgi?id=48519

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

3 years ago[libomptarget][cuda] Gracefully handle missing cuda library
Jon Chesterfield [Tue, 26 Jan 2021 02:54:00 +0000 (02:54 +0000)]
[libomptarget][cuda] Gracefully handle missing cuda library

[libomptarget][cuda] Gracefully handle missing cuda library

If using dynamic cuda, and it failed to load, it is not safe to call
cuGetErrorString.

Reviewed By: jdoerfert

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

3 years ago[X86] Correct some cross references in avxintrin.h.
Wolfgang Pieb [Tue, 26 Jan 2021 02:48:09 +0000 (18:48 -0800)]
[X86] Correct some cross references in avxintrin.h.

3 years ago[llvm-link] Fix crash when materializing appending global
Sergey Dmitriev [Tue, 26 Jan 2021 02:07:23 +0000 (18:07 -0800)]
[llvm-link] Fix crash when materializing appending global

This patch fixes llvm-link crash when materializing global variable
with appending linkage and initializer that depends on another
global with appending linkage.

Reviewed By: tra

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

3 years agoRevert "Fix SBDebugger::CreateTargetWithFileAndArch to accept LLDB_ARCH_DEFAULT."
Richard Smith [Tue, 26 Jan 2021 02:02:39 +0000 (18:02 -0800)]
Revert "Fix SBDebugger::CreateTargetWithFileAndArch to accept LLDB_ARCH_DEFAULT."

Also revert "Follow on to: f05dc40c31d1883b46b8bb60547087db2f4c03e3"

After these changes, multiple lldb tests are failing. Calls to
CreateTargetWithFileAndArch(None, None) appear to fail after these
changes.

This reverts commit f05dc40c31d1883b46b8bb60547087db2f4c03e3 and
1fba21778f84f266f7d32153c88e59e1900fbe5b.

3 years ago[libcxx] random_device, for OpenBSD specify optimal entropy properties
Brad Smith [Tue, 26 Jan 2021 01:55:09 +0000 (20:55 -0500)]
[libcxx] random_device, for OpenBSD specify optimal entropy properties

Reviewed By: ldionne

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

3 years agoFrontend: Take VFS and MainFileBuffer by reference in PrecompiledPreamble::CanReuse...
Duncan P. N. Exon Smith [Tue, 10 Nov 2020 15:54:03 +0000 (10:54 -0500)]
Frontend: Take VFS and MainFileBuffer by reference in PrecompiledPreamble::CanReuse, NFC

Clarify that `PrecompiledPreamble::CanReuse` requires non-null arguments
for `VFS` and `MainFileBuffer`, taking them by reference instead of by
pointer.

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

3 years ago[GlobalISel][Localizer] Don't localize phi operands which are used more than once...
Amara Emerson [Mon, 25 Jan 2021 19:43:19 +0000 (11:43 -0800)]
[GlobalISel][Localizer] Don't localize phi operands which are used more than once in the phi.

The current algorithm just tries to localize defs as far as they can go, and in
the case of G_PHI operands, it clones the def into the predecessor block for
each incoming edge. When multiple edges have the same register value, this can
cause unnecessary code bloat, and inhibit later optimizations.

This change checks if a given phi operand is unique in the phi, if not the
def of that register is not localized to the predecessor.

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

3 years ago[lit] Update lit.py shebang for Python3
Julian Lettner [Mon, 25 Jan 2021 21:46:00 +0000 (13:46 -0800)]
[lit] Update lit.py shebang for Python3

Update shebang to always use Python3 when executing `lit.py` directly.

A previous change of mine [1] revealed that we still use Python2 on some
bot configurations that invoke `llvm/utils/lit/lit.py` as a script
directly (instead of `python3 path/to/lit.py`).

[1] https://reviews.llvm.org/D94734

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

3 years ago[x86] Fix trivial typo in emmintrin.h
Wolfgang Pieb [Tue, 26 Jan 2021 00:52:23 +0000 (16:52 -0800)]
[x86] Fix trivial typo in emmintrin.h

3 years agoSourceManager: Migrate to FileEntryRef in getOrCreateContentCache, NFC
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 00:42:33 +0000 (16:42 -0800)]
SourceManager: Migrate to FileEntryRef in getOrCreateContentCache, NFC

Change `SourceManager::getOrCreateContentCache` to take a `FileEntryRef`
and update call sites (mostly internal to SourceManager.cpp). In a
couple of cases this temporarily relies on `FileEntry::getLastRef`, but
those can be cleaned up once other APIs switch over.

The one change outside of SourceManager.cpp is in ASTReader.cpp, which
stops relying on the auto-degrade-to-`FileEntry*` behaviour from
`InputFile::getFile` since it now needs a `FileEntryRef`.

No functionality change here.

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

3 years agoSourceManager: Unify FileEntry/FileEntryRef versions of createFileID
Duncan P. N. Exon Smith [Tue, 26 Jan 2021 00:54:12 +0000 (16:54 -0800)]
SourceManager: Unify FileEntry/FileEntryRef versions of createFileID

Change `SourceManager::createFileID(const FileEntry*)` to defer to
`SourceManager::createFileID(FileEntryRef)`. This fixes an unexercised
bug where the latter gained support for named pipes and the former
didn't, but since we're trying to remove all calls to the former it
doesn't really make sense to test this explicitly now that the
implementation is hollowed out.

This is a belated follow-up to 245218bb355599771ba43a0fe1449d1670f2666c,
which sunk named pipe support into FileManager and SourceManager. The
original version of that patch was based on top of
https://reviews.llvm.org/D92984, which removed the `FileEntry` overload
of `createFileID()`, and I missed the subtle difference when it was
rebased.

3 years ago[JITLink] Re-apply 6884fbc2c4f (ELF eh support) with fix for broken test case.
Lang Hames [Tue, 26 Jan 2021 00:24:55 +0000 (11:24 +1100)]
[JITLink] Re-apply 6884fbc2c4f (ELF eh support) with fix for broken test case.

3 years ago[mlir:Async] Use LLVM coro operations in async.coro lowering
Eugene Zhulenev [Mon, 25 Jan 2021 23:53:42 +0000 (15:53 -0800)]
[mlir:Async] Use LLVM coro operations in async.coro lowering

Instead of using llvm.call operations to call LLVM coro intrinsics use Coro operations from the LLVM dialect.

(This was reviewed as a part of https://reviews.llvm.org/D94923 but was lost in arc land from local branch)

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

3 years agoExpressionParser: Migrate to FileEntryRef in ParseInternal, NFC
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 19:36:00 +0000 (11:36 -0800)]
ExpressionParser: Migrate to FileEntryRef in ParseInternal, NFC

Migrate to the `FileEntryRef` overload of `SourceManager::createFileID`
(using `FileManager::getOptionalFileRef`) in
`ClangExpressionParser::ParseInternal`.

No functionality change here.

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

3 years ago[TargetLowering][RISCV] Don't transform (seteq/ne (sext_inreg X, VT), C1) -> (seteq...
Craig Topper [Tue, 26 Jan 2021 00:17:42 +0000 (16:17 -0800)]
[TargetLowering][RISCV] Don't transform (seteq/ne (sext_inreg X, VT), C1) -> (seteq/ne (zext_inreg X, VT), C1) if the sext_inreg is cheaper

RISCV has to use 2 shifts for (i64 (zext_inreg X, i32)), but we
can use addiw rd, rs1, x0 for sext_inreg. We already understood this
when type legalizing i32 seteq/ne on rv64. But this transform in
SimplifySetCC would sometimes undo it.

Reviewed By: luismarques

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

3 years ago[libc++] Support immovable return types in std::function.
Arthur O'Dwyer [Mon, 11 Jan 2021 21:29:17 +0000 (16:29 -0500)]
[libc++] Support immovable return types in std::function.

LWG reflector consensus is that this was a bug in libc++.
(In particular, MSVC also will fix it in their STL, soon.)
Bug originally discovered by Logan Smith.

Also fix `std::function<const void()>`, which should work
the same way as `std::function<void()>` in terms of allowing
"conversions" from non-void types.

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

3 years agoDebugInfo: Generalize the .debug_addr minimization flag to pave the way for including...
David Blaikie [Tue, 26 Jan 2021 00:15:14 +0000 (16:15 -0800)]
DebugInfo: Generalize the .debug_addr minimization flag to pave the way for including other strategies

3 years agoRevert "Revert "[GlobalISel] LegalizerHelper - Extract widenScalarAddoSubo method""
Mitch Phillips [Fri, 22 Jan 2021 22:25:31 +0000 (14:25 -0800)]
Revert "Revert "[GlobalISel] LegalizerHelper - Extract widenScalarAddoSubo method""

This reverts commit 554b3211fefd09b56b64357b9edd66c78ae200b5.

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

3 years ago[RISCV] Add isel patterns to optimize slli.uw patterns without Zba extension.
Craig Topper [Mon, 25 Jan 2021 23:59:25 +0000 (15:59 -0800)]
[RISCV] Add isel patterns to optimize slli.uw patterns without Zba extension.

This pattern can occur when an unsigned is used to index an array
on RV64.

Reviewed By: luismarques

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

3 years agoAMDGPU: Reduce the number of expensive calls in SIFormMemoryClause
Changpeng Fang [Tue, 26 Jan 2021 00:08:08 +0000 (16:08 -0800)]
AMDGPU: Reduce the number of expensive calls in SIFormMemoryClause

Summary:
  RPTracker::reset(MI) is a very expensive call when the number of virtual registers is huge.
We observed a long compilation time issue when RPT::reset() is called once for each cluster.

In this work, we call RPT.reset() only at the first seen cluster, and use advance() to get
the register pressure for the later clusters in the same basic block. This could effectively reduce the number
of the expensive calls and thus reduce the compile time.

Reviewers:
  rampitec

Fixes:
  SWDEV-239161

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

3 years ago[lld-macho] Link against ObjCARCOpts instead of ObjCARC
Jez Ng [Mon, 25 Jan 2021 14:43:39 +0000 (09:43 -0500)]
[lld-macho] Link against ObjCARCOpts instead of ObjCARC

Not sure what the difference is, but using the latter appears to cause
issues in standalone builds. See llvm.org/PR48853.

Reviewed By: #lld-macho, compnerd

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

3 years ago[NFC] Disallow unused prefixes in clang/test/Analysis
Mircea Trofin [Fri, 22 Jan 2021 18:25:08 +0000 (10:25 -0800)]
[NFC] Disallow unused prefixes in clang/test/Analysis

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

3 years ago[AMDGPU] Added -mcpu=tahiti to 3 tests. NFC.
Stanislav Mekhanoshin [Mon, 25 Jan 2021 23:38:02 +0000 (15:38 -0800)]
[AMDGPU] Added -mcpu=tahiti to 3 tests. NFC.

3 years ago[lldb/Lua] add support for Lua function breakpoint
Pedro Tammela [Mon, 21 Dec 2020 17:59:35 +0000 (17:59 +0000)]
[lldb/Lua] add support for Lua function breakpoint

Adds support for running a Lua function when a breakpoint is hit.

Example:
   breakpoint command add -s lua -F abc

The above runs the Lua function 'abc' passing 2 arguments. 'frame', 'bp_loc' and 'extra_args'.

A third parameter 'extra_args' is only present when there is structured data
declared in the command line.

Example:
   breakpoint command add -s lua -F abc -k foo -v bar

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

3 years ago[InlineAdvisor] Allow replay of inline decisions for the CGSCC inliner from optimizat...
modimo [Mon, 25 Jan 2021 23:25:39 +0000 (15:25 -0800)]
[InlineAdvisor] Allow replay of inline decisions for the CGSCC inliner from optimization remarks

This change leverages the work done in D83743 to replay in the SampleProfile inliner to also be used in the CGSCC inliner. NOTE: currently restricted to non-ML advisors only.

The added switch `-cgscc-inline-replay=<remarks file>` will replay the inlining decisions in that file where the remarks file is generated via `-Rpass=inline`. The aim here is to make it easier to analyze changes that would modify inlining heuristics to be separated from this behavior. Doing so allows easier examination of assembly and runtime behavior compared to the baseline rather than trying to dig through the large churn caused by inlining.

In LTO compilation, since inlining is done twice you can separately specify replay by passing the flag to the FE (`-cgscc-inline-replay=`) and to the linker (`-Wl,cgscc-inline-replay=`) with the remarks generated from their respective places.

Testing on mysqld by comparing the inline decisions between base (generates remarks.txt) and diff (replay using identical input/tools with remarks.txt) and examining the inlining sites with `diff` shows 14,000 mismatches out of 247,341 for a ~94% replay accuracy. I believe this gap can be narrowed further though for the general case we may never achieve full accuracy. For my personal use, this is close enough to be representative: I set the baseline as the one generated by the replay on identical input/toolset and compare that to my modified input/toolset using the same replay.

Testing:
ninja check-llvm
newly added test correctly replays CGSCC inlining decisions

Reviewed By: mtrofin, wenlei

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

3 years ago[OpenMP][deviceRTLs] Remove omp_is_initial_device
Shilei Tian [Mon, 25 Jan 2021 23:34:14 +0000 (18:34 -0500)]
[OpenMP][deviceRTLs] Remove omp_is_initial_device

`omp_is_initial_device` in device code was implemented as a builtin
function in D38968 for a better performance. Therefore there is no chance that
this function will be called to `deviceRTLs`. As we're moving to build `deviceRTLs`
with OpenMP compiler, this function can lead to a compilation error. This patch
just simply removes it.

Reviewed By: JonChesterfield

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

3 years ago[clang][Fuchsia] Add relative-vtables + asan multilibs
Leonard Chan [Fri, 22 Jan 2021 19:20:26 +0000 (11:20 -0800)]
[clang][Fuchsia] Add relative-vtables + asan multilibs

We're choosing to take an opt-in approach for landing Relative VTables, so we'll
need asan-equivalent multilibs with relative vtables enabled. Afterwards, we can
just flip the switch in our build.

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

3 years agoSupport: Remove duplicated code in {File,clang::ModulesDependency}Collector, NFC
Duncan P. N. Exon Smith [Sat, 23 Jan 2021 01:19:38 +0000 (17:19 -0800)]
Support: Remove duplicated code in {File,clang::ModulesDependency}Collector, NFC

Refactor the duplicated canonicalize-path logic in `FileCollector` and
`ModulesDependencyCollector` into a new utility called
`PathCanonicalizer` that's shared. This popped up when tracking down a
bug common to both in https://reviews.llvm.org/D95202.

As drive-bys, update a few names and comments to better reflect the
effect of the code, delay removal of `..`s to avoid an unnecessary extra
string copy, and leave behind a couple of FIXMEs for future
consideration.

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

3 years agoFix -Wmissing-override in lldb
David Blaikie [Mon, 25 Jan 2021 23:03:38 +0000 (15:03 -0800)]
Fix -Wmissing-override in lldb

3 years agoFix runInTerminal errors on ARM
Walter Erquinigo [Mon, 25 Jan 2021 22:45:39 +0000 (14:45 -0800)]
Fix runInTerminal errors on ARM

Caused by https://reviews.llvm.org/D93951

This feature is not needed on ARM, so let's just disable the tests on
ARM.

3 years agoRestore GNU , ## __VA_ARGS__ behavior in MSVC mode
Harald van Dijk [Mon, 25 Jan 2021 22:34:49 +0000 (22:34 +0000)]
Restore GNU , ## __VA_ARGS__ behavior in MSVC mode

As noted in D91913, MSVC implements the GNU behavior for
, ## __VA_ARGS__ as well. Do the same when `-fms-compatibility` is used.

Reviewed By: rsmith

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

3 years agoFollow on to: f05dc40c31d1883b46b8bb60547087db2f4c03e3
Jim Ingham [Mon, 25 Jan 2021 22:23:11 +0000 (14:23 -0800)]
Follow on to: f05dc40c31d1883b46b8bb60547087db2f4c03e3

When you pass in a bogus ArchSpec, TargetList.CreateTarget
makes a target with the arch of the executable.  That wasn't the
case with a bogus triple, so this change caused one of the bogus
input data tests to fail.  So check that the ArchSpec is valid
before passing it to CreateTarget.

3 years ago[clangd] Allow configuration database to be specified in config.
Sam McCall [Wed, 20 Jan 2021 17:35:11 +0000 (18:35 +0100)]
[clangd] Allow configuration database to be specified in config.

This allows for more flexibility than -compile-commands-dir or ancestor
discovery.

See https://github.com/clangd/clangd/issues/116

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

3 years ago[LSR] Drop potentially invalid nowrap flags when switching to post-inc IV (PR46943)
Nikita Popov [Sat, 23 Jan 2021 11:27:22 +0000 (12:27 +0100)]
[LSR] Drop potentially invalid nowrap flags when switching to post-inc IV (PR46943)

When LSR converts a branch on the pre-inc IV into a branch on the
post-inc IV, the nowrap flags on the addition may no longer be valid.
Previously, a poison result of the addition might have been ignored,
in which case the program was well defined. After branching on the
post-inc IV, we might be branching on poison, which is undefined behavior.

Fix this by discarding nowrap flags which are not present on the SCEV
expression. Nowrap flags on the SCEV expression are proven by SCEV
to always hold, independently of how the expression will be used.
This is essentially the same fix we applied to IndVars LFTR, which
also performs this kind of pre-inc to post-inc conversion.

I believe a similar problem can also exist for getelementptr inbounds,
but I was not able to come up with a problematic test case. The
inbounds case would have to be addressed in a differently anyway
(as SCEV does not track this property).

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

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

3 years ago[RISCV] Add RVV insertelt/extractelt scalable-vector patterns
Fraser Cormack [Mon, 11 Jan 2021 17:42:05 +0000 (17:42 +0000)]
[RISCV] Add RVV insertelt/extractelt scalable-vector patterns

Original patch by @rogfer01.

This patch adds support for insertelt and extractelt operations on
scalable vectors.

Special care must be taken on RV32 when dealing with i64 vectors as
there are no straightforward ways to insert a 64-bit element without a
register of that size. To that end, both are custom-lowered to different
sequences.

Authored-by: Roger Ferrer Ibanez <rofirrim@gmail.com>
Co-Authored-by: Fraser Cormack <fraser@codeplay.com>
Reviewed By: craig.topper

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

3 years agoFix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6
Walter Erquinigo [Mon, 25 Jan 2021 22:05:04 +0000 (14:05 -0800)]
Fix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6

This fails on Windows because std::future<llvm::Error> fail to compile.
Now switching to SBError as a workaround.

Failed buildbot: http://lab.llvm.org:8011/#/builders/83/builds/3021

3 years ago[mlir:Async] Add intermediate async.coro and async.runtime operations to simplify...
Eugene Zhulenev [Mon, 18 Jan 2021 18:58:34 +0000 (10:58 -0800)]
[mlir:Async] Add intermediate async.coro and async.runtime operations to simplify Async to LLVM lowering

[NFC] No new functionality, mostly a cleanup and one more abstraction level between Async and LLVM IR.

Instead of lowering from Async to LLVM coroutines and Async Runtime API in one shot, do it progressively via async.coro and async.runtime operations.

1. Lower from async to async.runtime/coro (e.g. async.execute to function with coro setup and runtime calls)
2. Lower from async.runtime/coro to LLVM intrinsics and runtime API calls

Intermediate coro/runtime operations will allow to run transformations on a higher level IR and do not try to match IR based on the LLVM::CallOp properties.

Although async.coro is very close to LLVM coroutines, it is not exactly the same API, instead it is optimized for usability in async lowering, and misses a lot of details that are present in @llvm.coro intrinsic.

Reviewed By: ftynse

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

3 years ago[clangd] ignore parallelism level for quick tasks
Quentin Chateau [Mon, 25 Jan 2021 21:56:03 +0000 (22:56 +0100)]
[clangd] ignore parallelism level for quick tasks

This allows quick tasks without dependencies that
need to run fast to run ASAP. This is mostly useful
for code formatting.

----------------------------

This fixes something that's been annoying me:
- Open your IDE workspace and its 20 open files
- Clangd spends 5 minutes parsing it all
- In the meantime you start to work
- Save a file, trigger format-on-save, which hangs because clangd is busy
- You're stuck waiting until clangd is done parsing your files before the formatting and save takes place

Reviewed By: sammccall

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

3 years agoRecommit "[AArch64][GlobalISel] Implement widenScalar for signed overflow"
Cassie Jones [Mon, 25 Jan 2021 21:57:20 +0000 (16:57 -0500)]
Recommit "[AArch64][GlobalISel] Implement widenScalar for signed overflow"

Implement widening for G_SADDO and G_SSUBO.
Add legalize-add/sub tests for narrow overflowing add/sub on AArch64.

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

3 years agoRevert "[ObjC][ARC] Annotate calls with attributes instead of emitting retainRV"
Richard Smith [Mon, 25 Jan 2021 21:30:12 +0000 (13:30 -0800)]
Revert "[ObjC][ARC] Annotate calls with attributes instead of emitting retainRV"

This reverts commit 53176c168061d6f26dcf3ce4fa59288b7d67255e, which
introduceed a layering violation. LLVM's IR library can't include
headers from Analysis.

3 years ago[flang] Fix errors in ISO_FORTRAN_ENV module for REAL128
peter klausler [Mon, 25 Jan 2021 20:25:55 +0000 (12:25 -0800)]
[flang] Fix errors in ISO_FORTRAN_ENV module for REAL128

Some parameters of 128-bit IEEE floating-point numbers were
incorrect, leading to a failure to define REAL128 to 16.

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

3 years ago[flang] Search for #include "file" in right directory
peter klausler [Mon, 25 Jan 2021 20:29:10 +0000 (12:29 -0800)]
[flang] Search for #include "file" in right directory

Make the #include "file" preprocessing directive begin its
search in the same directory as the file containing the directive,
as other preprocessors and our Fortran INCLUDE statement do.

Avoid current working directory for all source files after the original.

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

3 years ago[YAML I/O] Fix bug in emission of empty sequence
Jonas Devlieghere [Mon, 25 Jan 2021 21:02:20 +0000 (13:02 -0800)]
[YAML I/O] Fix bug in emission of empty sequence

Don't emit an output dash for an empty sequence. Take emitting a vector
of strings for example:

  std::vector<std::string> Strings = {"foo", "bar"};
  LLVM_YAML_IS_SEQUENCE_VECTOR(std::string)
  yout << Strings;

This emits the following YAML document.

  ---
  - foo
  - bar
  ...

When the vector is empty, this generates the following result:

  ---
  - []
  ...

Although this is valid YAML, it does not match what we meant to emit.
The result is a one-element sequence consisting of an empty list.
Indeed, if we were to try to read this again we get an error:

  YAML:2:4: error: not a mapping
  - []

The problem is the output dash before the empty list. The correct output
would be:

  ---
  []
  ...

This patch fixes that by not emitting the output dash for an empty
sequence.

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

3 years agoRevert "[lit] Use os.cpu_count() to cleanup TODO"
Julian Lettner [Mon, 25 Jan 2021 21:31:27 +0000 (13:31 -0800)]
Revert "[lit] Use os.cpu_count() to cleanup TODO"

A bot owner contacted me.  I will re-land after confirming that this
doesn't break anyone (since it's low priority).

This reverts commit 9946b169c379daee603436a4753acfef8be373dd.

3 years agoFix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6
Walter Erquinigo [Mon, 25 Jan 2021 21:24:01 +0000 (13:24 -0800)]
Fix 0f0462cacf34aa88ae71a13c4199c1b1e70f3ee6

This test fails on ARM, but this feature won't be used on ARM, so we can
disable it for that architecture.

3 years agoRevert "[IndirectFunctions] Skip propagating attributes to address taken functions"
Konstantin Zhuravlyov [Mon, 25 Jan 2021 20:49:49 +0000 (15:49 -0500)]
Revert "[IndirectFunctions] Skip propagating attributes to address taken functions"

This reverts commit dd8ae42674b494e46ec40a22f40068db2b4a8b60.

This commit causes infinite loop when compiling rocThrust and hipCUB.

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

3 years agoFix SBDebugger::CreateTargetWithFileAndArch to accept LLDB_ARCH_DEFAULT.
Jim Ingham [Thu, 21 Jan 2021 20:32:07 +0000 (12:32 -0800)]
Fix SBDebugger::CreateTargetWithFileAndArch to accept LLDB_ARCH_DEFAULT.

The API docs in SBDebugger.i claim this should work but it doesn't.  This
should fix it.

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

3 years ago[vscode] Improve runInTerminal and support linux
Walter Erquinigo [Mon, 28 Dec 2020 20:00:47 +0000 (12:00 -0800)]
[vscode] Improve runInTerminal and support linux

Depends on D93874.

runInTerminal was using --wait-for, but it was some problems because it uses process polling looking for a single instance of the debuggee:

- it gets to know of the target late, which renders breakpoints in the main function almost impossible
- polling might fail if there are already other processes with the same name
- polling might also fail on some linux machine, as it's implemented with the ps command, and the ps command's args and output are not standard everywhere

As a better way to implement this so that it works well on Darwin and Linux, I'm using now the following process:

- lldb-vscode notices the runInTerminal, so it spawns lldb-vscode with a special flag --launch-target <target>. This flags tells lldb-vscode to wait to be attached and then it execs the target program. I'm using lldb-vscode itself to do this, because it makes finding the launcher program easier. Also no CMAKE INSTALL scripts are needed.
- Besides this, the debugger creates a temporary FIFO file where the launcher program will write its pid to. That way the debugger will be sure of which program to attach.
- Once attach happend, the debugger creates a second temporary file to notify the launcher program that it has been attached, so that it can then exec. I'm using this instead of using a signal or a similar mechanism because I don't want the launcher program to wait indefinitely to be attached in case the debugger crashed. That would pollute the process list with a lot of hanging processes. Instead, I'm setting a 20 seconds timeout (that's an overkill) and the launcher program seeks in intervals the second tepmorary file.

Some notes:
- I preferred not to use sockets because it requires a lot of code and I only need a pid. It would also require a lot of code when windows support is implemented.
- I didn't add Windows support, as I don't have a windows machine, but adding support for it should be easy, as the FIFO file can be implemented with a named pipe, which is standard on Windows and works pretty much the same way.

The existing test which didn't pass on Linux, now passes.

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

3 years agoReland"[clangd][NFC] Simplify handing on methods with no params"
Nathan James [Mon, 25 Jan 2021 20:19:50 +0000 (20:19 +0000)]
Reland"[clangd][NFC] Simplify handing on methods with no params"

This reverts commit 9d9ceb37453ffe0186d04f4e9e4ba9fb41200b57.

First time round caused some build bot failures due to older compilers not patched with the Defect Report about full specialization being allowed at class scope.

3 years ago[gn build] Port e123cd674c02
LLVM GN Syncbot [Mon, 25 Jan 2021 20:11:10 +0000 (20:11 +0000)]
[gn build] Port e123cd674c02

3 years agolibcxx: Try to fix build after D92044
Nico Weber [Mon, 25 Jan 2021 20:10:41 +0000 (15:10 -0500)]
libcxx: Try to fix build after D92044

3 years ago[clang-format] [NFC] Rerun dump_format_style.py
Björn Schäpers [Mon, 25 Jan 2021 19:54:17 +0000 (20:54 +0100)]
[clang-format] [NFC] Rerun dump_format_style.py

3 years ago[clang-format] PR16518 Add flag to suppress empty line insertion before access modifier
Albertas Vyšniauskas [Mon, 25 Jan 2021 19:47:22 +0000 (20:47 +0100)]
[clang-format] PR16518 Add flag to suppress empty line insertion before access modifier

Add new option called InsertEmptyLineBeforeAccessModifier. Empty line
before access modifier is inerted if this option is set to true (which
is the default value, because clang-format always inserts empty lines
before access modifiers), otherwise empty lines are removed.

Fixes issue #16518.

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

3 years ago[clang-format] [NFC] Remove unsued arguments
Björn Schäpers [Thu, 21 Jan 2021 12:53:27 +0000 (13:53 +0100)]
[clang-format] [NFC] Remove unsued arguments

3 years ago[clang-format] [NFC] Restructure getLineCommentIndentPrefix
Björn Schäpers [Wed, 20 Jan 2021 20:48:19 +0000 (21:48 +0100)]
[clang-format] [NFC] Restructure getLineCommentIndentPrefix

When sorting the known prefixes after length the if in the loop will hit
at most once, so we can return from there.

Also replace the inner loop with an algorithm, that makes it more
readable.

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

3 years ago[clang-format] [NFC] Use some constexpr StringRef
Björn Schäpers [Wed, 20 Jan 2021 20:35:19 +0000 (21:35 +0100)]
[clang-format] [NFC] Use some constexpr StringRef

Instead of const char*.

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

3 years ago[ObjC][ARC] Annotate calls with attributes instead of emitting retainRV
Akira Hatanaka [Mon, 25 Jan 2021 19:56:33 +0000 (11:56 -0800)]
[ObjC][ARC] Annotate calls with attributes instead of emitting retainRV
or claimRV calls in the IR

Background:

This patch makes changes to the front-end and middle-end that are
needed to fix a longstanding problem where llvm breaks ARC's autorelease
optimization (see the link below) by separating calls from the marker
instructions or retainRV/claimRV calls. The backend changes are in
https://reviews.llvm.org/D92569.

https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue

What this patch does to fix the problem:

- The front-end annotates calls with attribute "clang.arc.rv"="retain"
  or "clang.arc.rv"="claim", which indicates the call is implicitly
  followed by a marker instruction and a retainRV/claimRV call that
  consumes the call result. This is currently done only when the target
  is arm64 and the optimization level is higher than -O0.

- ARC optimizer temporarily emits retainRV/claimRV calls after the
  annotated calls in the IR and removes the inserted calls after
  processing the function.

- ARC contract pass emits retainRV/claimRV calls after the annotated
  calls. It doesn't remove the attribute on the call since the backend
  needs it to emit the marker instruction. The retainRV/claimRV calls
  are emitted late in the pipeline to prevent optimization passes from
  transforming the IR in a way that makes it harder for the ARC
  middle-end passes to figure out the def-use relationship between the
  call and the retainRV/claimRV calls (which is the cause of PR31925).

- The function inliner removes the autoreleaseRV call in the callee that
  returns the result if nothing in the callee prevents it from being
  paired up with the calls annotated with "clang.arc.rv"="retain/claim"
  in the caller. If the call is annotated with "claim", a release call
  is inserted since autoreleaseRV+claimRV is equivalent to a release. If
  it cannot find an autoreleaseRV call, it tries to transfer the
  attributes to a function call in the callee. This is important since
  ARC optimizer can remove the autoreleaseRV call returning the callee
  result, which makes it impossible to pair it up with the retainRV or
  claimRV call in the caller. If that fails, it simply emits a retain
  call in the IR if the call is annotated with "retain" and does nothing
  if it's annotated with "claim".

- This patch teaches dead argument elimination pass not to change the
  return type of a function if any of the calls to the function are
  annotated with attribute "clang.arc.rv". This is necessary since the
  pass can incorrectly determine nothing in the IR uses the function
  return, which can happen since the front-end no longer explicitly
  emits retainRV/claimRV calls in the IR, and change its return type to
  'void'.

Future work:

- Use the attribute on x86-64.

- Fix the auto upgrader to convert call+retainRV/claimRV pairs into
  calls annotated with the attributes.

rdar://71443534

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

3 years agoRevert "[clangd][NFC] Simplify handing on methods with no params"
Keith Smiley [Mon, 25 Jan 2021 19:54:46 +0000 (11:54 -0800)]
Revert "[clangd][NFC] Simplify handing on methods with no params"

This broke the build http://lab.llvm.org:8011/#/builders/7/builds/1405

This reverts commit f05b492aae4d4a741ec59f19518df91a3012824c.

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

3 years ago[lit] Use os.cpu_count() to cleanup TODO
Julian Lettner [Fri, 15 Jan 2021 01:04:39 +0000 (17:04 -0800)]
[lit] Use os.cpu_count() to cleanup TODO

We can now use Python3.  Let's use `os.cpu_count()` to cleanup this
helper.

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

3 years ago[VPlan] Replace uses with new value in VPInstructionsToVPRecipe (NFC).
Florian Hahn [Mon, 25 Jan 2021 19:34:59 +0000 (19:34 +0000)]
[VPlan] Replace uses with new value in VPInstructionsToVPRecipe (NFC).

Now that VPRecipeBase inherits from VPDef, we can always use the new
VPValue for replacement, if the recipe defines one. Given the recipes
that are supported at the moment, all new recipes must have either 0 or
1 defined values.

3 years ago[ThreadPlan] fix exec on Linux
Walter Erquinigo [Fri, 22 Jan 2021 18:22:26 +0000 (10:22 -0800)]
[ThreadPlan] fix exec on Linux

3 years ago[GVN] do not repeat PRE on failure to split critical edge
Nick Desaulniers [Mon, 25 Jan 2021 19:12:17 +0000 (11:12 -0800)]
[GVN] do not repeat PRE on failure to split critical edge

Fixes an infinite loop encountered in GVN.

GVN will delay PRE if it encounters critical edges, attempt to split
them later via calls to SplitCriticalEdge(), then restart.

The caller of GVN::splitCriticalEdges() assumed a return value of true
meant that critical edges were split, that the IR had changed, and that
PRE should be re-attempted, upon which we loop infinitely.

This was exposed after D88438, by compiling the Linux kernel for s390,
but the test case is reproducible on x86.

Fixes: https://github.com/ClangBuiltLinux/linux/issues/1261

Reviewed By: void

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

3 years ago[mlir] Add C API for IntegerSet
Alex Zinenko [Mon, 25 Jan 2021 16:12:35 +0000 (17:12 +0100)]
[mlir] Add C API for IntegerSet

Depends On D95357

Reviewed By: stellaraccident

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

3 years ago[OpenMP][NVPTX] Rewrite CUDA intrinsics with NVVM intrinsics
Shilei Tian [Mon, 25 Jan 2021 19:14:23 +0000 (14:14 -0500)]
[OpenMP][NVPTX] Rewrite CUDA intrinsics with NVVM intrinsics

This patch makes prep for dropping CUDA when compiling `deviceRTLs`.
CUDA intrinsics are replaced by NVVM intrinsics which refers to code in
`__clang_cuda_intrinsics.h`. We don't want to directly include it because in the
near future we're going to switch to OpenMP and by then the header cannot be
used anymore.

Reviewed By: JonChesterfield

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

3 years ago[clangd][NFC] Simplify handing on methods with no params
Nathan James [Mon, 25 Jan 2021 19:08:10 +0000 (19:08 +0000)]
[clangd][NFC] Simplify handing on methods with no params

Add bind methods handling the case when a method has an empty params interface and when it has no parameters.

Remove ShutdownParams and ExitParams from Protocol, In LSP they aren't defined, instead the methods are defined to have void as the params. This signature now better reflects that.

Reviewed By: sammccall

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

3 years ago[RISCV] Custom type legalize i8/i16 UDIV/UREM/SDIV on RV64 so we can use divuw/remuw...
Craig Topper [Mon, 25 Jan 2021 17:35:14 +0000 (09:35 -0800)]
[RISCV] Custom type legalize i8/i16 UDIV/UREM/SDIV on RV64 so we can use divuw/remuw/divw.

This makes our i8/i16 codegen more similar to the i32 codegen.

I've also added computeKnownBits support for DIVUW/REMUW so
that we can remove zero extending ANDs from the output. Without
this we end up turning DIVUW/REMUW back into DIVU/REMU via some
isel patterns.

Reviewed By: frasercrmck, luismarques

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

3 years ago[libc++] Fix build after 51faba35fd81fbd3af407a29c136895a718ccd96
Ruslan Arutyunyan [Mon, 25 Jan 2021 18:34:03 +0000 (13:34 -0500)]
[libc++] Fix build after 51faba35fd81fbd3af407a29c136895a718ccd96

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

3 years ago[Win64] Ensure all stack frames are 8 byte aligned
Reid Kleckner [Mon, 25 Jan 2021 18:26:51 +0000 (10:26 -0800)]
[Win64] Ensure all stack frames are 8 byte aligned

The unwind info format requires that all adjustments are 8 byte aligned,
and the bottom three bits are masked out. Most Win64 calling conventions
have 32 bytes of shadow stack space for spilling parameters, and I
believe that constructing these fixed stack objects had the side effect
of ensuring an alignment of 8. However, the Intel regcall convention
does not have this shadow space, so when using that convention, it was
possible to make a 4 byte stack frame, which was impossible to describe
with unwind info.

Fixes pr48867

3 years ago[mlir][Affine] Add support for multi-store producer fusion
Diego Caballero [Wed, 20 Jan 2021 22:41:51 +0000 (00:41 +0200)]
[mlir][Affine] Add support for multi-store producer fusion

This patch adds support for producer-consumer fusion scenarios with
multiple producer stores to the AffineLoopFusion pass. The patch
introduces some changes to the producer-consumer algorithm, including:

* For a given consumer loop, producer-consumer fusion iterates over its
producer candidates until a fixed point is reached.

* Producer candidates are gathered beforehand for each iteration of the
consumer loop and visited in reverse program order (not strictly guaranteed)
to maximize the number of loops fused per iteration.

In general, these changes were needed to simplify the multi-store producer
support and remove some of the workarounds that were introduced in the past
to support more fusion cases under the single-store producer limitation.

This patch also preserves the existing functionality of AffineLoopFusion with
one minor change in behavior. Producer-consumer fusion didn't fuse scenarios
with escaping memrefs and multiple outgoing edges (from a single store).
Multi-store producer scenarios will usually (always?) have multiple outgoing
edges so we couldn't fuse any with escaping memrefs, which would greatly limit
the applicability of this new feature. Therefore, the patch enables fusion for
these scenarios. Please, see modified tests for specific details.

Reviewed By: andydavis1, bondhugula

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

3 years ago[SampleFDO] Report error when reading a bad/incompatible profile instead of
Wei Mi [Fri, 22 Jan 2021 23:09:21 +0000 (15:09 -0800)]
[SampleFDO] Report error when reading a bad/incompatible profile instead of
turning off SampleFDO silently.

Currently sample loader pass turns off SampleFDO optimization silently when
it sees error in reading the profile. This behavior will defeat the tests
which could have caught those bad/incompatible profile problems. This patch
change the behavior to report error.

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

3 years ago[lld] Consistent help text for `--save-temps`
Sam Clegg [Mon, 18 Jan 2021 19:39:28 +0000 (11:39 -0800)]
[lld] Consistent help text for `--save-temps`

I noticed that this option was not appearing at all in the `--help`
messages for `wasm-ld` or `ld.lld`.

Add help text and make it consistent across all ports.

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

3 years ago[PowerPC] Add missing negate for VPERMXOR on little endian subtargets
Nemanja Ivanovic [Mon, 25 Jan 2021 18:22:19 +0000 (12:22 -0600)]
[PowerPC] Add missing negate for VPERMXOR on little endian subtargets

This intrinsic is supposed to have the permute control vector complemented on
little endian systems (as the ABI specifies and GCC implements). With the
current code gen, the result vector is byte-reversed.

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

3 years ago[mlir] Use more C99 comments in C API header files
Alex Zinenko [Mon, 25 Jan 2021 14:22:16 +0000 (15:22 +0100)]
[mlir] Use more C99 comments in C API header files

These were left over from the original reformatting commit.

Reviewed By: stellaraccident

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

3 years ago[clang] Add -fprofile-prefix-map
Keith Smiley [Mon, 25 Jan 2021 18:03:07 +0000 (10:03 -0800)]
[clang] Add -fprofile-prefix-map

This flag allows you to re-write absolute paths in coverage data analogous to -fdebug-prefix-map. This flag is also implied by -ffile-prefix-map.