platform/upstream/llvm.git
2 years agoscudo: Only add no-omit-frame-pointer flags when the compiler supports them
Tom Stellard [Thu, 9 Sep 2021 04:10:38 +0000 (21:10 -0700)]
scudo: Only add no-omit-frame-pointer flags when the compiler supports them

Reviewed By: cryptoad

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

2 years ago[mlir][linalg] Fix dim(iter_arg) canonicalization
Matthias Springer [Thu, 9 Sep 2021 03:12:28 +0000 (12:12 +0900)]
[mlir][linalg] Fix dim(iter_arg) canonicalization

Run a small analysis to see if the runtime type of the iter_arg is changing. Fold only if the runtime type stays the same. (Same as `DimOfIterArgFolder` in SCF.)

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

2 years ago[polly] Fix "no member named 'getIndexExpressionsFromGEP'"
Leonard Chan [Thu, 9 Sep 2021 03:04:56 +0000 (20:04 -0700)]
[polly] Fix "no member named 'getIndexExpressionsFromGEP'"

As of 741fabc222f226d34d806056b804244b012853b, polly builders are
failing from this error. The signiature is slightly different and
accepts a ScalarEvolution reference instead. This should fix the polly
builders.

2 years agogn build: Add support for building lldb-server on Android.
Peter Collingbourne [Wed, 8 Sep 2021 19:53:30 +0000 (12:53 -0700)]
gn build: Add support for building lldb-server on Android.

The cross-compiled lldb-server targets are added to the lldb deps if
Android cross compilation is enabled.

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

2 years agogn build: Add support for building LLDB on Linux.
Peter Collingbourne [Thu, 2 Sep 2021 20:39:32 +0000 (13:39 -0700)]
gn build: Add support for building LLDB on Linux.

On Linux, LLDB depends on lldb-server at runtime (on Mac, the dependency on
a debug server presumably comes via the system debugserver), so I added it
to deps.

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

2 years ago[mlir][linalg] Tiling: Use loop ub in extract_slice size computation if possible
Matthias Springer [Thu, 9 Sep 2021 02:04:41 +0000 (11:04 +0900)]
[mlir][linalg] Tiling: Use loop ub in extract_slice size computation if possible

When tiling a LinalgOp, extract_slice/insert_slice pairs are inserted. To avoid going out-of-bounds when the tile size does not divide the shape size evenly (at the boundary), AffineMin ops are inserted. Some ops have assumptions regarding the dimensions of inputs/outputs. E.g., in a `A * B` matmul, `dim(A, 1) == dim(B, 0)`. However, loop bounds use either `dim(A, 1)` or `dim(B, 0)`.

With this change, AffineMin ops are expressed in terms of loop bounds instead of tensor sizes. (Both have the same runtime value.) This simplifies canonicalizations.

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

2 years agoRevert "[runtimes] Set more paths when building runtimes standalone"
Leonard Chan [Thu, 9 Sep 2021 01:31:10 +0000 (18:31 -0700)]
Revert "[runtimes] Set more paths when building runtimes standalone"

This reverts commit 407e07aa67ab56c92cdec1fdbf6b121afbceddaf.

Reverting since this seems to break OpenMP builds and our clang
builders. See thread on https://reviews.llvm.org/D107895.

2 years ago[APInt.h] Reduce the APInt header file interface a bit. NFC
Chris Lattner [Thu, 9 Sep 2021 00:36:43 +0000 (17:36 -0700)]
[APInt.h] Reduce the APInt header file interface a bit. NFC

This moves one mid-size function out of line, inlines the
trivial tcAnd/tcOr/tcXor/tcComplement methods into their only
caller, and moves the magic/umagic functions into SelectionDAG
since they are implementation details of its algorithm. This
also removes the unit tests for magic, but these are already
tested in the divide lowering logic for various targets.

This also upgrades some C style comments to C++.

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

2 years ago[MachineOutliner][AArch64] Ensure LR is live-in when inserting reg-save calls
Jessica Paquette [Thu, 9 Sep 2021 00:32:54 +0000 (17:32 -0700)]
[MachineOutliner][AArch64] Ensure LR is live-in when inserting reg-save calls

Similar to other code which handles creating the function frame.

If LR isn't live-in to the block that we're inserting the call into, we'll get
a MachineVerifier error.

2 years ago[GlobalISel] Implement merging of stores of truncates.
Amara Emerson [Wed, 8 Sep 2021 06:51:48 +0000 (23:51 -0700)]
[GlobalISel] Implement merging of stores of truncates.

This is a port of a combine which matches a pattern where a wide type scalar
value is stored by several narrow stores. It folds it into a single store or
a BSWAP and a store if the targets supports it.

Assuming little endian target:
 i8 *p = ...
 i32 val = ...
 p[0] = (val >> 0) & 0xFF;
 p[1] = (val >> 8) & 0xFF;
 p[2] = (val >> 16) & 0xFF;
 p[3] = (val >> 24) & 0xFF;
=>
 *((i32)p) = val;

On CTMark AArch64 -Os this results in a good amount of savings:

Program            before        after       diff
             SPASS 412792       412788       -0.0%
                kc 432528       432512       -0.0%
            lencod 430112       430096       -0.0%
  consumer-typeset 419156       419128       -0.0%
            bullet 475840       475752       -0.0%
        tramp3d-v4 367760       367628       -0.0%
          clamscan 383388       383204       -0.0%
    pairlocalalign 249764       249476       -0.1%
    7zip-benchmark 570100       568860       -0.2%
           sqlite3 287628       286920       -0.2%
Geomean difference                           -0.1%

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

2 years ago[SCEV] Move getIndexExpressionsFromGEP to delinearize [NFC]
Philip Reames [Wed, 8 Sep 2021 23:29:29 +0000 (16:29 -0700)]
[SCEV] Move getIndexExpressionsFromGEP to delinearize [NFC]

2 years agoAdd sanity check in MLIR ODS to catch case where two results have the same name
Mehdi Amini [Wed, 8 Sep 2021 18:06:47 +0000 (18:06 +0000)]
Add sanity check in MLIR ODS to catch case where two results have the same name

This is making a tablegen crash with a more friendly error.

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

2 years ago[APInt.h] don't privatize "needsCleanup"; it is used by Clang APValue
Chris Lattner [Wed, 8 Sep 2021 23:33:06 +0000 (16:33 -0700)]
[APInt.h] don't privatize "needsCleanup"; it is used by Clang APValue

2 years agoError: Improve unit test by using gtest equality rather than explicit string compare...
David Blaikie [Wed, 8 Sep 2021 23:21:11 +0000 (16:21 -0700)]
Error: Improve unit test by using gtest equality rather than explicit string compare calls

This ensures error messages from gtest includes the raw text of both
sides of the comparison - otherwise all gtest can report is the text of
the expression source, without any information about the values or how
they differ.

2 years agoFileError: Provide a way to retrieve the underlying error string without the file...
David Blaikie [Wed, 8 Sep 2021 23:16:11 +0000 (16:16 -0700)]
FileError: Provide a way to retrieve the underlying error string without the file name

For use with APIs that want to report the file name in a different
syntactic form, have other knowledge of the filename, etc.

2 years agoFileError: Support zero-length file names
David Blaikie [Wed, 8 Sep 2021 23:03:28 +0000 (16:03 -0700)]
FileError: Support zero-length file names

It's a common error in an API - to try to open an empty file, so it
seems like a reasonable FileError to produce "hey, you tried to open an
empty file" and to handle it the same way as any other file error.

2 years ago[APInt.h] Clean up the APInt interface. NFC.
Chris Lattner [Wed, 8 Sep 2021 23:07:43 +0000 (16:07 -0700)]
[APInt.h] Clean up the APInt interface. NFC.

This moves all the private implementation details to the bottom of
the header, and pushes all the "make an APInt" stuff up to the top.
This is in prep for making other changes to spiff up APInt a bit.

2 years ago[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument is...
Usman Nadeem [Wed, 8 Sep 2021 22:52:19 +0000 (15:52 -0700)]
[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument is honored

- Make flto an alias of flto=full.
- Make foffload-lto an alias of foffload-lto=full.
- Make flto_EQ_jobserver, flto_EQ_auto aliases of flto=full,
  since they are being treated as full lto right now.
- Clean up the code for parseLTOMode and setLTOMode.
- Replace uses of OPT_flto with OPT_flto_EQ since they alias now.

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

Change-Id: I5d867db83a680434fba5c8d85c9a83135d3b81ee

2 years ago[clang][Fuchsia] Remove COMPILER_RT_CAN_EXECUTE_TESTS
Leonard Chan [Wed, 8 Sep 2021 22:52:02 +0000 (15:52 -0700)]
[clang][Fuchsia] Remove COMPILER_RT_CAN_EXECUTE_TESTS

I forgot that we run `check-runtimes-x86_64-unknown-linux-gnu`, which
will run all compiler-rt tests also even though we are currently not in
a state where we can run them all yet. Remove this for now to fix our CI
builders.

2 years agoRevert "[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument...
Usman Nadeem [Wed, 8 Sep 2021 22:49:35 +0000 (15:49 -0700)]
Revert "[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument is honored"

This reverts commit d2d2e5ea480feb09dc0edeac2eb14310de74b372.

2 years ago[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument is...
Usman Nadeem [Wed, 8 Sep 2021 19:10:17 +0000 (12:10 -0700)]
[clang][Driver] Update/cleanup LTO logic to ensure that the last lto argument is honored

- Make flto an alias of flto=full.
- Make foffload-lto an alias of foffload-lto=full.
- Make flto_EQ_jobserver, flto_EQ_auto aliases of flto=full,
  since they are being treated as full lto right now.
- Clean up the code for parseLTOMode and setLTOMode.
- Replace uses of OPT_flto with OPT_flto_EQ since they alias now.

Change-Id: Iea5338c20cb800b43529b20745e92600e2cfd2b1

2 years ago[SCEV] Simplify findExistingSCEVInCache interface [NFC]
Philip Reames [Wed, 8 Sep 2021 22:25:08 +0000 (15:25 -0700)]
[SCEV] Simplify findExistingSCEVInCache interface [NFC]

We were returning a tuple when all but one caller only cared about one piece of the return value.  That one caller can inline the complexity, and we can simplify all other uses.

2 years ago[CodeExtractor] Creating exit stubs based off original order branch instructions.
Andrew Litteken [Mon, 23 Aug 2021 19:02:30 +0000 (12:02 -0700)]
[CodeExtractor] Creating exit stubs based off original order branch instructions.

Previously the CodeExtractor created exit stubs, and the subsequent return value of the outlined function based on the order of out-of-region blocks after splitting any phi nodes, and collecting the blocks to be outlined. This could cause differences in order if there was a difference of exit block phi nodes between the two regions. This patch moves the collection of the output target blocks to be before this occurs, so that the assignment of target block to output value will be the same, regardless of the contents of the output block.

Reviewers: paquette, roelofs

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

2 years ago[AArch64] Rewrite floatdp_1source.ll test. NFC
David Green [Wed, 8 Sep 2021 22:00:34 +0000 (23:00 +0100)]
[AArch64] Rewrite floatdp_1source.ll test. NFC

Rewrite this test to not rely on volatile stores in a large function,
just use separate functions like any other test would.

2 years agoPort the cost model printer to New PM
Arthur Eubanks [Wed, 8 Sep 2021 20:27:55 +0000 (13:27 -0700)]
Port the cost model printer to New PM

Reviewed By: asbirlea

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

2 years ago[RISCV] Disable use of i128 shift libcalls on RV32.
Craig Topper [Wed, 8 Sep 2021 21:26:05 +0000 (14:26 -0700)]
[RISCV] Disable use of i128 shift libcalls on RV32.

Since i128 isn't a legal C type on RV32, I don't believe
libgcc implements these functions for RV32. compiler-rt
does implement them because i128 support is enabled
in order to handle long double.

This is consistent with 32-bit X86 and ARM.

Reviewed By: efriedma

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

2 years ago[NFC] Add extra test for D106331
Eli Friedman [Wed, 8 Sep 2021 21:18:47 +0000 (14:18 -0700)]
[NFC] Add extra test for D106331

2 years ago[openmp] 41c73671d0, this time with staged patch applied
Jon Chesterfield [Wed, 8 Sep 2021 21:07:05 +0000 (22:07 +0100)]
[openmp] 41c73671d0, this time with staged patch applied

2 years ago[Delinerization] Require by offset to be zero.
Michael Kruse [Wed, 8 Sep 2021 20:36:39 +0000 (15:36 -0500)]
[Delinerization] Require by offset to be zero.

Users of delinearization assume that the the offset into the array element is zero. In most cases it will indeed be zero, but if it is not, the delinearization has to fail since it violates that assumption without the API even allowing to signal to the caller that the by offset is non-zero.

This bug caused Polly to miscompile blender (526.blender_r from SPEC CPU 2017) in -polly-process-unprofitable mode. The SCEV expression incorrectly delinearized has been reduced in the test case byte_offset.ll. The dropped offset into the array element of size 4 (a float) is ((sext i32 %mul7.i4534 to i64) + {(sext i32 %i1 to i64),+,((sext i32 (1 + ((1 + %shl.i.i) * (1 + %shl.i.i)) + %shl.i.i) to i64) * (sext i32 %i1 to i64))}<%for.body703>). This significant component was just dropped, and the wrong pointer was computed when regenerating code from the remaining delinearized subscripts. This occurred during blender's subsurface scattering implementation. As a result, blender's rendering diverged from the reference image.

Patch D108885 would also fix the API.

Reviewed By: bmahjour

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

2 years ago[runtimes] Allow overriding where CMake installs RUNTIME type libraries (DLLs)
Martin Storsjö [Wed, 11 Aug 2021 10:44:06 +0000 (13:44 +0300)]
[runtimes] Allow overriding where CMake installs RUNTIME type libraries (DLLs)

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

2 years ago[runtimes] Set more paths when building runtimes standalone
Martin Storsjö [Wed, 11 Aug 2021 11:14:31 +0000 (14:14 +0300)]
[runtimes] Set more paths when building runtimes standalone

These paths are needed when building with per-target runtime directories.

(It's possible to fix this by manually setting these when invoking
cmake, but one isn't supposed to need to do that.)

Also set LLVM_TOOLS_BINARY_DIR while touching this area (as it's
also unset in this case) even if it isn't specifically needed by the
per-target runtime configuration.

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

2 years agoLog to the right stream in DwarfTransformer::handleDie().
Greg Clayton [Tue, 7 Sep 2021 23:08:22 +0000 (16:08 -0700)]
Log to the right stream in DwarfTransformer::handleDie().

Since we might end up using multiple threads when logging information in the DWARFTransformer, the handleDie() method must use the supplied stream named "OS" when logging warnings and errors. When we use multiple threads, we log to a thread specific stream buffer and then use a mutex to ensure our output doesn't overlap when we emit warnings and errors after a thread is done.

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

2 years ago[openmp] Re-enable test from D109057, now with windows path aware regex
Jon Chesterfield [Wed, 8 Sep 2021 19:54:40 +0000 (20:54 +0100)]
[openmp] Re-enable test from D109057, now with windows path aware regex

2 years ago[lldb] Make sure there's a value for the key before dereferencing.
Jonas Devlieghere [Wed, 8 Sep 2021 20:44:24 +0000 (13:44 -0700)]
[lldb] Make sure there's a value for the key before dereferencing.

Make sure there's a value for the shared_cache_base_address key exists
in the dictionary before trying to dereference the value.

rdar://76894476

2 years ago[LAA] Remove unused OrigPtr from replaceSymbolicStrideSCEV (NFC).
Florian Hahn [Wed, 8 Sep 2021 18:49:32 +0000 (20:49 +0200)]
[LAA] Remove unused OrigPtr from replaceSymbolicStrideSCEV (NFC).

The OrigPtr argument is not used in tree.

2 years ago[Canonicalize] Don't call isBeforeInBlock in OperationFolder::tryToFold.
Chris Lattner [Wed, 8 Sep 2021 17:28:52 +0000 (10:28 -0700)]
[Canonicalize] Don't call isBeforeInBlock in OperationFolder::tryToFold.

This patch (e4635e6328c8) fixed a bug where a newly generated/reused
constant wouldn't dominate a folded operation.  It did so by calling
isBeforeInBlock to move the constant around on demand.  This introduced
a significant compile time regression, because "isBeforeInBlock" is
O(n) in the size of a block the first time it is called, and the cache
is invalidated any time canonicalize changes something big in the block.

This fixes LLVM PR51738 and this CIRCT issue:
https://github.com/llvm/circt/issues/1700

This does affect the order of constants left in the top of a block,
I staged in the testsuite changes in rG42431b8207a5.

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

2 years ago[Polly] Compile fix after Delinearization move.
Michael Kruse [Wed, 8 Sep 2021 20:28:43 +0000 (15:28 -0500)]
[Polly] Compile fix after Delinearization move.

by commit 585c594d749a2a88150b63804587af85abdabeaa

2 years ago[SROA] Support opaque pointers
Nikita Popov [Fri, 3 Sep 2021 20:26:47 +0000 (22:26 +0200)]
[SROA] Support opaque pointers

Make the following changes in order to support opaque pointers in SROA:

 * Generate i8 GEPs for opaque pointers.
 * Explicitly enforce that promotable allocas only have stores of
   the alloca type -- previously this was implicitly enforced.
 * Replace a check for pointer element type with load/store type.

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

2 years ago[AIX] Check for typedef properly when getting preferred type align
Steven Wan [Wed, 8 Sep 2021 20:21:39 +0000 (16:21 -0400)]
[AIX] Check for typedef properly when getting preferred type align

The current check for typedef is naive and doesn't deal with any convoluted cases. This patch makes use of the new 'AlignRequirement' enum field from 'TypeInfo' to determine whether or not this is an 'aligned' attribute on a typedef.

Reviewed By: rjmccall

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

2 years ago[MemorySSA] Support invariant.group metadata
Arthur Eubanks [Tue, 31 Aug 2021 19:24:50 +0000 (12:24 -0700)]
[MemorySSA] Support invariant.group metadata

The implementation is mostly copied from MemDepAnalysis. We want to look
at all loads and stores to the same pointer operand. Bitcasts and zero
GEPs of a pointer are considered the same pointer value. We choose the
most dominating instruction.

Since updating MemorySSA with invariant.group is non-trivial, for now
handling of invariant.group is not cached in any way, so it's part of
the walker. The number of loads/stores with invariant.group is small for
now anyway. We can revisit if this actually noticeably affects compile
times.

To avoid invariant.group affecting optimized uses, we need to have
optimizeUsesInBlock() not use invariant.group in any way.

Co-authored-by: Piotr Padlewski <prazek@google.com>
Reviewed By: asbirlea, nikic, Prazek

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

2 years ago[libc++] Revert OpenBSD-related changes to the documentation
Louis Dionne [Tue, 7 Sep 2021 16:55:48 +0000 (12:55 -0400)]
[libc++] Revert OpenBSD-related changes to the documentation

This commit partially reverts 0954e2b2d038 and 3fa4cff97480, which
make changes to the libc++ documentation implifying that OpenBSD is
supported. Neither of these changes have been reviewed AFAICT, so
I'm reverting as a matter of enforcing:

1. That changes get reviewed before being committed
2. That we have a discussion and a support plan for supporting
   OpenBSD officially in libc++

Please note that I would be thrilled to support OpenBSD officially in
libc++, however doing so requires more than adding a note in the docs.
In particular, please make sure you read the note in [1] about setting
up CI testing for OpenBSD.

[1]: https://libcxx.llvm.org/#platform-and-compiler-support

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

2 years agoMove delinearization logic out of SCEV [NFC]
Philip Reames [Wed, 8 Sep 2021 19:01:19 +0000 (12:01 -0700)]
Move delinearization logic out of SCEV [NFC]

None of this logic has anything to do with SCEV's internals, it just uses the existing public APIs.  As a result, we can move the code from ScalarEvolution.cpp/hpp to Delinearization.cpp/hpp with only minor changes.

This was discussed in advance on today's loop opt call.  It turned out to be easy as hoped.

2 years ago[ConstantHoisting] Support opaque pointers
Nikita Popov [Wed, 8 Sep 2021 19:22:28 +0000 (21:22 +0200)]
[ConstantHoisting] Support opaque pointers

Directly use i8 for GEP, rather than fetching element type of i8*.

2 years ago[libc++][NFC] Rename _EnableIf to __enable_if_t for consistency
Louis Dionne [Wed, 8 Sep 2021 13:14:43 +0000 (09:14 -0400)]
[libc++][NFC] Rename _EnableIf to __enable_if_t for consistency

In other places in the code, we use lowercase spelling for things that
are not available in prior standards.

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

2 years ago[ObjC][ARC] Use the addresses of the ARC runtime functions instead of
Akira Hatanaka [Wed, 8 Sep 2021 18:58:03 +0000 (11:58 -0700)]
[ObjC][ARC] Use the addresses of the ARC runtime functions instead of
integer 0/1 for the operand of bundle "clang.arc.attachedcall"

https://reviews.llvm.org/D102996 changes the operand of bundle
"clang.arc.attachedcall". This patch makes changes to llvm that are
needed to handle the new IR.

This should make it easier to understand what the IR is doing and also
simplify some of the passes as they no longer have to translate the
integer values to the runtime functions.

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

2 years ago[ObjC][ARC] Use the addresses of the ARC runtime functions instead of
Akira Hatanaka [Wed, 8 Sep 2021 18:56:22 +0000 (11:56 -0700)]
[ObjC][ARC] Use the addresses of the ARC runtime functions instead of
integer 0/1 for the operand of bundle "clang.arc.attachedcall"

This should make it easier to understand what the IR is doing and also
simplify some of the passes as they no longer have to translate the
integer values to the runtime functions.

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

2 years ago[libFuzzer] Add missing argument to CrashResistantMerge.
Matt Morehouse [Wed, 8 Sep 2021 18:46:37 +0000 (11:46 -0700)]
[libFuzzer] Add missing argument to CrashResistantMerge.

Fixes a build error caused by a bad merge conflict resolution for
https://reviews.llvm.org/D105084.

2 years ago[compiler-rt][fuzzer] Do not link in libc++ in tests and disable exceptions
Leonard Chan [Wed, 8 Sep 2021 18:45:52 +0000 (11:45 -0700)]
[compiler-rt][fuzzer] Do not link in libc++ in tests and disable exceptions

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

2 years ago[compiler-rt] Use COMPILER_RT_TEST_CXX_COMPILER for linking compiler-rt tests
Leonard Chan [Wed, 8 Sep 2021 18:44:00 +0000 (11:44 -0700)]
[compiler-rt] Use COMPILER_RT_TEST_CXX_COMPILER for linking compiler-rt tests

Before, COMPILER_RT_TEST_COMPILER was used which pointed to a C compiler. While
it is incorrect to assume either of these is the default compiler, using the
C++ one allows for linking cpp tests.

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

2 years ago[IROutliner] Using canonical values to find corresponding values. (NFC)
Andrew Litteken [Mon, 23 Aug 2021 18:56:10 +0000 (11:56 -0700)]
[IROutliner] Using canonical values to find corresponding values. (NFC)

D104143 introduced canonical value numbering between regions, which allows for the easy identification of items across a region, eliminating the need in the outliner to create parallel lists of instructions for each region, and replace output values in a less convoluted way.

Additionally, in a future commit, the output values will not necessarily be recorded values from the region itself, it could be a combination value where the actual value being output is a PHINode instead.  This new method allows us to handle the replacement of the output value to the stored value with the corresponding item in the same place for both normal output values, and PHINode outputs instead of handling the different types of outputs in different locations.

Reviewers: paquette, roelofs

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

2 years ago[OpenMP] Do not SPMDize generic regions with no parallel
Joseph Huber [Wed, 8 Sep 2021 13:52:28 +0000 (09:52 -0400)]
[OpenMP] Do not SPMDize generic regions with no parallel

This patch changes SPMDization to not trigger for regions with no
parallelism. Otherwise, this will introduce unnecessary barriers that
will slow the single-threaded region down.

Reviewed By: jdoerfert

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

2 years ago[compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's...
Leonard Chan [Wed, 8 Sep 2021 18:32:11 +0000 (11:32 -0700)]
[compiler-rt][Fuchsia] Support building + running compiler-rt tests on fuchsia's host toolchain

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

2 years ago[lldb] Delete IRExecutionUnit::SearchSpec
Alex Langford [Tue, 7 Sep 2021 18:42:34 +0000 (11:42 -0700)]
[lldb] Delete IRExecutionUnit::SearchSpec

IRExecutionUnit::SearchSpec is a struct that encapsulates information
needed to look for a symbol. Specifically, it is comprised of a name
represented with a ConstString and a FunctionNameType mask.
Because the mask is unused (effectively always set to
eFunctionNameTypeFull), we can remove the mask and replace all uses with
eFunctionNameTypeFull.  After doing that, SearchSpec is effectively a
wrapper around a ConstString.

As an aside, SearchSpec is similar in purpose to Module::LookupInfo. I
briefly considered replacing uses of SearchSpec with LookupInfo, but
the current code only cares about symbol names (treating them as
eFunctionNameTypeFull). This code does care about language type, so
LookupInfo may be appropriate for IRExecutionUnit in the future.

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

2 years ago[GlobalISel] Use a typedef for builder function matchinfos for brevity. NFC.
Amara Emerson [Wed, 8 Sep 2021 18:24:44 +0000 (11:24 -0700)]
[GlobalISel] Use a typedef for builder function matchinfos for brevity. NFC.

2 years ago[ISEL][BitTestBlock] omit additional bit test when default destination is unreachable
Nick Desaulniers [Wed, 8 Sep 2021 17:44:16 +0000 (10:44 -0700)]
[ISEL][BitTestBlock] omit additional bit test when default destination is unreachable

Otherwise we end up with an extra conditional jump, following by an
unconditional jump off the end of a function. ie.

  bb.0:
    BT32rr ..
    JCC_1 %bb.4 ...
  bb.1:
    BT32rr ..
    JCC_1 %bb.2 ...
    JMP_1 %bb.3
  bb.2:
    ...
  bb.3.unreachable:
  bb.4:
    ...

  Should be equivalent to:
  bb.0:
    BT32rr ..
    JCC_1 %bb.4 ...
    JMP_1 %bb.2
  bb.1:
  bb.2:
    ...
  bb.3.unreachable:
  bb.4:
    ...

This can occur since at the higher level IR (Instruction) SwitchInsts
are required to have BBs for default destinations, even when it can be
deduced that such BBs are unreachable.

For most programs, this isn't an issue, just wasted instructions since the
unreachable has been statically proven.

The x86_64 Linux kernel when built with CONFIG_LTO_CLANG_THIN=y fails to
boot though once D106056 is re-applied.  D106056 makes it more likely
that correlation-propagation (CVP) can deduce that the default case of
SwitchInsts are unreachable. The x86_64 kernel uses a binary post
processor called objtool, which emits this warning:

vmlinux.o: warning: objtool: cfg80211_edmg_chandef_valid()+0x169: can't
find jump dest instruction at .text.cfg80211_edmg_chandef_valid+0x17b

I haven't debugged precisely why this causes a failure at boot time, but
fixing this very obvious jump off the end of the function fixes the
warning and boot problem.

Link: https://bugs.llvm.org/show_bug.cgi?id=50080
Fixes: https://github.com/ClangBuiltLinux/linux/issues/679
Fixes: https://github.com/ClangBuiltLinux/linux/issues/1440

Reviewed By: hans

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

2 years ago[asan] Fixed the jump to use the 4 byte offset version.
Kirill Stoimenov [Wed, 8 Sep 2021 17:04:43 +0000 (17:04 +0000)]
[asan] Fixed the jump to use the 4 byte offset version.

This should have been the 4 byte version in the first place. Unfortunatelly there is no easy way to add a test as both the 1 byte and 4 byte version are printed as 'jmp' in the assembly code.

Reviewed By: kda

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

2 years ago[WebAssembly] Change WebAssemblyMCLowerPrePass to ModulePass
Wouter van Oortmerssen [Thu, 2 Sep 2021 22:18:58 +0000 (15:18 -0700)]
[WebAssembly] Change WebAssemblyMCLowerPrePass to ModulePass

It was a FunctionPass before, which subverted its purpose to collect ALL symbols before MCLowering, depending on how LLVM schedules function passes.
Fixes https://bugs.llvm.org/show_bug.cgi?id=51555

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

2 years ago[HIP] Warn capture this pointer in device lambda
Yaxun (Sam) Liu [Fri, 20 Aug 2021 22:03:56 +0000 (18:03 -0400)]
[HIP] Warn capture this pointer in device lambda

HIP currently diagnose capture of this pointer in device lambda in
host member functions. If this pointer points to managed memory,
it can be used in both device and host functions. Under this
situation, capturing this pointer in device lambda functions
in host member functions is valid usage. Change the diagnostic
about capturing this pointer to warning.

Reviewed by: Artem Belevich

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

2 years ago[libc++] Comma-operator-proof a lot of algorithm/container code.
Arthur O'Dwyer [Wed, 8 Sep 2021 01:35:37 +0000 (21:35 -0400)]
[libc++] Comma-operator-proof a lot of algorithm/container code.

Detected by evil-izing the widely used `MoveOnly` testing type.
I had to patch some tests that were themselves using its comma operator,
but I think that's a worthwhile cost in order to catch more places
in our headers that needed comma-proofing.

The trick here is that even `++ptr, SomeClass()` can find a comma operator
by ADL, if `ptr` is of type `Evil*`. (A comma between two operands
of non-class-or-enum type is always treated as the built-in
comma, without ADL. But if either operand is class-or-enum, then
ADL happens for _both_ operands' types.)

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

2 years ago[RISCV] Pre-commit tests for D109394. NFC
Craig Topper [Wed, 8 Sep 2021 17:25:32 +0000 (10:25 -0700)]
[RISCV] Pre-commit tests for D109394. NFC

2 years ago[tests] Make testsuite more resilient to "order of constant" changes. NFC.
Chris Lattner [Wed, 8 Sep 2021 17:09:42 +0000 (10:09 -0700)]
[tests] Make testsuite more resilient to "order of constant" changes.  NFC.

2 years agoSupport: hoist `extern template` declarations
Saleem Abdulrasool [Wed, 8 Sep 2021 16:20:43 +0000 (09:20 -0700)]
Support: hoist `extern template` declarations

Precede the `extern template` declaration prior to use.  This is helpful
as it prevents the compiler from having to worry about instantiating the
template as it will be provided for.  This is particularly important for
Windows where `__declspec(dllexport)` will traverses inheritance clauses
resulting in an incorrect application of dll interface to declarations.

2 years ago[GlobalISel] Add G_ROTL and G_ROTR to right_identity_zero
Jessica Paquette [Sat, 4 Sep 2021 00:55:13 +0000 (17:55 -0700)]
[GlobalISel] Add G_ROTL and G_ROTR to right_identity_zero

Similar to `DAGCombiner::visitRotate`.

This makes `rotl_bitwidth_cst` in postlegalizercombiner-rotate.mir reduce down
to a COPY. Modify the checkline to make sure that only rotate_out_of_range
runs there.

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

2 years ago[RISCV] Remove unused tablegen template parameters. NFC
Craig Topper [Wed, 8 Sep 2021 17:01:29 +0000 (10:01 -0700)]
[RISCV] Remove unused tablegen template parameters. NFC

Identified in D109359

2 years agoAdd sanity check in MLIR ODS to catch case where two operands have the same name
Mehdi Amini [Wed, 8 Sep 2021 16:50:27 +0000 (16:50 +0000)]
Add sanity check in MLIR ODS to catch case where two operands have the same name

This is making a tablegen crash into a more friendly error.

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

2 years agoFix `asan/TestCases/Darwin/scrible.cpp` to work on platforms where `long` is not...
Dan Liew [Wed, 8 Sep 2021 01:09:38 +0000 (18:09 -0700)]
Fix `asan/TestCases/Darwin/scrible.cpp` to work on platforms where `long` is not 64-bits.

Previously the test was failing on platforms where `long` was less than
64-bits wide (e.g. older WatchOS simulators and arm64_32) because the
`padding` field was too small.

The test currently relies on the `my_object->isa` being scribbled or
left unmodified after `my_object` is freed. However, this was not the
case because the `isa` pointer intersected with
`ChunkHeader::free_context_id`.  `free_context_id` starts at the
beginning of user memory but it only initialized once the memory is
freed. This caused the `isa` pointer to change after it was freed
leading to the test crashing.

To fix this the `padding` field has been made explicitly 64-bits wide
(same size as `ChunkHeader::free_context_id`).

rdar://75806757

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

2 years ago[ISEL][BitTestBlock] pre-commit test for D109103
Nick Desaulniers [Wed, 8 Sep 2021 16:44:17 +0000 (09:44 -0700)]
[ISEL][BitTestBlock] pre-commit test for D109103

Upload a test that shows ISEL taking a SwitchInst that has an
unreachable BB for a default target being lowered to an unconditional
jump off the end of a function.

Link: https://bugs.llvm.org/show_bug.cgi?id=50080
Link: https://github.com/ClangBuiltLinux/linux/issues/679
Link: https://github.com/ClangBuiltLinux/linux/issues/1440
Reviewed By: craig.topper, hans

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

2 years ago[RISCV] Use V0 instead of VMV0: for mask vectors in isel patterns.
Craig Topper [Wed, 8 Sep 2021 16:35:02 +0000 (09:35 -0700)]
[RISCV] Use V0 instead of VMV0: for mask vectors in isel patterns.

This is consistent with the RVV intrinsic patterns. This has been
shown to prevent some "ran out of registers" errors in our internal
testing.

Unfortunately, there are some regressions on LMUL=8 tests in here.
I think the lack of registers with LMUL=8 just makes it very hard
to schedule correctly.

Reviewed By: frasercrmck

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

2 years ago[IROutliner] Remove unused variable. NFC.
Benjamin Kramer [Wed, 8 Sep 2021 16:33:21 +0000 (18:33 +0200)]
[IROutliner] Remove unused variable. NFC.

2 years ago[X86] X86DAGToDAGISel::matchBitExtract(): support 'num high bits to clear' pattern
Roman Lebedev [Wed, 8 Sep 2021 16:16:55 +0000 (19:16 +0300)]
[X86] X86DAGToDAGISel::matchBitExtract(): support 'num high bits to clear' pattern

Currently, we only deal with the case where we can match
the number of low bits to be kept, i.e.:
```
x & ((1 << y) - 1)
```
will extract low `y` bits of `x`.

But what will
```
x & (-1 >> y)
```
do?

Logically, it will extract `bitwidth(x) - y` low bits, i.e.:
```
x & ~(-1 << (bitwidth(x)-y))
```
... except we can't do such a transformation in IR in general,
because if we wanted to extract all the bits `(-1 >> 0)` is fine,
but `-1 << bitwidth(x)` would be `poison`: https://alive2.llvm.org/ce/z/BKJZfw,

Yet, here with BMI's BEXTR and BMI2's BZHI we don't have any such problems with edge-cases.
So what we can do is: https://alive2.llvm.org/ce/z/gm5M2B

As briefly discussed with @craig.topper, this appears to be not worse than what we'd end up with currently (a pair of shifts):
* https://godbolt.org/z/nsPb8bejs (direct data dependency, sequential execution)
* https://godbolt.org/z/7bj3zeh1d (no direct data dependency, parallel execution)

Reviewed By: craig.topper

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

2 years ago[RISCV] Add an GPR def to the Zvlseg SPILL/RELOAD pseudos
Craig Topper [Wed, 8 Sep 2021 16:14:56 +0000 (09:14 -0700)]
[RISCV] Add an GPR def to the Zvlseg SPILL/RELOAD pseudos

The expansion of these pseudos creates ADD instructions. Those
ADDs modify a GPR so that it is no longer contains the same value
as the input base pointer. Therefore, I believe we should have a
GPR as a Def on these instructions and expansion should get the
destination register for the ADDs from that operand.

At least in our tests here this works out so that register
scavenging picks the same register as the base pointer.

Reviewed By: frasercrmck

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

2 years agoRedistribute energy for Corpus
gtt1995 [Wed, 8 Sep 2021 13:18:19 +0000 (06:18 -0700)]
Redistribute energy for Corpus

I found that the initial corpus allocation of fork mode has certain defects.
I designed a new initial corpus allocation strategy based on size grouping.
This method can give more energy to the small seeds in the corpus and
increase the throughput of the test.

Fuzzbench data (glibfuzzer is -fork_corpus_groups=1):
https://www.fuzzbench.com/reports/experimental/2021-08-05-parallel/index.html

Reviewed By: morehouse

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

2 years agoAnalysis: move declaration of variables to a more suitable location
Saleem Abdulrasool [Tue, 7 Sep 2021 21:37:53 +0000 (14:37 -0700)]
Analysis: move declaration of variables to a more suitable location

This moves 2 variable declarations from `llvm/Support/Debug.h` to a more
appropriate home in the headers for `LLVMAnalysis`.  These variables are
defined in `LLVMAnalysis` rather than in `LLVMSupport` and although they
control debugging behavior, the declarations being colocated in the same
library's headers is both easier to locate and aids correctly describing
the library's interfaces.

Reviewed By: rnk, mehdi_amini, aeubanks

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

2 years ago[llvm-objcopy][NFC] Refactor CopyConfig structure - categorize options.
Alexey Lapshin [Tue, 7 Sep 2021 18:13:28 +0000 (21:13 +0300)]
[llvm-objcopy][NFC] Refactor CopyConfig structure - categorize options.

This patch continues refactoring done by D99055. It puts format specific
options into the correponding CopyConfig structures.

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

2 years ago[IROutliner] Adding supports for multiple exits
Andrew Litteken [Wed, 28 Jul 2021 16:22:35 +0000 (09:22 -0700)]
[IROutliner] Adding supports for multiple exits

When we start outlining across branches, there is the possibility that we will have two different blocks with different output locations, or a single branch that goes to two blocks outside of the region that is being outlined. While the CodeExtractor provides most of the mechanisms by using the return value of the extracted function as the input to a switch statement to correctly branch to the correct location, we need special handling for different output schemas to each location.

This is done by repeating the existing storing scheme for each different exit block. We have a map from the return values used, to the basic block that is used to store the outputs for that particular exit block within the outlined function. Then if needed, we create a switch statement for each return block to branch to the correct set of stored outputs.

Reviewers: paquette

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

2 years ago[IR] Construct SmallVector with iterator ranges (NFC)
Kazu Hirata [Wed, 8 Sep 2021 15:54:15 +0000 (08:54 -0700)]
[IR] Construct SmallVector with iterator ranges (NFC)

Note that arg_operands has been deprecated in favor of args.

2 years agoIR: move the declaration of `VerifyDomInfo` (NFC)
Saleem Abdulrasool [Tue, 7 Sep 2021 21:28:05 +0000 (14:28 -0700)]
IR: move the declaration of `VerifyDomInfo` (NFC)

This moves the declaration of `VerifyDomInfo` into
`llvm/IR/Dominators.h` from `llvm/Support/Debug.h`.  Although this is a
debugging utility, the definition of the symbol is in LLVMIR, not in
LLVMSupport.  This moves the declaration to the containing modules'
header.

Reviewed By: rnk, mehdhi_amini

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

2 years ago[lldb] Remove unused GDBRemoteCommunicationClient::SendAttach function
David Spickett [Wed, 8 Sep 2021 08:55:56 +0000 (08:55 +0000)]
[lldb] Remove unused GDBRemoteCommunicationClient::SendAttach function

Reviewed By: labath

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

2 years ago[OpenMP][NFC] Added comment on OpenMP 5.0 task affinity pilot implementation
AndreyChurbanov [Wed, 8 Sep 2021 15:12:31 +0000 (18:12 +0300)]
[OpenMP][NFC] Added comment on OpenMP 5.0 task affinity pilot implementation

2 years ago[MLIR] FlatAffineConstraints: Refactored computation of explicit representation for...
Kunwar Shaanjeet Singh Grover [Wed, 8 Sep 2021 14:52:01 +0000 (20:22 +0530)]
[MLIR] FlatAffineConstraints: Refactored computation of explicit representation for identifiers

This patch refactors the existing implementation of computing an explicit
representation of an identifier as a floordiv in terms of other identifiers and
exposes this computation as a public function.

The computation of this representation is required to support local identifiers
in PresburgerSet subtract, complement and isEqual.

Reviewed By: bondhugula, arjunp

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

2 years ago[libc] Fix running benchmarks under msan/asan
Guillaume Chatelet [Wed, 8 Sep 2021 14:43:48 +0000 (14:43 +0000)]
[libc] Fix running benchmarks under msan/asan

asan/msan intercepts `aligned_malloc` and misbehave when the requested
alignment is greater than 512.
https://github.com/llvm/llvm-project/blob/b041b613e6fff713fc9ad6dbc73024286fb2fc93/compiler-rt/lib/asan/asan_allocator.cpp#L430-L431

2 years ago[InstCombine] add test for zext with 'or' op; NFC
Sanjay Patel [Wed, 8 Sep 2021 13:40:25 +0000 (09:40 -0400)]
[InstCombine] add test for zext with 'or' op; NFC

2 years ago[InstCombine] remove unnecessary instructions from test; NFC
Sanjay Patel [Wed, 8 Sep 2021 13:33:30 +0000 (09:33 -0400)]
[InstCombine] remove unnecessary instructions from test; NFC

2 years ago[OpenMP] libomp: runtime part of omp_all_memory task dependence implementation.
AndreyChurbanov [Wed, 8 Sep 2021 13:55:32 +0000 (16:55 +0300)]
[OpenMP] libomp: runtime part of omp_all_memory task dependence implementation.

New omp_all_memory task dependence type is implemented.
Library recognizes the new type via either
(dependence_address == NULL && dependence_flag == 0x80)
or
(dependence_address == SIZE_MAX).
A task with new dependence type depends on each preceding task
with any dependence type (kind of a dependence barrier).

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

2 years ago[lldb] [Commands] Remove 'append' from 'platform file open' mode
Michał Górny [Fri, 6 Aug 2021 19:32:41 +0000 (21:32 +0200)]
[lldb] [Commands] Remove 'append' from 'platform file open' mode

Remove File::eOpenOptionAppend from the mode used by 'platform file
open' command.  According to POSIX, O_APPEND causes all successive
writes to be done at the end of the file.  This effectively makes
the offset argument to 'platform file write' meaningless.

Furthermore, apparently O_APPEND is not implemented reliably everywhere.
The Linux manpage for pwrite(2) suggests that Linux does respect
O_APPEND there while according to POSIX it should not, so the actual
behavior would be dependent on how the vFile:pwrite packet is
implemented on the server.

Ideally, the mode used for opening flags would be provided via options.
However, changing the default mode seems to be a reasonable intermediate
solution.

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

2 years ago[libc++] Use enable_if_t instead of _EnableIf
Louis Dionne [Tue, 17 Aug 2021 16:26:09 +0000 (12:26 -0400)]
[libc++] Use enable_if_t instead of _EnableIf

I just ran into a compiler error involving __bind_back and some overloads
that were being disabled with _EnableIf. I noticed that the error message
was quite bad and did not mention the reason for the overload being
excluded. Specifically, the error looked like this:

     candidate template ignored: substitution failure [with _Args =
     <ContiguousView>]: no member named '_EnableIfImpl' in 'std::_MetaBase<false>'

Instead, when using enable_if or enable_if_t, the compiler is clever and
can produce better diagnostics, like so:

     candidate template ignored: requirement 'is_invocable_v<
          std::__bind_back_op<1, std::integer_sequence<unsigned long, 0>>,
          std::ranges::views::__transform::__fn &, std::tuple<PlusOne> &,
          ContiguousView>' was not satisfied [with _Args = <ContiguousView>]

Basically, it tries to do a poor man's implementation of concepts, which
is already a lot better than simply complaining about substitution failure.

Hence, this commit uses enable_if_t instead of _EnableIf whenever
possible. That is both more straightforward than using the internal
helper, and also leads to better error messages in those cases.

I understand the motivation for _EnableIf's implementation was to improve
compile-time performance, however I believe striving to improve error
messages is even more important for our QOI, hence this patch. Furthermore,
it is unclear that _EnableIf actually improved compile-time performance
in any noticeable way (see discussion in the review for details).

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

2 years ago[MLIR] Add loop coalesce utility for affine.for
Arnab Dutta [Wed, 8 Sep 2021 12:19:48 +0000 (17:49 +0530)]
[MLIR] Add loop coalesce utility for affine.for

Add loop coalesce utility for affine.for. This expects loops to have
been normalized a-priori. This works for both constant as well non
constant upper bounds having single/multiple result upper bound affine
map.

With contributions from Arnab Dutta and Uday Bondhugula.

Reviewed By: bondhugula, ayzhuang

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

2 years ago[MC] Add Subtarget for MAsmParser call to emitCodeAlignment
Peter Smith [Wed, 8 Sep 2021 09:33:52 +0000 (10:33 +0100)]
[MC] Add Subtarget for MAsmParser call to emitCodeAlignment

The call to emitCodeAlignment was missing a STI which is required
after D45962.

emitCodeAlignment has a default parameter of 0 for MaxBytesToEmit.
Explicitly passing 0 here was interpreted as as nullptr for the STI.
This could possibly be avoided by taking STI as a const reference in
emitCodeAlignment.

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

2 years ago[X86] Add AVX2 test coverage to combine-concatvectors.ll
Simon Pilgrim [Wed, 8 Sep 2021 12:26:08 +0000 (13:26 +0100)]
[X86] Add AVX2 test coverage to combine-concatvectors.ll

This will be useful as part of D109348

2 years ago[FuncSpec] Fix typo in option description. NFC.
Sjoerd Meijer [Wed, 8 Sep 2021 11:53:05 +0000 (12:53 +0100)]
[FuncSpec] Fix typo in option description. NFC.

2 years ago[DAG] Fix GT -> GE condition when creating SetCC
David Green [Wed, 8 Sep 2021 11:41:51 +0000 (12:41 +0100)]
[DAG] Fix GT -> GE condition when creating SetCC

79845ed6dfc6511f99 folded some setcc(ashr) conditions to setcc, but got
the condition for NE incorrect, using GT where it should be using GE.

2 years ago[FuncSpec] Fix test case: only run funcspec and not any other passes. NFC.
Sjoerd Meijer [Wed, 8 Sep 2021 10:24:58 +0000 (11:24 +0100)]
[FuncSpec] Fix test case: only run funcspec and not any other passes. NFC.

2 years ago[LiveDebugValues] Handle spills of indirect debug values correctly
Evgeny Leviant [Wed, 8 Sep 2021 11:06:08 +0000 (14:06 +0300)]
[LiveDebugValues] Handle spills of indirect debug values correctly

When handling register spill for indirect debug value LiveDebugValues pass doesn't add
DW_OP_deref operator which may in some cases cause debugger to return value address, instead
of value while machine register holding that address is spilled.

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

2 years ago[clang-offload-bundler] Make Bundle Entry ID backward compatible
Saiyedul Islam [Mon, 26 Jul 2021 16:39:41 +0000 (22:09 +0530)]
[clang-offload-bundler] Make Bundle Entry ID backward compatible

Earlier BundleEntryID used to be <OffloadKind>-<Triple>-<GPUArch>.
This used to work because the clang-offload-bundler didn't need
GPUArch explicitly for any bundling/unbundling action. With
unbundleArchive it needs GPUArch to ensure compatibility between
device specific code objects. D93525 enforced triples to have
separators for all 4 components irrespective of number of
components, like "amdgcn-amd-amdhsa--". It was required to
to correctly parse a possible 4th environment component or a GPU.
But, this condition is breaking backward compatibility with
archive libraries compiled with compilers older than D93525.

This patch allows triples to have any number of components with
and without extra separator for empty environment field. Thus,
both the following bundle entry IDs are same:
openmp-amdgcn-amd-amdhsa--gfx906
openmp-amdgcn-amd-amdhsa-gfx906

Reviewed By: yaxunl, grokos

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

2 years ago[MemCpyOpt] Fix a variety of scalable-type crashes
Fraser Cormack [Mon, 6 Sep 2021 15:56:12 +0000 (16:56 +0100)]
[MemCpyOpt] Fix a variety of scalable-type crashes

This patch fixes a variety of crashes resulting from the `MemCpyOptPass`
casting `TypeSize` to a constant integer, whether implicitly or
explicitly.

Since the `MemsetRanges` requires a constant size to work, all but one
of the fixes in this patch simply involve skipping the various
optimizations for scalable types as cleanly as possible.

The optimization of `byval` parameters, however, has been updated to
work on scalable types in theory. In practice, this optimization is only
valid when the length of the `memcpy` is known to be larger than the
scalable type size, which is currently never the case. This could
perhaps be done in the future using the `vscale_range` attribute.

Some implicit casts have been left as they were, under the knowledge
they are only called on aggregate types. These should never be
scalably-sized.

Reviewed By: nikic, tra

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

2 years ago[AArch64] Regenerate some test checks. NFC
David Green [Wed, 8 Sep 2021 10:08:32 +0000 (11:08 +0100)]
[AArch64] Regenerate some test checks. NFC

This patch just reruns the update_llc_test_checks script on the AArch64
tests claiming to be updated by the script, cleaning up the output.

2 years ago[lldb] Support "eflags" register name in generic reg fallback
Michał Górny [Mon, 23 Aug 2021 12:19:24 +0000 (14:19 +0200)]
[lldb] Support "eflags" register name in generic reg fallback

Enhance the generic register fallback code to support "eflags" register
name in addition to "rflags", as the former is used by gdbserver.  This
permits lldb-server to recognize the generic flags register when
interfacing with gdbserver-style target.xml (i.e. without generic=""
attributes), and therefore aligns ABI plugins' AugmentRegisterInfo()
between lldb-server and gdbserver.

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

2 years ago[LegalizeTypes][VP] Add promotion support for binary VP ops
Fraser Cormack [Wed, 18 Aug 2021 10:50:55 +0000 (11:50 +0100)]
[LegalizeTypes][VP] Add promotion support for binary VP ops

This patch extends the preliminary support for vector-predicated (VP)
operation legalization to include promotion of illegal integer vector
types.

Integer promotion of binary VP operations is relatively simple and
piggy-backs on the non-VP logic, but passing the two extra mask and VP
operands through to the promoted operation.

Tests have been added to the RISC-V target to cover the basic scenarios
for integer promotion for both fixed- and scalable-vector types.

Reviewed By: craig.topper

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

2 years ago[lldb] [gdb-server] Add tests for more vFile packets
Michał Górny [Tue, 10 Aug 2021 12:48:45 +0000 (14:48 +0200)]
[lldb] [gdb-server] Add tests for more vFile packets

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

2 years ago[lldb] [Commands] Fix reporting errors in 'platform file read/write'
Michał Górny [Fri, 6 Aug 2021 19:56:15 +0000 (21:56 +0200)]
[lldb] [Commands] Fix reporting errors in 'platform file read/write'

Fix 'platform file read' and 'platform file write' commands to correctly
detect erraneous return and report it as such.  Currently, errors were
implicitly printed as a return value of -1, and the commands were
assumed to be successful.

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