platform/upstream/llvm.git
2 years ago[Dexter] Improve performance by evaluating expressions only when needed
Stephen Tozer [Tue, 14 Sep 2021 11:06:23 +0000 (12:06 +0100)]
[Dexter] Improve performance by evaluating expressions only when needed

Currently, Dexter's model for fetching watch values is to build a list of
expressions to watch before running the debugger, then evaluating all of them at
each breakpoint, then finally looking up the values of these expressions at each
line they were expected on. When using dexter on a large project while watching
many different expressions, this is very slow, as Dexter will make a massive
number of calls made to the debugger's API, the vast majority of which are not
being used for anything. This patch fixes this issue by having Dexter only
evaluate expressions at a breakpoint when it will be used by a Dexter command.

Reviewed By: jmorse

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

2 years ago[Windows build] Use "DIA SDK" in sysroot
Nico Weber [Tue, 14 Sep 2021 12:59:28 +0000 (08:59 -0400)]
[Windows build] Use "DIA SDK" in sysroot

This updates llvm/utils/sysroot.py to include the "DIA SDK" folder in the
sysroot.

It also updates the build to look for the DIA SDK there if a sysroot is set.

This requires moving LLVM_WINSYSROOT to config-ix.cmake.

For the GN build, I chose to pass a qualified path to diaguids in libs instead
of pushing a config with a `/libpath:` flag. The former requires a GN with
https://gn-review.googlesource.com/c/gn/+/12200, the latter requires D109624.
The former is more like the cmake build, arguably a bit simpler, and it's
easier to check for the wrong GN revision and easier to update GN.

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

2 years ago[llvm cmake] replace tabs with spaces in config-ix.cmake
Nico Weber [Tue, 14 Sep 2021 12:58:59 +0000 (08:58 -0400)]
[llvm cmake] replace tabs with spaces in config-ix.cmake

2 years ago[OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021
Justas Janickas [Tue, 7 Sep 2021 13:32:05 +0000 (14:32 +0100)]
[OpenCL] Enables .rgba vector extension in C++ for OpenCL 2021

`.rgba` vector extension setting in C++ for OpenCL 2021 is now
performed analogously to OpenCL C 3.0. Test case added.

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

2 years ago[mlir][linalg] Fold ExtractSliceOps during tiling.
Tobias Gysi [Tue, 14 Sep 2021 11:43:08 +0000 (11:43 +0000)]
[mlir][linalg] Fold ExtractSliceOps during tiling.

Add the makeComposedExtractSliceOp method that creates an ExtractSliceOp and folds chains of ExtractSliceOps by computing the sum of their offsets and by multiplying their strides.

Reviewed By: nicolasvasilache

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

2 years ago[runtimes] Check whether -nostdinc++ and -nostdlib++ are supported
Martin Storsjö [Mon, 13 Sep 2021 20:05:23 +0000 (23:05 +0300)]
[runtimes] Check whether -nostdinc++ and -nostdlib++ are supported

Don't blindly assume they're supported - GCC doesn't support -nostdlib++.

The llvm-project/runtimes directory is supposed to allow building the
runtimes standalone from a newly built Clang, and thus should allow
building with other compilers too.

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

2 years agoRecommit "[LAA] Support pointer phis in loop by analyzing each incoming pointer."
Florian Hahn [Mon, 13 Sep 2021 13:44:39 +0000 (14:44 +0100)]
Recommit "[LAA] Support pointer phis in loop by analyzing each incoming pointer."

SCEV does not look through non-header PHIs inside the loop. Such phis
can be analyzed by adding separate accesses for each incoming pointer
value.

This results in 2 more loops vectorized in SPEC2000/186.crafty and
avoids regressions when sinking instructions before vectorizing.

Fixes PR50296, PR50288.

Reviewed By: Meinersbur

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

2 years ago[ARM] Teach DemandedVectorElts about VMOVN lanes
David Green [Tue, 14 Sep 2021 10:05:31 +0000 (11:05 +0100)]
[ARM] Teach DemandedVectorElts about VMOVN lanes

The class of instructions that write to narrow top/bottom lanes only
demand the even or odd elements of the input lanes. Which means that a
pair of VMOVNT; VMOVNB demands no lanes from the original input. This
teaches that to instcombine from the target hooks available through
ARMTTIImpl.

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

2 years ago[MLIR] Improve op parse error message for AtLeastNOperands trait
Uday Bondhugula [Tue, 14 Sep 2021 08:42:50 +0000 (14:12 +0530)]
[MLIR] Improve op parse error message for AtLeastNOperands trait

Improve parse error message for "at least N operands" op trait.

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

2 years ago[libc][Obvious] Some clean work with memmove.
Cheng Wang [Tue, 14 Sep 2021 09:19:28 +0000 (17:19 +0800)]
[libc][Obvious] Some clean work with memmove.

2 years ago[clang] disable implicit moves when not in CPlusPLus
Matheus Izvekov [Sat, 11 Sep 2021 23:11:02 +0000 (01:11 +0200)]
[clang] disable implicit moves when not in CPlusPLus

See PR51842.

This fixes an assert firing in the static analyzer, triggered by implicit moves
in blocks in C mode:

This also simplifies the AST a little bit when compiling non C++ code,
as the xvalue implicit casts are not inserted.

We keep and test that the nrvo flag is still being set on the VarDecls,
as that is still a bit beneficial while not really making anything
more complicated.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Reviewed By: NoQ

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

2 years agoAArch64: fix indentation of ProcAppleA14. NFC.
Tim Northover [Tue, 14 Sep 2021 09:00:34 +0000 (10:00 +0100)]
AArch64: fix indentation of ProcAppleA14. NFC.

2 years ago[OpenCL] Tests C++ for OpenCL version macros
Justas Janickas [Tue, 7 Sep 2021 13:40:46 +0000 (14:40 +0100)]
[OpenCL] Tests C++ for OpenCL version macros

Version macro definitions are tested for C++ for OpenCL when
explicit version is provided on command line via `-cl-std` flag.

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

2 years ago[WebAssembly] NFC: Remove unused tblgen template args
Cullen Rhodes [Tue, 14 Sep 2021 07:52:12 +0000 (07:52 +0000)]
[WebAssembly] NFC: Remove unused tblgen template args

Identified in D109359.

Reviewed By: aheejin

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

2 years ago[AArch64] NFC: Use 'asm' in SIMDScalarCPY
Cullen Rhodes [Tue, 14 Sep 2021 07:52:05 +0000 (07:52 +0000)]
[AArch64] NFC: Use 'asm' in SIMDScalarCPY

Fixes a warning identified in D109359. The mnemonic is also mov, not
cpy.

Reviewed By: dmgreen

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

2 years ago[Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol
Martin Storsjö [Tue, 7 Sep 2021 11:56:43 +0000 (14:56 +0300)]
[Win64EH] Write .pdata symbol relocations relative to the temporary begin symbol

Previously the relocations pointed at the public user facing,
possibly external symbol.

When the function itself is weak, that symbol may be overridden at
link time, pointing at another strong implementation of the same
function instead. In that case, there's two conflicting pdata entries
pointing at the same address, and the wrong unwind info might end up
used.

Both GCC/binutils and MSVC produce pdata pointing at internal static
symbols. (GCC/binutils point at the .text section just as LLVM does
after this change, MSVC points at special label type symbols with the
type IMAGE_SYM_CLASS_LABEL and names like '$LN4'.)

This fixes unwinding through an overridden "operator new" with a
statically linked C++ library in MinGW mode. (Building libc++ with
-ffunction-sections and linking with --gc-sections might avoid the
issue too.)

This makes the produced object files a little less user friendly
to debug, but with other recent improvements for llvm-readobj, the
unwind info debugging experience should be pretty much the same.

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

2 years ago[llvm-readobj] [COFF] Resolve relocations pointing at section symbols for arm64 too
Martin Storsjö [Mon, 6 Sep 2021 12:30:37 +0000 (15:30 +0300)]
[llvm-readobj] [COFF] Resolve relocations pointing at section symbols for arm64 too

This syncs parts from the x86 implementation to the ARMWinEH
implementation.

Currently, neither of the compilers targeting COFF/arm64 (MSVC, LLVM)
produce such relocations, but LLVM might after a later patch.

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

2 years ago[llvm-readobj] [COFF] Try to resolve symbols in unwind info on x86
Martin Storsjö [Fri, 10 Sep 2021 13:31:30 +0000 (16:31 +0300)]
[llvm-readobj] [COFF] Try to resolve symbols in unwind info on x86

This is the same as we do on arm64 already for the MSVC style label
symbols, but also handle the way GCC produces it - with all relocations
pointing at the .text section symbol, with various offsets.

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

2 years ago[runtimes] Calculate the path to the llvm directory without the LLVM cmake package
Martin Storsjö [Mon, 13 Sep 2021 19:27:44 +0000 (22:27 +0300)]
[runtimes] Calculate the path to the llvm directory without the LLVM cmake package

If building by pointing cmake directly at the llvm-project/runtimes
directory, the llvm cmake package files (that provide e.g.
LLVM_BUILD_MAIN_SRC_DIR) aren't necessarily available. Instead just
use a path relative to the current source dir.

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

2 years ago[runtimes] Initialize LLVM_DEFAULT_TARGET_TRIPLE if not set by the caller
Martin Storsjö [Mon, 13 Sep 2021 19:27:17 +0000 (22:27 +0300)]
[runtimes] Initialize LLVM_DEFAULT_TARGET_TRIPLE if not set by the caller

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

2 years agoCheck supported architectures in sseXYZ/avxXYZ headers
serge-sans-paille [Mon, 13 Sep 2021 13:27:24 +0000 (15:27 +0200)]
Check supported architectures in sseXYZ/avxXYZ headers

It doesn't make sense to include those headers on the wrong architecture,
provide an explicit error message in that case.

Fix https://bugs.llvm.org/show_bug.cgi?id=48915

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

2 years ago[WebAssembly] Fix a typo in comments
Heejin Ahn [Tue, 14 Sep 2021 07:44:27 +0000 (00:44 -0700)]
[WebAssembly] Fix a typo in comments

2 years agoFixup some formatting from a recent commit
David Blaikie [Tue, 14 Sep 2021 07:41:19 +0000 (00:41 -0700)]
Fixup some formatting from a recent commit

2 years agoDebugInfo: Add support for template parameters with reference qualifiers
David Blaikie [Tue, 14 Sep 2021 07:32:06 +0000 (00:32 -0700)]
DebugInfo: Add support for template parameters with reference qualifiers

Followon from the previous commit supporting cvr qualifiers.

2 years agoDebugInfo: Add support for template parameters with qualifiers
David Blaikie [Tue, 14 Sep 2021 07:02:36 +0000 (00:02 -0700)]
DebugInfo: Add support for template parameters with qualifiers

eg: t1<void () const> - DWARF doesn't have a particularly nice way to
encode this, for real member function types (like `void (t1::*)()
const`) the const-ness is encoded in the type of the artificial first
parameter. But `void () const` has no parameters, so encode it like a
normal const-qualified type, using DW_TAG_const_type. (similarly for
restrict and volatile)

Reference qualifiers (& and &&) coming in a separate commit shortly.

2 years ago[yaml2obj][XCOFF] add the SectionIndex field for symbol.
Esme-Yi [Tue, 14 Sep 2021 06:18:03 +0000 (06:18 +0000)]
[yaml2obj][XCOFF] add the SectionIndex field for symbol.

Summary: Add the SectionIndex field for symbol.
1: a symbol can reference a section by SectionName or SectionIndex.
2: a symbol can reference a section by both SectionName and SectionIndex.
3: if both Section and SectionIndex are specified, but the two values refer
   to different sections, an error will be reported.
4: an invalid SectionIndex is allowed.
5: if a symbol references a non-existent section by SectionName, an error will be reported.

Reviewed By: jhenderson, Higuoxing

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

2 years ago[APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer.
Chris Lattner [Fri, 10 Sep 2021 18:31:26 +0000 (11:31 -0700)]
[APInt] Add a concat method, use LLVM_UNLIKELY to help optimizer.

Three unrelated changes:

1) Add a concat method as a convenience to help write bitvector
   use cases in a nicer way.
2) Use LLVM_UNLIKELY as suggested by @xbolva00 in a previous patch.
3) Fix casing of some "slow" methods to follow naming standards.

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

2 years ago[PowerPC] prepare more loop load/store instructions
Chen Zheng [Tue, 14 Sep 2021 04:26:33 +0000 (04:26 +0000)]
[PowerPC] prepare more loop load/store instructions

PPCLoopInstrFormPrep pass now can prepare for load store instructions
in a loop whose increment is not a constant integer.

Reviewed By: jsji

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

2 years agoAMDGPU: Fix assert with indirect call with known required inputs
Matt Arsenault [Tue, 14 Sep 2021 01:52:07 +0000 (21:52 -0400)]
AMDGPU: Fix assert with indirect call with known required inputs

The attributor can determine that some indirect calls do not require
special inputs. The special inputs will still be present in the ABI,
so we need to allocate the registers and pass undefs.

2 years agoImprove type printing of const arrays to normalize array-of-const and const-array
David Blaikie [Tue, 14 Sep 2021 02:03:41 +0000 (19:03 -0700)]
Improve type printing of const arrays to normalize array-of-const and const-array

Since these map to the same effective type - render them the same/in the
more legible way (const x[n]).

2 years ago[mlir][linalg] makeTiledShape: No affine.min if tile size == 1
Matthias Springer [Tue, 14 Sep 2021 01:47:39 +0000 (10:47 +0900)]
[mlir][linalg] makeTiledShape: No affine.min if tile size == 1

This improves codegen (more static type information) with `scalarize-dynamic-dims`.

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

2 years ago[mlir][linalg] New tiling option: Scalarize dynamic dims
Matthias Springer [Tue, 14 Sep 2021 01:40:13 +0000 (10:40 +0900)]
[mlir][linalg] New tiling option: Scalarize dynamic dims

This tiling option scalarizes all dynamic dimensions, i.e., it tiles all dynamic dimensions by 1.

This option is useful for linalg ops with partly dynamic tensor dimensions. E.g., such ops can appear in the partial iteration after loop peeling. After scalarizing dynamic dims, those ops can be vectorized.

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

2 years ago[mlir][linalg] Add scf.for loop peeling to codegen strategy
Matthias Springer [Tue, 14 Sep 2021 01:27:00 +0000 (10:27 +0900)]
[mlir][linalg] Add scf.for loop peeling to codegen strategy

Only scf.for loops are supported at the moment. linalg.tiled_loop support will be added in a subsequent commit.

Only static tensor sizes are supported. Loops for dynamic tensor sizes can be peeled, but the generated code is not optimal due to a missing canonicalization pattern.

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

2 years ago[Bazel] Fix Bazel config for 2c8e784915
Geoffrey Martin-Noble [Tue, 14 Sep 2021 01:22:42 +0000 (18:22 -0700)]
[Bazel] Fix Bazel config for 2c8e784915

Updates the Bazel config for OrcTargetProcess after
https://github.com/llvm/llvm-project/commit/2c8e784915

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

2 years ago[mlir][linalg] TiledLoopOp peeling: Do not peel partial iterations
Matthias Springer [Tue, 14 Sep 2021 00:59:41 +0000 (09:59 +0900)]
[mlir][linalg] TiledLoopOp peeling: Do not peel partial iterations

Extend the unit test with an option for skipping partial iterations during loop peeling.

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

2 years ago[RISCV] add Half-precision test for vle/vse
Shao-Ce Sun [Mon, 13 Sep 2021 10:28:10 +0000 (18:28 +0800)]
[RISCV] add Half-precision test for vle/vse

Reviewed By: craig.topper

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

2 years ago[gn build] Port 2c8e78491588
LLVM GN Syncbot [Tue, 14 Sep 2021 00:27:49 +0000 (00:27 +0000)]
[gn build] Port 2c8e78491588

2 years ago[ORC] Fix self-assignment.
Lang Hames [Mon, 13 Sep 2021 23:21:39 +0000 (09:21 +1000)]
[ORC] Fix self-assignment.

We want to read the page size from EPI->PageSize. Thanks to Simon Pilgrim for
spotting this.

2 years ago[ORC] Add Shared/OrcRTBridge, and TargetProcess/OrcRTBootstrap.
Lang Hames [Mon, 13 Sep 2021 03:45:31 +0000 (13:45 +1000)]
[ORC] Add Shared/OrcRTBridge, and TargetProcess/OrcRTBootstrap.

This is a small first step towards reorganization of the ORC libraries:

Declarations for types and function names (as strings) to be found in the
"ORC runtime bootstrap" set are moved into OrcRTBridge.h / OrcRTBridge.cpp.

The current implementation of the "ORC runtime bootstrap" functions is moved
into OrcRTBootstrap.h and OrcRTBootstrap.cpp. It is likely that this code will
eventually be moved into ORT-RT proper (in compiler RT).

The immediate goal of this change is to make these bootstrap functions usable
for clients other than SimpleRemoteEPC/SimpleRemoteEPCServer. The first planned
client is a new RuntimeDyld::MemoryManager that will run over EPC, which will
allow us to remove the old OrcRemoteTarget code.

2 years ago[Hexagon] Use getTypeAllocSize to compute difference between objects
Brendon Cahoon [Tue, 14 Sep 2021 00:04:00 +0000 (19:04 -0500)]
[Hexagon] Use getTypeAllocSize to compute difference between objects

The code was using getTypeStoreSize to calculate the difference
between consecutive objects. The calculation was incorrect due
to padding that is added between consecutive objects. The
getTypeAllocSize includes the padding amount. For example,
if the type is [19 x i8], the difference between consecutive
objects is 32 bytes, not 19 bytes.

A second case for getTypeAllocSize is needed when computing
the pointer values for the vector accesses. The calculation needs
to account for the padding as well.

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

2 years ago[Hexagon] Handle bitcast of i64/i128 -> v64i1/v128i1
Ankit Aggarwal [Mon, 13 Sep 2021 23:52:09 +0000 (18:52 -0500)]
[Hexagon] Handle bitcast of i64/i128 -> v64i1/v128i1

2 years ago[clang] Revert gcc-driver part of 648feabc65d8
Nico Weber [Mon, 13 Sep 2021 23:03:33 +0000 (19:03 -0400)]
[clang] Revert gcc-driver part of 648feabc65d8

See discussion on https://reviews.llvm.org/D109624

2 years ago[opt] Remove some legacy PM flags
Arthur Eubanks [Sun, 12 Sep 2021 21:39:49 +0000 (14:39 -0700)]
[opt] Remove some legacy PM flags

Reviewed By: asbirlea

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

2 years ago[GlobalDCE] In VFE support for relative pointers, allow GEP references to the base...
Kuba Mracek [Mon, 13 Sep 2021 21:44:49 +0000 (14:44 -0700)]
[GlobalDCE] In VFE support for relative pointers, allow GEP references to the base symbol

This is for Swift VFE support. In some vtable forms that Swift emits, the "base" of a relative pointer is not the global symbol itself directly, but a GEP into it -- so the pointer is relative to a particular field in the global. So getPointerAtOffset() needs to be able to see through the GEP and allow it in a SUB expression, to correctly recognize the offset as a vtable slot.

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

2 years ago[lld][WebAssembly] Relax limitations on multithreaded instantiation
Thomas Lively [Mon, 13 Sep 2021 22:03:50 +0000 (15:03 -0700)]
[lld][WebAssembly] Relax limitations on multithreaded instantiation

For multithreaded modules (i.e. modules with a shared memory), lld injects a
synthetic Wasm start function that is automatically called during instantiation
to initialize memory from passive data segments. Even though the module will be
instantiated separately on each thread, memory initialization should happen only
once. Furthermore, memory initialization should be finished by the time each
thread finishes instantiation. Since multiple threads may be instantiating their
modules at the same time, the synthetic function must synchronize them.

The current synchronization tries to atomically increment a flag from 0 to 1 in
memory then enters one of two cases. First, if the increment was successful, the
current thread is responsible for initializing memory. It does so, increments
the flag to 2 to signify that memory has been initialized, then notifies all
threads waiting on the flag. Otherwise, the thread atomically waits on the flag
with an expected value of 1 until memory has been initialized. Either the
initializer thread finishes initializing memory (i.e. sets the flag to 2) first
and the waiter threads do not end up blocking, or the waiter threads succesfully
start waiting before memory is initialized so they will be woken by the
initializer thread once it has finished.

One complication with this scheme is that there are various contexts on the Web,
most notably on the main browser thread, that cannot successfully execute a
wait. Executing a wait in these contexts causes a trap, and in this case would
cause instantiation to fail. The embedder must therefore ensure that these
contexts win the race and become responsible for initializing memory, since that
is the only code path that does not execute a wait.

Unfortunately, since only one thread can win the race and initialize memory,
this scheme makes it impossible to have multiple threads in contexts that cannot
wait. For example, it is not currently possible to instantiate the module on
both the main browser thread as well as in an AudioWorklet. To loosen this
restriction, this commit inserts an extra check so that the wait will not be
executed at all when memory has already been initialized, i.e. when the flag
value is 2. After this change, the module can be instantiated on threads in
non-waiting contexts as long as the embedder can guarantee either that the
thread will win the race and initialize memory (as before) or that memory has
already been initialized when instantiation begins. Threads in contexts that can
wait can continue racing to initialize memory.

Fixes (or at least improves) PR51702.

Reviewed By: dschuff

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

2 years ago[mlir][doc] fix typos.
Jian Cai [Mon, 13 Sep 2021 20:42:24 +0000 (13:42 -0700)]
[mlir][doc] fix typos.

Also wrap some function/class names in backticks.

Reviewed By: ftynse

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

2 years ago[WebAssembly] Handle _setjmp and _longjmp in SjLj
Heejin Ahn [Mon, 13 Sep 2021 00:05:50 +0000 (17:05 -0700)]
[WebAssembly] Handle _setjmp and _longjmp in SjLj

In some platforms `_setjmp` and `_longjmp` are used instead of `setjmp`
and `longjmp`. This CL adds support for them.

Fixes https://github.com/emscripten-core/emscripten/issues/14999.

Reviewed By: dschuff

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

2 years ago[WebAssembly] Rethrow longjmp in EH handling if EmSjLj is enabled
Heejin Ahn [Sun, 12 Sep 2021 06:05:06 +0000 (23:05 -0700)]
[WebAssembly] Rethrow longjmp in EH handling if EmSjLj is enabled

This is a fix on top of D106525's Case 2. In D106525, in
`runEHOnFunction` which handles Emscripten EH, We rethrow `longjmp` only
when the module has any usage of `setjmp` or `longjmp`. But now Wasm
object files are linked using wasm-ld, the module this pass sees is not
the whole program, and even if this module does not contain any
`longjmp`, another file can contain it and can be linked with the
current module. This enables the rethrowing of longjmp whenever
Emscripten SjLj is enabled, regardless of whether it is used in this
module or not.

Reviewed By: dschuff

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

2 years ago[Bazel][mlir] Simplify test/BUILD.bazel with globs
Geoffrey Martin-Noble [Mon, 13 Sep 2021 20:24:31 +0000 (13:24 -0700)]
[Bazel][mlir] Simplify test/BUILD.bazel with globs

This reduces the maintenance burden by using globs, which is the
tradeoff we make in the other LLVM Bazel build files as well.

Reviewed By: mehdi_amini

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

2 years ago[lldb] Actually fix format specifier after D108233
Fangrui Song [Mon, 13 Sep 2021 20:40:37 +0000 (13:40 -0700)]
[lldb] Actually fix format specifier after D108233

And revert c4fa2c8aa493e4c786446739ba3eb0eb4918d579

2 years ago[ClangScanDeps][test] Add -fmodules-cache-path=DIR/cache to make diagnostics.c hermetic
Fangrui Song [Mon, 13 Sep 2021 20:17:55 +0000 (13:17 -0700)]
[ClangScanDeps][test] Add -fmodules-cache-path=DIR/cache to make diagnostics.c hermetic

Otherwise it may access sys::path::cache_directory/clang/ModuleCache which may not be writable.

2 years ago[Sanitizers] intercept accept4 on freebsd
David Carlier [Mon, 13 Sep 2021 20:15:07 +0000 (21:15 +0100)]
[Sanitizers] intercept accept4 on freebsd

2 years ago[value-tracking] see through returned attribute.
Florian Mayer [Mon, 13 Sep 2021 09:01:55 +0000 (10:01 +0100)]
[value-tracking] see through returned attribute.

Reviewed By: vitalybuka

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

2 years ago[hwasan] Respect returns attribute when tracking values.
Florian Mayer [Fri, 3 Sep 2021 11:58:58 +0000 (12:58 +0100)]
[hwasan] Respect returns attribute when tracking values.

Reviewed By: vitalybuka

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

2 years ago[flang][OpenMP] Add parsing support for nontemporal clause.
Arnamoy Bhattacharyya [Mon, 13 Sep 2021 16:29:22 +0000 (12:29 -0400)]
[flang][OpenMP] Add parsing support for nontemporal clause.

This patch adds parsing support for the nontemporal clause.  Also adds a couple of test cases.

Reviewed By: clementval

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

2 years ago[ADT] Extend EnableIfCallable for callables with incomplete returns
Fehr Mathieu [Mon, 13 Sep 2021 18:15:13 +0000 (18:15 +0000)]
[ADT] Extend EnableIfCallable for callables with incomplete returns

std::is_convertible has no defined behavior when its arguments
are incomplete, even if they are equal. In practice, it returns false.
Adding std::is_same allows us to use the constructor using a callable,
even if the return value is incomplete. We also check the case where
we convert a T into a const T.

Reviewed By: DaniilSuchkov

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

Committer: Daniil Suchkov <dsuchkov@azul.com>

2 years agoReorder mmt4d shapes:
Benoit Jacob [Mon, 13 Sep 2021 19:08:54 +0000 (12:08 -0700)]
Reorder mmt4d shapes:

* Revert https://reviews.llvm.org/D107307 so that both LHS and RHS have
  the same layout with K0 as the innermost dimension.

* Continuing from https://reviews.llvm.org/D107003, move also 'K'
  to the outer side, so that now the inter-tile dimensions as all outer,
  and the intra-tile dimensions are all inner.

Reviewed By: asaadaldien

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

2 years ago[Sanitizers] intercept getgrouplist on Linux and FreeBSD.
David Carlier [Mon, 13 Sep 2021 17:42:43 +0000 (18:42 +0100)]
[Sanitizers] intercept getgrouplist on Linux and FreeBSD.

Reviewed By: vitalyb

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

2 years ago[lldb] Fix warning in MinidumpFileBuilder.cpp
Alex Langford [Mon, 13 Sep 2021 17:34:31 +0000 (10:34 -0700)]
[lldb] Fix warning in MinidumpFileBuilder.cpp

Fixes the following warning:

$llvm_project/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.cpp:744:11: warning:
format specifies type 'long' but the argument has type 'lldb::offset_t' (aka 'unsigned long long') [-Wformat]
          m_data.GetByteSize());
          ^~~~~~~~~~~~~~~~~~~~

2 years ago[openmp] Apply test change from D109500
Jon Chesterfield [Mon, 13 Sep 2021 17:01:07 +0000 (18:01 +0100)]
[openmp] Apply test change from D109500

2 years ago[openmp] Apply code change from D109500
Jon Chesterfield [Mon, 13 Sep 2021 17:00:15 +0000 (18:00 +0100)]
[openmp] Apply code change from D109500

2 years agoRevert "[openmp] Fix 51647, corrupt bitcode on amdgpu"
Jon Chesterfield [Mon, 13 Sep 2021 16:58:33 +0000 (17:58 +0100)]
Revert "[openmp] Fix 51647, corrupt bitcode on amdgpu"

This reverts commit d5c049a3f68791490e8c87d9974e9831ede0ada0.
Going to re-commit it in pieces for easier application to 13

2 years agoRevert "[IndVars] Replace PHIs if loop exits on 1st iteration"
Philip Reames [Mon, 13 Sep 2021 17:11:18 +0000 (10:11 -0700)]
Revert "[IndVars] Replace PHIs if loop exits on 1st iteration"

This reverts commit 5a6dfb27ca7424f15a20f9bb7ec90d858865faa3.  See original review for why.

2 years agoRevert "[IndVars] Break backedge and replace PHIs if loop exits on 1st iteration"
Philip Reames [Mon, 13 Sep 2021 17:10:49 +0000 (10:10 -0700)]
Revert "[IndVars] Break backedge and replace PHIs if loop exits on 1st iteration"

This reverts commit d9ca444835e67960df927d5b8cade57776fdd8cb.  See review for why.

2 years ago[gn build] Fix typos in config visibility lists
Nico Weber [Mon, 13 Sep 2021 16:50:30 +0000 (12:50 -0400)]
[gn build] Fix typos in config visibility lists

GN https://gn-review.googlesource.com/c/gn/+/12140 identified these
typos. Fix them.

No effective behavior change.

2 years ago[RegScavenger][NFC] Refer to the already initialized local variable for spill slot...
vnalamot [Mon, 13 Sep 2021 15:21:17 +0000 (20:51 +0530)]
[RegScavenger][NFC] Refer to the already initialized local variable for spill slot index

Reviewed By: arsenm

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

2 years ago[mlir][Linalg] Insert static buffers as high as possible during ComprehensiveBufferiz...
Nicolas Vasilache [Mon, 13 Sep 2021 12:39:29 +0000 (12:39 +0000)]
[mlir][Linalg] Insert static buffers as high as possible during ComprehensiveBufferization.

This revision allows hoisting static alloc/dealloc pairs as high as possible during ComprehensiveBufferization.
This also aligns such allocated buffers to 128B by default.

This change exhibited some issues wrt insertion points and a missing copy that are also fixed in this revision; tests are updated accordingly.

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

2 years ago[Utils] Use make_early_inc_range (NFC)
Kazu Hirata [Mon, 13 Sep 2021 15:57:23 +0000 (08:57 -0700)]
[Utils] Use make_early_inc_range (NFC)

2 years ago[mlir][emitc] Print signed integers properly
Simon Camphausen [Mon, 13 Sep 2021 14:57:09 +0000 (16:57 +0200)]
[mlir][emitc] Print signed integers properly

Previously negative integers were printed as large unsigned values.

Reviewed By: marbre

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

2 years ago[APInt] Add APIntOps::ScaleBitMask helper
Simon Pilgrim [Mon, 13 Sep 2021 15:26:57 +0000 (16:26 +0100)]
[APInt] Add APIntOps::ScaleBitMask helper

APInt is used to describe a bit mask in a variety of value tracking and demanded bits/elts functions.

When traversing through dst/src operands, we have a number of places where these masks need to widened/narrowed to translate through bitcasts, reductions etc. to a different type.

This patch add a APIntOps::ScaleBitMask common helper, adds unit test coverage, and updates a number of cases to use the the helper instead of their own implementation.

This came up on D109065 where we currently have to add yet another implementation of the same code.

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

2 years ago[SelectionDAG][NFC] Fix typo in VerifyDAGDiverence() function name
vnalamot [Mon, 13 Sep 2021 15:16:42 +0000 (20:46 +0530)]
[SelectionDAG][NFC] Fix typo in VerifyDAGDiverence() function name

Reviewed By: arsenm

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

2 years ago[MLIR] Mark test case XFAIL on SystemZ for now.
Jonas Paulsson [Mon, 13 Sep 2021 14:44:49 +0000 (16:44 +0200)]
[MLIR]  Mark test case XFAIL on SystemZ for now.

mlir-cpu-runner/math_polynomial_approx.mlir

This test case is currently failing on SystemZ, but it does not appear to
necessarily be a target specific problem. See discussion at
https://bugs.llvm.org/show_bug.cgi?id=51204.

2 years agoRevert "[libc] Some clean work with memmove."
Guillaume Chatelet [Mon, 13 Sep 2021 14:32:08 +0000 (14:32 +0000)]
Revert "[libc] Some clean work with memmove."

This reverts commit b659b789c03ac339e28d7b91406b67bb887a426d.

2 years ago[openmp] Fix 51647, corrupt bitcode on amdgpu
dpalermo [Mon, 13 Sep 2021 14:21:21 +0000 (15:21 +0100)]
[openmp] Fix 51647, corrupt bitcode on amdgpu

Patch by @dpalermo

The corrupt bitcode reported in https://bugs.llvm.org/show_bug.cgi?id=51647 seems to be a result of a later pass changing the workfn variable to addrspace(5) (thread private, on the stack). That seems reasonable for an alloca without an address space so it's an open question why that can crash the bitcode reader.

This change puts it in the thread private address space to begin with which means whatever misfired further down the pipeline does not break it. That matches the codegen from clang where stack variables are always annotated (5) and then addrspace cast prior to following use.

This therefore patches around whatever unsuccessfully moved the alloca variable to addrspace(5). That solves the problem of openmp opt producing code that crashes the bitcode reader. It should be possible to create a minimal repro for the underlying bug based on some handwritten IR that uses an alloca in a generic address space.

Reviewed By: ronlieb, jdoerfert, dpalermo-phab

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

2 years ago[gn build] (semi-manually) port 4247381e26dd
Nico Weber [Mon, 13 Sep 2021 14:03:29 +0000 (10:03 -0400)]
[gn build] (semi-manually) port 4247381e26dd

2 years ago[lldb] [test] Remove parent output checks from follow-child tests
Michał Górny [Mon, 13 Sep 2021 13:43:12 +0000 (15:43 +0200)]
[lldb] [test] Remove parent output checks from follow-child tests

Remove the parent output checks, as they make the test flaky while
serving no real purpose.  If the parent crashed/hanged, it will never
resume the child and the test would fail anyway.

2 years ago[SystemZ][z/OS] Missing wchar functions libc++
Muiez Ahmed [Mon, 13 Sep 2021 13:43:21 +0000 (09:43 -0400)]
[SystemZ][z/OS] Missing wchar functions libc++

The aim is to add the missing z/OS specific implementations for mbsnrtowcs and wcsnrtombs, as part of libc++.

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

2 years ago[mlir][linalg] ComprehensiveBufferize: Do not copy InitTensorOps
Matthias Springer [Mon, 13 Sep 2021 13:26:40 +0000 (22:26 +0900)]
[mlir][linalg] ComprehensiveBufferize: Do not copy InitTensorOps

Do not copy InitTensorOps or casts thereof.

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

2 years ago[VPlan] Add test that requires duplicating recipe for sinking.
Florian Hahn [Mon, 14 Jun 2021 18:33:12 +0000 (19:33 +0100)]
[VPlan] Add test that requires duplicating recipe for sinking.

2 years ago[lldb] Skip TestGuiBasicDebug due to pr51833
Pavel Labath [Mon, 13 Sep 2021 13:11:00 +0000 (15:11 +0200)]
[lldb] Skip TestGuiBasicDebug due to pr51833

2 years ago[InstCombining] Refactor checks for TryToSinkInstruction. NFC
Anna Thomas [Sun, 12 Sep 2021 19:11:26 +0000 (15:11 -0400)]
[InstCombining] Refactor checks for TryToSinkInstruction. NFC

Moved out the checks for profitability of TryToSinkInstructions
into a lambda function.
This will also allow us to easily add checks for bailing out if the
transform is not profitable.

Tests-Run: instCombine tests.

2 years ago[analyzer] MallocChecker: Add notes from NoOwnershipChangeVisitor only when a functio...
Kristóf Umann [Wed, 25 Aug 2021 14:07:56 +0000 (16:07 +0200)]
[analyzer] MallocChecker: Add notes from NoOwnershipChangeVisitor only when a function "intents", but doesn't change ownership, enable by default

D105819 Added NoOwnershipChangeVisitor, but it is only registered when an
off-by-default, hidden checker option was enabled. The reason behind this was
that it grossly overestimated the set of functions that really needed a note:

std::string getTrainName(const Train *T) {
  return T->name;
} // note: Retuning without changing the ownership of or deallocating memory
// Umm... I mean duh? Nor would I expect this function to do anything like that...

void foo() {
  Train *T = new Train("Land Plane");
  print(getTrainName(T)); // note: calling getTrainName / returning from getTrainName
} // warn: Memory leak

This patch adds a heuristic that guesses that any function that has an explicit
operator delete call could have be responsible for deallocating the memory that
ended up leaking. This is waaaay too conservative (see the TODOs in the new
function), but it safer to err on the side of too little than too much, and
would allow us to enable the option by default *now*, and add refinements
one-by-one.

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

2 years ago[JITLink] Factor out forEachRelocation() function from addRelocations() in ELF Aarch6...
Stefan Gränitz [Mon, 13 Sep 2021 12:49:01 +0000 (14:49 +0200)]
[JITLink] Factor out forEachRelocation() function from addRelocations() in ELF Aarch64 backend (NFC)

First step in reducing redundancy in `addRelocations()` implementations across ELF JITLink backends. The patch factors out common logic for ELF relocation traversal into the new helper function `forEachRelocation()` in the `ELFLinkGraphBuilder` base class. For now, this is applied to the Aarch64 implementation. Others may follow soon.

Reviewed By: lhames

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

2 years ago[clang] Make the driver not diagnose errors on nonexistent linker inputs
Nico Weber [Mon, 13 Sep 2021 12:57:38 +0000 (08:57 -0400)]
[clang] Make the driver not diagnose errors on nonexistent linker inputs

When nonexistent linker inputs are passed to the driver, the linker
now errors out, instead of the compiler. If the linker does not run,
clang now emits a "warning: linker input unused" instead of an error
for nonexistent files.

The motivation for this change is that I noticed that
`clang-cl /winsysroot sysroot main.cc ole32.lib` emitted a
"ole32.lib not found" error, even though the linker finds it just fine when
I run `clang-cl /winsysroot sysroot main.cc /link ole32.lib`.

The same problem occurs if running `clang-cl main.cc ole32.lib` in a
non-MSVC shell.

The problem is that DiagnoseInputExistence() only looked for libs in %LIB%,
but MSVCToolChain uses much more involved techniques.

For this particular problem, we could make DiagnoseInputExistence() ask
the toolchain to see if it can find a .lib file, but in general the
driver can't know what the linker will do to find files, so it shouldn't
try. For example, if we implement PR24616, lld-link will look in the
registry to determine a good default for %LIB% if it isn't set.

This is less or a problem for the gcc driver, since .a paths there are
either passed via -l flags (which honor -L), or via a qualified path
(that doesn't honor -L) -- but for example ld.lld's --chroot flag
can also trigger this problem. Without this patch,
`clang -fuse-ld=lld -Wl,--chroot,some/dir /file.o` will complain that
`/file.o` doesn't exist, even though
`clang -fuse-ld=lld -Wl,--chroot,some/dir -Wl,/file.o` succeeds just fine.

This implements rnk's suggestion on the old bug PR27234.

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

2 years agoSwiftAsync: use runtime-provided flag for extended frame if back-deploying
Tim Northover [Fri, 3 Sep 2021 08:59:02 +0000 (09:59 +0100)]
SwiftAsync: use runtime-provided flag for extended frame if back-deploying

When back-deploying Swift async code we can't always toggle the flag showing an
extended frame is present because it will confuse unwinders on systems released
before this feature. So in cases where the code might run there, we `or` in a
mask provided by the runtime (as an absolute symbol) telling us whether the
unwinders can cope.

When deploying only for newer OSs, we can still hard-code the bit-set for
greater efficiency.

2 years agoRevert "[clang] Check unsupported types in expressions"
Andrew Savonichev [Mon, 13 Sep 2021 12:34:21 +0000 (15:34 +0300)]
Revert "[clang] Check unsupported types in expressions"

This reverts commit ec6c847179fd019acae4d97a18f9e7d3961a6fdf.

Fails on check-openmp:

/b/1/openmp-clang-x86_64-linux-debian/llvm.build/projects/openmp/runtime/test/lock/Output/omp_init_lock.c.tmp
--
Exit Code: -11

2 years ago[gn build] Port 0213d7ec0c50
LLVM GN Syncbot [Mon, 13 Sep 2021 12:04:24 +0000 (12:04 +0000)]
[gn build] Port 0213d7ec0c50

2 years ago[clang] Check unsupported types in expressions
Andrew Savonichev [Wed, 10 Mar 2021 17:23:41 +0000 (20:23 +0300)]
[clang] Check unsupported types in expressions

The patch adds missing diagnostics for cases like:

  float F3 = ((__float128)F1 * (__float128)F2) / 2.0f;

Sema::checkDeviceDecl (renamed to checkTypeSupport) is changed to work
with a type without the corresponding ValueDecl. It is also refactored
so that host diagnostics for unsupported types can be added here as
well.

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

2 years ago[OpenCL] Initialize temporaries in the private address space
Ole Strohm [Mon, 13 Sep 2021 11:29:16 +0000 (12:29 +0100)]
[OpenCL] Initialize temporaries in the private address space

This patch fixes initializing temporaries, which are currently initialized
without an address space, meaning that no constructor can ever be applicable.
Now they will be constructed in the private addrspace.

Fixes the second issue in PR43296.

Reviewed By: Anastasia

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

2 years ago[mlir][Linalg] Use reify for padded op shape derivation.
Nicolas Vasilache [Fri, 10 Sep 2021 07:12:14 +0000 (07:12 +0000)]
[mlir][Linalg] Use reify for padded op shape derivation.

Previously, we would insert a DimOp and rely on later canonicalizations.
Unfortunately, reifyShape kind of rewrites are not canonicalizations anymore.
This introduces undesirable pass dependencies.

Instead, immediately reify the result shape and avoid the DimOp altogether.
This is akin to a local folding, which avoids introducing more reliance on `-resolve-shaped-type-result-dims` (similar to compositions of `affine.apply` by construction to avoid chains of size > 1).

It does not completely get rid of the reliance on the pass as the process is merely local: calling the pass may still be necessary for global effects. Indeed, one of the tests still requires the pass.

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

2 years ago[analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function...
Kristóf Umann [Thu, 19 Aug 2021 13:37:02 +0000 (15:37 +0200)]
[analyzer][NFCI] Allow clients of NoStateChangeFuncVisitor to check entire function calls, rather than each ExplodedNode in it

Fix a compilation error due to a missing 'template' keyword.

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

2 years ago[OpenCL] Support cl_ext_float_atomics
Sven van Haastregt [Mon, 13 Sep 2021 11:06:04 +0000 (12:06 +0100)]
[OpenCL] Support cl_ext_float_atomics

See https://github.com/KhronosGroup/OpenCL-Docs/pull/552 for initial
specification.

Patch by Haonan Yang.

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

2 years ago[lldb] Remove redundant register alt_names
Michał Górny [Fri, 10 Sep 2021 11:56:24 +0000 (13:56 +0200)]
[lldb] Remove redundant register alt_names

Remove redundant register alt_names that correspond to their respective
generic names.  D108554 makes it possible to query registers through
their generic names directly, therefore making repeating them via
alt_name unnecessary.

While at it, also remove alt_names that are equal to register names
on PPC.

This patch does not alter register definitions where the generic names
are listed as primary names, and other names are provided as alt_name
(e.g. ARM).

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

2 years ago[lldb] Support querying registers via generic names without alt_names
Michał Górny [Mon, 23 Aug 2021 13:29:45 +0000 (15:29 +0200)]
[lldb] Support querying registers via generic names without alt_names

Update GetRegisterInfoByName() methods to support getting registers
by a generic name independently of alt_name entries in the register
context.  This makes it possible to use generic names when interacting
with gdbserver (that does not supply alt_names).  It also makes it
possible to remove some of the duplicated information from register
context declarations and/or use alt_names for another purpose.

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

2 years ago[AArch64] NFC: Remove unused template args
Cullen Rhodes [Mon, 13 Sep 2021 10:10:32 +0000 (10:10 +0000)]
[AArch64] NFC: Remove unused template args

Identified in D109359.

Reviewed By: dmgreen

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

2 years ago[AArch64] Regenerate some test checks. NFC
David Green [Mon, 13 Sep 2021 10:29:44 +0000 (11:29 +0100)]
[AArch64] Regenerate some test checks. NFC

This regenerates some of the tests that had very-close-to-updated check
line already, in order to make them more maintainable.

2 years ago[VectorCombine] Support AND/UREM indices that require freezing.
Florian Hahn [Mon, 13 Sep 2021 10:21:45 +0000 (11:21 +0100)]
[VectorCombine] Support AND/UREM indices that require freezing.

38b098be6605 limited scalarization to indices that are known non-poison.
For certain patterns that restrict the range of an index, we can insert
a freeze of the original value, to prevent propagation of poison.

Reviewed By: lebedev.ri

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

2 years ago[llvm][sve] Lowering for VLS masked extending loads
David Truby [Wed, 1 Sep 2021 11:49:48 +0000 (12:49 +0100)]
[llvm][sve] Lowering for VLS masked extending loads

This extends the custom lowering for extending loads on
fixed length vectors in SVE to support masked extending loads.

The existing tests for correct behaviour of masked extending loads
exhibit bad code generation due to the legalistaion of i1 vectors.
They have been left as-is and new tests have been added that do not
exhibit this behaviour.

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

2 years ago[Sema] Add test for __builtin_fminf errors.
Florian Hahn [Mon, 13 Sep 2021 10:02:22 +0000 (11:02 +0100)]
[Sema] Add test for __builtin_fminf errors.

2 years ago[AArch64][SVE] NFC: Remove unused name from cvt builtins
Cullen Rhodes [Mon, 13 Sep 2021 09:46:31 +0000 (09:46 +0000)]
[AArch64][SVE] NFC: Remove unused name from cvt builtins

Identified in D109359.

Reviewed By: paulwalker-arm, dmgreen

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