platform/upstream/llvm.git
3 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.

3 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

3 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

3 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

3 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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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)

3 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.

3 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

3 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 '""'

3 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

3 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

3 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

3 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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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

3 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

3 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

3 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

3 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

3 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.

3 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.

3 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

3 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

3 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

3 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>
3 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

3 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.

3 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.

3 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

3 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

3 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

3 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

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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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

3 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

3 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

3 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

3 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.

3 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

3 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.

3 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

3 years agoRevert "[lld] Add lto-pgo-warn-mismatch option"
Wang, Pengfei [Wed, 11 Aug 2021 08:25:42 +0000 (16:25 +0800)]
Revert "[lld] Add lto-pgo-warn-mismatch option"

This reverts commit 0cfb00a1c98f8ca3749b8d829b7301f397efa302.

3 years agotsan: fix Printf format string
Dmitry Vyukov [Wed, 11 Aug 2021 06:28:01 +0000 (08:28 +0200)]
tsan: fix Printf format string

Reported on D107745

Reported-by: Wolfgang Pieb (wolfgangp)
Reviewed By: melver

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

3 years ago[gn build] Port
LLVM GN Syncbot [Wed, 11 Aug 2021 08:16:37 +0000 (08:16 +0000)]
[gn build] Port

3 years ago[libunwind] Compile with -Wunused-but-set-variable
Daniel Kiss [Wed, 11 Aug 2021 08:11:31 +0000 (10:11 +0200)]
[libunwind] Compile with -Wunused-but-set-variable

-Wunused-but-set-variable triggers a warning even the block of code is effectively dead.

Reviewed By: MaskRay

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

3 years ago[Arm][Unwind][libc++abi] Add _Unwind_ForcedUnwind to EHABI.
Daniel Kiss [Wed, 11 Aug 2021 08:11:30 +0000 (10:11 +0200)]
[Arm][Unwind][libc++abi] Add _Unwind_ForcedUnwind to EHABI.

_Unwind_ForcedUnwind is not mandated by the EHABI but for compatibilty
reasons adding so the interface to higher layers would be the same.
Dropping EHABI specific _Unwind_Stop_Fn definition since it is not defined by EHABI.

Reviewed By: MaskRay

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

3 years ago[Unwind] Split unwind.h
Daniel Kiss [Wed, 11 Aug 2021 08:11:27 +0000 (10:11 +0200)]
[Unwind] Split unwind.h

Moving Itanium and ArmEHABI specific implementations to dedicated files.
This is a NFC patch.

Reviewed By: MaskRay

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

3 years agoRevert "Bufferization for tiled loop."
Alexander Belyaev [Wed, 11 Aug 2021 08:04:12 +0000 (10:04 +0200)]
Revert "Bufferization for tiled loop."

This reverts commit edaffebcb2a62b0195e23fe7d4ead005822865c3.

3 years agoRevert "[mlir] Change the pattern for TiledLoopOp bufferization."
Alexander Belyaev [Wed, 11 Aug 2021 08:01:36 +0000 (10:01 +0200)]
Revert "[mlir] Change the pattern for TiledLoopOp bufferization."

This reverts commit 2f946eaa9d2648b883b2a1e567b23fff307f13d9.

3 years ago[AArch64][SME] Support ptrue(s) in streaming mode
Cullen Rhodes [Wed, 11 Aug 2021 07:07:32 +0000 (07:07 +0000)]
[AArch64][SME] Support ptrue(s) in streaming mode

The ptrue and ptrues instructions are legal in streaming mode, missed in
D106272.

The reference can be found here:
https://developer.arm.com/documentation/ddi0602/2021-06/SVE-Instructions

Reviewed By: paulwalker-arm

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

3 years ago[ELF] Don't emit SHF_GNU_RETAIN on Solaris
Rainer Orth [Wed, 11 Aug 2021 07:27:51 +0000 (09:27 +0200)]
[ELF] Don't emit SHF_GNU_RETAIN on Solaris

The introduction of `SHF_GNU_RETAIN` has caused massive problems on Solaris.

Initially, as reported in Bug 49437, it caused dozens of testsuite failures
on both sparc and x86.  The objects were marked as `ELFOSABI_NONE`, but
`SHF_GNU_RETAIN` is a GNU extension. In the native Solaris ABI, that flag
(in the range for OS-specific values) is `SHF_SUNW_ABSENT` with a
completely different semantics, which confuses Solaris `ld` very much.

Later, the objects became (correctly) marked `ELFOSABI_GNU`, which Solaris
`ld` doesn't support, causing it to SEGV and break the build.  The linker
is currently being hardened to not accept non-native OS ABIs to avoid this.

The need for linker support is already documented in
`clang/include/clang/Basic/AttrDocs.td`, but not currently checked.

This patch avoids all this by not emitting `SHF_GNU_RETAIN` on Solaris at all.

Tested on `amd64-pc-solaris2.11`, `sparcv9-sun-solaris2.11`, and
`x86_64-pc-linux-gnu`.

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

3 years ago[mlir][Analysis][NFC] Remove code duplication around getFlattenedAffineExprs
Matthias Springer [Wed, 11 Aug 2021 06:59:43 +0000 (15:59 +0900)]
[mlir][Analysis][NFC] Remove code duplication around getFlattenedAffineExprs

Remove code duplication in `addLowerOrUpperBound` and `composeMatchingMap`.

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

3 years ago[mlir][Analysis][NFC] Reimplement FlatAffineConstraints::composeMap
Matthias Springer [Wed, 11 Aug 2021 06:48:21 +0000 (15:48 +0900)]
[mlir][Analysis][NFC] Reimplement FlatAffineConstraints::composeMap

Reimplement this function in terms of `composeMatchingMap`.

Also fix a bug in `composeMatchingMap` where local dims of `this` could be missing in `localCst`.

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

3 years ago[DAG] Reword comment for EnforceNodeIdInvariant and InvalidateNodeId. NFC.
madhur13490 [Tue, 10 Aug 2021 17:22:29 +0000 (22:52 +0530)]
[DAG] Reword comment for EnforceNodeIdInvariant and InvalidateNodeId. NFC.

Reviewed By: niravd

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

3 years ago[lld] Add lto-pgo-warn-mismatch option
Yolanda Chen [Wed, 11 Aug 2021 05:22:36 +0000 (13:22 +0800)]
[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).
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 this "lto-pgo-warn-mismatch" option to lld to help turn on/off the profile mismatch warnings explicitly when build with ThinLTO and CSPGO.

Reviewed By: tejohnson

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

3 years ago[mlir][Analysis][NFC] Reimplement FlatAffineConstraints::addLowerOrUpperBound
Matthias Springer [Wed, 11 Aug 2021 06:15:30 +0000 (15:15 +0900)]
[mlir][Analysis][NFC] Reimplement FlatAffineConstraints::addLowerOrUpperBound

Reimplement this function in terms of the function variant without Value semantics.

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

3 years ago[InstrProfiling] Generate runtime hook for Fuchsia
Petr Hosek [Tue, 10 Aug 2021 18:03:07 +0000 (11:03 -0700)]
[InstrProfiling] Generate runtime hook for Fuchsia

When none of the translation units in the binary have been instrumented
we shouldn't need to link the profile runtime. However, because we pass
-u__llvm_profile_runtime on Linux and Fuchsia, the runtime would still
be pulled in and incur some overhead. On Fuchsia which uses runtime
counter relocation, it also means that we cannot reference the bias
variable unconditionally.

This change modifies the InstrProfiling pass to pull in the profile
runtime only when needed by declaring the __llvm_profile_runtime symbol
in the translation unit only when needed. For now we restrict this only
for Fuchsia, but this can be later expanded to other platforms. This
approach was already used prior to 9a041a75221ca, but we changed it
to always generate the __llvm_profile_runtime due to a TAPI limitation,
but that limitation may no longer apply, and it certainly doesn't apply
on platforms like Fuchsia.

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

3 years agoRevert "[InstrProfiling] Emit bias variable eagerly"
Petr Hosek [Tue, 10 Aug 2021 18:23:50 +0000 (11:23 -0700)]
Revert "[InstrProfiling] Emit bias variable eagerly"

This reverts commit 6660cec568504df47d9becb0c552c20577880df8 since
it was superseded by https://reviews.llvm.org/D98061.

3 years ago[mlir][Analysis] Add FlatAffineConstraints::addLowerOrUpperBound
Matthias Springer [Wed, 11 Aug 2021 06:08:02 +0000 (15:08 +0900)]
[mlir][Analysis] Add FlatAffineConstraints::addLowerOrUpperBound

This function overload is similar to the existing `FlatAffineConstraints::addLowerOrUpperBound`. It constrains a dimension based on an affine map. However, in contrast to the other overloading, it does not attempt to align dimensions/symbols of the affine map with the dimensions/symbols of the constraint set. Instead, dimensions/symbols are expected to already be aligned.

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

3 years ago[Attributor][NFC] Try to make the windows build bots happy
Johannes Doerfert [Wed, 11 Aug 2021 06:10:13 +0000 (01:10 -0500)]
[Attributor][NFC] Try to make the windows build bots happy

Failed for some reason, potentially because of the inner type
declaration in combination with the `using`. This might help.

Failure:
https://lab.llvm.org/buildbot/#/builders/127/builds/15432

3 years ago[mlir][Analysis] Add alignAffineMapWithValues
Matthias Springer [Wed, 11 Aug 2021 05:55:22 +0000 (14:55 +0900)]
[mlir][Analysis] Add alignAffineMapWithValues

This function aligns an affine map (and operands) with given dims and syms SSA values.

This is useful in conjunction with `FlatAffineConstraints::addLowerOrUpperBound`, which requires the `boundMap` to be aligned with the constraint set's dims and syms.

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

3 years ago[Attributor][FIX] Handle recurrences (PHIs) in AAPointerInfo explicitly
Johannes Doerfert [Tue, 10 Aug 2021 09:06:59 +0000 (04:06 -0500)]
[Attributor][FIX] Handle recurrences (PHIs) in AAPointerInfo explicitly

PHI nodes are not pass through but change their value, we have to
account for that to avoid missing stores.

Follow up for D107798 to fix PR51249 for good.

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

3 years ago[Attributor][FIX] Only avoid visiting PHI uses multiple times (PR51249)
Johannes Doerfert [Tue, 10 Aug 2021 03:22:49 +0000 (22:22 -0500)]
[Attributor][FIX] Only avoid visiting PHI uses multiple times (PR51249)

AAPointerInfoFloating needs to visit all uses and some multiple times if
we go through PHI nodes. Attributor::checkForAllUses keeps a visited set
so we don't recurs endlessly. We now allow recursion for non-phi uses so
we track all pointer offsets via PHI nodes properly without endless
recursion.

This replaces the first attempt D107579.

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

3 years ago[Attributor][NFC] Precommit reproducer for PR51249
Johannes Doerfert [Tue, 10 Aug 2021 03:27:45 +0000 (22:27 -0500)]
[Attributor][NFC] Precommit reproducer for PR51249

The bulk of the changes come from attributes but only the @phi_store
function is effectively added.

3 years ago[OpenMP][FIX] Disabled optimizations have to be made known
Johannes Doerfert [Tue, 10 Aug 2021 18:24:34 +0000 (13:24 -0500)]
[OpenMP][FIX] Disabled optimizations have to be made known

To avoid simplification with wrong constants we need to make sure we
know that we won't perform specific optimizations based on the users
request. The non-SPMDzation and non-CustomStateMachine flags did only
prevent the final transformation but allowed to value simplification
to go ahead.

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

3 years ago[SelectionDAGBuilder] Save iterator to avoid second DenseMap lookup. NFC
Craig Topper [Wed, 11 Aug 2021 05:32:18 +0000 (22:32 -0700)]
[SelectionDAGBuilder] Save iterator to avoid second DenseMap lookup. NFC

We were calling find and then using operator[]. Instead keep the
iterator from find and use it to get the value.

Just happened to notice while investigating how we decide what extends
to use between basic blocks.

3 years ago[NFC][MLGO] 'Use' variable used for asserts
Mircea Trofin [Wed, 11 Aug 2021 02:46:04 +0000 (19:46 -0700)]
[NFC][MLGO] 'Use' variable used for asserts

3 years ago[llvm][clang][NFC] updates inline licence info
Christopher Di Bella [Thu, 5 Aug 2021 03:16:17 +0000 (03:16 +0000)]
[llvm][clang][NFC] updates inline licence info

Some files still contained the old University of Illinois Open Source
Licence header. This patch replaces that with the Apache 2 with LLVM
Exception licence.

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

3 years ago[gn build] Port 58915667d0b9
LLVM GN Syncbot [Wed, 11 Aug 2021 02:07:04 +0000 (02:07 +0000)]
[gn build] Port 58915667d0b9

3 years ago[CSSPGO] Additional cleanup as a follow-up to D107838
Hongtao Yu [Wed, 11 Aug 2021 02:00:33 +0000 (19:00 -0700)]
[CSSPGO] Additional cleanup as a follow-up to D107838

3 years ago[libc++] IWYU to fix Modules complaints in <__ranges/reverse_view.h>.
Arthur O'Dwyer [Wed, 11 Aug 2021 02:01:19 +0000 (22:01 -0400)]
[libc++] IWYU to fix Modules complaints in <__ranges/reverse_view.h>.

And now we can use granular concepts headers!

3 years ago[libc++][modularisation] Split up <concepts> into granular headers.
Arthur O'Dwyer [Thu, 29 Jul 2021 05:08:30 +0000 (01:08 -0400)]
[libc++][modularisation] Split up <concepts> into granular headers.

This is the complete split of <concepts>, with nothing left in the main header.

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

3 years ago[RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD
Ben Shi [Tue, 10 Aug 2021 11:56:19 +0000 (19:56 +0800)]
[RISCV][test] Add new tests for mul optimization in the zba extension with SH*ADD

Reviewed By: craig.topper

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

3 years ago[CSSPGO] Do not use getCanonicalFnName in pseudo probe descriptor decoding
Hongtao Yu [Tue, 10 Aug 2021 15:59:01 +0000 (08:59 -0700)]
[CSSPGO] Do not use getCanonicalFnName in pseudo probe descriptor decoding

Pseudo probe descriptors are created very early in the pipeline where function names just come from the front end and are not yet decorated. So calling getCanonicalFnName on the function names in probe desc is basically a no-op, which also addes a depenency from MC to ProfileData unnessesarily.

Reviewed By: wenlei, wlei

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

3 years ago[gn build] Port f9e58f35e905
LLVM GN Syncbot [Tue, 10 Aug 2021 23:45:53 +0000 (23:45 +0000)]
[gn build] Port f9e58f35e905

3 years ago[libcxx][ranges] Add `views::counted` CPO.
zoecarver [Tue, 27 Jul 2021 22:44:33 +0000 (15:44 -0700)]
[libcxx][ranges] Add `views::counted` CPO.

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

3 years ago[AArch64][GlobalISel] Relax oneuse restriction for PTR_ADD chain combining to check...
Amara Emerson [Tue, 10 Aug 2021 23:11:56 +0000 (16:11 -0700)]
[AArch64][GlobalISel] Relax oneuse restriction for PTR_ADD chain combining to check addressing legality.

With contributions by Sebastian Neubauer

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

3 years ago[M68k][GloballSel] RegBankSelect implementation
Sushma Unnibhavi [Tue, 10 Aug 2021 06:36:16 +0000 (23:36 -0700)]
[M68k][GloballSel] RegBankSelect implementation

Implementation of RegBankSelect for the M68k backend.

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