lldb.git
10 months ago[tests][OpenMPIRBuilder] Use EXPECT_EQ instead ASSERT_EQ.
Michael Kruse [Fri, 11 Dec 2020 17:45:35 +0000 (11:45 -0600)]
[tests][OpenMPIRBuilder] Use EXPECT_EQ instead ASSERT_EQ.

Test execution can continue even if previous cases failed.

10 months ago[BasicAA] Handle two unknown sizes for GEPs
Nikita Popov [Tue, 1 Dec 2020 17:06:37 +0000 (18:06 +0100)]
[BasicAA] Handle two unknown sizes for GEPs

If we have two unknown sizes and one GEP operand and one non-GEP
operand, then we currently simply return MayAlias. The comment says
we can't do anything useful ... but we can! We can still check that
the underlying objects are different (and do so for the GEP-GEP case).

To reduce the compile-time impact, this a) checks this early, before
doing the relatively expensive GEP decomposition that will not be
used and b) doesn't do the check if the other operand is a phi or
select. In that case, the phi/select will already recurse, so this
would just do two slightly different recursive walks that arrive at
the same roots.

Compile-time is still a bit of a mixed bag: https://llvm-compile-time-tracker.com/compare.php?from=624af932a808b363a888139beca49f57313d9a3b&to=845356e14adbe651a553ed11318ddb5e79a24bcd&stat=instructions
On average this is a small improvement, but sqlite with ThinLTO has
a 0.5% regression (lencod has a 1% improvement).

The BasicAA test case checks this by using two memsets with unknown
size. However, the more interesting case where this is useful is
the LoopVectorize test case, as analysis of accesses in loops tends
to always us unknown sizes.

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

10 months ago[PGO] Adjust -vp-counters-per-site under dynamic linking.
Hiroshi Yamauchi [Wed, 9 Dec 2020 23:04:55 +0000 (15:04 -0800)]
[PGO] Adjust -vp-counters-per-site under dynamic linking.

Addressing clang bootstrap under the dynamic linking mode running out of static
allocation of value profile nodes, reported in D81682.

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

10 months ago[OpenMPIRBuilder] Various changes required for tileLoops.
Michael Kruse [Fri, 11 Dec 2020 16:55:58 +0000 (10:55 -0600)]
[OpenMPIRBuilder] Various changes required for tileLoops.

Extract some changes not directly related to tileLoops out of D92974:
 * Refactor `createLoopSkeleton` out of `createCanonicalLoop`.
 * Introduce `ComputeIP` parameter to the `createCanonicalLoop` overload inserts instructions to compute the trip count. Specifying the location is necessary to make these instructions appear before the outermost loop of a loop nest that is tiled.
 * Introduce `Name` parameter to `createCanonicalLoop`. This can help better understanding the origin of values of basic blocks with many loops. The default value is "loop" instead of "for" which could be confused with the "for directive" (aka worksharing-loop) and does not apply to Fortran.
 * Remove `CanonicalLoopInfo::eraseFromParent` which is currently unused and untested and was added in anticipation to be used by `tileLoops`. `eraseFromParent` has shown to be insufficient when more than a single loop is involved and is replaced by `removeUnusedBlocksFromParent` in D92974.

Reviewed By: SouraVX

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

10 months ago[libc++] Use TARGET_FILE instead of TARGET_SONAME_FILE when generating ABI lists
Louis Dionne [Tue, 8 Dec 2020 17:15:44 +0000 (12:15 -0500)]
[libc++] Use TARGET_FILE instead of TARGET_SONAME_FILE when generating ABI lists

TARGET_SONAME_FILE isn't valid on Windows, and TARGET_FILE should achieve
the same results.

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

10 months ago[libc++] NFCI: Implement make_shared as allocate_shared with std::allocator
Louis Dionne [Wed, 9 Dec 2020 21:57:28 +0000 (16:57 -0500)]
[libc++] NFCI: Implement make_shared as allocate_shared with std::allocator

This simplifies the implementation, and it appears to be equivalent since
make_shared was allocating memory with std::allocator anyway.

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

10 months ago[MC][ELF] Accept abbreviated form with sh_flags and sh_entsize
Tobias Burnus [Fri, 11 Dec 2020 16:43:06 +0000 (16:43 +0000)]
[MC][ELF] Accept abbreviated form with sh_flags and sh_entsize

D73999 / commit 75af9da755721123e62b45cd0bc0c5e688a9722a
added for LLVM 11 a check that sh_flags and sh_entsize (and sh_type)
changes are an error, in line with GNU assembler.

However, GNU assembler accepts and GCC generates an abbreviated form:
while the first .section contains the flags and entsize, subsequent
sections simply contain the name without repeating entsize or flags.

Do likewise for better compatibility.

See https://bugs.llvm.org/show_bug.cgi?id=48201

Reviewed By: jhenderson, MaskRay

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

10 months agoRevert [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Fri, 11 Dec 2020 16:35:50 +0000 (17:35 +0100)]
Revert [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This reverts commit 8a4390dc4768fcd929a7231717980ccb28f124f7.

(The reland did not have the bugfix, just trying to get more details
from the buildbots)

10 months agoReland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC
Sam McCall [Fri, 11 Dec 2020 15:47:17 +0000 (16:47 +0100)]
Reland [clangd] Extract per-dir CDB cache to its own threadsafe class. NFC

This reverts commit de4f5519015cc97f28718d90cc6dac73c0a15161.

More debug output to try to pin down an impossible condition.

10 months ago[YAML] Use correct source location for unknown key errors.
Nathan James [Fri, 11 Dec 2020 16:34:06 +0000 (16:34 +0000)]
[YAML] Use correct source location for unknown key errors.

Currently unknown keys when inputting mapping traits have the location set to the Value.
Example:
```
YAML:1:14: error: unknown key 'UnknownKey'
{UnknownKey: SomeValue}
             ^~~~~~~~~
```
This is unhelpful for a user as it draws them to fix the wrong item.

Reviewed By: silvas

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

10 months ago[PowerPC] Remove duplicate layout
Jinsong Ji [Fri, 11 Dec 2020 15:47:42 +0000 (15:47 +0000)]
[PowerPC] Remove duplicate layout

10 months ago[mlir] Support inlining into affine operations
Alex Zinenko [Wed, 9 Dec 2020 08:51:15 +0000 (09:51 +0100)]
[mlir] Support inlining into affine operations

Introduce support for inlining into affine operations. This uses the generic
inline infrastructure and boils down to checking that, if applied, the inlining
doesn't violate the affine dimension/symbol value categorization. Given valid
IR, only the values that are valid dimensions/symbols thanks to being top-level
in their affine scope need special handling.

Reviewed By: rriddle

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

10 months ago[clangd] Use enumMember instead of enumConstant
Nathan James [Fri, 11 Dec 2020 14:46:12 +0000 (14:46 +0000)]
[clangd] Use enumMember instead of enumConstant

We should be using enumMember as thats defined in LSP, enumConstant is non standard so clients aren't likely to support it
Fixes https://github.com/clangd/clangd/issues/622n

Reviewed By: sammccall

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

10 months ago[DFSan] Add custom wrapper for recvmmsg.
Matt Morehouse [Fri, 11 Dec 2020 14:24:43 +0000 (06:24 -0800)]
[DFSan] Add custom wrapper for recvmmsg.

Uses the recvmsg wrapper logic in a loop.

Reviewed By: stephan.yichao.zhao

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

10 months ago[AMDGPU] Make use of emitRemovedIntrinsicError. NFC.
Jay Foad [Fri, 11 Dec 2020 14:02:14 +0000 (14:02 +0000)]
[AMDGPU] Make use of emitRemovedIntrinsicError. NFC.

Change-Id: I482bbf528255f2eacd3878ddfe7edb9a8f63d5c2

10 months ago[mlir][ArmNeon][RFC] Add a Neon dialect
Nicolas Vasilache [Fri, 11 Dec 2020 12:53:49 +0000 (12:53 +0000)]
[mlir][ArmNeon][RFC] Add a Neon dialect

This revision starts an Arm-specific ArmNeon dialect discussed in the [discourse RFC thread](https://llvm.discourse.group/t/rfc-vector-dialects-neon-and-sve/2284).

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

10 months ago[mlir] Expose target configuration for lowering to ROCDL.
Adrian Kuegel [Thu, 10 Dec 2020 13:02:06 +0000 (14:02 +0100)]
[mlir] Expose target configuration for lowering to ROCDL.

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

10 months agoAdd rsqrt lowering from standard to ROCDL.
Adrian Kuegel [Thu, 10 Dec 2020 09:47:53 +0000 (10:47 +0100)]
Add rsqrt lowering from standard to ROCDL.

Add a lowering for rsqrt from standard dialect to ROCDL.

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

10 months agoRemove references to the ast_type_traits namespace
Alexander Kornienko [Fri, 11 Dec 2020 01:26:21 +0000 (02:26 +0100)]
Remove references to the ast_type_traits namespace

Follow up to https://reviews.llvm.org/D92994

10 months ago[KernelAddressSanitizer] Fix globals exclusion for indirect aliases
Marco Elver [Fri, 11 Dec 2020 11:20:40 +0000 (12:20 +0100)]
[KernelAddressSanitizer] Fix globals exclusion for indirect aliases

GlobalAlias::getAliasee() may not always point directly to a
GlobalVariable. In such cases, try to find the canonical GlobalVariable
that the alias refers to.

Link: https://github.com/ClangBuiltLinux/linux/issues/1208
Reviewed By: dvyukov, nickdesaulniers

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

10 months ago[SelectionDAG] Implement SplitVecOp_INSERT_SUBVECTOR
Joe Ellis [Wed, 9 Dec 2020 10:06:52 +0000 (10:06 +0000)]
[SelectionDAG] Implement SplitVecOp_INSERT_SUBVECTOR

This function is needed for when it is necessary to split the subvector
operand of an llvm.experimental.vector.insert call. Splitting the
subvector operand means performing two insertions: one inserting the
lower part of the split subvector into the destination vector, and
another for inserting the upper part.

Through experimenting, it seems quite rare to need split the subvector
operand, but this is necessary to avoid assertion errors.

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

10 months ago[NFC][Test] Add a test to verify the instruction form we got from isel
QingShan Zhang [Fri, 11 Dec 2020 10:36:46 +0000 (10:36 +0000)]
[NFC][Test] Add a test to verify the instruction form we got from isel

10 months ago[NFC][Test] Format the PowerPC test for incoming patch
QingShan Zhang [Fri, 11 Dec 2020 09:50:59 +0000 (09:50 +0000)]
[NFC][Test] Format the PowerPC test for incoming patch

10 months ago[clangd] Reorder the class field to avoid -Wreorder-ctor warning, NFC.
Haojian Wu [Fri, 11 Dec 2020 09:45:50 +0000 (10:45 +0100)]
[clangd] Reorder the class field to avoid -Wreorder-ctor warning, NFC.

10 months agoFix build issue caused by 9b76160e53f67008ff21095098129a2949595a06
David Sherwood [Fri, 11 Dec 2020 09:43:13 +0000 (09:43 +0000)]
Fix build issue caused by 9b76160e53f67008ff21095098129a2949595a06

10 months ago[AST][RecoveryAST] Preserve type for member call expr if argments are not matched.
Haojian Wu [Sun, 29 Nov 2020 21:31:42 +0000 (22:31 +0100)]
[AST][RecoveryAST] Preserve type for member call expr if argments are not matched.

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

10 months ago[ARM] Make t2DoLoopStartTP a terminator
David Green [Fri, 11 Dec 2020 09:23:57 +0000 (09:23 +0000)]
[ARM] Make t2DoLoopStartTP a terminator

Although this was something that I was hoping we would not have to do,
this patch makes t2DoLoopStartTP a terminator in order to keep it at the
end of it's block, so not allowing extra MVE instruction between it and
the end. With t2DoLoopStartTP's also starting tail predication regions,
it also marks them as having side effects. The t2DoLoopStart is still
not a terminator, giving it the extra scheduling freedom that can be
helpful, but now that we have a TP version they can be treated
differently.

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

10 months ago[VE] Add vgt and vsc intrinsic instructions
Kazushi (Jam) Marukawa [Wed, 9 Dec 2020 16:20:40 +0000 (01:20 +0900)]
[VE] Add vgt and vsc intrinsic instructions

Add vgt and vsc intrinsic instructions and regression tests.

Reviewed By: simoll

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

10 months ago[gn build] Port 5663bf201f5
LLVM GN Syncbot [Fri, 11 Dec 2020 09:17:05 +0000 (09:17 +0000)]
[gn build] Port 5663bf201f5

10 months agoRevert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."
Haojian Wu [Fri, 11 Dec 2020 08:59:37 +0000 (09:59 +0100)]
Revert "[analyzer] NFC: Move path diagnostic consumer implementations to libAnalysis."

The patch introduced a cycle dependency:

clangAnalysis -> clangFrontend -> clangSema -> clangAnalysis

This reverts commit 00ffea77ad887b576e9db82d98c97a31fee172cb.
This reverts commit ea6641085d025ca0a5cef940465ef14d0ccace02.

10 months ago[gn build] Port 9b76160e53f
LLVM GN Syncbot [Fri, 11 Dec 2020 08:40:54 +0000 (08:40 +0000)]
[gn build] Port 9b76160e53f

10 months ago[Support] Introduce a new InstructionCost class
David Sherwood [Tue, 10 Nov 2020 11:09:20 +0000 (11:09 +0000)]
[Support] Introduce a new InstructionCost class

This is the first in a series of patches that attempts to migrate
existing cost instructions to return a new InstructionCost class
in place of a simple integer. This new class is intended to be
as light-weight and simple as possible, with a full range of
arithmetic and comparison operators that largely mirror the same
sets of operations on basic types, such as integers. The main
advantage to using an InstructionCost is that it can encode a
particular cost state in addition to a value. The initial
implementation only has two states - Normal and Invalid - but these
could be expanded over time if necessary. An invalid state can
be used to represent an unknown cost or an instruction that is
prohibitively expensive.

This patch adds the new class and changes the getInstructionCost
interface to return the new class. Other cost functions, such as
getUserCost, etc., will be migrated in future patches as I believe
this to be less disruptive. One benefit of this new class is that
it provides a way to unify many of the magic costs in the codebase
where the cost is set to a deliberately high number to prevent
optimisations taking place, e.g. vectorization. It also provides
a route to represent the extremely high, and unknown, cost of
scalarization of scalable vectors, which is not currently supported.

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

10 months ago[libc++] Remove invalid use of `#if _LIBCPP_STD_VER >= 11`, as `_LIBCPP_STD_VER`...
Marek Kurdej [Fri, 11 Dec 2020 07:31:04 +0000 (08:31 +0100)]
[libc++] Remove invalid use of `#if _LIBCPP_STD_VER >= 11`, as `_LIBCPP_STD_VER` can never be less than 11.

The relevant part of `__config` is:
```
#ifndef _LIBCPP_STD_VER
#  if  __cplusplus <= 201103L
#    define _LIBCPP_STD_VER 11
```

Reviewed By: ldionne, #libc

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

10 months ago[OpenMPIRBuilder] Fix typo. NFC.
Michael Kruse [Fri, 11 Dec 2020 06:04:12 +0000 (00:04 -0600)]
[OpenMPIRBuilder] Fix typo. NFC.

10 months ago[NFC] Inline maxDevirtIterationsReached()
Arthur Eubanks [Fri, 11 Dec 2020 06:04:49 +0000 (22:04 -0800)]
[NFC] Inline maxDevirtIterationsReached()

This was separated in the past because the cl::opt was in the .cpp file
but DevirtSCCRepeatedPass::run() was in the .h file. Now that
DevirtSCCRepeatedPass::run() is in the .cpp file, get rid of the tiny
maxDevirtIterationsReached(), it's bad for readability.

10 months ago[RISCV] Separate masked and unmasked definitions for pseudo instructions.
Hsiangkai Wang [Thu, 10 Dec 2020 09:06:22 +0000 (17:06 +0800)]
[RISCV] Separate masked and unmasked definitions for pseudo instructions.

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

10 months ago[MemorySSA] Remove unused declaration optimizeUses (NFC)
Kazu Hirata [Fri, 11 Dec 2020 04:54:37 +0000 (20:54 -0800)]
[MemorySSA] Remove unused declaration optimizeUses (NFC)

The declaration was introduced on Aug 2, 2016 in commit
c43aa5a5b62b21c1d38cd3d2ece7d0d5124d5180 without a corresponding
definition.

Note that we do have a definition for
MmeorySSA::OptimizeUses::optimizeUses but not for
MmeorySSA::optimizeUses.

10 months ago[Support] Use is_contained (NFC)
Kazu Hirata [Fri, 11 Dec 2020 04:40:37 +0000 (20:40 -0800)]
[Support] Use is_contained (NFC)

10 months ago[Polly] Consider InvalidContext to determine partial READ.
Michael Kruse [Fri, 11 Dec 2020 02:40:37 +0000 (20:40 -0600)]
[Polly] Consider InvalidContext to determine partial READ.

MemoryAccess::setNewAccessRelation() in assert-builds checks whether the
access relation for a READ has a memory location for every instance of
the domain. Otherwise, we would not have value to load from. That check
already considered that instances outside the Scop's context do not
matter since they are never executed (or would be undefined behavior).
In this patch also take instances of the InvalidContext into account,
as these can also be assumed to never occur. InvalidContext was
introduced to avoid the computational complexity of subtracting
restrictions from the AssumedContext. However, this additional check in
setNewAccessRelation is only done in assert-builds.

The assertion case with an InvalidContext may occur with DeLICM on a
conditionally infinite loops, as it is the case in the following code:

    for (int i = 0; i < n; i+=b)
      vreg = ...;
    *Dest = vreg;

The loop is infinite when b=0, and [b] -> { : b = 0 }  is part of the
InvalidContext. When DeLICM tries to map the memory for %vreg to *Dest,
there is no store instance that uses the value of vreg when b = 0, hence
no location to map it to. However, the case is irrelevant since Polly's
runtime condition check ensures that this is never case.

Fixes llvm.org/PR48445

10 months ago[RISCV] Use tail agnostic policy for vsetvli instruction emitted in the custom inserter
Craig Topper [Fri, 11 Dec 2020 01:35:25 +0000 (17:35 -0800)]
[RISCV] Use tail agnostic policy for vsetvli instruction emitted in the custom inserter

The compiler is making no effort to preserve upper elements. To do so would require another source operand tied with the destination and a different intrinsic interface to give control of this source to the programmer.

This patch changes the tail policy to agnostic so that the CPU doesn't need to make an effort to preserve them.

This is consistent with the RVV intrinsic spec here https://github.com/riscv/rvv-intrinsic-doc/blob/master/rvv-intrinsic-rfc.md#configuration-setting

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

10 months ago[analyzer] OSObjectCStyleCast: Improve warning message.
Artem Dergachev [Sat, 21 Nov 2020 09:41:31 +0000 (01:41 -0800)]
[analyzer] OSObjectCStyleCast: Improve warning message.

Suggest OSRequiredCast as a closer alternative to C-style cast.
Explain how to decide.

10 months ago[libc++] ADL-proof by adding _VSTD:: qualifications to memmove etc.
Arthur O'Dwyer [Tue, 8 Dec 2020 02:50:15 +0000 (21:50 -0500)]
[libc++] ADL-proof by adding _VSTD:: qualifications to memmove etc.

Generally these calls aren't vulnerable to ADL because they involve only
primitive types. The ones in <list> and <vector> drag in namespace std
but that's OK; the ones in <fstream> and <strstream> are vulnerable
iff `CharT` is an enum type, which seems far-fetched.
But absolutely zero of them *need* ADL to happen; so in my opinion
they should all be consistently qualified, just like calls to any
other (non-user-customizable) functions in namespace std.

Also: Include <cstring> and <cwchar> in <__string>.
We seemed to be getting lucky that <memory> included <iterator>
included <iosfwd> included <wchar.h>. That gave us the
global-namespace `wmemmove`, but not `_VSTD::wmemmove`.
This is now fixed.

I didn't touch these headers:
<ext/__hash> uses strlen, safely
<support/ibm/locale_mgmt_aix.h> uses memcpy, safely
<string.h> uses memchr and strchr, safely
<wchar.h> uses wcschr, safely
<__bsd_locale_fallbacks.h> uses wcsnrtombs, safely

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

10 months ago[libc++] Include C++ headers, not C headers, in <charconv>.
Arthur O'Dwyer [Tue, 8 Dec 2020 02:45:29 +0000 (21:45 -0500)]
[libc++] Include C++ headers, not C headers, in <charconv>.

This matches how libc++ does it in all other C++ headers
(that is, headers not ending in ".h").
We need to include <cstring> if we want to use `_VSTD::memmove`
instead of unqualified ADL `memmove`. Even though ADL doesn't
physically matter in <charconv>'s specific case, I'm trying
to migrate libc++ to using `_VSTD::memmove` for all cases
(because some of them do matter, and this way it's easier to
grep for outliers).

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

10 months agoRe-land: [lit] Support running tests on Windows without GnuWin32
Alexandre Ganea [Fri, 11 Dec 2020 02:37:58 +0000 (21:37 -0500)]
Re-land: [lit] Support running tests on Windows without GnuWin32

Historically, we have told contributors that GnuWin32 is a pre-requisite
because our tests depend on utilities such as sed, grep, diff, and more.
However, Git on Windows includes versions of these utilities in its
installation. Furthermore, GnuWin32 has not been updated in many years.
For these reasons, it makes sense to have the ability to run llvm tests
in a way that is both:

a) Easier on the user (less stuff to install)
b) More up-to-date (The verions that ship with git are at least as
   new, if not newer, than the versions in GnuWin32.
We add support for this here by attempting to detect where Git is
installed using the Windows registry, confirming the existence of
several common Unix tools, and then adding this location to lit's PATH
environment.

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

10 months ago[libomptarget][nfc] Remove data_sharing type aliasing
Jon Chesterfield [Fri, 11 Dec 2020 02:13:22 +0000 (02:13 +0000)]
[libomptarget][nfc] Remove data_sharing type aliasing

[libomptarget][nfc] Remove data_sharing type aliasing

Libomptarget previous used __kmpc_data_sharing_slot to access values of type
__kmpc_data_sharing_{worker,master}_slot_static. This aliasing violation was
benign in practice. The master type has since been removed, so a single type
can be used instead.

This is particularly helpful for the transition to an openmp deviceRTL, as the
c++/openmp compiler for amdgcn currently rejects the flexible array member for
being an incomplete type. Serves the same purpose as abandoned D86324.

Reviewed By: jdoerfert

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

10 months agoTooling: Migrate some tests to FileEntryRef, NFC
Duncan P. N. Exon Smith [Wed, 9 Dec 2020 21:32:47 +0000 (13:32 -0800)]
Tooling: Migrate some tests to FileEntryRef, NFC

Migrate to the `FileEntryRef` overload of `SourceManager::createFileID`
(using `FileManager::getOptionalFileRef`) in RefactoringTest.cpp and
RewriterTestContext.h.

No functionality change.

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

10 months ago[lld-macho] Disable some tests that are failing on Windows
Jez Ng [Fri, 11 Dec 2020 01:48:31 +0000 (17:48 -0800)]
[lld-macho] Disable some tests that are failing on Windows

lto-object-path.ll, like stabs.s, is disabled on Windows as the path
separators make it difficult to write a test that works across
platforms.

This diff also disables implicit-dylibs.s on Windows as we seem to emit
LC_LOAD_DYLIBs in a different order on that platform. This seems like a
bug in LLD that needs to be addressed (in a future diff).

10 months ago[lld-macho] Don't include absolute address value in expected test output
Jez Ng [Fri, 11 Dec 2020 01:40:14 +0000 (17:40 -0800)]
[lld-macho] Don't include absolute address value in expected test output

Should fix the mattrs.ll failure introduced by rG29d3b0e47113.

10 months ago[WebAssembly][lld] Exclude COMDAT sections
Derek Schuff [Wed, 9 Dec 2020 18:57:27 +0000 (10:57 -0800)]
[WebAssembly][lld] Exclude COMDAT sections

Allow exclusion/discarding of custom sections with COMDAT groups.
It piggybacks on the existing COMDAT-handling code, but applies to custom sections as well.

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

10 months ago[gn build] Port 705a4c149d8
LLVM GN Syncbot [Fri, 11 Dec 2020 01:40:59 +0000 (01:40 +0000)]
[gn build] Port 705a4c149d8

10 months ago[CSSPGO] Pseudo probe encoding and emission.
Hongtao Yu [Tue, 8 Dec 2020 23:37:32 +0000 (15:37 -0800)]
[CSSPGO] Pseudo probe encoding and emission.

This change implements pseudo probe encoding and emission for CSSPGO. Please see RFC here for more context: https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s

Pseudo probes are in the form of intrinsic calls on IR/MIR but they do not turn into any machine instructions. Instead they are emitted into the binary as a piece of data in standalone sections.  The probe-specific sections are not needed to be loaded into memory at execution time, thus they do not incur a runtime overhead. 

**ELF object emission**

The binary data to emit are organized as two ELF sections, i.e, the `.pseudo_probe_desc` section and the `.pseudo_probe` section. The `.pseudo_probe_desc` section stores a function descriptor for each function and the `.pseudo_probe` section stores the actual probes, each fo which corresponds to an IR basic block or an IR function callsite. A function descriptor is stored as a module-level metadata during the compilation and is serialized into the object file during object emission.

Both the probe descriptors and pseudo probes can be emitted into a separate ELF section per function to leverage the linker for deduplication.  A `.pseudo_probe` section shares the same COMDAT group with the function code so that when the function is dead, the probes are dead and disposed too. On the contrary, a `.pseudo_probe_desc` section has its own COMDAT group. This is because even if a function is dead, its probes may be inlined into other functions and its descriptor is still needed by the profile generation tool.

The format of `.pseudo_probe_desc` section looks like:

```
.section   .pseudo_probe_desc,"",@progbits
.quad   6309742469962978389  // Func GUID
.quad   4294967295           // Func Hash
.byte   9                    // Length of func name
.ascii  "_Z5funcAi"          // Func name
.quad   7102633082150537521
.quad   138828622701
.byte   12
.ascii  "_Z8funcLeafi"
.quad   446061515086924981
.quad   4294967295
.byte   9
.ascii  "_Z5funcBi"
.quad   -2016976694713209516
.quad   72617220756
.byte   7
.ascii  "_Z3fibi"
```

For each `.pseudoprobe` section, the encoded binary data consists of a single function record corresponding to an outlined function (i.e, a function with a code entry in the `.text` section). A function record has the following format :

```
FUNCTION BODY (one for each outlined function present in the text section)
    GUID (uint64)
        GUID of the function
    NPROBES (ULEB128)
        Number of probes originating from this function.
    NUM_INLINED_FUNCTIONS (ULEB128)
        Number of callees inlined into this function, aka number of
        first-level inlinees
    PROBE RECORDS
        A list of NPROBES entries. Each entry contains:
          INDEX (ULEB128)
          TYPE (uint4)
            0 - block probe, 1 - indirect call, 2 - direct call
          ATTRIBUTE (uint3)
            reserved
          ADDRESS_TYPE (uint1)
            0 - code address, 1 - address delta
          CODE_ADDRESS (uint64 or ULEB128)
            code address or address delta, depending on ADDRESS_TYPE
    INLINED FUNCTION RECORDS
        A list of NUM_INLINED_FUNCTIONS entries describing each of the inlined
        callees.  Each record contains:
          INLINE SITE
            GUID of the inlinee (uint64)
            ID of the callsite probe (ULEB128)
          FUNCTION BODY
            A FUNCTION BODY entry describing the inlined function.
```

To support building a context-sensitive profile, probes from inlinees are grouped by their inline contexts. An inline context is logically a call path through which a callee function lands in a caller function. The probe emitter builds an inline tree based on the debug metadata for each outlined function in the form of a trie tree. A tree root is the outlined function. Each tree edge stands for a callsite where inlining happens. Pseudo probes originating from an inlinee function are stored in a tree node and the tree path starting from the root all the way down to the tree node is the inline context of the probes. The emission happens on the whole tree top-down recursively. Probes of a tree node will be emitted altogether with their direct parent edge. Since a pseudo probe corresponds to a real code address, for size savings, the address is encoded as a delta from the previous probe except for the first probe. Variant-sized integer encoding, aka LEB128, is used for address delta and probe index.

**Assembling**

Pseudo probes can be printed as assembly directives alternatively. This allows for good assembly code readability and also provides a view of how optimizations and pseudo probes affect each other, especially helpful for diff time assembly analysis.

A pseudo probe directive has the following operands in order: function GUID, probe index, probe type, probe attributes and inline context. The directive is generated by the compiler and can be parsed by the assembler to form an encoded `.pseudoprobe` section in the object file.

A example assembly looks like:

```
foo2: # @foo2
# %bb.0: # %bb0
pushq %rax
testl %edi, %edi
.pseudoprobe 837061429793323041 1 0 0
je .LBB1_1
# %bb.2: # %bb2
.pseudoprobe 837061429793323041 6 2 0
callq foo
.pseudoprobe 837061429793323041 3 0 0
.pseudoprobe 837061429793323041 4 0 0
popq %rax
retq
.LBB1_1: # %bb1
.pseudoprobe 837061429793323041 5 1 0
callq *%rsi
.pseudoprobe 837061429793323041 2 0 0
.pseudoprobe 837061429793323041 4 0 0
popq %rax
retq
# -- End function
.section .pseudo_probe_desc,"",@progbits
.quad 6699318081062747564
.quad 72617220756
.byte 3
.ascii "foo"
.quad 837061429793323041
.quad 281547593931412
.byte 4
.ascii "foo2"
```

With inlining turned on, the assembly may look different around %bb2 with an inlined probe:

```
# %bb.2:                                # %bb2
.pseudoprobe    837061429793323041 3 0
.pseudoprobe    6699318081062747564 1 0 @ 837061429793323041:6
.pseudoprobe    837061429793323041 4 0
popq    %rax
retq
```

**Disassembling**

We have a disassembling tool (llvm-profgen) that can display disassembly alongside with pseudo probes. So far it only supports ELF executable file.

An example disassembly looks like:

```
00000000002011a0 <foo2>:
  2011a0: 50                    push   rax
  2011a1: 85 ff                 test   edi,edi
  [Probe]:  FUNC: foo2  Index: 1  Type: Block
  2011a3: 74 02                 je     2011a7 <foo2+0x7>
  [Probe]:  FUNC: foo2  Index: 3  Type: Block
  [Probe]:  FUNC: foo2  Index: 4  Type: Block
  [Probe]:  FUNC: foo   Index: 1  Type: Block  Inlined: @ foo2:6
  2011a5: 58                    pop    rax
  2011a6: c3                    ret
  [Probe]:  FUNC: foo2  Index: 2  Type: Block
  2011a7: bf 01 00 00 00        mov    edi,0x1
  [Probe]:  FUNC: foo2  Index: 5  Type: IndirectCall
  2011ac: ff d6                 call   rsi
  [Probe]:  FUNC: foo2  Index: 4  Type: Block
  2011ae: 58                    pop    rax
  2011af: c3                    ret
```

Reviewed By: wmi

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

10 months ago[libc] Add [l|ll]abs implementation.
Cheng Wang [Thu, 3 Dec 2020 12:17:24 +0000 (20:17 +0800)]
[libc] Add [l|ll]abs implementation.

Implement abs, labs and llabs with template.

Reviewed By: sivachandra

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

10 months ago[lld][WebAssembly] Split __wasm_apply_relocs function in two
Sam Clegg [Thu, 10 Dec 2020 02:14:31 +0000 (18:14 -0800)]
[lld][WebAssembly] Split __wasm_apply_relocs function in two

We have two types of relocations that we apply on startup:
1. Relocations that apply to wasm globals
2. Relocations that apply to wasm memory

The first set of relocations use only the `__memory_base` import to
update a set of internal globals.  Because wasm globals are thread local
these need to run on each thread.  Memory relocations, like static
constructors, must only be run once.

To ensure global relocations run on all threads and because the only
depend on the immutable `__memory_base` import we can run them during
the WebAssembly start functions, instead of waiting until the
post-instantiation __wasm_call_ctors.

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

10 months agoEnsure that we don't leave behind "InstantiatingSpecialization" entries
Richard Smith [Fri, 11 Dec 2020 00:49:27 +0000 (16:49 -0800)]
Ensure that we don't leave behind "InstantiatingSpecialization" entries
after destroying an InstantiatingTemplate object.

This previously caused us to (silently!) bail out of class template
instantiation, thinking we'd produced an error, in some corner cases.

10 months ago[test] Fix compiler-rt/test/profile/coverage_emptylines.cpp if the build directory...
Fangrui Song [Fri, 11 Dec 2020 00:57:09 +0000 (16:57 -0800)]
[test] Fix compiler-rt/test/profile/coverage_emptylines.cpp if the build directory is under /tmp

llvm-cov -path-equivalence=/tmp,... is used by some checked-in coverage mapping
files where the original filename is under /tmp. If the test itself produces the
coverage mapping file, there is no need for /tmp.

For coverage_emptylines.cpp: the source filename is under the build directory.
If the build directory is under /tmp, the path mapping will make
llvm-cov fail to find the file.

10 months ago[WebAssembly] Support COMDAT sections in assembly syntax
Derek Schuff [Fri, 11 Dec 2020 00:40:08 +0000 (16:40 -0800)]
[WebAssembly] Support COMDAT sections in assembly syntax

This CL changes the asm syntax for section flags, making them more like ELF
(previously "passive" was the only option). Now we also allow "G" to designate
COMDAT group sections. In these sections we set the appropriate comdat flag on
function symbols, and also avoid auto-creating a new section for them.

This also adds asm-based tests for the changes D92691 to go along with
the direct-to-object tests.

Differential Revision: https://reviews.llvm.org/D92952
This is a reland of rG4564553b8d8a with a fix to the lit pipeline in
llvm/test/MC/WebAssembly/comdat.ll

10 months agofix typo to cycle bots
Nico Weber [Fri, 11 Dec 2020 00:20:09 +0000 (19:20 -0500)]
fix typo to cycle bots

10 months agoRevert "[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing."
Jonas Paulsson [Fri, 11 Dec 2020 00:05:51 +0000 (18:05 -0600)]
Revert "[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing."

Temporarily reverted.

This reverts commit ea475c77ff9eab1de7d44684c8fb453b39f70081.

10 months ago[gn build] Port 7ead5f5aa38
LLVM GN Syncbot [Thu, 10 Dec 2020 23:59:49 +0000 (23:59 +0000)]
[gn build] Port 7ead5f5aa38

10 months agoRemove references to the ast_type_traits namespace
Alexander Kornienko [Thu, 10 Dec 2020 23:52:35 +0000 (00:52 +0100)]
Remove references to the ast_type_traits namespace

Follow up to cd62511496938e33c061c90796dd23a5288ff843 /
https://reviews.llvm.org/D74499

Reviewed By: aaron.ballman

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

10 months ago[lld-macho] Don't load dylibs more than once
Jez Ng [Thu, 10 Dec 2020 06:29:28 +0000 (22:29 -0800)]
[lld-macho] Don't load dylibs more than once

Also remove `DylibFile::reexported` since it's unused.

Fixes llvm.org/PR48393.

Reviewed By: thakis

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

10 months ago[lld-macho] Implement `-no_implicit_dylibs`
Jez Ng [Wed, 9 Dec 2020 23:08:05 +0000 (15:08 -0800)]
[lld-macho] Implement `-no_implicit_dylibs`

Dylibs that are "public" -- i.e. top-level system libraries -- are considered
implicitly linked when another library re-exports them. That is, we should load
them & bind directly to their symbols instead of via their re-exporting
umbrella library. This diff implements that behavior by default, as well as an
opt-out flag.

In theory, this is just a performance optimization, but in practice it seems
that it's needed for correctness.

Fixes llvm.org/PR48395.

Reviewed By: thakis

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

10 months ago[lld-macho] Initialize AsmParsers earlier
Jez Ng [Wed, 9 Dec 2020 05:51:32 +0000 (21:51 -0800)]
[lld-macho] Initialize AsmParsers earlier

We need to initialize AsmParsers before any calls to `addFile`, as
bitcode files may require them. Otherwise we trigger `Assertion T &&
T->hasMCAsmParser()' failed`.

Reviewed By: #lld-macho, compnerd

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

10 months ago[lld-macho] Add support for -mcpu, -mattr, -code-model in LTO
Jez Ng [Tue, 8 Dec 2020 13:08:56 +0000 (05:08 -0800)]
[lld-macho] Add support for -mcpu, -mattr, -code-model in LTO

`-mcpu` and `-code-model` tests were copied from similar ones in
LLD-ELF.

There doesn't seem to be an equivalent test for `-mattr` in LLD-ELF, so
I've verified our behavior by cribbing a test from
CodeGen/X86/recip-fastmath.ll.

Reviewed By: #lld-macho, compnerd, MaskRay

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

10 months ago[lld-macho] Don't attempt to emit rebase opcodes for debug sections
Jez Ng [Wed, 9 Dec 2020 01:47:19 +0000 (17:47 -0800)]
[lld-macho] Don't attempt to emit rebase opcodes for debug sections

This was causing a crash as we were attempting to look up the
nonexistent parent OutputSection of the debug sections. We didn't detect
it earlier because there was no test for PIEs with debug info (PIEs
require us to emit rebases for X86_64_RELOC_UNSIGNED).

This diff filters out the debug sections while loading the ObjFiles. In
addition to fixing the above problem, it also lets us avoid doing
redundant work -- we no longer parse / apply relocations / attempt to
emit dyld opcodes for these sections that we don't emit.

Fixes llvm.org/PR48392.

Reviewed By: thakis

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

10 months ago[lld-macho] Implement -object_path_lto
Jez Ng [Thu, 3 Dec 2020 04:34:17 +0000 (20:34 -0800)]
[lld-macho] Implement -object_path_lto

This makes it possible for STABS entries to reference the debug info
contained in the LTO-compiled output.

I'm not sure how to test the file mtime within llvm-lit -- GNU and BSD
`stat` take different command-line arguments. I've omitted the check for
now.

Reviewed By: clayborg

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

10 months agoRevert "[WebAssembly] Support COMDAT sections in assembly syntax"
Derek Schuff [Thu, 10 Dec 2020 23:55:33 +0000 (15:55 -0800)]
Revert "[WebAssembly] Support COMDAT sections in assembly syntax"

This reverts commit 4564553b8d8ab81dc21431a35275581cb42329c8.
It broke several buildbots.

10 months agoRevert "[CSSPGO] Pseudo probe encoding and emission."
Mitch Phillips [Thu, 10 Dec 2020 23:42:51 +0000 (15:42 -0800)]
Revert "[CSSPGO] Pseudo probe encoding and emission."

This reverts commit b035513c06d1cba2bae8f3e88798334e877523e1.

Reason: Broke the ASan buildbots:
  http://lab.llvm.org:8011/#/builders/5/builds/2269

10 months agoRevert "[NFC] Fix a gcc build break by using an explict constructor."
Mitch Phillips [Thu, 10 Dec 2020 23:42:38 +0000 (15:42 -0800)]
Revert "[NFC] Fix a gcc build break by using an explict constructor."

This reverts commit 248b279cf04d9e439a1e426ffd24f2dfa93d02f8.

Reason: Dependency of patch that broke the ASan buildbots:
  http://lab.llvm.org:8011/#/builders/5/builds/2269

10 months agoRevert "[NFC] Fix a gcc build break by not using an initializer."
Mitch Phillips [Thu, 10 Dec 2020 23:42:02 +0000 (15:42 -0800)]
Revert "[NFC] Fix a gcc build break by not using an initializer."

This reverts commit 1dc0a8521f616af5897327e4c03098f9312e9c59.

Reason: Dependency of patch that broke the ASan buildbots:
  http://lab.llvm.org:8011/#/builders/5/builds/2269

10 months ago[VE] Remove -faddrsig and -fnoaddrsig tests
Kazushi (Jam) Marukawa [Thu, 10 Dec 2020 01:54:15 +0000 (10:54 +0900)]
[VE] Remove -faddrsig and -fnoaddrsig tests

Remove explicitly declared -faddrsig and -fnoaddrsig option tests
since those are already tested in addrsig.c.  We test only the implicit
behavior of VE driver.

This is suggested in https://reviews.llvm.org/D92386.  Thanks.

Reviewed By: MaskRay

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

10 months ago[llvm-cov][gcov] Optimize the cycle counting algorithm by skipping zero count cycles
Xinhao Yuan [Thu, 10 Dec 2020 23:22:29 +0000 (15:22 -0800)]
[llvm-cov][gcov] Optimize the cycle counting algorithm by skipping zero count cycles

This change is similar to http://gcc.gnu.org/PR90380

This reduces the complexity from exponential to polynomial of the arcs.

Reviewed By: MaskRay

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

10 months ago[WebAssembly] Support COMDAT sections in assembly syntax
Derek Schuff [Mon, 7 Dec 2020 19:54:44 +0000 (11:54 -0800)]
[WebAssembly] Support COMDAT sections in assembly syntax

This CL changes the asm syntax for section flags, making them more like ELF
(previously "passive" was the only option). Now we also allow "G" to designate
COMDAT group sections. In these sections we set the appropriate comdat flag on
function symbols, and also avoid auto-creating a new section for them.

This also adds asm-based tests for the changes D92691 to go along with
the direct-to-object tests.

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

10 months ago[msan] Do not use 77 as exit code, instead use 1
Florian Schmaus [Thu, 10 Dec 2020 20:47:16 +0000 (12:47 -0800)]
[msan] Do not use 77 as exit code, instead use 1

MSan uses 77 as exit code since it appeared with c5033786ba34 ("[msan]
MemorySanitizer runtime."). However, Test runners like the one from
Meson use the GNU standard approach where a exit code of 77 signals
that the test should be skipped [1]. As a result Meson's test runner
reports tests as skipped if MSan is enabled and finds issues:

build $ meson test
ninja: Entering directory `/home/user/code/project/build'
ninja: no work to do.
1/1 PROJECT:all / SimpleTest    SKIP           0.09s

I could not find any rationale why 77 was initially chosen, and I
found no other clang sanitizer that uses this value as exit
code. Hence I believe it is safe to change this to a safe
default. You can restore the old behavior by setting the environment
variable MSAN_OPTIONS to "exitcode=77", e.g.

export MSAN_OPTIONS="exitcode=77"

1: https://mesonbuild.com/Unit-tests.html#skipped-tests-and-hard-errors

Reviewed By: #sanitizers, eugenis

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

10 months ago[SmallVector] Copy new docs into Doxygen comment
Scott Linder [Thu, 10 Dec 2020 21:54:15 +0000 (21:54 +0000)]
[SmallVector] Copy new docs into Doxygen comment

Copy the `ProgrammersManual.rst` changes from D92522 to the Doxygen
comment for `SmallVector`, to hopefully encourage new uses migrating to
the no-explicit-`N` form.

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

10 months ago[mlir] Remove the dependency on StandardOps from FoldUtils
River Riddle [Thu, 10 Dec 2020 22:13:37 +0000 (14:13 -0800)]
[mlir] Remove the dependency on StandardOps from FoldUtils

OperationFolder currently uses ConstantOp as a backup when trying to materialize a constant after an operation is folded. This dependency isn't really useful or necessary given that dialects can/should provide a `materializeConstant` implementation.

Fixes PR#44866

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

10 months ago[DFSan] Appease the custom wrapper lint script.
Matt Morehouse [Thu, 10 Dec 2020 22:12:00 +0000 (14:12 -0800)]
[DFSan] Appease the custom wrapper lint script.

10 months ago[clang-tidy] performance-unnecessary-copy-initialization: Prevent false positives...
Felix Berger [Fri, 20 Nov 2020 21:31:52 +0000 (16:31 -0500)]
[clang-tidy] performance-unnecessary-copy-initialization: Prevent false positives when dependent variable is modified.

Extend the check to not only look at the variable the unnecessarily copied
variable is initialized from, but also ensure that any variable the old variable
references is not modified.

Extend DeclRefExprUtils to also count references and pointers to const assigned
from the DeclRef we check for const usages.

Reviewed-by: aaron.ballman
Differential Revision: https://reviews.llvm.org/D91893

10 months agoBasic: Initialize FileEntry's fields inline, almost NFC
Duncan P. N. Exon Smith [Thu, 10 Dec 2020 21:44:06 +0000 (13:44 -0800)]
Basic: Initialize FileEntry's fields inline, almost NFC

Initialize most of FileEntry's fields inline (all the ones that can be).
The only functionality change is to avoid leaving some fields
uninitialized.

10 months ago[libc++] NFCI: Refactor __shared_ptr_emplace
Louis Dionne [Wed, 9 Dec 2020 21:22:17 +0000 (16:22 -0500)]
[libc++] NFCI: Refactor __shared_ptr_emplace

This is the first of a series of patches leading up to the implementation
of P0674r1, i.e. array support in allocate_shared. I am splitting this
up into multiple patches because the overall change is very tricky and
I want to isolate potential breakage.

10 months ago[DFSan] Add custom wrapper for pthread_join.
Matt Morehouse [Thu, 10 Dec 2020 21:41:17 +0000 (13:41 -0800)]
[DFSan] Add custom wrapper for pthread_join.

The wrapper clears shadow for retval.

Reviewed By: stephan.yichao.zhao

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

10 months ago[RISCV] Simplify vector instruction handling in RISCVMCInstLower.cpp.
Craig Topper [Thu, 10 Dec 2020 21:37:42 +0000 (13:37 -0800)]
[RISCV] Simplify vector instruction handling in RISCVMCInstLower.cpp.

Use RegisterClass::contains instead of going through getMinimalPhysRegClass
and hasSuperClassEq.

Remove the special case for NoRegister. It's identical to the
handling for any other regsiter that isn't VRM2/M4/M8.

10 months ago[gn build] fix up arm64 builtin sources a bit
Nico Weber [Thu, 10 Dec 2020 21:16:57 +0000 (16:16 -0500)]
[gn build] fix up arm64 builtin sources a bit

The fp_mode.c removal is done by filter_builtin_sources in the cmake build.

10 months ago[gn build] only build iOS builtins with full Xcode
Nico Weber [Thu, 10 Dec 2020 21:16:30 +0000 (16:16 -0500)]
[gn build] only build iOS builtins with full Xcode

Commandline tools doesn't include the iOS SDK.

10 months ago[gn build] add a missing dependency
Nico Weber [Thu, 10 Dec 2020 21:15:52 +0000 (16:15 -0500)]
[gn build] add a missing dependency

10 months ago[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing.
Jonas Paulsson [Tue, 8 Dec 2020 00:33:28 +0000 (01:33 +0100)]
[SystemZFrameLowering] Don't overrwrite R1D (backchain) when probing.

The loop-based probing done for stack clash protection altered R1D which
corrupted the backchain value to be stored after the probing was done.

By using R0D instead for the loop exit value, R1D is not modified.

Review: Ulrich Weigand.

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

10 months ago[mlir][SCCP] Don't visit private callables unless they are used when tracking interpr...
River Riddle [Thu, 10 Dec 2020 20:53:13 +0000 (12:53 -0800)]
[mlir][SCCP] Don't visit private callables unless they are used when tracking interprocedural arguments/results

This fixes a subtle bug where SCCP could incorrectly optimize a private callable while waiting for its arguments to be resolved.

Fixes PR#48457

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

10 months agoAdd MLIR Python binding for Array Attribute
Mehdi Amini [Wed, 9 Dec 2020 02:15:02 +0000 (02:15 +0000)]
Add MLIR Python binding for Array Attribute

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

10 months ago[mlir][Parser] Fix crash in DenseElementsAttr parser when no elements are parsed
River Riddle [Thu, 10 Dec 2020 20:44:35 +0000 (12:44 -0800)]
[mlir][Parser] Fix crash in DenseElementsAttr parser when no elements are parsed

This fixes a crash when no elements are parsed, but the type expects at least one.

Fixes PR#47763

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

10 months ago[GWP-ASan] IWYU & clang-format
Mitch Phillips [Thu, 10 Dec 2020 20:41:56 +0000 (12:41 -0800)]
[GWP-ASan] IWYU & clang-format

Run an IWYU pass and clang-format GWP-ASan code.

Reviewed By: eugenis, mcgrathr

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

10 months ago[mlir][StandardOps] Verify that the result of an integer constant is signless
River Riddle [Thu, 10 Dec 2020 19:47:17 +0000 (11:47 -0800)]
[mlir][StandardOps] Verify that the result of an integer constant is signless

This was missed when supported for unsigned/signed integer types was first added, and results in crashes if a user tries to create/print a constant with the incorrect integer type.

Fixes PR#46222

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

10 months ago[PGO] Enable preinline and cleanup when optimize for size
Zequan Wu [Wed, 2 Dec 2020 00:15:06 +0000 (16:15 -0800)]
[PGO] Enable preinline and cleanup when optimize for size

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

10 months ago[DFSan] Add custom wrapper for getpeername.
Matt Morehouse [Thu, 10 Dec 2020 20:23:23 +0000 (12:23 -0800)]
[DFSan] Add custom wrapper for getpeername.

The wrapper clears shadow for addr and addrlen when written to.

Reviewed By: stephan.yichao.zhao

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

10 months ago[scudo] [standalone] [NFC] clang-format code.
Mitch Phillips [Thu, 10 Dec 2020 20:16:45 +0000 (12:16 -0800)]
[scudo] [standalone] [NFC] clang-format code.

clang-format the scudo standalone codebase.

Reviewed By: cryptoad

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

10 months ago[AArch64] Don't try to compress jump tables if there are any inline asm instructions.
Amara Emerson [Tue, 8 Dec 2020 18:08:23 +0000 (10:08 -0800)]
[AArch64] Don't try to compress jump tables if there are any inline asm instructions.

Inline asm can contain constructs like .bytes which may have arbitrary size.
In some cases, this causes us to miscalculate the size of blocks and therefore
offsets, causing us to incorrectly compress a JT.

To be safe, just bail out of the whole thing if we find any inline asm.

Fixes PR48255

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

10 months ago[RISCV][NFC] Fix Sext/Zext Tests
Sam Elliott [Thu, 10 Dec 2020 20:10:29 +0000 (20:10 +0000)]
[RISCV][NFC] Fix Sext/Zext Tests

These were missed in a rebase of https://reviews.llvm.org/D92793

10 months ago[NFC] Fix a gcc build break by not using an initializer.
Hongtao Yu [Thu, 10 Dec 2020 19:54:22 +0000 (11:54 -0800)]
[NFC] Fix a gcc build break by not using an initializer.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

10 months ago[NPM] Support -fmerge-functions
Arthur Eubanks [Thu, 10 Dec 2020 06:41:47 +0000 (22:41 -0800)]
[NPM] Support -fmerge-functions

I tried to put it in the same place in the pipeline as the legacy PM.

Fixes PR48399.

Reviewed By: asbirlea, nikic

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

10 months ago[RISCV] Add (Proposed) Assembler Extend Pseudo-Instructions
Sam Elliott [Thu, 10 Dec 2020 19:23:46 +0000 (19:23 +0000)]
[RISCV] Add (Proposed) Assembler Extend Pseudo-Instructions

There is an in-progress proposal for the following pseudo-instructions
in the assembler, to complement the existing `sext.w` rv64i instruction:
- sext.b
- sext.h
- zext.b
- zext.h
- zext.w

The `.b` and `.h` variants are available with rv32i and rv64i, and `zext.w` is
only available with `rv64i`.

These are implemented primarily as pseudo-instructions, as these instructions
expand to multiple real instructions. In the case of `zext.b`, this expands to a
single rv32/64i instruction, so it is implemented with an InstAlias (like
`sext.w` is on rv64i).

The proposal is available here: https://github.com/riscv/riscv-asm-manual/pull/61

Reviewed By: asb

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

10 months ago[Doc] Update branch name in Phabricator documentation
Alexey Bader [Thu, 10 Dec 2020 11:15:43 +0000 (14:15 +0300)]
[Doc] Update branch name in Phabricator documentation

master -> main

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