platform/upstream/llvm.git
2 years agoCleanup includes: ProfileData
serge-sans-paille [Wed, 23 Feb 2022 21:18:20 +0000 (22:18 +0100)]
Cleanup includes: ProfileData

Estimation of the impact on preprocessor output:

before: 1067349756
after: 1065940348

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120434

2 years agoCleanup include: DebugInfo/Symbolize
serge-sans-paille [Wed, 23 Feb 2022 21:16:39 +0000 (22:16 +0100)]
Cleanup include: DebugInfo/Symbolize

Estimation of the impact on preprocessor output
after: 1067349756
before:1067487786

Discourse thread: https://discourse.llvm.org/t/include-what-you-use-include-cleanup
Differential Revision: https://reviews.llvm.org/D120433

2 years ago[AMDGPU] Fix permissions on test files
Jay Foad [Thu, 24 Feb 2022 12:17:34 +0000 (12:17 +0000)]
[AMDGPU] Fix permissions on test files

2 years ago[AArch64] Add vector select test showing redundant operations.
Florian Hahn [Thu, 24 Feb 2022 12:12:21 +0000 (12:12 +0000)]
[AArch64] Add vector select test showing redundant operations.

The tests show sub-optimal lowering of extend/cmp/select chains starting
with v16i8 vectors.

2 years ago[NFC][RISCV] Reuse ISD::NodeType in float extension
Shao-Ce SUN [Thu, 24 Feb 2022 03:14:43 +0000 (11:14 +0800)]
[NFC][RISCV] Reuse ISD::NodeType in float extension

Reviewed By: asb

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

2 years ago[OpenCL] opencl-c.h: remove arg names for image builtins
Sven van Haastregt [Thu, 24 Feb 2022 11:52:32 +0000 (11:52 +0000)]
[OpenCL] opencl-c.h: remove arg names for image builtins

This simplifies completeness comparisons against OpenCLBuiltins.td and
also makes the header no longer "claim" the identifiers "image",
"image_array", "coord", "sampler", "sample", "gradientX", "gradientY",
"lod", and "color".

Continues the direction set out in D119560.

2 years ago[lldb] Fix macos build for D120425
Pavel Labath [Thu, 24 Feb 2022 11:47:17 +0000 (12:47 +0100)]
[lldb] Fix macos build for D120425

2 years ago[mlir][LLVM] Allow scalable vectors in ShuffleVectorOp
Javier Setoain [Thu, 27 Jan 2022 13:36:16 +0000 (13:36 +0000)]
[mlir][LLVM] Allow scalable vectors in ShuffleVectorOp

The current implementation of ShuffleVectorOp assumes all vectors are
scalable. LLVM IR allows shufflevector operations on scalable vectors,
and the current translation between LLVM Dialect and LLVM IR does the
rigth thing when the shuffle mask is all zeroes. This is required to
do a splat operation on a scalable vector, but it doesn't make sense
for scalable vectors outside of that operation, i.e.: with non-all zero
masks.

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

2 years ago[X86] LowerShiftByScalarVariable - use getSplatSourceVector for vXi8 shift expansion
Simon Pilgrim [Thu, 24 Feb 2022 11:12:52 +0000 (11:12 +0000)]
[X86] LowerShiftByScalarVariable - use getSplatSourceVector for vXi8 shift expansion

Using getSplatValue causes poor codegen due to not always being able to remove the EXTRACT_VECTOR_ELT created inside getSplatValue.

The vXi16 shifts/rotates are still showing occasional regressions but vXi8 is a definite improvement.

2 years agoRevert "[RISCV] add the MC layer support of Zfinx extension"
Nikita Popov [Thu, 24 Feb 2022 11:12:05 +0000 (12:12 +0100)]
Revert "[RISCV] add the MC layer support of Zfinx extension"

This reverts commit 7798ecca9c3db42241169d31fea4fb820ed01830.

As reported in https://reviews.llvm.org/D93298#3331641 and
following, this causes assertion failures with inline assembly.

2 years ago[NFC][clang] Simplify `isOneOf` function
Shao-Ce SUN [Thu, 20 Jan 2022 02:58:26 +0000 (10:58 +0800)]
[NFC][clang] Simplify `isOneOf` function

Reviewed By: tmatheson

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

2 years ago[lldb] One more fix for the MonitorChildProcess patch (D120425)
Pavel Labath [Thu, 24 Feb 2022 11:05:42 +0000 (12:05 +0100)]
[lldb] One more fix for the MonitorChildProcess patch (D120425)

2 years ago[mlir][linalg][bufferize] Always bufferize in-place with "out" operands by default
Matthias Springer [Thu, 24 Feb 2022 10:48:40 +0000 (19:48 +0900)]
[mlir][linalg][bufferize] Always bufferize in-place with "out" operands by default

In D115022, we introduced an optimization where OpResults of a `linalg.generic` may bufferize in-place with an "in" OpOperand if the corresponding "out" OpOperand is not used in the computation.

This optimization can lead to unexpected behavior if the newly chosen OpOperand is in the same alias set as another OpOperand (that is used in the computation). In that case, the newly chosen OpOperand must bufferize out-of-place. This can be confusing to users, as always choosing the "out" OpOperand (regardless of whether it is used) would be expected when having the notion of "destination-passing style" in mind.

With this change, we go back to always bufferizing in-place with "out" OpOperands by default, but letting users override the behavior with a bufferization option.

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

2 years ago[lldb] Fix windows build for D120425
Pavel Labath [Thu, 24 Feb 2022 10:50:54 +0000 (11:50 +0100)]
[lldb] Fix windows build for D120425

2 years ago[flang][docs] Update the top "doc" page
Andrzej Warzynski [Thu, 17 Feb 2022 16:53:57 +0000 (16:53 +0000)]
[flang][docs] Update the top "doc" page

* Added a note about "Classic Flang"
* sorted entries in ToC

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

2 years ago[lldb/host] Remove monitor_signals argument from process monitoring functions
Pavel Labath [Tue, 22 Feb 2022 16:45:35 +0000 (17:45 +0100)]
[lldb/host] Remove monitor_signals argument from process monitoring functions

All current callers set the argument to false. monitor_signals=true used
to be used in the Process plugins (which needed to know when the
debugged process gets a signal), but this implementation has several
serious issues, which means that individual process plugins now
orchestrate the monitoring of debugged processes themselves.

This allows us to simplify the implementation (no need to play with
process groups), and the interface (we only catch fatal events, so the
callback is always called just once).

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

2 years ago[Sema] Silence unused variable warning in Release builds. NFC.
Benjamin Kramer [Thu, 24 Feb 2022 09:58:32 +0000 (10:58 +0100)]
[Sema] Silence unused variable warning in Release builds. NFC.

2 years ago[mlir][python] Support more types in IntegerAttr.value
rkayaith [Thu, 24 Feb 2022 09:21:40 +0000 (10:21 +0100)]
[mlir][python] Support more types in IntegerAttr.value

Previously only accessing values for `index` and signless int types
would work; signed and unsigned ints would hit an assert in
`IntegerAttr::getInt`. This exposes `IntegerAttr::get{S,U}Int` to the C
API and calls the appropriate function from the python bindings.

Reviewed By: ftynse

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

2 years ago[clang-format] Avoid inserting space after C++ casts.
Marek Kurdej [Tue, 22 Feb 2022 21:32:03 +0000 (22:32 +0100)]
[clang-format] Avoid inserting space after C++ casts.

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

This is a solution for standard C++ casts: const_cast, dynamic_cast, reinterpret_cast, static_cast.

A general approach handling all possible casts is not possible without semantic information.
Consider the code:
```
static_cast<T>(*function_pointer_variable)(arguments);
```
vs.
```
some_return_type<T> (*function_pointer_variable)(parameters);
// Later used as:
function_pointer_variable = &some_function;
return function_pointer_variable(args);
```
In the latter case, it's not a cast but a variable declaration of a pointer to function.
Without knowing what `some_return_type<T>` is (and clang-format does not know it), it's hard to distinguish between the two cases. Theoretically, one could check whether "parameters" are types (not a cast) and "arguments" are value/expressions (a cast), but that might be inefficient (needs lots of lookahead).

Reviewed By: MyDeveloperDay, HazardyKnusperkeks, owenpan

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

2 years ago[sancov][sanitizer-common] Correct sanitizer coverage point
Xiaodong Liu [Thu, 24 Feb 2022 09:14:24 +0000 (17:14 +0800)]
[sancov][sanitizer-common] Correct sanitizer coverage point

Sanitizer coverage point should be the previous instruction PC of the
caller and the offset to the previous instruction might be different
on each CPU architecture.

Reviewed By: MaskRay

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

2 years ago[clang-format] Fix QualifierOrder breaking the code with requires clause.
Marek Kurdej [Mon, 21 Feb 2022 13:17:58 +0000 (14:17 +0100)]
[clang-format] Fix QualifierOrder breaking the code with requires clause.

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

Given the config:
```
BasedOnStyle: LLVM
QualifierAlignment: Custom
QualifierOrder: ['constexpr', 'type']
```

The code:
```
template <typename F>
  requires std::invocable<F>
constexpr constructor();
```
was incorrectly formatted to:
```
template <typename F>
  requires
constexpr std::invocable<F> constructor();
```
because we considered `std::invocable<F> constexpr` as a type, not recognising the requires clause.

This patch avoids moving the qualifier across the boundary of the requires clause (checking `ClosesRequiresClause`).

Reviewed By: HazardyKnusperkeks, owenpan

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

2 years ago[AArch64][AsmParser] Arch directives should set implied features.
Sander de Smalen [Thu, 24 Feb 2022 08:46:15 +0000 (08:46 +0000)]
[AArch64][AsmParser] Arch directives should set implied features.

When assembling for example an SVE instruction with the `.arch +sve2` directive,
+sve should be implied by setting +sve2, similar to what would happen if
one would pass the mattr=+sve2 flag on the command-line.

The AsmParser doesn't set the implied features, meaning that the SVE
instruction does not assemble. This patch fixes that.

Note that the same does not hold when disabling a feature. For example,
+nosve2 does not imply +nosve.

Reviewed By: c-rhodes

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

2 years ago[clang-format] Do not insert space after new/delete keywords in C function declarations
Luis Penagos [Thu, 24 Feb 2022 08:48:24 +0000 (09:48 +0100)]
[clang-format] Do not insert space after new/delete keywords in C function declarations

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

Reviewed By: curdeius, HazardyKnusperkeks

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

2 years ago[libc++] Remove <chrono> include from <future>
Nikolas Klauser [Wed, 23 Feb 2022 22:07:07 +0000 (23:07 +0100)]
[libc++] Remove <chrono> include from <future>

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

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

2 years ago[C++20][Modules][3/8] Initial handling for module partitions.
Iain Sandoe [Sun, 7 Feb 2021 01:00:33 +0000 (01:00 +0000)]
[C++20][Modules][3/8] Initial handling for module partitions.

This implements the parsing and recognition of module partition CMIs
and removes the FIXMEs in the parser.

Module partitions are recognised in the base computation of visibility,
however additional amendments to visibility follow in subsequent patches.

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

2 years ago[RISCV] Add schedule class for Zbm and Zbe extension
lian wang [Tue, 15 Feb 2022 06:17:33 +0000 (06:17 +0000)]
[RISCV] Add schedule class for Zbm and Zbe extension

Reviewed By: craig.topper

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

2 years ago[RISCV][NFC] Remove useless intrinsic function declare in test of Zbp extension
lian wang [Thu, 24 Feb 2022 01:57:10 +0000 (01:57 +0000)]
[RISCV][NFC] Remove useless intrinsic function declare in test of Zbp extension

Reviewed By: benshi001

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

2 years ago[libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms
Martin Storsjö [Tue, 22 Feb 2022 10:28:08 +0000 (12:28 +0200)]
[libcxx] [test] Fix the get/put long_double_ru_RU tests on Apple platforms

This fixes issue #45084 (https://llvm.org/PR45739).

Remove unnecessary trailing spaces after the "RUB" international
currency symbol (and after the plain number in some parts of the
put_long_double test).

Both of these test files are
`XFAIL: netbsd || linux || LIBCXX-WINDOWS-FIXME`, and then have some of
their test cases commented out when `__APPLE__`. This patch comments-in
those test cases and adjusts them all to work on Apple, while leaving the
test `XFAIL`ed on NetBSD, Linux, and Windows.

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

2 years ago[analyzer] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off builds
Fangrui Song [Thu, 24 Feb 2022 08:13:13 +0000 (00:13 -0800)]
[analyzer] Fix -Wunused-lambda-capture in -DLLVM_ENABLE_ASSERTIONS=off builds

2 years ago[InstCombine] Canonicalize SPF to min/max intrinsics
Nikita Popov [Mon, 14 Feb 2022 16:18:07 +0000 (17:18 +0100)]
[InstCombine] Canonicalize SPF to min/max intrinsics

Now that integer min/max intrinsics have good support in both
InstCombine and other passes, start canonicalizing SPF min/max
to intrinsic min/max.

Once this sticks, we can stop matching SPF min/max in various
places, and can remove hacks we have for preventing infinite loops
and breaking of SPF canonicalization.

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

2 years agoRevert "[InstCombine] Remove one-use limitation from X-Y==0 fold"
Nikita Popov [Thu, 24 Feb 2022 07:50:40 +0000 (08:50 +0100)]
Revert "[InstCombine] Remove one-use limitation from X-Y==0 fold"

This reverts commit 65dc78d63ee2eb20fbed54401091f08a685ef8c1.

This caused a major code-size regression on tramp3d-v4, revert
until I can investigate.

2 years ago[mlir][SCF] Apply suggested ClangTidy fixes.
Adrian Kuegel [Thu, 24 Feb 2022 07:22:13 +0000 (08:22 +0100)]
[mlir][SCF] Apply suggested ClangTidy fixes.

2 years ago[BOLT] Support PC-relative relocations with addends
Maksim Panchenko [Thu, 24 Feb 2022 06:54:42 +0000 (22:54 -0800)]
[BOLT] Support PC-relative relocations with addends

PC-relative memory operand could reference a different object from
the one located at the target address, e.g. when a negative offset
is used. Check relocations for the real referenced object.

Reviewed By: rafauler

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

2 years ago[Driver][RISCV] Add missing rv64 test case
eopXD [Tue, 22 Feb 2022 03:20:02 +0000 (19:20 -0800)]
[Driver][RISCV] Add missing rv64 test case

Add missing test case. Thanks @rogfer01 for spotting this out.

Reviewed By: asb

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

2 years ago[RISCV] Add more tests for vcpop and vfirst with VL=0
Chenbing.Zheng [Thu, 24 Feb 2022 05:23:25 +0000 (05:23 +0000)]
[RISCV] Add more tests for vcpop and vfirst with VL=0

Reviewed By: craig.topper

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

2 years ago[RISCV][NFC] Add helper function isVectorConfigInstr to reduce Repeated code.
Chenbing.Zheng [Thu, 24 Feb 2022 03:49:58 +0000 (03:49 +0000)]
[RISCV][NFC] Add helper function isVectorConfigInstr to reduce Repeated code.

Reviewed By: craig.topper

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

2 years ago[ELF] Symbols.h: remove #include "InputFiles.h"
Fangrui Song [Thu, 24 Feb 2022 05:36:45 +0000 (21:36 -0800)]
[ELF] Symbols.h: remove #include "InputFiles.h"

2 years ago[ELF] Move isUsedInRegularObj assignment from ctor to call sites. NFC
Fangrui Song [Thu, 24 Feb 2022 05:32:50 +0000 (21:32 -0800)]
[ELF] Move isUsedInRegularObj assignment from ctor to call sites. NFC

This removes the tricky
`isUsedInRegularObj(!file || file->kind() == InputFile::ObjKind)`
and the copy from `Symbol::mergeProperties`.

2 years ago[RISCV] Use SelectionDAG::getFreeze to simplify some code. NFC
Craig Topper [Thu, 24 Feb 2022 05:12:54 +0000 (21:12 -0800)]
[RISCV] Use SelectionDAG::getFreeze to simplify some code. NFC

2 years ago[ELF][test] Avoid race on a.out
Fangrui Song [Thu, 24 Feb 2022 04:48:49 +0000 (20:48 -0800)]
[ELF][test] Avoid race on a.out

2 years ago[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC
Fangrui Song [Thu, 24 Feb 2022 04:44:34 +0000 (20:44 -0800)]
[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC

2 years ago[BOLT][NFC] Report errors from RewriteInstance `discoverStorage` and `run`
Amir Ayupov [Thu, 24 Feb 2022 03:30:30 +0000 (19:30 -0800)]
[BOLT][NFC] Report errors from RewriteInstance `discoverStorage` and `run`

Further improve error handling in BOLT by reporting `RewriteInstance` errors in
a library and fuzzer-friendly way instead of exiting.

Follow-up to D119658

Reviewed By: rafauler

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

2 years ago[ELF] Move TLS mismatch error from Symbol::replace to postParse
Fangrui Song [Thu, 24 Feb 2022 04:34:48 +0000 (20:34 -0800)]
[ELF] Move TLS mismatch error from Symbol::replace to postParse

* detect `def_tls.o undef_nontls.o` violation
* place error checking code (checking duplicate symbol) together
* allow `--defsym tls1=tls2 def_tls.o`

As a degraded error checking, `--defsym tls1=42` violation will not be detected.

2 years ago[flang] Do not print format tabs
V Donaldson [Thu, 24 Feb 2022 00:31:07 +0000 (16:31 -0800)]
[flang] Do not print format tabs

As an extension, tabs are accepted in a format, but should be skipped,
not printed.

2 years ago[HIP] Support `-fgpu-default-stream`
Yaxun (Sam) Liu [Tue, 22 Feb 2022 01:16:04 +0000 (20:16 -0500)]
[HIP] Support `-fgpu-default-stream`

Introduce -fgpu-default-stream={legacy|per-thread} option to
support per-thread default stream for HIP runtime.

When -fgpu-default-stream=per-thread, HIP kernels are
launched through hipLaunchKernel_spt instead of
hipLaunchKernel. Also HIP_API_PER_THREAD_DEFAULT_STREAM=1
is defined by the preprocessor to enable other per-thread stream
API's.

Reviewed by: Artem Belevich

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

2 years ago[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC
Fangrui Song [Thu, 24 Feb 2022 03:18:24 +0000 (19:18 -0800)]
[ELF] Don't rely on Symbols.h's transitive inclusion of InputFiles.h. NFC

2 years ago[mlir][sparse][taco] Add support for float32.
Bixia Zheng [Tue, 22 Feb 2022 22:04:30 +0000 (14:04 -0800)]
[mlir][sparse][taco] Add support for float32.

Previously, we only support float64. We now support float32 and float64. When
constructing a tensor without providing a data type, the default is float32.

Fix the tests to data type consistency. All PyTACO application tests now use
float32 to match the default data type of TACO. Other tests may use float32 or
float64.

Reviewed By: aartbik

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

2 years ago[ELF] Remove SharedSymbol::getFile. NFC
Fangrui Song [Thu, 24 Feb 2022 01:57:52 +0000 (17:57 -0800)]
[ELF] Remove SharedSymbol::getFile. NFC

Symbol.h depends on InputFiles.h. This change moves us toward dropping the
weird dependency.

The call sites will become slightly uglier (`cast<SharedFile>(s->file)`), but
the compromise is acceptable.

2 years ago[ScalarEvolution] Control flag for nonstrict inequalities in finite loops
Mircea Trofin [Thu, 24 Feb 2022 01:45:32 +0000 (17:45 -0800)]
[ScalarEvolution] Control flag for nonstrict inequalities in finite loops

D118090 causes a pretty significant (19%) regression in some Eigen
benchmarks. Investigating is a bit time consuming as the compilation
unit where this occurs is large. Rather than revert, this patch adds a
flag controlling that behavior (enabled by default).

2 years ago[mlir][sparse][linalg] add linalg rewriting specific to sparse tensors
Aart Bik [Thu, 24 Feb 2022 00:22:42 +0000 (16:22 -0800)]
[mlir][sparse][linalg] add linalg rewriting specific to sparse tensors

Now that sparse tensor types are first-class citizens and the sparse compiler
is taking shape, it is time to make sure other compiler optimizations compose
well with sparse tensors. Mostly, this should be completely transparent (i.e.,
dense and sparse take the same path). However, in some cases, optimizations
only make sense in the context of sparse tensors. This is a first example of
such an optimization, where fusing a sampled elt-wise multiplication only makes
sense when the resulting kernel has a potential lower asymptotic complexity due
to the sparsity.

As an extreme example, running SDDMM with 1024x1024 matrices and a sparse
sampling matrix with only two elements runs in 463.55ms in the unfused
case but just 0.032ms in the fused case, with a speedup of 14485x that
is only possible in the exciting world of sparse computations!

Reviewed By: mravishankar

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

2 years ago[lldb/test] Fix TestProgressReporting.py race issue with the event listener
Med Ismail Bennani [Thu, 24 Feb 2022 00:42:53 +0000 (16:42 -0800)]
[lldb/test] Fix TestProgressReporting.py race issue with the event listener

This patch is a follow-up of D120100 to address some feedbacks from
@labath.

This should mainly fix the race issue with the even listener by moving
the listener setup to the main thread.

This also changes the SBDebugger::GetProgressFromEvent SWIG binding
arguments to be output only, so the user don't have to provide them.

Finally, this updates the test to check it the out arguments are returned
in a tuple and re-enables the test on all platforms.

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years agoPGOInstrumentation, GCOVProfiling: Split indirectbr critical edges regardless of...
Matthias Braun [Wed, 16 Feb 2022 23:01:37 +0000 (15:01 -0800)]
PGOInstrumentation, GCOVProfiling: Split indirectbr critical edges regardless of PHIs

The `SplitIndirectBrCriticalEdges` function was originally designed for
`CodeGenPrepare` and skipped splitting of edges when the destination
block didn't contain any `PHI` instructions. This only makes sense when
reducing COPYs like `CodeGenPrepare`. In the case of
`PGOInstrumentation` or `GCOVProfiling` it would result in missed
counters and wrong result in functions with computed goto.

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

2 years agoSimplify/cleanup BasicBlockUtilsTest
Matthias Braun [Thu, 17 Feb 2022 21:57:06 +0000 (13:57 -0800)]
Simplify/cleanup BasicBlockUtilsTest

Cleanup BasicBolckUtilsTest using C++ raw string literals, remove
duplicated block functions and smaller style changes.

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

2 years ago[asan] Allow -fsanitize-address-globals-dead-stripping with -fno-data-sections for ELF
Fangrui Song [Thu, 24 Feb 2022 00:08:25 +0000 (16:08 -0800)]
[asan] Allow -fsanitize-address-globals-dead-stripping with -fno-data-sections for ELF

-fdata-sections decides whether global variables go into different sections.
This is orthogonal to whether we place their metadata (`.data` or `asan_globals`) into different sections.

With -fno-data-sections, `-fsanitize-address-globals-dead-stripping` can still:

* deduplicate COMDAT `asan.module_ctor` and `asan.module_dtor`
* (with ld --gc-sections): for a data section (e.g. `.data`), if all global variables defined relative to it are unreferenced, discard them and associated `asan_globals` sections (rare but no need to exclude this case)

Similar to c7b90947bd0179d914fea56b52be545c8f60f20a for PE/COFF.

Reviewed By: #sanitizers, kstoimenov, vitalybuka

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

2 years ago[BOLT][NFC] Fix undefined behavior in encodeAnnotationImm
Amir Ayupov [Wed, 23 Feb 2022 06:54:15 +0000 (22:54 -0800)]
[BOLT][NFC] Fix undefined behavior in encodeAnnotationImm

Fix UBSan-reported issue in MCPlusBuilder::encodeAnnotationImm (left shift of a
negative value).

Test Plan:
```
ninja check-bolt
...
PASS: BOLT-Unit :: Core/./CoreTests/AArch64/MCPlusBuilderTester.Annotation/0 (1 of 140)
PASS: BOLT-Unit :: Core/./CoreTests/X86/MCPlusBuilderTester.Annotation/0 (131 of 134)
```

Reviewed By: maksfb, yota9

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

2 years agoTeach the AArch64 backend to instruction select the BCAX instruction.
Owen Anderson [Fri, 18 Feb 2022 08:15:25 +0000 (00:15 -0800)]
Teach the AArch64 backend to instruction select the BCAX instruction.

Reviewed By: dmgreen

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

2 years agoReland "unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV after 32b73bc...
Nico Weber [Wed, 23 Feb 2022 23:41:20 +0000 (18:41 -0500)]
Reland "unbreak Modules/cxx20-export-import.cpp with LLVM_APPEND_VC_REV after 32b73bc6ab82"

This reverts commit 5086cff04eec4327acc22a90466854ad4d89d570.
32b73bc6ab82 relanded in 1592d88aa7bc.

2 years ago[FormatVariadic] Mark index as required in docstring
Dave Lee [Wed, 2 Feb 2022 18:45:19 +0000 (10:45 -0800)]
[FormatVariadic] Mark index as required in docstring

After looking at the formatv docstring, I thought the index was optional (as it
is in other languages). This changes the header docs to show `index` instead of
`[index]`, to indicate that it is required.

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

2 years ago[CMake] Use CMAKE_SYSROOT to build libs for Win to ARM cross tooolchain. NFC.
Vladimir Vereschaka [Thu, 17 Feb 2022 01:20:39 +0000 (17:20 -0800)]
[CMake] Use CMAKE_SYSROOT to build libs for Win to ARM cross tooolchain. NFC.

Provide CMAKE_SYSROOT for the libc++/libc++abi/libunwind libraries
instead of specific <foo>_SYSROOT for each of them.

Fixed passing some CMake arguments for the runtimes.

Referenced Differentials:
 * https://reviews.llvm.org/D119836
 * https://reviews.llvm.org/D112155
 * https://reviews.llvm.org/D111672

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

2 years ago[libc++] Add empty line in ReleaseNotes.rst
Nikolas Klauser [Wed, 23 Feb 2022 23:09:18 +0000 (00:09 +0100)]
[libc++] Add empty line in ReleaseNotes.rst

2 years ago[OpenMP][NFC] Address warnings and lint messages in CGOpenMPRuntime
Joseph Huber [Wed, 23 Feb 2022 22:40:29 +0000 (17:40 -0500)]
[OpenMP][NFC] Address warnings and lint messages in CGOpenMPRuntime

Summary:
This patch addressed the warnings and linting messages for the
CGOpenMPRuntime.cpp file. This was causing some -Werror builds to fail.

2 years agoAdd support for floating-point option `ffp-eval-method` and for
Zahira Ammarguellat [Tue, 19 Oct 2021 16:12:57 +0000 (09:12 -0700)]
Add support for floating-point option `ffp-eval-method` and for
`pragma clang fp eval_method`.

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

2 years ago[NFC][hwasan] Check _GLIBCXX_RELEASE in test
Vitaly Buka [Wed, 23 Feb 2022 22:29:09 +0000 (14:29 -0800)]
[NFC][hwasan] Check _GLIBCXX_RELEASE in test

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

2 years ago[opt] Pin region viewer passes to legacy PM.
Michael Kruse [Tue, 22 Feb 2022 22:34:04 +0000 (16:34 -0600)]
[opt] Pin region viewer passes to legacy PM.

The RegionPrinter, RegionOnlyPrinter, RegionViewer and RegionOnlyViewer passes have not yet been ported to the new pass manager.

Reviewed By: aeubanks

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

2 years ago[HWASan] Use hwasan_memalign for aligned new.
Vitaly Buka [Wed, 23 Feb 2022 22:05:00 +0000 (14:05 -0800)]
[HWASan] Use hwasan_memalign for aligned new.

Aligned new does not require size to be a multiple of alignment, so
memalign is the correct choice instead of aligned_alloc.

Fixes false reports for unaligned sizes.

Reviewed By: eugenis

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

2 years ago[SampleProf][Inliner] Add an option to turn off inliner in sample-profile pass.
minglotus-6 [Tue, 22 Feb 2022 20:07:43 +0000 (12:07 -0800)]
[SampleProf][Inliner] Add an option to turn off inliner in sample-profile pass.

Use case is offline evaluation (for inliner effectiveness) or debugging.

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

2 years ago[NFC][hwasan] Clang-format the file
Vitaly Buka [Wed, 23 Feb 2022 22:04:51 +0000 (14:04 -0800)]
[NFC][hwasan] Clang-format the file

2 years agoUse function prototypes when appropriate; NFC
Aaron Ballman [Wed, 23 Feb 2022 22:11:34 +0000 (17:11 -0500)]
Use function prototypes when appropriate; NFC

2 years agoFix more unused lambda capture warnings, NFC
Reid Kleckner [Wed, 23 Feb 2022 22:05:26 +0000 (14:05 -0800)]
Fix more unused lambda capture warnings, NFC

2 years ago[libc++] Granularize chrono includes
Nikolas Klauser [Wed, 23 Feb 2022 22:05:22 +0000 (23:05 +0100)]
[libc++] Granularize chrono includes

Reviewed By: Quuxplusone, #libc

Spies: libcxx-commits

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

2 years ago[HWASan] add test for debug info of allocas that don't need padding.
Florian Mayer [Tue, 15 Feb 2022 19:41:52 +0000 (11:41 -0800)]
[HWASan] add test for debug info of allocas that don't need padding.

Reviewed By: eugenis

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

2 years agoFix unused lambda capture warning, NFC
Reid Kleckner [Wed, 23 Feb 2022 22:01:01 +0000 (14:01 -0800)]
Fix unused lambda capture warning, NFC

2 years ago[NVPTX] Add ex2.approx.f16/f16x2 support
Nicolas Miller [Tue, 22 Feb 2022 22:50:42 +0000 (14:50 -0800)]
[NVPTX] Add ex2.approx.f16/f16x2 support

his patch adds builtins and intrinsics for the f16 and f16x2 variants of the ex2
instruction.

These two variants were added in PTX7.0, and are supported by sm_75 and above.

Note that this isn't wired with the exp2 llvm intrinsic because the ex2
instruction is only available in its approx variant.

Running ptxas on the assembly generated by the test f16-ex2.ll works as
expected.

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

2 years ago[NVPTX] Add more FMA intriniscs/builtins
Jakub Chlanda [Tue, 22 Feb 2022 22:45:19 +0000 (14:45 -0800)]
[NVPTX] Add more FMA intriniscs/builtins

This patch adds builtins/intrinsics for the following variants of FMA:

- f16, f16x2
  - rn
  - rn_ftz
  - rn_sat
  - rn_ftz_sat
  - rn_relu
  - rn_ftz_relu
- bf16, bf16x2
  - rn
  - rn_relu

ptxas (Cuda compilation tools, release 11.0, V11.0.194) is happy with the generated assembly.

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

2 years ago[NVPTX] Expose float tys min, max, abs, neg as builtins
Jakub Chlanda [Tue, 22 Feb 2022 22:42:15 +0000 (14:42 -0800)]
[NVPTX] Expose float tys min, max, abs, neg as builtins

Adds support for the following builtins:

- abs, neg:
- .bf16,
- .bf16x2
- min, max
- {.ftz}{.NaN}{.xorsign.abs}.f16
- {.ftz}{.NaN}{.xorsign.abs}.f16x2
- {.NaN}{.xorsign.abs}.bf16
- {.NaN}{.xorsign.abs}.bf16x2
- {.ftz}{.NaN}{.xorsign.abs}.f32

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

2 years ago[Clang][Docs] Add '-fopenmp-offload-mandatory' to command line reference
Joseph Huber [Wed, 23 Feb 2022 21:53:30 +0000 (16:53 -0500)]
[Clang][Docs] Add '-fopenmp-offload-mandatory' to command line reference

2 years ago[SLP] Fastpath instructions not in block being scheduled [nfc]
Philip Reames [Wed, 23 Feb 2022 21:48:03 +0000 (13:48 -0800)]
[SLP] Fastpath instructions not in block being scheduled [nfc]

2 years ago[OpenMP] Add option to make offloading mandatory
Joseph Huber [Tue, 22 Feb 2022 21:15:34 +0000 (16:15 -0500)]
[OpenMP] Add option to make offloading mandatory

Currently when we generate OpenMP offloading code we always make
fallback code for the CPU. This is necessary for implementing features
like conditional offloading and ensuring that unhandled pragmas don't
result in missing symbols. However, this is problematic for a few cases.
For offloading tests we can silently fail to the host without realizing
that offloading failed. Additionally, this makes it impossible to
provide interoperabiility to other offloading schemes like HIP or CUDA
because those methods do not provide any such host fallback guaruntee.
this patch adds the `-fopenmp-offload-mandatory` flag to prevent
generating the fallback symbol on the CPU and instead replaces the
function with a dummy global and the failed branch with 'unreachable'.

Reviewed By: ABataev

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

2 years ago[SLP] Replace a impossible branch condition with an assert [NFC]
Philip Reames [Wed, 23 Feb 2022 21:42:49 +0000 (13:42 -0800)]
[SLP] Replace a impossible branch condition with an assert [NFC]

An entire bundle must be inside the scheduling window.  Assert that this property holds as opposed to checking it at runtime.

2 years ago[sanitizer][sancov] Use pc-1 for s390x
Fangrui Song [Wed, 23 Feb 2022 21:35:22 +0000 (13:35 -0800)]
[sanitizer][sancov] Use pc-1 for s390x

The stack trace addresses may be odd (normally addresses should be even), but
seems a good compromise when the instruction length (2,4,6) cannot be detected
easily.

Reviewed By: uweigand

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

2 years ago[clang] Remove Address::deprecated() from CGClass.cpp
Arthur Eubanks [Wed, 23 Feb 2022 21:26:32 +0000 (13:26 -0800)]
[clang] Remove Address::deprecated() from CGClass.cpp

2 years ago{SLP] Make it clear ScheduleDataMap is keyed by instructions [NFC]
Philip Reames [Wed, 23 Feb 2022 21:28:29 +0000 (13:28 -0800)]
{SLP] Make it clear ScheduleDataMap is keyed by instructions [NFC]

2 years ago[ELF][test] Fix edata-etext.s
Fangrui Song [Wed, 23 Feb 2022 21:29:21 +0000 (13:29 -0800)]
[ELF][test] Fix edata-etext.s

2 years ago[instrprof] Rename the profile kind types to be more descriptive.
Snehasish Kumar [Thu, 17 Feb 2022 22:44:49 +0000 (14:44 -0800)]
[instrprof] Rename the profile kind types to be more descriptive.

Based on the discussion in D115393, I've updated the names to be more
descriptive.

Reviewed By: ellis, MaskRay

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

2 years agoRevert "[SLP] Remove cap on schedule window size"
Philip Reames [Wed, 23 Feb 2022 21:08:18 +0000 (13:08 -0800)]
Revert "[SLP] Remove cap on schedule window size"

This reverts commit 6adf4b039e095224edbbecda5972e5e3353b53b6.  Reverting while investigating https://github.com/llvm/llvm-project/issues/54029

2 years agoRevert "[SLP] Simplify extendSchedulingRegion"
Philip Reames [Wed, 23 Feb 2022 21:08:10 +0000 (13:08 -0800)]
Revert "[SLP] Simplify extendSchedulingRegion"

This reverts commit 8c85f3a0523070ef656e30e368df0a679c1400cd.

2 years ago[OpenMP][Offloading] Change N back to 256 in bug49334.cpp
Shilei Tian [Wed, 23 Feb 2022 21:10:35 +0000 (16:10 -0500)]
[OpenMP][Offloading] Change N back to 256 in bug49334.cpp

2 years ago[libcxx] [test] Fix time.get.byname get_one for Glibc and Windows
Martin Storsjö [Tue, 25 Jan 2022 09:38:41 +0000 (09:38 +0000)]
[libcxx] [test] Fix time.get.byname get_one for Glibc and Windows

This matches the fixes for the wchar version in
f081cc50372f9415ef4fa2204a4b7f54153af455.

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

2 years ago[DAGCombiner][TargetLowering] Pass SDValue by value to isMulAddWithConstProfitable.
Craig Topper [Wed, 23 Feb 2022 20:35:06 +0000 (12:35 -0800)]
[DAGCombiner][TargetLowering] Pass SDValue by value to isMulAddWithConstProfitable.

Internally to DAGCombiner the SDValues were passed by non-const
reference despite not being modified. They were then passed by
const reference to TLI.

This patch passes them by value which is consistent with the vast
majority of code.

Reviewed By: RKSimon

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

2 years ago[DAGCombine] Extend combineCarryDiamond()
Pawe Bylica [Wed, 23 Feb 2022 18:26:48 +0000 (19:26 +0100)]
[DAGCombine] Extend combineCarryDiamond()

In combineCarryDiamond() use getAsCarry() to find more candidates for being a carry flag.

Reviewed By: RKSimon

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

2 years ago[pseudo] fix an out-of-bound error in LRTable.
Haojian Wu [Wed, 23 Feb 2022 20:34:20 +0000 (21:34 +0100)]
[pseudo] fix an out-of-bound error in LRTable.

Fix window debug build.

2 years ago[lldb] Fix (unintentional) recursion in CommandObjectRegexCommand
Jonas Devlieghere [Wed, 23 Feb 2022 19:52:20 +0000 (11:52 -0800)]
[lldb] Fix (unintentional) recursion in CommandObjectRegexCommand

Jim noticed that the regex command is unintentionally recursive. Let's
use the following command regex as an example:

  (lldb) com regex humm 's/([^ ]+) ([^ ]+)/p %1 %2 %1 %2/'

If we call it with arguments foo bar, thing behave as expected:

  (lldb) humm foo bar
  (...)
  foo bar foo bar

However, if we include %2 in the arguments, things break down:

  (lldb) humm fo%2o bar
  (...)
  fobaro bar fobaro bar

The problem is that the implementation of the substitution is too naive.
It substitutes the %1 token into the target template in place, then does
the %2 substitution starting with the resultant string. So if the
previous substitution introduced a %2 token, it would get processed in
the second sweep, etc.

This patch addresses the issue by walking the command once and
substituting the % variables in place.

  (lldb) humm fo%2o bar
  (...)
  fo%2o bar fo%2o bar

Furthermore, this patch also reports an error if not enough variables
were provided and add support for substituting %0.

rdar://81236994

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

2 years ago[SLP] Rearrange fields in ScheduleData for density [NFC]
Philip Reames [Wed, 23 Feb 2022 19:57:56 +0000 (11:57 -0800)]
[SLP] Rearrange fields in ScheduleData for  density [NFC]

2 years ago[NFC][PowerPC] Fix the check-cpu.ll test case.
Stefan Pintilie [Wed, 23 Feb 2022 15:18:19 +0000 (09:18 -0600)]
[NFC][PowerPC] Fix the check-cpu.ll test case.

This test doesn't work because the CHECK-NOT line is actually checking
something that only exists on stderr and not stdout.
Changed the test so that we now check both stderr and stdout.
Changed the test so that we check pwr9, pwr10, and future. The cpu names of
power9 or power10 are not supported in the llc backend.

Reviewed By: nemanjai, #powerpc

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

2 years ago[mlir] Add sectionMemoryMapper to ExecutionEngineOptions
Emilio Cota [Wed, 23 Feb 2022 15:51:36 +0000 (10:51 -0500)]
[mlir] Add sectionMemoryMapper to ExecutionEngineOptions

By specifying a sectionMemoryMapper, users can control how
memory for JIT code is allocated.

In particular, I need this in order to use a named memory
region so that profilers such as perf(1) can correctly label
execution cycles coming from JIT'ed code.

Reviewed-by: ezhulenev
Differential Revision: https://reviews.llvm.org/D120415

2 years ago[Driver] Add -fno-sanitize-address-globals-dead-stripping
Fangrui Song [Wed, 23 Feb 2022 19:51:30 +0000 (11:51 -0800)]
[Driver] Add -fno-sanitize-address-globals-dead-stripping

It's customary for these options to have the -fno- form which is sometimes
handy to work around issues. Using the supported driver option is preferred over
the internal cl::opt option `-mllvm -asan-globals-live-support=0`

Reviewed By: kstoimenov, vitalybuka

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

2 years ago[SLP] Remove SchedulingPriority from ScheduleData [NFC]
Philip Reames [Wed, 23 Feb 2022 19:40:03 +0000 (11:40 -0800)]
[SLP] Remove SchedulingPriority from ScheduleData [NFC]

First step in trying to shrink the memory footprint of ScheduleData to improve cache locality.

2 years ago[PATCH] ASAN: Align declaration with definition of a fn
Martin Liska [Wed, 23 Feb 2022 19:25:17 +0000 (11:25 -0800)]
[PATCH] ASAN: Align declaration with definition of a fn

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

Reviewed By: vitalybuka

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

2 years ago[TSan][NFC] fixup for comment of Shadow
Xu Mingjie [Wed, 23 Feb 2022 19:15:57 +0000 (11:15 -0800)]
[TSan][NFC] fixup for comment of Shadow

There should be 1-bit unused field between tid field and is_atomic field of Shadow.

Reviewed By: dvyukov, vitalybuka

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

2 years agoRevert "[TSan][NFC] fixup for comment of Shadow"
Vitaly Buka [Wed, 23 Feb 2022 19:21:04 +0000 (11:21 -0800)]
Revert "[TSan][NFC] fixup for comment of Shadow"

Wrong author.

This reverts commit 6bff092e3ed4ae1f21b290f88cf7152cb331aa48.