platform/upstream/llvm.git
2 years ago[OpenCL] Remove argument names from math builtins
Sven van Haastregt [Wed, 6 Apr 2022 10:43:59 +0000 (11:43 +0100)]
[OpenCL] Remove argument names from math builtins

This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the argument name identifiers.

Continues the direction set out in D119560.

2 years agoRevert "Revert "[mlir] Rewrite canonicalization of collapse(expand) and expand(collap...
Alexander Belyaev [Wed, 6 Apr 2022 09:58:21 +0000 (11:58 +0200)]
Revert "Revert "[mlir] Rewrite canonicalization of collapse(expand) and expand(collapse).""

This reverts commit 96e9b6c9dc60946f08399def879a19395bc98107.

2 years ago[AMDGPU] Add a test for setting WAVESIZE in pixel shaders
Jay Foad [Wed, 6 Apr 2022 09:59:25 +0000 (10:59 +0100)]
[AMDGPU] Add a test for setting WAVESIZE in pixel shaders

2 years ago[X86] Add test for smin(x, 0) & smax(x, 0)
Wei Xiao [Wed, 6 Apr 2022 09:28:26 +0000 (17:28 +0800)]
[X86] Add test for smin(x, 0) & smax(x, 0)

2 years ago[AMDGPU] Regenerate omod.ll tests
Simon Pilgrim [Wed, 6 Apr 2022 09:27:43 +0000 (10:27 +0100)]
[AMDGPU] Regenerate omod.ll tests

2 years ago[AMDGPU] Add a test for setting EXTRA_LDS_SIZE in pixel shaders
Jay Foad [Wed, 6 Apr 2022 09:49:43 +0000 (10:49 +0100)]
[AMDGPU] Add a test for setting EXTRA_LDS_SIZE in pixel shaders

2 years agoAdd support for more archs in `Triple::getArchTypeForLLVMName`
Antonio Frighetto [Wed, 6 Apr 2022 09:01:05 +0000 (10:01 +0100)]
Add support for more archs in `Triple::getArchTypeForLLVMName`

Add support for i386, s390x in Triple::getArchTypeForLLVMName.

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

2 years ago[docs] Fix Kaleidoscope code example
Roman Sokolkov [Wed, 6 Apr 2022 09:38:07 +0000 (10:38 +0100)]
[docs] Fix Kaleidoscope code example

* replace virtual with override
* use default like in full code example

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

2 years ago[DAG] Allow XOR(X,MIN_SIGNED_VALUE) to perform AddLike folds
Simon Pilgrim [Wed, 6 Apr 2022 09:37:07 +0000 (10:37 +0100)]
[DAG] Allow XOR(X,MIN_SIGNED_VALUE) to perform AddLike folds

As raised on PR52267, XOR(X,MIN_SIGNED_VALUE) can be treated as ADD(X,MIN_SIGNED_VALUE), so let these cases use the 'AddLike' folds, similar to how we perform no-common-bits OR(X,Y) cases.

define i8 @src(i8 %x) {
  %r = xor i8 %x, 128
  ret i8 %r
}
=>
define i8 @tgt(i8 %x) {
  %r = add i8 %x, 128
  ret i8 %r
}
Transformation seems to be correct!

https://alive2.llvm.org/ce/z/qV46E2

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

2 years ago[mlir][bufferize][NFC] Clean up ModuleBufferizationState
Matthias Springer [Wed, 6 Apr 2022 09:01:41 +0000 (18:01 +0900)]
[mlir][bufferize][NFC] Clean up ModuleBufferizationState

* Store bbArg indices instead of BlockArguments, so that args can be changed during bufferizationn.
* Use type aliases for better readability.

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

2 years ago[X86] Remove TB_NO_REVERSE for 2 memory folding entries
Shengchen Kan [Wed, 6 Apr 2022 09:19:48 +0000 (17:19 +0800)]
[X86] Remove TB_NO_REVERSE for 2 memory folding entries

```
X86::MMX_MOVD64from64rr -> X86::MMX_MOVQ64mr
X86::MMX_MOVD64grr -> X86::MMX_MOVD64mr
```

These two entries were added in llvm-svn: 372770.
I think these two should be reversable.

Reviewed By: RKSimon, pengfei

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

2 years ago[mlir][MemRef] Allow transposed layouts in ExpandShapeOp.
Nicolas Vasilache [Wed, 6 Apr 2022 07:57:03 +0000 (03:57 -0400)]
[mlir][MemRef] Allow transposed layouts in ExpandShapeOp.

https://reviews.llvm.org/D122641 introduced fixes to the ExpandShapeOp verifier
but also introduced an artificial layout limitation that prevents the consideration of transposed layouts.

This revision fixes the omissions and reimplements the logic using saturated arithmetic which is more
idiomatic and avoids leaking internal implementation details.

Tests cases are added for transposed layouts.

Reviewed By: springerm

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

2 years ago[DAG] SimplifySetCC - relax fold (X^C1) == C2 --> X == C1^C2
Simon Pilgrim [Wed, 6 Apr 2022 08:18:08 +0000 (09:18 +0100)]
[DAG] SimplifySetCC - relax fold (X^C1) == C2 --> X == C1^C2

https://alive2.llvm.org/ce/z/A_auBq

Remove limitation that wouldn't perform the fold if all the inverted bits are known zero

The thumb2 changes look to be benign, although it does show that the TEQ/TST isel patterns could probably be improved.

Fixes movmsk regression in D122754

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

2 years ago[cmake] Remove LLVM_ENABLE_NEW_PASS_MANAGER cmake option
Nikita Popov [Tue, 5 Apr 2022 13:05:46 +0000 (15:05 +0200)]
[cmake] Remove LLVM_ENABLE_NEW_PASS_MANAGER cmake option

Or rather, error out if it is set to something other than ON. This
removes the ability to enable the legacy pass manager by default,
but does not remove the ability to explicitly enable it through
various flags like -flegacy-pass-manager or -enable-new-pm=0.

I checked, and our test suite definitely doesn't pass with
LLVM_ENABLE_NEW_PASS_MANAGER=OFF anymore.

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

2 years ago[CMake][compiler-rt] Make CRT separately buildable
Petr Hosek [Mon, 28 Feb 2022 20:21:11 +0000 (12:21 -0800)]
[CMake][compiler-rt] Make CRT separately buildable

This is useful when building a complete toolchain to ensure that CRT
is built after builtins but before the rest of the compiler-rt.

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

2 years ago[CSKY] Add atomic expand pass to support atomic operation with libcall
Zi Xuan Wu [Wed, 6 Apr 2022 04:03:21 +0000 (12:03 +0800)]
[CSKY] Add atomic expand pass to support atomic operation with libcall

For now, just support atomic operations by libcall. Further, should investigate atomic
implementation in CSKY target and codegen with atomic and fence related instructions.

2 years ago[libcxx] [test] Remove UNSUPPORTED markings for mingw issues that no longer are prese...
Martin Storsjö [Thu, 10 Mar 2022 09:06:27 +0000 (11:06 +0200)]
[libcxx] [test] Remove UNSUPPORTED markings for mingw issues that no longer are present in CI

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

2 years agoFix warnings about variables that are set but only used in debug mode
Martin Storsjö [Tue, 5 Apr 2022 08:34:05 +0000 (11:34 +0300)]
Fix warnings about variables that are set but only used in debug mode

Add void casts to mark the variables used, next to the places where
they are used in assert or `LLVM_DEBUG()` expressions.

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

2 years agoRevert "[CMake][compiler-rt] Make CRT separately buildable"
Petr Hosek [Wed, 6 Apr 2022 07:01:06 +0000 (00:01 -0700)]
Revert "[CMake][compiler-rt] Make CRT separately buildable"

This reverts commit b89b18e350e11efc599f6ce2bb55cbec89a0efe1 since
it broke the sanitizer bots.

2 years ago[CMake][compiler-rt] Make CRT separately buildable
Petr Hosek [Mon, 28 Feb 2022 20:21:11 +0000 (12:21 -0800)]
[CMake][compiler-rt] Make CRT separately buildable

This is useful when building a complete toolchain to ensure that CRT
is built after builtins but before the rest of the compiler-rt.

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

2 years ago[X86][tablgen] Consider the mnemonic when auto-generating memory folding table
Shengchen Kan [Wed, 6 Apr 2022 04:52:18 +0000 (12:52 +0800)]
[X86][tablgen] Consider the mnemonic when auto-generating memory folding table

Intuitively, the memory folding pair should have the same mnemonic.

This patch removes
```
{X86::SENDUIPI,X86::VMXON}
```
in the auto-generated table.
And `NotMemoryFoldable` for `TPAUSE` and `CLWB` can be saved.
```
{X86::MOVLHPSrr,X86::MOVHPSrm}
{X86::VMOVLHPSZrr,X86::VMOVHPSZ128rm}
{X86::VMOVLHPSrr,X86::VMOVHPSrm}
```
It seems the three pairs above are mistakenly killed.
But we can add them back manually later.

Reviewed By: Amir

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

2 years ago[lldb/source/Utility/DataExtractor.cpp] Update for `llvm::MD5::MD5Result` API change
Argyrios Kyrtzidis [Wed, 6 Apr 2022 04:47:45 +0000 (21:47 -0700)]
[lldb/source/Utility/DataExtractor.cpp] Update for `llvm::MD5::MD5Result` API change

2 years ago[Support/Hash functions] Change the `final()` and `result()` of the hashing functions...
Argyrios Kyrtzidis [Mon, 4 Apr 2022 23:48:30 +0000 (16:48 -0700)]
[Support/Hash functions] Change the `final()` and `result()` of the hashing functions to return an array of bytes

Returning `std::array<uint8_t, N>` is better ergonomics for the hashing functions usage, instead of a `StringRef`:

* When returning `StringRef`, client code is "jumping through hoops" to do string manipulations instead of dealing with fixed array of bytes directly, which is more natural
* Returning `std::array<uint8_t, N>` avoids the need for the hasher classes to keep a field just for the purpose of wrapping it and returning it as a `StringRef`

As part of this patch also:

* Introduce `TruncatedBLAKE3` which is useful for using BLAKE3 as the hasher type for `HashBuilder` with non-default hash sizes.
* Make `MD5Result` inherit from `std::array<uint8_t, 16>` which improves & simplifies its API.

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

2 years agoPreserve aliasing info during memory intrinsics lowering
Evgeniy Brevnov [Tue, 25 Jan 2022 06:17:57 +0000 (13:17 +0700)]
Preserve aliasing info during  memory intrinsics lowering

By specification, source and destination of llvm.memcpy.* must either be equal or non-overlapping. This semantics is hard or impossible to figure out once lowered. This patch explicitly marks loads from source and stores to destination as not aliasing if source and destination is known to be not equal.

Reviewed By: arsenm

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

2 years ago[NFC][CSKY] Fix the test error in toolchain case in windows by add UNSUPPORTED: syste...
Zi Xuan Wu [Wed, 6 Apr 2022 04:16:38 +0000 (12:16 +0800)]
[NFC][CSKY] Fix the test error in toolchain case in windows by add UNSUPPORTED: system-windows

2 years ago[Attributor] Introduce AAInstanceInfo
Johannes Doerfert [Wed, 16 Mar 2022 20:53:32 +0000 (15:53 -0500)]
[Attributor] Introduce AAInstanceInfo

The Attributor, as many other parts in LLVM, uses pointer equivalence
for `llvm::Value`s. This only works as long as `llvm::Value`s are
dynamically unique, or, to be exact, we will never end up with the same
`llvm::Value` representing two dynamic instances. We already provided a
helper to check the former, namely `AA::isDynamicallyUnique`, however we
could not check the latter. In this patch we move the logic into a
separate AA which helps with the growing complexity and use cases. We
also extend the interface to answer the second question rather than the
first. So we do not determine dynamically uniqueness but if we might end
up with the `llvm::Value` describing a different dynamic instance. Note
that the latter is very much tied to the Attributor capabilities to look
through memory, recursion, etc. so we need to update the logic as we go.

2 years ago[Attributor] Keep loads feeding in `llvm.assume` if stores stays
Johannes Doerfert [Tue, 15 Mar 2022 17:32:28 +0000 (12:32 -0500)]
[Attributor] Keep loads feeding in `llvm.assume` if stores stays

If a load is only used by an `llvm.assume` and the stores feeding into
the load are not removable, keep the load.

2 years ago[gn build] Port 97e496054a37
LLVM GN Syncbot [Wed, 6 Apr 2022 03:38:24 +0000 (03:38 +0000)]
[gn build] Port 97e496054a37

2 years ago[Clang][CSKY] Add the CSKY target and compiler driver
Zi Xuan Wu [Tue, 29 Mar 2022 08:18:10 +0000 (16:18 +0800)]
[Clang][CSKY] Add the CSKY target and compiler driver

Add CSKY target toolchains to support csky in linux and elf environment.

It can leverage the basic universal Linux toolchain for linux environment, and only add some compile or link parameters.
For elf environment, add a CSKYToolChain to support compile and link.

Also add some parameters into basic codebase of clang driver.

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

2 years ago[RISCV][NFC] Remove '--check-prefixes=CHECK' in some cases as they are default
Ping Deng [Wed, 6 Apr 2022 03:17:54 +0000 (03:17 +0000)]
[RISCV][NFC] Remove '--check-prefixes=CHECK' in some cases as they are default

Reviewed By: frasercrmck

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

2 years ago[RISCV] [NFC] Add Immediate tests for the cmov instruction
Liqin Weng [Wed, 6 Apr 2022 03:08:27 +0000 (03:08 +0000)]
[RISCV] [NFC] Add Immediate tests for the cmov instruction

Reviewed By: craig.topper

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

2 years ago[mlir][LLVMIR] Add vector predication binary intrinsic ops.
jacquesguan [Sat, 2 Apr 2022 09:35:51 +0000 (17:35 +0800)]
[mlir][LLVMIR] Add vector predication binary intrinsic ops.

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

2 years ago[Clang][PowerPC] Add max/min intrinsics to Clang and PPC backend
Ting Wang [Wed, 6 Apr 2022 02:43:48 +0000 (22:43 -0400)]
[Clang][PowerPC] Add max/min intrinsics to Clang and PPC backend

Add support for builtin_[max|min] which has below prototype:
A builtin_max (A1, A2, A3, ...)
All arguments must have the same type; they must all be float, double, or long double.
Internally use SelectCC to get the result.

Reviewed By: qiucf

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

2 years agoMachineVerifier: Diagnose undef set on full register defs
Matt Arsenault [Wed, 30 Mar 2022 14:24:40 +0000 (10:24 -0400)]
MachineVerifier: Diagnose undef set on full register defs

An undef def of a full register would assert in LiveIntervalCalc.

2 years agoAMDGPU/GlobalISel: Handle legacy grid ID intrinsics
Matt Arsenault [Sat, 15 Jan 2022 15:53:05 +0000 (10:53 -0500)]
AMDGPU/GlobalISel: Handle legacy grid ID intrinsics

Handle the llvm.r600.* intrinsics which are still in use in libclc. I
thought it would be possible to switch it to using
llvm.amdgcn.implicitarg.ptr already, but it turns out the implicit
arguments are currently split into a piece before and after the
explicit kernel arguments.

2 years agoAMDGPU: Fix LiveVariables error after lowering SI_END_CF
Matt Arsenault [Thu, 20 Jan 2022 00:48:20 +0000 (19:48 -0500)]
AMDGPU: Fix LiveVariables error after lowering SI_END_CF

This wasn't accounting for the block change in updating LiveVariables.

2 years ago[AArch64] Enhance last active true vector combine
zhongyunde [Wed, 6 Apr 2022 01:48:12 +0000 (09:48 +0800)]
[AArch64] Enhance last active true vector combine

Last active extracting will output LASTB + WHILELS, and the WHILELS itself
is a flag-setting operation, so perform it preferly.

Reviewed By: paulwalker-arm, sdesmalen

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

2 years ago[Attributor] Remove broken and duplicated load simplification
Johannes Doerfert [Tue, 15 Mar 2022 17:34:28 +0000 (12:34 -0500)]
[Attributor] Remove broken and duplicated load simplification

We look through loads in the "generic value traversal" and we
consequently don't need to look through them again in AAValueSimplify*.
The test changes stem from the fact that we allowed any simplified
value, incl. non-dynamically unique ones, as long as the underlying
memory was an alloca. This doesn't seem to make sense as allocas do not
protect against dynamically non-unique values. We need to make the
unique check better rather than excluding allocas. That in mind, we can
remove a lot of code by simply relying on the generic value traversal
load look through.

To soften the blow some minor adjustments have been made that allow more
simplification through the now used scheme and some tests have been
given a `norecurse` for now.

2 years ago[Attributor] Move recursion reasoning into `AA::isPotentiallyReachable`
Johannes Doerfert [Tue, 15 Mar 2022 17:34:04 +0000 (12:34 -0500)]
[Attributor] Move recursion reasoning into `AA::isPotentiallyReachable`

With D106397 we ensured that `AAReachability` will not answer queries for
potentially recursive functions. This was necessary as we did not treat
recursion explicitly otherwise. Now that we have
`AA::isPotentiallyReachable` we can make `AAReachability` a purely
intra-procedural AA which does not care about recursion.
`AA::isPotentiallyReachable`, however, does already deal with "going
back" the call graph and can now do so for potentially recursive
functions.

2 years ago[WPD] Add statistics
Teresa Johnson [Tue, 5 Apr 2022 18:35:16 +0000 (11:35 -0700)]
[WPD] Add statistics

Add statistics to count overall devirtualized targets as well as the
various types of devirtualizations applied at callsites.

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

2 years agoMIRParser: Fix asserting with invalid flags on machine operands
Matt Arsenault [Mon, 28 Mar 2022 13:36:47 +0000 (09:36 -0400)]
MIRParser: Fix asserting with invalid flags on machine operands

Constructing an operand with kills on defs and deads on uses asserts
in the constructor, so diagnose these.

2 years agoRevert "[InstrProfiling] No runtime hook for unused funcs"
Gulfem Savrun Yeniceri [Wed, 6 Apr 2022 01:39:32 +0000 (01:39 +0000)]
Revert "[InstrProfiling] No runtime hook for unused funcs"

This reverts commit c7f91e227a799dfee05962bb108274dbfe809fee.
This patch caused an issue in Fuchsia source code coverage builders.

2 years ago[Clang][Sema] Prohibit statement expression in the default argument
Jun Zhang [Wed, 6 Apr 2022 00:45:46 +0000 (08:45 +0800)]
[Clang][Sema] Prohibit statement expression in the default argument

As statement expression makes no sense in the default argument,
this patch tries to disable it in the all cases.

Please note that the statement expression is a GNU extension, which
means that Clang should be consistent with GCC. However, there's no
response from GCC devs since we have raised the issue for several weeks.
In this case, I think we can disallow statement expressions as a default
parameter in general for now, and relax the restriction if GCC folks
decide to retain the feature for functions but not lambdas in the
future.

Related discussion: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104765

Fixes https://github.com/llvm/llvm-project/issues/53488

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

2 years ago[unittests] fix intermittent SupportTests failures
Yuanfang Chen [Tue, 5 Apr 2022 19:47:09 +0000 (12:47 -0700)]
[unittests] fix intermittent SupportTests failures

by invoking `SupportTests --gtest_shuffle=1`.

`HideUnrelatedOptions`/`HideUnrelatedOptionsMulti` failed due to other
tests calling `cl::ResetCommandLineParser()` which causes default
options to be removed.

`ExitOnError` would hang due to the threading environment. Renaming it
as `*Deathtest` is the recommended practice by GTest docs.

2 years ago[mlir][sparse] avoid reserving dense storage for ptr/idx
Aart Bik [Tue, 5 Apr 2022 23:56:07 +0000 (16:56 -0700)]
[mlir][sparse] avoid reserving dense storage for ptr/idx

This avoids a rather big bug where we were reserving
dense space for the ptx/idx in the first sparse dimension.
For example, using CSR for a 140874 x 140874 matrix with
3977139 nonzero would reserve the full 19845483876 space.
This revision fixes this for now, but we need to revisit
the reservation heuristic to make this better.

Reviewed By: bixia

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

2 years ago[JITLink][MachO] Fix alignment bug in the c-string literal section graphifier.
Lang Hames [Wed, 6 Apr 2022 00:04:55 +0000 (17:04 -0700)]
[JITLink][MachO] Fix alignment bug in the c-string literal section graphifier.

This function had been assuming a 1-byte alignment, which isn't always correct.
This commit updates it to take the alignment from the __cstring section.

The key change is to the createContentBlock call, but the surrounding code is
updated with clearer debugging output to support the testcase (and any future
debugging work).

2 years ago[MLIR] [Python] Pybind adaptors: coerce None to default MlirLocation
John Demme [Wed, 6 Apr 2022 00:10:20 +0000 (17:10 -0700)]
[MLIR] [Python] Pybind adaptors: coerce None to default MlirLocation

Add default source location coercion to enable location elision in
Python code.

2 years ago[clang] Corrections for target_clones multiversion functions.
Tom Honermann [Thu, 24 Mar 2022 19:39:49 +0000 (12:39 -0700)]
[clang] Corrections for target_clones multiversion functions.

This change merges code for emit of target and target_clones multiversion
resolver functions and, in doing so, corrects handling of target_clones
functions that are declared but not defined. Previously, a use of such
a target_clones function would result in an attempted emit of an ifunc
that referenced an undefined resolver function. Ifunc references to
undefined resolver functions are not allowed and, when the LLVM verifier
is not disabled (via '-disable-llvm-verifier'), resulted in the verifier
issuing a "IFunc resolver must be a definition" error and aborting the
compilation. With this change, ifuncs and resolver function definitions
are always emitted for used target_clones functions regardless of whether
the target_clones function is defined (if the function is defined, then
the ifunc and resolver are emitted regardless of whether the function is
used).

This change has the side effect of causing target_clones variants and
resolver functions to be emitted in a different order than they were
previously. This is harmless and is reflected in the updated tests.

Reviewed By: erichkeane

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

2 years ago[clang] NFC: Preparation for merging code to emit target and target_clones resolvers.
Tom Honermann [Fri, 1 Apr 2022 20:14:41 +0000 (13:14 -0700)]
[clang] NFC: Preparation for merging code to emit target and target_clones resolvers.

This change modifies CodeGenModule::emitMultiVersionFunctions() in preparation
for a change that will merge support for emitting target_clones resolvers into
this function. This change mostly serves to isolate indentation changes from
later behavior modifying changes.

Reviewed By: erichkeane

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

2 years ago[clang] NFC: Simplify the interface to CodeGenModule::GetOrCreateMultiVersionResolver().
Tom Honermann [Fri, 1 Apr 2022 04:48:28 +0000 (21:48 -0700)]
[clang] NFC: Simplify the interface to CodeGenModule::GetOrCreateMultiVersionResolver().

Previously, GetOrCreateMultiVersionResolver() required the caller to provide
a GlobalDecl along with an llvm::type and FunctionDecl. The latter two can be
cheaply obtained from the first, and the llvm::type parameter is not always
used, so requiring the caller to provide them was unnecessary and created the
possibility that callers would pass an inconsistent set. This change simplifies
the interface to only require the GlobalDecl value.

Reviewed By: erichkeane

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

2 years ago[clang] NFC: Enhance comments in CodeGen for multiversion function support.
Tom Honermann [Thu, 31 Mar 2022 21:48:36 +0000 (14:48 -0700)]
[clang] NFC: Enhance comments in CodeGen for multiversion function support.

Reviewed By: erichkeane

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

2 years ago[libc++] Remove error about _LIBCPP_ALTERNATE_STRING_LAYOUT not being supported anymore
Louis Dionne [Tue, 5 Apr 2022 23:44:44 +0000 (19:44 -0400)]
[libc++] Remove error about _LIBCPP_ALTERNATE_STRING_LAYOUT not being supported anymore

It's been over two years since I added the temporary error, so I think
it's reasonable to remove it now.

2 years ago[libc++][NFC] Remove stray whitespace in comment
Louis Dionne [Tue, 5 Apr 2022 23:43:46 +0000 (19:43 -0400)]
[libc++][NFC] Remove stray whitespace in comment

2 years ago[Attributor] Visit droppable uses in AAIsDead
Johannes Doerfert [Tue, 15 Mar 2022 17:33:45 +0000 (12:33 -0500)]
[Attributor] Visit droppable uses in AAIsDead

If we ignore droppable users everything only used in llvm.assume (among
other things) is going to be deleted as dead. This is not helpful.
Instead we want to only delete things we actually don't need anymore. A
follow up will deal with loads in a smarter way.

2 years ago[Attributor][NFC] Pre-commit new test case
Johannes Doerfert [Tue, 15 Mar 2022 14:11:34 +0000 (09:11 -0500)]
[Attributor][NFC] Pre-commit new test case

2 years agoFix bazel build.
Jorge Gorbe Moya [Tue, 5 Apr 2022 22:45:53 +0000 (15:45 -0700)]
Fix bazel build.

- https://reviews.llvm.org/D122619 bumped zlib version but didn't change
  the hash

- Added new header from https://reviews.llvm.org/D108438

2 years ago[GlobalISel] NFC: Add test coverage for s144 and s142
Jessica Paquette [Tue, 5 Apr 2022 22:24:57 +0000 (15:24 -0700)]
[GlobalISel] NFC: Add test coverage for s144 and s142

144 = 16 * 9

For types where s16 is legal.

It may be interesting to break these down into 16-bit chunks rather than 32
or 64 bits.

Add tests for some opcodes, just so we get some test coverage drawing attention
to this.

2 years ago[lldb] Update ReadAllRegisterValues in RegisterContextWindows
Jonas Devlieghere [Tue, 5 Apr 2022 22:15:42 +0000 (15:15 -0700)]
[lldb] Update ReadAllRegisterValues in RegisterContextWindows

2 years agoDisable LLDB index cache for .o files with no UUID.
Greg Clayton [Fri, 4 Mar 2022 00:53:04 +0000 (16:53 -0800)]
Disable LLDB index cache for .o files with no UUID.

After enabling the LLDB index cache in production we discovered that some distributed build systems play with the modification times of any .o files that were downloaded from the build cache. This was causing the LLDB index cache to read the wrong cache file for files that didn't have a UUID as all of the modfication times were set to the same value by the build system. When new .o files were downloaded, the only unique identifier was the mod time which were all the same, and we would load an older cache for the updated .o file. So disabling caching of files that have no UUIDs for now until we can create a more solid solution.

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

2 years ago[GlobalISel] NFC: Add some test coverage for s158
Jessica Paquette [Tue, 5 Apr 2022 21:57:34 +0000 (14:57 -0700)]
[GlobalISel] NFC: Add some test coverage for s158

158 = 32 * 5 - 2

This is a wide type which may benefit from a different widening scheme than
types which are multiples of 64. For example, if 32-bit and 64-bit scalars
are both allowed, and a type is a multiple of 32, or is closer to a multiple
of 32, it *may* be better to

- Widen to the wide multiple of 32
- Break up the type into 32-bit chunks

Anyway, we don't have any test coverage for this at all, so for the sake of
making sure we test it, let's add some test coverage.

2 years ago[NFC][Bitstream] Improve the dumpability of bitstream/bitcode headers
William Woodruff [Tue, 5 Apr 2022 20:43:59 +0000 (13:43 -0700)]
[NFC][Bitstream] Improve the dumpability of bitstream/bitcode headers

The `LLVMBitCodes.h` header contains various enums that are updated whenever LLVM's bitcode fundamentally changes. It would be nice to track these changes in a semi-automated way, so that external tools that attempt to parse LLVM's bitstream and bitcode can remain in sync.

Before this change, `LLVMBitCodes.h` had a single dependency -- it needed the `FIRST_APPLICATION_BLOCKID` enum value from `BitCodes.h`. `BitCodes.h`, in turn, had a whole tree of include dependencies that boiled down to `llvm-config.h`, meaning that it was impossible to dump the AST of either file without having a partial or full LLVM build tree already present.

To eliminate that requirement, this patch introduces a new leaf-only header, `BitCodeEnums.h`, which includes the "core" enums originally in `BitCodes.h`. `LLVMBitCodes.h` and `BitCodes.h` both include this new header in turn, preserving the current header relationships while allowing `LLVMBitCodes.h` to be dumped fully independently with a command like this (run from the repository root):

```
clang -fsyntax-only -x c++ -Illvm/include -Xclang -ast-dump=json -Xclang -ast-dump-filter -Xclang llvm::bitc::BlockIDs llvm/include/llvm/Bitcode/LLVMBitCodes.h
```

I recognize that this is a pretty unusual change and perhaps not a guarantee that the LLVM authors would like to make in the general case (i.e., that individual files within LLVM can have their AST dumped with minimal dependencies). However, I believe the criticality/limited scope of the file(s) in this patch warrants an exception. Please let me know if there's any other information I can provide, or anything else I can do to improve this patch!

Reviewed By: tejohnson

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

2 years agoRevert "[mlir] Rewrite canonicalization of collapse(expand) and expand(collapse)."
Hanhan Wang [Tue, 5 Apr 2022 22:05:41 +0000 (15:05 -0700)]
Revert "[mlir] Rewrite canonicalization of collapse(expand) and expand(collapse)."

This reverts commit 64f659bee67b5a024defeb3cd2ecf65e1ad8c0a7.

An invalid tensor.expand_shape op is generated with the commit. To repro:

$ mlir-opt -canonicalize a.mlir

```
func @foo(%0: tensor<1x1xf32>, %1: tensor<1x1xf32>, %2: tensor<1x1xf32>) -> tensor<1x1xf32> {
  %cst = arith.constant 0.000000e+00 : f32
  %3 = linalg.init_tensor [8, 1] : tensor<8x1xf32>
  %4 = linalg.fill ins(%cst : f32) outs(%3 : tensor<8x1xf32>) -> tensor<8x1xf32>
  %5 = tensor.collapse_shape %0 [] : tensor<1x1xf32> into tensor<f32>
  %6 = tensor.insert_slice %5 into %4[0, 0] [1, 1] [1, 1] : tensor<f32> into tensor<8x1xf32>
  %7 = linalg.init_tensor [8, 1] : tensor<8x1xf32>
  %8 = linalg.fill ins(%cst : f32) outs(%7 : tensor<8x1xf32>) -> tensor<8x1xf32>
  %9 = tensor.collapse_shape %2 [] : tensor<1x1xf32> into tensor<f32>
  %10 = tensor.insert_slice %9 into %8[0, 0] [1, 1] [1, 1] : tensor<f32> into tensor<8x1xf32>
  %11 = tensor.collapse_shape %6 [[0, 1]] : tensor<8x1xf32> into tensor<8xf32>
  %12 = linalg.init_tensor [8] : tensor<8xf32>
  %13 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%11 : tensor<8xf32>) outs(%12 : tensor<8xf32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<8xf32>
  %14 = tensor.expand_shape %13 [[0, 1, 2, 3]] : tensor<8xf32> into tensor<1x1x8x1xf32>
  %15 = tensor.collapse_shape %1 [] : tensor<1x1xf32> into tensor<f32>
  %16 = linalg.init_tensor [] : tensor<f32>
  %17 = linalg.generic {indexing_maps = [affine_map<() -> ()>, affine_map<() -> ()>], iterator_types = []} ins(%15 : tensor<f32>) outs(%16 : tensor<f32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<f32>
  %18 = tensor.expand_shape %17 [] : tensor<f32> into tensor<1x1x1x1xf32>
  %19 = tensor.collapse_shape %10 [[0, 1]] : tensor<8x1xf32> into tensor<8xf32>
  %20 = linalg.init_tensor [8] : tensor<8xf32>
  %21 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%19 : tensor<8xf32>) outs(%20 : tensor<8xf32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<8xf32>
  %22 = tensor.expand_shape %21 [[0, 1, 2, 3]] : tensor<8xf32> into tensor<1x1x8x1xf32>
  %23 = linalg.mmt4d {comment = "f32*f32->f32, aarch64, matrix*vector"} ins(%14, %18 : tensor<1x1x8x1xf32>, tensor<1x1x1x1xf32>) outs(%22 : tensor<1x1x8x1xf32>) -> tensor<1x1x8x1xf32>
  %24 = tensor.collapse_shape %23 [[0, 1, 2, 3]] : tensor<1x1x8x1xf32> into tensor<8xf32>
  %25 = linalg.init_tensor [8] : tensor<8xf32>
  %26 = linalg.generic {indexing_maps = [affine_map<(d0) -> (d0)>, affine_map<(d0) -> (d0)>], iterator_types = ["parallel"]} ins(%24 : tensor<8xf32>) outs(%25 : tensor<8xf32>) {
  ^bb0(%arg3: f32, %arg4: f32):
    linalg.yield %arg3 : f32
  } -> tensor<8xf32>
  %27 = tensor.expand_shape %26 [[0, 1]] : tensor<8xf32> into tensor<8x1xf32>
  %28 = tensor.extract_slice %27[0, 0] [1, 1] [1, 1] : tensor<8x1xf32> to tensor<f32>
  %29 = tensor.expand_shape %28 [] : tensor<f32> into tensor<1x1xf32>
  return %29 : tensor<1x1xf32>
}
```

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

2 years ago[lldb] Add more missing consts in NativeRegisterContexts
Jonas Devlieghere [Tue, 5 Apr 2022 21:39:45 +0000 (14:39 -0700)]
[lldb] Add more missing consts in NativeRegisterContexts

2 years ago[lldb] Add missing const to NativeRegisterContextLinux_arm
Benjamin Kramer [Tue, 5 Apr 2022 21:39:08 +0000 (23:39 +0200)]
[lldb] Add missing const to NativeRegisterContextLinux_arm

2 years ago[MLIR][Affine][Analysis] Merge FAC and FACV
Groverkss [Tue, 5 Apr 2022 21:14:47 +0000 (02:44 +0530)]
[MLIR][Affine][Analysis] Merge FAC and FACV

With the introduction of IntegerPolyhedron and IntegerRelation in Presburger
directory, the purpose of FlatAffineConstraints becomes redundant. For users
requiring Presburger arithmetic without IR information, Presburger library can
directly be used. For users requiring IR information,
FlatAffineValueConstraints can be used.

This patch merges FAC and FACV to remove redundancy of FAC.

Reviewed By: arjunp

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

2 years ago[BOLT][NFC] Move isADD64rr and isADDri out of MCPlusBuilder class
Amir Ayupov [Tue, 5 Apr 2022 21:30:44 +0000 (14:30 -0700)]
[BOLT][NFC] Move isADD64rr and isADDri out of MCPlusBuilder class

Reviewed By: rafauler

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

2 years agoDebugInfo: ThinLTO: Import template parameters on type declarations
David Blaikie [Tue, 5 Apr 2022 21:28:10 +0000 (21:28 +0000)]
DebugInfo: ThinLTO: Import template parameters on type declarations

Necessary when importing class template specializations that have
simplified template names (may otherwise be necessary - eg: Sony
requires template parameter DIEs even with unsimplified names, but short
of always importing names this is the best I can do for now) - long term
this probably needs a flag for the DICompositeType to specify whether it
needs template parameters on declarations & that flag could power this
behavior, rather than inspecting the name.

2 years ago[lldb] Add missing const to NativeRegisterContextLinux_x86_64
Jonas Devlieghere [Tue, 5 Apr 2022 21:24:32 +0000 (14:24 -0700)]
[lldb] Add missing const to NativeRegisterContextLinux_x86_64

Fixes error: invalid conversion from ‘const uint8_t*’ {aka ‘const
unsigned char*’} to ‘uint8_t*’ {aka ‘unsigned char*’}

2 years agoRevert "[VFS] RedirectingFileSystem only replace path if not already mapped"
Ben Barham [Mon, 4 Apr 2022 23:38:46 +0000 (16:38 -0700)]
Revert "[VFS] RedirectingFileSystem only replace path if not already mapped"

This reverts commit 3fda0edc51fd68192a30e302d45db081bb02d7f9, which
breaks crash reproducers in very specific circumstances. Specifically,
since crash reproducers have `UseExternalNames` set to false, the
`File->getFileEntry().getDir()->getName()` call in `DoFrameworkLookup`
would use the *cached* directory name instead of the directory of the
looked-up file.

The plan is to re-commit this patch but to *add*
`ExposesExternalVFSPath` rather than replace `IsVFSMapped`.

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

2 years ago[lldb] Update the NativeRegisterContext to take a WritableMemoryBuffer
Jonas Devlieghere [Tue, 5 Apr 2022 21:17:26 +0000 (14:17 -0700)]
[lldb] Update the NativeRegisterContext to take a WritableMemoryBuffer

2 years ago[PS4] Fix header search list
Paul Robinson [Tue, 5 Apr 2022 21:13:50 +0000 (14:13 -0700)]
[PS4] Fix header search list

A missing "break" in the initial implementation had us adding a
spurious "/usr/include" to the header search list. Later someone
introduced LLVM_FALLTHROUGH to prevent a warning.  Replace this with
the correct "break" and make sure the extra directory isn't added to
the PS4 header search list.

2 years agoEmit OpenCL metadata when targeting SPIR-V
Shangwu Yao [Mon, 4 Apr 2022 16:52:46 +0000 (16:52 +0000)]
Emit OpenCL metadata when targeting SPIR-V

This is required for converting function calls such as get_global_id()
into SPIR-V builtins.

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

2 years ago[mlir] Reinstate the variable
Bill Wendling [Tue, 5 Apr 2022 20:56:44 +0000 (13:56 -0700)]
[mlir] Reinstate the variable

Mid-air collition of patches.

2 years ago[lldb] Update reinterpret_cast in linux/Host.cpp
Jonas Devlieghere [Tue, 5 Apr 2022 20:50:12 +0000 (13:50 -0700)]
[lldb] Update reinterpret_cast in linux/Host.cpp

Fixes error: reinterpret_cast from type ‘const uint8_t*’ {aka ‘const
unsigned char*’} to type ‘char*’ casts away qualifiers

2 years agoReland "[ASTMatchers] Output currently matching node on crash"
Nathan James [Tue, 5 Apr 2022 20:47:06 +0000 (21:47 +0100)]
Reland "[ASTMatchers] Output currently matching node on crash"

Extend D120185 to also log the node being matched on in case of a crash.
This can help if a matcher is causing a crash or there are not enough interesting nodes bound.

Reviewed By: aaron.ballman

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

This reverts commit 61d67c8eecd2547bc690f9a6bba61b9ba814c71b.

This relands commit 6e33e45b943061f79ab6de1b60d04d4c6f32f8f9.

Fixing the build issue on 32bit machines due to not enough free bits in the PointerUnion.

2 years ago[lldb] Change CreateMemoryInstance to take a WritableDataBuffer
Jonas Devlieghere [Tue, 5 Apr 2022 20:33:55 +0000 (13:33 -0700)]
[lldb] Change CreateMemoryInstance to take a WritableDataBuffer

Change the CreateMemoryInstance interface to take a WritableDataBuffer.

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

2 years ago[lldb] Refactor DataBuffer so we can map files as read-only
Jonas Devlieghere [Fri, 1 Apr 2022 22:59:18 +0000 (15:59 -0700)]
[lldb] Refactor DataBuffer so we can map files as read-only

Currently, all data buffers are assumed to be writable. This is a
problem on macOS where it's not allowed to load unsigned binaries in
memory as writable. To be more precise, MAP_RESILIENT_CODESIGN and
MAP_RESILIENT_MEDIA need to be set for mapped (unsigned) binaries on our
platform.

Binaries are mapped through FileSystem::CreateDataBuffer which returns a
DataBufferLLVM. The latter is backed by a llvm::WritableMemoryBuffer
because every DataBuffer in LLDB is considered to be writable. In order
to use a read-only llvm::MemoryBuffer I had to split our abstraction
around it.

This patch distinguishes between a DataBuffer (read-only) and
WritableDataBuffer (read-write) and updates LLDB to use the appropriate
one.

rdar://74890607

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

2 years ago[mlir] Remove an unused variable and correct types.
Bill Wendling [Tue, 5 Apr 2022 20:43:45 +0000 (13:43 -0700)]
[mlir] Remove an unused variable and correct types.

No functionality change.

2 years ago[mlir-vscode] Add better support for multiple workspace folders
River Riddle [Thu, 31 Mar 2022 09:26:12 +0000 (02:26 -0700)]
[mlir-vscode] Add better support for multiple workspace folders

We currently only launch one set of language clients when starting the extension,
but this has the unfortunate effect of applying the same settings to all workspace
folders. This commit adds support for multiple workspace folders by launching
a server for each folder in the workspace. This allows for having different servers
for different workspace folders, e.g. when there are multiple MLIR projects in
the same workspace.

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

2 years ago[mlir-vscode] Add better resolution for server file paths
River Riddle [Thu, 31 Mar 2022 08:04:21 +0000 (01:04 -0700)]
[mlir-vscode] Add better resolution for server file paths

We currently require that server paths are full paths, which is
fairly inconvenient for a myriad of reasons. This commit
attempts to resolve a given server path with the current workspace.

This has a nice additional affect that we can now actually have
default server paths. This means that mlir-lsp-server and
mlir-pdll-lsp-server can be transparently picked up from
build directories (i.e. generally no need for upstream users to
configure the extension).

Fixes #54627

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

2 years ago[BOLT] Check for !isTailCall in isUnconditionalBranch
Vladislav Khmelevsky [Fri, 1 Apr 2022 18:57:51 +0000 (21:57 +0300)]
[BOLT] Check for !isTailCall in isUnconditionalBranch

Add !isTailCall in isUnconditionalBranch check in order to sync the x86
and aarch64 and fix the fixDoubleJumps pass on aarch64.

Vladislav Khmelevsky,
Advanced Software Technology Lab, Huawei

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

2 years agoFix typo in new -config-file option
Aaron Siddhartha Mondal [Tue, 5 Apr 2022 20:27:56 +0000 (16:27 -0400)]
Fix typo in new -config-file option

The new -config-file option introduced by 9e1f4f1 was accidentally
referenced as args.config_path on the python side. This patch renames
args.config_path to args.config_file.

To avoid confusion with python file objects, the input argument for
get_tidy_invocation has been renamed from config_path to
config_file_path.

See GitHub issue #54728 for a discussion.

2 years ago[mlir][linalg] Move linalg.fill folding into linalg.generic pattern from canonicaliza...
Nirvedh [Thu, 31 Mar 2022 17:54:31 +0000 (17:54 +0000)]
[mlir][linalg] Move linalg.fill folding into linalg.generic pattern from canonicalization to elementwise fusion

Reviewed By: mravishankar

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

2 years agoMove BasicBlock::getTerminator definition to the header
Artur Pilipenko [Tue, 5 Apr 2022 19:32:58 +0000 (12:32 -0700)]
Move BasicBlock::getTerminator definition to the header

This way it can be inlined to its caller. This method
shows up in the profile and it is essentially a fancy
getter. It would benefit from inlining into its callers.

NFC.

2 years ago[JITLink] Fix sorting bug for PC-begin candidate symbols during EH-frame fixup.
Lang Hames [Tue, 5 Apr 2022 18:45:25 +0000 (11:45 -0700)]
[JITLink] Fix sorting bug for PC-begin candidate symbols during EH-frame fixup.

The sort should have been lexicographic, but wasn't. This resulted in us
choosing a common symbol at address zero over the intended target function,
leading to a crash.

This patch also moves sorting up to the start of the pass, which means that we
only need to hold on to the canonical symbol at each address rather than a list
of candidates.

2 years ago[PS5] Add PS5 as a legal triple component
Paul Robinson [Mon, 4 Apr 2022 20:55:35 +0000 (13:55 -0700)]
[PS5] Add PS5 as a legal triple component

2 years agoRefine memory buffer for importing shared cache objc class list
Jason Molenda [Tue, 5 Apr 2022 19:47:17 +0000 (12:47 -0700)]
Refine memory buffer for importing shared cache objc class list

In https://reviews.llvm.org/D118972 I increased this buffer to be
big enough to import 261,144 classes but this is a lot more than
we currently have, an allocating a too-large buffer can add memory
pressure even if it's only for a short time.  Reduce the size of
this memory buffer to big enough to import 163,840 classes.  I'll
probably move to a scheme where we read the objc classes in chunks,
with a smaller buffer and multiple inferior function calls.

rdar://91275493

2 years ago[clang] Emit target_clones resolver functions as COMDAT.
Tom Honermann [Fri, 25 Mar 2022 22:38:08 +0000 (15:38 -0700)]
[clang] Emit target_clones resolver functions as COMDAT.

Previously, resolver functions synthesized for target_clones multiversion
functions were not emitted as COMDAT. Now fixed.

2 years ago[clang] NFC: Extend comdat validation in target multiversion function tests.
Tom Honermann [Fri, 25 Mar 2022 22:35:16 +0000 (15:35 -0700)]
[clang] NFC: Extend comdat validation in target multiversion function tests.

2 years ago[Lint][Verifier] NFC: Rename 'Assert*' macros to 'Check*'.
Tom Honermann [Sat, 2 Apr 2022 01:52:29 +0000 (18:52 -0700)]
[Lint][Verifier] NFC: Rename 'Assert*' macros to 'Check*'.

The LLVM IR verifier and analysis linter defines and uses several macros in
code that performs validation of IR expectations. Previously, these macros
were named with an 'Assert' prefix. These names were misleading since the
macro definitions are not conditioned on build kind; they are defined
identically in builds that have asserts enabled and those that do not. This
was confusing since an LLVM developer might expect these macros to be
conditionally enabled as 'assert' is. Further confusion was possible since
the LLVM IR verifier is implicitly disabled (in Clang::ConstructJob()) for
builds without asserts enabled, but only for Clang driver invocations; not
for clang -cc1 invocations. This could make it appear that the macros were
not active for builds without asserts enabled, e.g. when investigating
behavior using the Clang driver, and thus lead to surprises when running
tests that exercise the clang -cc1 interface.

This change renames this set of macros as follows:
  Assert -> Check
  AssertDI -> CheckDI
  AssertTBAA -> CheckTBAA

2 years ago[PartiallyInlineLibCalls] Don't partially inline a musttail libcall.
Bert Abrath [Tue, 5 Apr 2022 19:20:52 +0000 (22:20 +0300)]
[PartiallyInlineLibCalls] Don't partially inline a musttail libcall.

Partially inlining a libcall that has the musttail attribute
leads to broken LLVM IR, triggering an assertion in the IR verifier.

Reviewed By: lebedev.ri

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

2 years ago[mlir] Fix unused variable warning. NFCI.
Benjamin Kramer [Tue, 5 Apr 2022 19:23:49 +0000 (21:23 +0200)]
[mlir] Fix unused variable warning. NFCI.

2 years ago[Darwin][ASan][Sanitizer] Enable dlclose-test for all darwin targets.
Roy Sundahl [Mon, 4 Apr 2022 22:33:56 +0000 (15:33 -0700)]
[Darwin][ASan][Sanitizer] Enable dlclose-test for all darwin targets.

Test was being skipped on non-x86 darwin architectures.

rdar://79795770

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

2 years agoChange the LLVM signpost category
Jonas Devlieghere [Tue, 5 Apr 2022 19:09:21 +0000 (12:09 -0700)]
Change the LLVM signpost category

Currently, the LLVM/LLDB timers are visible in Instruments for all apps.

The developer-visible "PointsOfInterest" category is reserved for
runtime issues and developer-authored "important" logging. These logs
are visible to developer almost always in Instruments

The LLVM/LLDB timers do not belong there. Having these present in the
system is noisy and confusing to developers. This patch moves them under
a new "toolchain" category.

rdar://91266582

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

2 years ago[GlobalISel] NFC: Regen some tests + improve test coverage for wide even types
Jessica Paquette [Tue, 5 Apr 2022 19:09:31 +0000 (12:09 -0700)]
[GlobalISel] NFC: Regen some tests + improve test coverage for wide even types

It turns out we don't do an awesome job with weird types like s318 (and other
types near them, like s316).

We don't have any test coverage for those types, so let's add some so it's
easier to see the impact of legalization improvements on them when we make
changes.

Since the test generator was changed, it's easier to update relevant tests prior
to changing things rather than squinting at a bunch of "ah, CHECK is now
CHECK-NEXT" lines. So, let's just regenerate a bunch of tests while we're
here.

Unfortunately the "CHECK-NEXT" scheme doesn't work with legalize-cmp for some
reason, and the test will fail. So keep that one having CHECK lines.

2 years ago[AMDGPU][OpenCL] Remove "printf and hostcall" diagnostic
Scott Linder [Tue, 5 Apr 2022 18:49:33 +0000 (18:49 +0000)]
[AMDGPU][OpenCL] Remove "printf and hostcall" diagnostic

The diagnostic is unreliable, and triggers even for dead uses of
hostcall that may exist when linking the device-libs at lower
optimization levels.

Eliminate the diagnostic, and directly document the limitation for
OpenCL before code object V5.

Make some NFC changes to clarify the related code in the
MetadataStreamer.

Add a clang test to tie OCL sources containing printf to the backend IR
tests for this situation.

Reviewed By: sameerds, arsenm, yaxunl

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

2 years ago[Clang] Do not warn on unused lifetime-extending vars with side effects...
Corentin Jabot [Tue, 29 Mar 2022 15:28:56 +0000 (17:28 +0200)]
[Clang] Do not warn on unused lifetime-extending vars with side effects...

const auto & var = ObjectWithSideEffects();

Fixes https://github.com/llvm/llvm-project/issues/54489

Reviewed By: aaron.ballman

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

2 years ago[mlir][vector] Separate high-D insert/extract strided slice rewrite
Lei Zhang [Tue, 5 Apr 2022 18:17:22 +0000 (14:17 -0400)]
[mlir][vector] Separate high-D insert/extract strided slice rewrite

Right now `populateVectorInsertExtractStridedSliceTransforms` contains
two categories of patterns, one for decomposing high-D insert/extract
strided slices, the other for lowering them to shuffle ops.
They are at different levels---the former is in the middle, while
the latter is a step of final lowering. Split them to give users
more control of which pattern to pick.

This means break down the previous `VectorExtractStridedSliceOpRewritePattern`,
which is doing two things together.

Also renamed those patterns to be clearer.

Reviewed By: ThomasRaoux

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

2 years agoCheck if register class was changed in constrainOperandRegClass()
Daniel Sanders [Tue, 5 Apr 2022 18:23:51 +0000 (11:23 -0700)]
Check if register class was changed in constrainOperandRegClass()

NFC
When no actual change happens there's no need to notify the
observers about the fact the register class is being constrained.
So we should avoid notifying observers when no change has
happened, because this can dramatically affect compile
time for particular test cases.

Reviewed By: dsanders, arsenm

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

2 years ago[lldb-vscode] Implement stderr/stdout on win32 and redirect lldb log to VSCode
Walter Erquinigo [Tue, 5 Apr 2022 18:21:22 +0000 (11:21 -0700)]
[lldb-vscode] Implement stderr/stdout on win32 and redirect lldb log to VSCode

This patch implements stderr/stdout forwarding on windows.
This was previously not implemented in D99974.
I added separate callbacks so the output can be sent to the different channels VSCode provides (OutputType::Stdout, OutputType::Stderr, OutputType::Console).

This patch also passes a log callback handler to SBDebugger::Create to be able to see logging output when it is enabled.

Since the output is now redirect on early startup I removed the calls to SetOutputFileHandle/SetErrorFileHandle, which set them to /dev/null.

I send the output of stderr/stdout/lldb log to OutputType::Console

Reviewed By: wallace

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