platform/upstream/llvm.git
2 years ago[CSSPGO] Allow the use of debug-info-for-profiling and pseudo-probe-for-profiling...
Hongtao Yu [Wed, 11 Aug 2021 01:19:21 +0000 (18:19 -0700)]
[CSSPGO] Allow the use of debug-info-for-profiling and pseudo-probe-for-profiling together

Previoulsy debug-info-for-profiling and pseudo-probe-for-profiling are mutual exclusive because they compete the dwarf discrimnator for callsites on the IR. This changes allows to use the two switches together. The side effect is that callsite discriminators will be taken by pseudo probe, while discriminators for other instructions are still available for AutoFDO use. This is less than ideal, however, it still allows us a chance to smoothly transition from AutoFDO to CSSPGO, by collecting both profiles from a CSSPGO binary.

Reviewed By: wenlei, wmi

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

2 years ago[InstCombine] remove unused function argument; NFC
Sanjay Patel [Thu, 12 Aug 2021 15:46:11 +0000 (11:46 -0400)]
[InstCombine] remove unused function argument; NFC

This was just added with 6de1dbbd09c1 , and I missed
pulling the extra arg from the final revision.

2 years ago[Attributor][FIX] Do not try to rewrite functions with casted call sites
Johannes Doerfert [Thu, 12 Aug 2021 15:10:27 +0000 (10:10 -0500)]
[Attributor][FIX] Do not try to rewrite functions with casted call sites

If we cast a function at the call site it is hard(er) to get the rewrite
correct, let's not attempt it for now.

Fixes PR51448.

2 years ago[Attributor][FIX] Guard constant casts with type size checks
Johannes Doerfert [Thu, 12 Aug 2021 14:52:24 +0000 (09:52 -0500)]
[Attributor][FIX] Guard constant casts with type size checks

2 years ago[Attributor] Do not delete volatile stores to null/undef
Johannes Doerfert [Wed, 11 Aug 2021 14:48:46 +0000 (09:48 -0500)]
[Attributor] Do not delete volatile stores to null/undef

See D106309.

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

2 years ago[ARM] Fix DAG combine loop in reduction distribution
David Green [Thu, 12 Aug 2021 15:37:39 +0000 (16:37 +0100)]
[ARM] Fix DAG combine loop in reduction distribution

Given a constant operand, the MVE and DAGCombine combines could fight,
each redistributing in the opposite order. Add a guard to the MVE
vecreduce distribution to prevent that.

2 years ago[gn build] Port d2c5cbc3a856
LLVM GN Syncbot [Thu, 12 Aug 2021 15:33:09 +0000 (15:33 +0000)]
[gn build] Port d2c5cbc3a856

2 years agoAdd a check for enforcing minimum length for variable names
Florin Iucha [Thu, 12 Aug 2021 15:31:26 +0000 (11:31 -0400)]
Add a check for enforcing minimum length for variable names

Add a check for enforcing minimum length for variable names. A default
minimum length of three characters is applied to regular variables
(including function parameters). Loop counters and exception variables
have a minimum of two characters. Additionally, the 'i', 'j' and 'k'
are accepted as legacy values.

All three sizes, as well as the list of accepted legacy loop counter
names are configurable.

2 years ago[InstCombine] remove shl(neg x), y transform
Sanjay Patel [Thu, 12 Aug 2021 15:27:22 +0000 (11:27 -0400)]
[InstCombine] remove shl(neg x), y transform

This diff was accidentally committed with:
1b5a195845e1

2 years ago[InstCombine] factorize min/max intrinsic ops with common operand
Sanjay Patel [Thu, 12 Aug 2021 12:34:30 +0000 (08:34 -0400)]
[InstCombine] factorize min/max intrinsic ops with common operand

This is an adaptation of D41603 and another step on the way
to canonicalizing to the intrinsic forms of min/max.

See D98152 for status.

2 years ago[InstCombine] add tests for factorization of min/max intrinsics; NFC
Sanjay Patel [Thu, 12 Aug 2021 11:07:43 +0000 (07:07 -0400)]
[InstCombine] add tests for factorization of min/max intrinsics; NFC

2 years ago[PowerPC] Fix return address computation for "__builtin_return_address"
Victor Huang [Thu, 12 Aug 2021 13:03:21 +0000 (08:03 -0500)]
[PowerPC] Fix return address computation for "__builtin_return_address"

When depth > 0, callee frame address is used to compute the return address of
callee producing improper return address. This patch adds the fix to use caller
frame address to compute the return address of callee.

Reviewed By: nemanjai, #powerpc

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

2 years ago[llvm][Inline] Refactor out InlineOrder
Liqiang Tao [Thu, 12 Aug 2021 14:19:45 +0000 (22:19 +0800)]
[llvm][Inline] Refactor out InlineOrder

Move InlineOrder to separated file.

Reviewed By: kazu

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

2 years ago[OpenCL] Tidy up preserve_vec3 test
Sven van Haastregt [Thu, 12 Aug 2021 13:51:20 +0000 (14:51 +0100)]
[OpenCL] Tidy up preserve_vec3 test

Add CHECK-LABELs and fix string substitution to actually match the
previous definition.

2 years ago[Polly] Simplify domains before gist.
Michael Kruse [Thu, 12 Aug 2021 11:11:58 +0000 (06:11 -0500)]
[Polly] Simplify domains before gist.

The compilation of the file
526.blender_r/src/blender/source/blender/editors/space_logic/logic_ops.c
from the SPEC CPU 2017 benchmarks took excessive time to compute

    InvalidDomain.gist_params(Ctx)

Simplifying beforehand, specifically using isl_set_detect_equalities,
reduces the computation time to a negible level again.

2 years agotsan: remove implicit memcpy in MutexSet::Desc::operator=()
Dmitry Vyukov [Thu, 12 Aug 2021 12:47:47 +0000 (14:47 +0200)]
tsan: remove implicit memcpy in MutexSet::Desc::operator=()

The default compiler-generated MutexSet::Desc::operator=()
now contains memcpy() call since Desc become bigger.
This fails in debug mode since we call interceptor from within the runtime.
Define own operator=() using internal_memcpy().
This also makes copy ctor necessary, otherwise:
tsan_mutexset.h:33:11: warning: definition of implicit copy constructor for
'Desc' is deprecated because it has a user-declared copy assignment operator
And if we add copy ctor, we also need the default ctor
since it's called by MutexSet ctor.

Depends on D107911.

Reviewed By: melver

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

2 years agoRevert "[Matrix] Update column.major.load call in PPC test."
Florian Hahn [Thu, 12 Aug 2021 12:13:52 +0000 (13:13 +0100)]
Revert "[Matrix] Update column.major.load call in PPC test."

Dependent commit a1ef81de35a4 has been reverted in a1ef81de35a4.

2 years agoRevert "[Matrix] Overload stride arg in matrix.columnwise.load/store."
Mehdi Amini [Thu, 12 Aug 2021 11:57:19 +0000 (11:57 +0000)]
Revert "[Matrix] Overload stride arg in matrix.columnwise.load/store."

This reverts commit a1ef81de35a4bac6d3b22e9d7186d880124d7a55.

Broke the MLIR buildbot.

2 years ago[Test] Move test for PR50555 from InstCombine to AggressiveInstCombine
Anton Afanasyev [Thu, 12 Aug 2021 11:40:27 +0000 (14:40 +0300)]
[Test] Move test for PR50555 from InstCombine to AggressiveInstCombine

2 years agotsan: extend MutexSet to memorize mutex address/stack_id
Dmitry Vyukov [Tue, 10 Aug 2021 18:19:58 +0000 (20:19 +0200)]
tsan: extend MutexSet to memorize mutex address/stack_id

We currently memorize u64 id + epoch for each mutex.
The new tsan runtime will memorize address + stack_id instead.
But switching to address + stack_id requires new trace,
which in turn requires new MutexSet and some other changes.
Extend MutexSet to support both new and old info to break
the dependency cycles. The plan is to remove the old
info/methods after switching to the new runtime.

Reviewed By: vitalybuka, melver

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

2 years ago[flang][driver] Add support for Frontend Plugins
Stuart Ellis [Thu, 12 Aug 2021 10:42:08 +0000 (11:42 +0100)]
[flang][driver] Add support for Frontend Plugins

Introducing a plugin API and a simple HelloWorld Plugin example.
This patch adds the `-load` and `-plugin` flags to frontend driver and
the code around using custom frontend actions from within a plugin
shared library object.

It also adds to the Driver-help test to check the help option with the
updated driver flags.

Additionally, the patch creates a plugin-example test to check the
HelloWorld plugin example runs correctly. As part of this, a new CMake
flag (`FLANG_BUILD_EXAMPLES`) is added to allow the example to be built
and for the test to run.

This Plugin API has only been tested on Linux.

Reviewed By: awarzynski

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

2 years ago[llvm][sve] Fix erroneous tests for fixed length extending loads
David Truby [Thu, 12 Aug 2021 10:29:12 +0000 (10:29 +0000)]
[llvm][sve] Fix erroneous tests for fixed length extending loads

2 years ago[clang] [MinGW] Consider the per-target libc++ include directory too
Martin Storsjö [Wed, 11 Aug 2021 10:53:43 +0000 (13:53 +0300)]
[clang] [MinGW] Consider the per-target libc++ include directory too

The existing logic for per-target libc++ include directories only
seem to exist for the Gnu and Fuchsia drivers, added in
ea12d779bc238c387511fe7462020f4ecf4a8246 / D89013.

This is less generic than the corresponding case in the Gnu driver,
but matches the existing level of genericity in the MinGW driver
(and others too).

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

2 years ago[CMake] Make the vendor part of default mingw triples consistent
Martin Storsjö [Wed, 11 Aug 2021 11:06:28 +0000 (14:06 +0300)]
[CMake] Make the vendor part of default mingw triples consistent

Consistently use 'w64' as vendor string; it was 'pc' for the original
i686 triple added in 91bd6c922d7cf, but the later x86_64 triple
used 'w64' as vendor, added in d6c1f37f86440.

When the arm triples were added in c84ad73a27da6, the differing
vendors were copied over accidentally to the arm targets too.

When using per-target runtime directories, having inconsistent vendor
parts of the target triples is fatal.

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

2 years ago[LLD] [MinGW] Add more options for disabling flags in the executable
Martin Storsjö [Wed, 11 Aug 2021 20:41:24 +0000 (23:41 +0300)]
[LLD] [MinGW] Add more options for disabling flags in the executable

In e72403f96de7f1c681acd5968f72aa986412dfce, we added the flag
"--no-dynamicbase" for disabling the dynamicbase flag which we set
by default. At the time, ld.bfd didn't have any corresponding
option (as ld.bfd defaulted to not setting the flag). Almost at
the same time, corresponding options were added to ld.bfd for
disabling it (while it was being enabled by default), with a
different name, "--disable-dynamicbase".

Thus add the "--disable-dynamicbase" option. Make this default
one advertised in the help listing, but keep the "--no-dynamicbase"
form as an alias. Also improve checking for the last option set
if there are multiple ones on the same command line.

Also add corresponding disable options for a lot of other flags
that we set by default, also added in ld.bfd in the same commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=514b4e191d5f46de8e142fe216e677a35fa9c4bb

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

2 years ago[Matrix] Update column.major.load call in PPC test.
Florian Hahn [Thu, 12 Aug 2021 10:25:10 +0000 (11:25 +0100)]
[Matrix] Update column.major.load call in PPC test.

a1ef81de35a4bac6d3 adjusted the definition of the intrinsic, but did not
update a PowerPC test. Fix the test by updating the call & declaration
of @llvm.matrix.column.major.load.

2 years ago[llvm-objcopy][ELF] Avoid reordering section headers
Igor Kudrin [Thu, 12 Aug 2021 10:12:09 +0000 (17:12 +0700)]
[llvm-objcopy][ELF] Avoid reordering section headers

As for now, llvm-objcopy sorts section headers according to the offsets
of the sections in the input file. That can corrupt section references
in the dynamic symbol table because it is a loadable section and as such
is not updated by the tool. Even though the section references are not
required for loading the binary correctly, they are still handy for a
user who analyzes the file.

While the patch removes global reordering of section headers, it layouts
the sections in the same way as before, i.e. according to their original
offsets. All that helps the output file to resemble the input better.

Note that the patch removes sorting SHT_GROUP sections to the start of
the list, which was introduced in D62620 in order to ensure that they
come before the group members, along with the corresponding test. The
original issue was caused by the sorting of section headers, so dropping
the sorting also resolves the issue.

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

2 years ago[Matrix] Overload stride arg in matrix.columnwise.load/store.
Florian Hahn [Thu, 12 Aug 2021 08:53:04 +0000 (09:53 +0100)]
[Matrix] Overload stride arg in matrix.columnwise.load/store.

This patch adjusts the intrinsics definition of
llvm.matrix.column.major.load and llvm.matrix.column.major.store to
allow overloading the type of the stride. The bitwidth of the stride is
used to perform the offset computation.

This fixes a crash when using __builtin_matrix_column_major_load or
__builtin_matrix_column_major_store on 32 bit platforms. The stride argument
of the builtins are defined as `size_t`, which is 32 bits wide on 32 bit
platforms.

Note that we still perform offset computations with 64 bit width on 32
bit platforms for accesses that do not take a user-specified stride.
This can be fixed separately.

Fixes PR51304.

Reviewed By: erichkeane

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

2 years ago[llvm][sve] Lowering for VLS extending loads
David Truby [Wed, 11 Aug 2021 14:59:00 +0000 (14:59 +0000)]
[llvm][sve] Lowering for VLS extending loads

This patch enables extending loads for fixed length SVE code generation.

There is a slight regression here in the mulh tests; since these tests
load the parameter and then extend it these are treated as extending
loads which are merged, preventing the mulh instruction from being
generated. As this affects scalable SVE codegen as well this should be
addressed in a separate patch.

Reviewed By: bsmith

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

2 years ago[clang-tidy][docs] Remove the entry about 'cppcoreguidelines-init-variables' from...
Whisperity [Thu, 12 Aug 2021 08:41:46 +0000 (10:41 +0200)]
[clang-tidy][docs] Remove the entry about 'cppcoreguidelines-init-variables' from the release notes

The patch in http://reviews.llvm.org/D106431 landed in commit
4a097efe7784767b7d12ffcb8f2b22b9f4d045e2 to the main branch.
However, this patch was also backported to upcoming release 13.0.0 in
commit 8dcdfc0de84f60b5b4af97ac5b357881af55bc6e, which makes this entry
in the release notes **NOT** a new thing for the purposes of 14.0.0.

2 years ago[clang-format] improve distinction of K&R function definitions vs attributes
Krasimir Georgiev [Thu, 12 Aug 2021 08:26:56 +0000 (10:26 +0200)]
[clang-format] improve distinction of K&R function definitions vs attributes

After
https://github.com/llvm/llvm-project/commit/9da70ab3d43c79116f80fc06aa7cf517374ce42c
we saw a few regressions around trailing attribute definitions and in
typedefs (examples in the added test cases). There's some tension
distinguishing K&R definitions from attributes at the parser level,
where we have to decide if we need to put the type of the K&R definition
on a new unwrapped line before we have access to the rest of the line,
so we're scanning backwards and looking for a pattern like f(a, b). But
this type of pattern could also be an attribute macro, or the whole
declaration could be a typedef itself. I updated the code to check for a
typedef at the beginning of the line and to not consider raw identifiers
as possible first K&R declaration (but treated as an attribute macro
instead). This is not 100% correct heuristic, but I think it should be
reasonably good in practice, where we'll:
  * likely be in some very C-ish code when using K&R style (e.g., stuff
    that uses `struct name a;` instead of `name a;`
  * likely be in some very C++-ish code when using attributes
  * unlikely mix up the two in the same declaration.

Ideally, we should only decide to add the unwrapped line before the K&R
declaration after we've scanned the rest of the line an noticed the
variable declarations and the semicolon, but the way the parser is
organized I don't see a good way to do this in the current parser, which
only has good context for the previously visited tokens. I also tried
not emitting an unwrapped line there and trying to resolve the situation
later in the token annotator and the continuation indenter, and that
approach seems promising, but I couldn't make it to work without
messing up a bunch of other cases in unit tests.

Reviewed By: MyDeveloperDay

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

2 years ago[X86] Reverse *_set_ph and *_setr_ph 's set order.
Freddy Ye [Thu, 12 Aug 2021 08:24:16 +0000 (16:24 +0800)]
[X86] Reverse *_set_ph and *_setr_ph 's set order.

Reviewed By: pengfei

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

2 years ago[compiler-rt][fuzzer] Mark flags test unsupported on AArch64 Linux
David Spickett [Thu, 12 Aug 2021 08:24:47 +0000 (08:24 +0000)]
[compiler-rt][fuzzer] Mark flags test unsupported on AArch64 Linux

Previously I xfailed this but it's only failing in stage 2 so
we get xpasses for stage 1. Disable it completely.

2 years ago[AArch64] NFC: Remove register decoder tables in disassembler
Cullen Rhodes [Thu, 12 Aug 2021 07:28:56 +0000 (07:28 +0000)]
[AArch64] NFC: Remove register decoder tables in disassembler

The register classes are generated by TableGen, use them instead of
handwritten tables.

Reviewed By: david-arm

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

2 years ago[Object] Add missing PPC_DYNAMIC_TAG macros
Fangrui Song [Thu, 12 Aug 2021 07:05:04 +0000 (00:05 -0700)]
[Object] Add missing PPC_DYNAMIC_TAG macros

2 years ago[clang-format] handle trailing comments in function definition detection
Krasimir Georgiev [Thu, 12 Aug 2021 06:51:58 +0000 (08:51 +0200)]
[clang-format] handle trailing comments in function definition detection

A follow-up to
https://github.com/llvm/llvm-project/commit/f6bc614546e169bb1b17a29c422ebace038e6c62
where we handle the case where the semicolon is followed by a trailing
comment.

Reviewed By: MyDeveloperDay

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

2 years agotsan: fix build breakage due to AppMemBeg
Dmitry Vyukov [Thu, 12 Aug 2021 06:14:22 +0000 (08:14 +0200)]
tsan: fix build breakage due to AppMemBeg

AppMemBeg was renamed to LoAppMemBeg in 3830c93478
("tsan: rename kAppMemBeg to kLoAppMemBeg").
Rename remaining uses of the old name in tsan_platform_mac.cpp.

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

2 years ago[profile][test] Add -no-pie to make value profile merge work on Linux with default PIE
Fangrui Song [Thu, 12 Aug 2021 05:41:52 +0000 (22:41 -0700)]
[profile][test] Add -no-pie to make value profile merge work on Linux with default PIE

Alpine enables PIE by default.

2 years ago[tests] [trace] Add a more comprehensive test for `thread trace export ctf` command
Walter Erquinigo [Thu, 12 Aug 2021 03:05:31 +0000 (20:05 -0700)]
[tests] [trace] Add a more comprehensive test for `thread trace export ctf` command

Follow up on https://reviews.llvm.org/D105741

- Add new test that exhaustively checks the output file's content
- Fix typos in documentation and other minor fixes

Reviewed By: wallace

Original Author: jj10306

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

2 years agoReapply "SROA: Enhance speculateSelectInstLoads"
Christudasan Devadasan [Tue, 10 Aug 2021 03:36:21 +0000 (23:36 -0400)]
Reapply "SROA: Enhance speculateSelectInstLoads"

Originally committed as ffc3fb665d0a0dccd64cc8c803ad8cc1a0d5dfa1
Reverted in fcf2d5f40296be4e0f0e954001beb7814f97a212 due to an
assertion failure.

Original commit message:

Allow the folding even if there is an
intervening bitcast.

Reviewed By: arsenm

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

2 years ago[CMake] Enable clang_rt.crt{begin,end} on ppc32/ppc64
Daniel Kolesa [Thu, 12 Aug 2021 01:25:41 +0000 (18:25 -0700)]
[CMake] Enable clang_rt.crt{begin,end} on ppc32/ppc64

2 years agoUpdate gdbremote_testcase.py to allow new k-v pair in qMemoryRegionInfo
Jason Molenda [Thu, 12 Aug 2021 00:34:52 +0000 (17:34 -0700)]
Update gdbremote_testcase.py to allow new k-v pair in qMemoryRegionInfo

2 years agoFix two bugs with stack corefiles patch, restrict test built debugserver
Jason Molenda [Thu, 12 Aug 2021 00:17:39 +0000 (17:17 -0700)]
Fix two bugs with stack corefiles patch, restrict test built debugserver

These two tests, TestSkinnyCorefile.py and TestStackCorefile.py,
require a new debugserver on darwin systems to run correctly; for now,
skip them if the system debugserver is in use.  There's no easy way to
test if the debugserver being used supports either of these memory
region info features. For end users, the fallback will be a full
corefile and that's not the worst thing, but for the tests it is a
problem.

2 years ago[AArch64][GlobalISel] Simplify/nuke the merge/unmerge legalizer rules.
Amara Emerson [Wed, 11 Aug 2021 23:26:51 +0000 (16:26 -0700)]
[AArch64][GlobalISel] Simplify/nuke the merge/unmerge legalizer rules.

These rules were originally written when the new predicate based legalizer
was introduced in an attempt to preserve existing behaviour. It wasn't
properly kept up to date as things like vector support was split out into
G_CONCAT_VECTORS, and frankly, even if it was, it was too complex.

It's much easier to start from scratch with what we can actually support,
which is just a few type combinations. Anything illegal we should either
legalize, or should be eliminated as a side effect of artifact combination.

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

2 years ago[libc] add strtoll function and backend
Michael Jones [Thu, 5 Aug 2021 21:06:08 +0000 (21:06 +0000)]
[libc] add strtoll function and backend

This change adds the stroll function, but most of the implementation is
in the new file str_conv_utils.h since many of the other integer
conversion functions are implemented through what are effectively calls
to strtoll.

Reviewed By: sivachandra

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

2 years agoSupport post-processing Ops in unrolled loop iterations
Tyler Augustine [Wed, 11 Aug 2021 23:00:29 +0000 (23:00 +0000)]
Support post-processing Ops in unrolled loop iterations

This can be useful when one needs to know which unrolled iteration an Op belongs to, for example, conveying noalias information among memory-affecting ops in parallel-access loops.

Reviewed By: mehdi_amini

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

2 years ago[CSSPGO][llvm-profgen] Trim and merge context beforehand to reduce memory usage
wlei [Mon, 9 Aug 2021 18:44:33 +0000 (11:44 -0700)]
[CSSPGO][llvm-profgen] Trim and merge context beforehand to reduce memory usage

Currently we use a centralized string map(StringMap<FunctionSamples> ProfileMap) to store the profile while populating the sample, which might cause the memory usage bottleneck. I saw in an extreme case, there are thousands of samples whose context stack depth is >= 100. The memory consumption can be greater than 100GB.

As here the context is used for inlining, we can assume we won't have so many of inlinees keeping inlined at the same root function, so this change tried to cap the context stack and merge the samples for peak memory reduction and this is done after recursion compression.

The default value is -1 meaning no depth limit, in the future we can tune to a smaller one.

Reviewed By: hoy, wenlei

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

2 years ago[mlir] Drop LLVM dialect from TestPolynomialApproximation
Benjamin Kramer [Wed, 11 Aug 2021 22:58:52 +0000 (00:58 +0200)]
[mlir] Drop LLVM dialect from TestPolynomialApproximation

No longer needed after c1ebefdf77f34cc0b23597071098c8f8a8d2839b

2 years agoAdd missing cmake dep to fix MLIR build with BUILD_SHARED_LIBS=ON (NFC)
Mehdi Amini [Wed, 11 Aug 2021 22:50:44 +0000 (22:50 +0000)]
Add missing cmake dep to fix MLIR build with BUILD_SHARED_LIBS=ON (NFC)

2 years ago[lldb] Fix TestFormattersBoolRefPtr on AS
Jonas Devlieghere [Wed, 11 Aug 2021 21:54:32 +0000 (14:54 -0700)]
[lldb] Fix TestFormattersBoolRefPtr on AS

BOOL is bool instead of signed char on ARM. See
https://reviews.llvm.org/D93421#inline-874116 for details.

2 years ago[AArch64][SVE] Remove assertion/range check for i16 values during immediate selection
Usman Nadeem [Wed, 11 Aug 2021 21:44:44 +0000 (14:44 -0700)]
[AArch64][SVE] Remove assertion/range check for i16 values during immediate selection

The assertion can fail in some cases when an i16 constant is promoted
to i32.

e.g. in the added test case the value `i16 -32768` is within the range
of i16 but the assert fails when the constant is promoted to positive
`i32 32768` by an earlier call to DAG.getConstant().

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

Change-Id: I2f6179783cbc9630e6acab149a762b43c65664de

2 years ago[lldb] Replace assertTrue(foo in bar) with assertIn(foo, bar)
Jonas Devlieghere [Wed, 11 Aug 2021 21:40:15 +0000 (14:40 -0700)]
[lldb] Replace assertTrue(foo in bar) with assertIn(foo, bar)

The benefit of using assertIn is an improved error message when the
assertion fails:

  AssertionError: False is not True

becomes

  AssertionError: 'have ints 5 20 20 5' not found in '""'

2 years ago[lldb] Skip TestConcurrent.* watchpoint tests for Darwin on ARM
Jonas Devlieghere [Wed, 11 Aug 2021 21:26:31 +0000 (14:26 -0700)]
[lldb] Skip TestConcurrent.* watchpoint tests for Darwin on ARM

All TestConcurrent.* tests that involve watchpoints are broken on
ARM-based Darwin platforms, including Apple Silicon.

rdar://81811539

2 years ago[lldb] Update MemoryRegionInfo ctors in unit tests
Jonas Devlieghere [Wed, 11 Aug 2021 21:13:28 +0000 (14:13 -0700)]
[lldb] Update MemoryRegionInfo ctors in unit tests

2 years ago[libc++] Avoid conflating stderr and stdout in the DSL
Louis Dionne [Wed, 11 Aug 2021 16:23:55 +0000 (12:23 -0400)]
[libc++] Avoid conflating stderr and stdout in the DSL

This is a workaround until https://reviews.llvm.org/D81892 is merged
and the internal Lit shell stops conflating error output with normal
output. Without this, any program that writes to stderr will trip up
the programOutput function, because it will pick up the '# command stderr:'
string and think it's part of the command's stdout.

rdar://81056048

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

2 years ago[libc++] Remove workarounds for missing __builtin_addressof
Louis Dionne [Wed, 11 Aug 2021 14:34:51 +0000 (10:34 -0400)]
[libc++] Remove workarounds for missing __builtin_addressof

All supported compilers implement __builtin_addressof. Even MSVC implements
addressof as a simple call to __builtin_addressof, so it would work if we
were to port libc++ to that compiler.

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

2 years ago[AArch64][GlobalISel] Add ptradd_immed_chain combine to post-legalizer combiner.
Amara Emerson [Wed, 11 Aug 2021 20:41:43 +0000 (13:41 -0700)]
[AArch64][GlobalISel] Add ptradd_immed_chain combine to post-legalizer combiner.

2 years ago[ObjC][ARC] Don't form a StoreStrong call if it is unsafe to move the
Akira Hatanaka [Wed, 11 Aug 2021 19:55:28 +0000 (12:55 -0700)]
[ObjC][ARC] Don't form a StoreStrong call if it is unsafe to move the
release call

findSafeStoreForStoreStrongContraction checks whether it's safe to move
the release call to the store by inspecting all instructions between the
two, but was ignoring retain instructions. This was causing objects to
be released and deallocated before they were retained.

rdar://81668577

2 years ago[lldb] Skip TestStepOverWatchpoint on AS
Jonas Devlieghere [Wed, 11 Aug 2021 20:05:47 +0000 (13:05 -0700)]
[lldb] Skip TestStepOverWatchpoint on AS

Include macosx in the list of operating systems for which this is broken
on arm64.

rdar://34027183

2 years agoAdd the ability to process save-core stack-memory-only corefiles
Jason Molenda [Wed, 11 Aug 2021 20:37:31 +0000 (13:37 -0700)]
Add the ability to process save-core stack-memory-only corefiles

Add a field to the qMemoryRegionInfo packet where the remote stub
can describe the type of memory -- heap, stack.  Keep track of
memory regions that are stack memory in lldb.  Add a new "--style
stack" to process save-core to request that only stack memory be
included in the corefile.

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

2 years ago[mlir] BUILD.bazel: remove LLVMDialect from MathTransforms
Emilio Cota [Wed, 11 Aug 2021 20:27:04 +0000 (22:27 +0200)]
[mlir] BUILD.bazel: remove LLVMDialect from MathTransforms

c1ebefdf77f3 "[mlir] Make polynomial approximation emit
std instead of LLVM ops" removed the dependence on LLVMDialect.

Remove the dependence also from BUILD.bazel.

Reviewed By: bkramer

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

2 years ago[flang] Fix list-directed plural repeated null values at end of record
peter klausler [Tue, 10 Aug 2021 20:13:50 +0000 (13:13 -0700)]
[flang] Fix list-directed plural repeated null values at end of record

A repeated null value at the end of an input record with a count > 1
would incorrectly advance to the next record when resumed.  Fix.

Improve some poor naming and code flow noticed while debugging, so
next time will be easier.

Extend a unit test to check this case.

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

2 years ago[flang] Fix two typos in API names
peter klausler [Tue, 10 Aug 2021 21:08:15 +0000 (14:08 -0700)]
[flang] Fix two typos in API names

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

2 years ago[PowerPC] Do not define __PRIVILEGED__
Stefan Pintilie [Wed, 4 Aug 2021 14:16:11 +0000 (09:16 -0500)]
[PowerPC] Do not define __PRIVILEGED__

We do not want to define __PRIVILEGED__. There is no use case for the
definition and gcc does not define it. This patch removes that definition.

Reviewed By: lei, NeHuang

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

2 years ago[mlir][linalg] fixed typo
Aart Bik [Wed, 11 Aug 2021 17:22:12 +0000 (10:22 -0700)]
[mlir][linalg] fixed typo

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

2 years ago[lld] Add llvm-profdata to lld test deps
Reid Kleckner [Wed, 11 Aug 2021 18:52:37 +0000 (11:52 -0700)]
[lld] Add llvm-profdata to lld test deps

As of https://reviews.llvm.org/D104431, the test suite runs
llvm-profdata, so it must be added to the list of deps.

2 years agoSimplify dllexport class member code, NFC
Reid Kleckner [Wed, 11 Aug 2021 18:42:20 +0000 (11:42 -0700)]
Simplify dllexport class member code, NFC

We can hoist the check for the dllexport attribute to before the check
if this is a static data member or method.

2 years ago[InstSimplify] Eliminate vector reverse of a splat vector
Usman Nadeem [Tue, 10 Aug 2021 00:21:24 +0000 (17:21 -0700)]
[InstSimplify] Eliminate vector reverse of a splat vector

    experimental.vector.reverse(splat(X)) -> splat(X)

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

Change-Id: Id29ba88fd669ff8686712e96b1bdc46dda5b853c

2 years ago[SampleFDO] Add two passes of MIRAddFSDiscriminatorsPass
Rong Xu [Wed, 11 Aug 2021 17:56:03 +0000 (10:56 -0700)]
[SampleFDO] Add two passes of MIRAddFSDiscriminatorsPass

This patch adds Pass1 of MIRADDFSDiscriminatorsPass before register
allocation, and Pass2 of MIRAddFSDiscriminatorsPass before
Block-Placement. This is still under --enable-fs-discrmininator
option (default false).

This would reduce the turn-around time for FSAFDO transition.

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

2 years ago[mlir][tosa] Migrate tosa to more efficient linalg.conv
Rob Suderman [Wed, 11 Aug 2021 18:05:08 +0000 (11:05 -0700)]
[mlir][tosa] Migrate tosa to more efficient linalg.conv

Existing linalg.conv2d is not well optimized for performance. Changed to a
version that is more aligned for optimziation. Include the corresponding
transposes to use this optimized version.

This also splits the conv and depthwise conv into separate implementations
to avoid overly complex lowerings.

Reviewed By: antiagainst

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

2 years ago[libc++] Restore `basic_ios`'s implicit conversion to `bool` in C++03 mode.
Arthur O'Dwyer [Fri, 6 Aug 2021 18:50:09 +0000 (14:50 -0400)]
[libc++] Restore `basic_ios`'s implicit conversion to `bool` in C++03 mode.

efriedma noted that D104682 broke this test case, reduced from SPEC2006.

    #include <istream>
    bool a(std::istream a) {
        return a.getline(0,0) == 0;
    }

We can unbreak it by restoring the conversion to something-convertible-to-bool.
We chose `void*` in order to match libstdc++.

For more ancient history, see PR19460: https://bugs.llvm.org/show_bug.cgi?id=19460

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

2 years ago[lldb][NFC] Define DWARFDIE::children out-of-line instead of using template magic
Raphael Isemann [Wed, 11 Aug 2021 17:14:56 +0000 (19:14 +0200)]
[lldb][NFC] Define DWARFDIE::children out-of-line instead of using template magic

As pointed out by David in D103172 (thanks!)

Reviewed By: dblaikie

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

2 years ago[DWARF] Remove extractFast (NFC)
Kazu Hirata [Wed, 11 Aug 2021 16:55:00 +0000 (09:55 -0700)]
[DWARF] Remove extractFast (NFC)

The last use was removed on Dec 13, 2016 in commit
c8c1032c0c52d7f851ccfa29ec850b24047ebcb9.  This patch repurposes the
function comment for the other variant of extractFast.

2 years ago[InstCombine] avoid breaking up min/max (cmp+sel) idioms
Sanjay Patel [Wed, 11 Aug 2021 16:41:47 +0000 (12:41 -0400)]
[InstCombine] avoid breaking up min/max (cmp+sel) idioms

This is a quick fix for a motivating case that looks like this:
https://godbolt.org/z/GeMqzMc38

As noted, we might be able to restore the min/max patterns
with select folds, or we just wait for this to become easier
with canonicalization to min/max intrinsics.

2 years ago[InstCombine] add tests for inc/dec with min/max; NFC
Sanjay Patel [Wed, 11 Aug 2021 16:09:03 +0000 (12:09 -0400)]
[InstCombine] add tests for inc/dec with min/max; NFC

2 years ago[LTO][lld] Add lto-pgo-warn-mismatch option
Yolanda Chen [Wed, 11 Aug 2021 16:45:55 +0000 (09:45 -0700)]
[LTO][lld] Add lto-pgo-warn-mismatch option

When enable CSPGO for ThinLTO, there are profile cfg mismatch warnings that will cause lld-link errors (with /WX)
due to source changes (e.g. `#if` code runs for profile generation but not for profile use)
To disable it we have to use an internal "/mllvm:-no-pgo-warn-mismatch" option.
In contrast clang uses option ”-Wno-backend-plugin“ to avoid such warnings and gcc has an explicit "-Wno-coverage-mismatch" option.

Add "lto-pgo-warn-mismatch" option to lld COFF/ELF to help turn on/off the profile mismatch warnings explicitly when build with ThinLTO and CSPGO.

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

2 years ago[scudo] Add GWP-ASan state/metadata pointer proxies.
Mitch Phillips [Wed, 11 Aug 2021 16:21:28 +0000 (09:21 -0700)]
[scudo] Add GWP-ASan state/metadata pointer proxies.

Provide accessor proxies for the gwp-asan regions that are useful in
symbolizing dumps offline. Should be useful for Fuchsia to be able to
locate these internal pointers to stash the data in a minidump.

Reviewed By: cryptoad

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

2 years ago[lldb/Commands] Fix heap-use-after-free error in CommandObjectProcess
Med Ismail Bennani [Wed, 11 Aug 2021 15:56:36 +0000 (16:56 +0100)]
[lldb/Commands] Fix heap-use-after-free error in CommandObjectProcess

This patch should fix the use-after-free error that was brought up by
the LLDB ASAN Green Dragon bot.

This is caused because the `StringRef` object was acquired too early
before being use and by the underlying memory was modified which caused
it to point to null memory.

Fetching back the string reference close to its usage location should
fix the issue.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2 years ago[LegalizeTypes][NFC] Remove else-after-return
Fraser Cormack [Wed, 11 Aug 2021 11:12:17 +0000 (12:12 +0100)]
[LegalizeTypes][NFC] Remove else-after-return

Reviewed By: craig.topper

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

2 years ago[libc++][doc] Improve contributor documentation.
Mark de Wever [Wed, 11 Aug 2021 15:33:54 +0000 (17:33 +0200)]
[libc++][doc] Improve contributor documentation.

Addresses the post-commit review comments of D107596.

2 years ago[OpenMP][NFC] libomp: reduced timeouts in the test from 50 to 2 sec.
AndreyChurbanov [Wed, 11 Aug 2021 14:58:52 +0000 (17:58 +0300)]
[OpenMP][NFC] libomp: reduced timeouts in the test from 50 to 2 sec.

2 years agoCodeGen: No need to check for isExternC if HasStrictReturn is already false
Arnold Schwaighofer [Tue, 10 Aug 2021 14:45:32 +0000 (07:45 -0700)]
CodeGen: No need to check for isExternC if HasStrictReturn is already false

NFC intended.

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

2 years ago[mlir] Make polynomial approximation emit std instead of LLVM ops
Benjamin Kramer [Wed, 11 Aug 2021 12:09:41 +0000 (14:09 +0200)]
[mlir] Make polynomial approximation emit std instead of LLVM ops

This is a bit cleaner and removes issues with 2d vectors. It also has a
big impact on constant folding, hence the test changes.

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

2 years ago[mlir] Add std.bitcast -> llvm.bitcast conversion
Alex Zinenko [Wed, 11 Aug 2021 11:23:40 +0000 (13:23 +0200)]
[mlir] Add std.bitcast -> llvm.bitcast conversion

The conversion is a straightforward one-to-one mapping with optional unrolling
for nD vectors, similarly to other cast operations.

Depends On D107889

Reviewed By: cota, akuegel

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

2 years ago[mlir] Tighten LLVM_AnyNonAggregate ODS type constraint
Alex Zinenko [Wed, 11 Aug 2021 11:21:31 +0000 (13:21 +0200)]
[mlir] Tighten LLVM_AnyNonAggregate ODS type constraint

The constraint was checking that the type is not an LLVM structure or array
type, but was not checking that it is an LLVM-compatible type, making it accept
incorrect types. As a result, some LLVM dialect ops could process values that
are not compatible with the LLVM dialect leading to further issues with
conversions and translations that assume all values are LLVM-compatible. Make
LLVM_AnyNonAggregate only accept LLVM-compatible types.

Reviewed By: cota, akuegel

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

2 years ago[gn build] Port 89a7bdb1f37a
LLVM GN Syncbot [Wed, 11 Aug 2021 14:16:15 +0000 (14:16 +0000)]
[gn build] Port 89a7bdb1f37a

2 years ago[PowerPC][NFC] Update llvm/test/CodeGen/PowerPC/2010-05-03-retaddr1.ll with utils...
Victor Huang [Wed, 11 Aug 2021 14:09:31 +0000 (09:09 -0500)]
[PowerPC][NFC] Update llvm/test/CodeGen/PowerPC/2010-05-03-retaddr1.ll with utils/update_llc_test_checks.py

2 years ago[libc++] Remove _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
Louis Dionne [Tue, 10 Aug 2021 15:35:27 +0000 (11:35 -0400)]
[libc++] Remove _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS

All supported compilers have implemented __has_unique_object_representations
for a while, so it's reasonable to remove the workaround.

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

2 years ago[libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE
Louis Dionne [Tue, 10 Aug 2021 16:44:20 +0000 (12:44 -0400)]
[libc++] Remove _LIBCPP_HAS_NO_IS_AGGREGATE

All supported compilers have been supporting __is_aggregate for a long
time now, so it's reasonable to remove this workaround.

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

2 years ago[libc++] Add the __bind_back and __compose helpers
Louis Dionne [Mon, 9 Aug 2021 19:41:26 +0000 (15:41 -0400)]
[libc++] Add the __bind_back and __compose helpers

Those are going to be used to implement range adaptors,
see D107098 for details.

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

2 years ago[compiler-rt][fuzzer] Xfail flags test on AArch64 Linux
David Spickett [Wed, 11 Aug 2021 13:53:18 +0000 (13:53 +0000)]
[compiler-rt][fuzzer] Xfail flags test on AArch64 Linux

This fails with:
/tmp/FlagsTest-5761bc.o: In function `sancov.module_ctor_8bit_counters':
FlagsTest.cpp:(.text.sancov.module_ctor_8bit_counters[sancov.module_ctor_8bit_counters]+0x14): undefined reference to `__start___sancov_cntrs'
FlagsTest.cpp:(.text.sancov.module_ctor_8bit_counters[sancov.module_ctor_8bit_counters]+0x18): undefined reference to `__stop___sancov_cntrs'
<...>

Since https://reviews.llvm.org/D107374. However the changes
there don't seem to be the real fault so xfail while I look into it.

2 years ago[OpenMP]Fix PR50336: Remove temporary files in the offload bundler tool
Joseph Huber [Fri, 6 Aug 2021 21:11:13 +0000 (17:11 -0400)]
[OpenMP]Fix PR50336: Remove temporary files in the offload bundler tool

Temporary files created by the offloading device toolchain are not removed
after compilation when using a two-step compilation. The offload-bundler uses a
different filename for the device binary than the `.o` file present in the
Job's input list. This is not listed as a temporary file so it is never
removed. This patch explicitly adds the device binary as a temporary file to
consume it. This fixes PR50336.

Reviewed By: jdoerfert

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

2 years ago[lldb][docs] Remove index entry to removed StructuredDataPlugins
Raphael Isemann [Wed, 11 Aug 2021 11:47:02 +0000 (13:47 +0200)]
[lldb][docs] Remove index entry to removed StructuredDataPlugins

This page was removed in b2e25572d2a7b65a018580097b50910b3049ab65

2 years agotsan: fix active mapping selection
Dmitry Vyukov [Wed, 11 Aug 2021 10:39:38 +0000 (12:39 +0200)]
tsan: fix active mapping selection

Fix bug introduced by commit 5d106f16b972.
SANITIZER_IOSSIM is always defined,
it's the value 0/1 that's meaningful.

Reviewed By: DavidSpickett

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

2 years ago[clang][analyzer] Improve bug report in alpha.security.ReturnPtrRange
Balázs Kéri [Wed, 11 Aug 2021 09:19:19 +0000 (11:19 +0200)]
[clang][analyzer] Improve bug report in alpha.security.ReturnPtrRange

Add some notes and track of bad return value.

Reviewed By: steakhal

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

2 years ago[lldb][NFC] Fix small format error in TestCppVirtualFunctions
Raphael Isemann [Wed, 11 Aug 2021 10:26:22 +0000 (12:26 +0200)]
[lldb][NFC] Fix small format error in TestCppVirtualFunctions

2 years ago[lldb] Rework 'lldb' substitution workaround in dwarf5-lazy-dwo.c
Raphael Isemann [Wed, 11 Aug 2021 10:08:36 +0000 (12:08 +0200)]
[lldb] Rework 'lldb' substitution workaround in dwarf5-lazy-dwo.c

This test is specifying the lldb log channel via `ll""db` which only really works
because the command parser ends up parsing that as `lldb`. Just putting the
channel name in quotes is enough to avoid the lldb command substitution and
doesn't rely on this weird parser behaviour.

2 years ago[Orc] Enable debug object tests only on x86_64 hosts
Stefan Gränitz [Fri, 6 Aug 2021 12:34:31 +0000 (12:34 +0000)]
[Orc] Enable debug object tests only on x86_64 hosts

These tests rely on running IR code with an explicit x86_64 target triple. They won't work on other architectures. (They won't work for 32-bit processes on x86_64 hosts either. We will take care of this later.)

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

2 years ago[ARM] Add extra debug messages for validating live outs. NFC
David Green [Wed, 11 Aug 2021 09:35:53 +0000 (10:35 +0100)]
[ARM] Add extra debug messages for validating live outs. NFC

We are running into more and more cases where the liveouts of low
overhead loops do not validate. Add some extra debug messages to make it
clearer why.

2 years ago[hwasan] Fix test with TCO eliminating free frame.
Florian Mayer [Tue, 10 Aug 2021 20:02:13 +0000 (21:02 +0100)]
[hwasan] Fix test with TCO eliminating free frame.

This broke https://lab.llvm.org/buildbot/#/builders/37/builds/6016/steps/10/logs/stdio

Reviewed By: eugenis

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