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

3 years agoSimplify coro::salvageDebugInfo() (NFC-ish)
Adrian Prantl [Tue, 10 Aug 2021 22:02:25 +0000 (15:02 -0700)]
Simplify coro::salvageDebugInfo() (NFC-ish)

This patch removes the hand-rolled implementation of salvageDebugInfo
for cast and GEPs and replaces it with a call into
llvm::salvageDebugInfoImpl().

A side-effect of this is that additional redundant convert operations
are introduced, but those don't have any negative effect on the
resulting DWARF expression.

rdar://80227769

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

3 years agoStreamline the API of salvageDebugInfoImpl (NFC)
Adrian Prantl [Mon, 2 Aug 2021 23:59:45 +0000 (16:59 -0700)]
Streamline the API of salvageDebugInfoImpl (NFC)

This patch refactors / simplifies salvageDebugInfoImpl(). The goal
here is to simplify the implementation of coro::salvageDebugInfo() in
a followup patch.

  1. Change the return value to I.getOperand(0). Currently users of
     salvageDebugInfoImpl() assume that the first operand is
     I.getOperand(0). This patch makes this information explicit. A
     nice side-effect of this change is that it allows us to salvage
     expressions such as add i8 1, %a in the future.

  2. Factor out the creation of a DIExpression and return an array of
     DIExpression operations instead. This change allows users that
     call salvageDebugInfoImpl() in a loop to avoid the costly
     creation of temporary DIExpressions and to defer the creation of
     a DIExpression until the end.

This patch does not change any functionality.

rdar://80227769

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

3 years ago[lld][WebAssembly] Prefer objdump -d over obj2yaml for tests. NFC
Sam Clegg [Tue, 27 Jul 2021 18:06:03 +0000 (11:06 -0700)]
[lld][WebAssembly] Prefer objdump -d over obj2yaml for tests. NFC

Now that we have https://reviews.llvm.org/D105539 we can
use objdump -d to actually check for instruction sequences
rather than binary blobs.

This is just an example of how to do that we should followup
with a wider ranging conversion of existing tests.

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

3 years ago[mlir][tosa] Add folders for trivial tosa operation cases
Rob Suderman [Tue, 10 Aug 2021 21:42:56 +0000 (14:42 -0700)]
[mlir][tosa] Add folders for trivial tosa operation cases

Some folding cases are trivial to fold away, specifically no-op cases where
an operation's input and output are the same. Canonicalizing these away
removes unneeded operations.

The current version includes tensor cast operations to resolve shape
discreprencies that occur when an operation's result type differs from the
input type. These are resolved during a tosa shape propagation pass.

Reviewed By: NatashaKnk

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

3 years ago[mlir][tosa] Add dilation to tosa.transpose_conv2d lowering
Rob Suderman [Tue, 10 Aug 2021 21:36:08 +0000 (14:36 -0700)]
[mlir][tosa] Add dilation to tosa.transpose_conv2d lowering

Dilation only requires increasing the padding on the left/right side of the
input, and including dilation in the convolution. This implementation still
lacks support for strided convolutions.

Reviewed By: NatashaKnk

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

3 years ago[mlir][tosa] Add quantized and unquantized versions for tosa.depthwise_conv2d lowering
natashaknk [Tue, 10 Aug 2021 21:29:15 +0000 (14:29 -0700)]
[mlir][tosa] Add quantized and unquantized versions for tosa.depthwise_conv2d lowering

Reviewed By: rsuderman

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

3 years ago[analyzer] Cleanup a FIXME in SValBuilder.cpp
Vince Bridgers [Sun, 8 Aug 2021 20:36:37 +0000 (15:36 -0500)]
[analyzer] Cleanup a FIXME in SValBuilder.cpp

This change follows up on a FIXME submitted with D105974. This change simply let's the reference case fall through to return a concrete 'true'
instead of a nonloc pointer of appropriate length set to NULL.

Reviewed By: NoQ

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

3 years ago[Sema] Include full range of the switch condition in -Wswitch diagnostic
Sam McCall [Tue, 10 Aug 2021 20:49:49 +0000 (22:49 +0200)]
[Sema] Include full range of the switch condition in -Wswitch diagnostic

3 years ago[RISCV] Remove stale TODO from test. NFC
Craig Topper [Tue, 10 Aug 2021 20:13:44 +0000 (13:13 -0700)]
[RISCV] Remove stale TODO from test. NFC

3 years ago[mlir][drr] Improve error message for unexpected attribute (NFC)
Jacques Pienaar [Tue, 10 Aug 2021 20:03:52 +0000 (13:03 -0700)]
[mlir][drr] Improve error message for unexpected attribute (NFC)

When using an attribute where a value is expected previously this would fail
complaining about unbound symbol. Instead make error clear and mention common
failure reason.

3 years ago[docs] Clarify variable-width integer (VBR) encoding example.
Volodymyr Sapsai [Tue, 10 Aug 2021 01:42:26 +0000 (18:42 -0700)]
[docs] Clarify variable-width integer (VBR) encoding example.

Show that the bit chunks are placed starting at the least significant
bit. Select a different number, so the bit chunks have different values
and it is more obvious where they are in the encoded result.

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

3 years ago[mlir] Support normalizing memrefs with MemRef_ReinterpretCastOp
Haruki Imai [Tue, 10 Aug 2021 19:45:07 +0000 (01:15 +0530)]
[mlir] Support normalizing memrefs with MemRef_ReinterpretCastOp

This patch enables normalizing memrefs with MemRef_ReinterpretCastOp by
adding MemRefsNormalizable trait in the Op definition.

Signed-off-by: Haruki Imai <imaihal@jp.ibm.com>
Reviewed By: bondhugula

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

3 years ago[MemCpyOpt] Optimize MemoryDef insertion
Nikita Popov [Sat, 7 Aug 2021 21:09:09 +0000 (23:09 +0200)]
[MemCpyOpt] Optimize MemoryDef insertion

When converting a store into a memset, we currently insert the new
MemoryDef after the store MemoryDef, which requires all uses to be
renamed to the new def using a whole block scan. Instead, we can
insert the new MemoryDef before the store and not rename uses,
because we know that the location is immediately overwritten, so
all uses should still refer to the old MemoryDef. Those uses will
get renamed when the old MemoryDef is actually dropped, which is
efficient.

I expect something similar can be done for some of the other MSSA
updates in MemCpyOpt. This is an alternative to D107513, at least
for this particular case.

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

3 years ago[mlir] Change the pattern for TiledLoopOp bufferization.
Alexander Belyaev [Tue, 10 Aug 2021 19:08:10 +0000 (21:08 +0200)]
[mlir] Change the pattern for TiledLoopOp bufferization.

This version is does not affect the patterns for Extract/InsertSliceOp and
LinalgOps.

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

3 years ago[ARC] Add codegen for count trailing zeros intrinsic for the ARC backend
Thomas Johnson [Sat, 7 Aug 2021 19:05:59 +0000 (21:05 +0200)]
[ARC] Add codegen for count trailing zeros intrinsic for the ARC backend

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

3 years ago[InlineAdvisor] Add single quotes around caller/callee names
Fangrui Song [Tue, 10 Aug 2021 18:51:31 +0000 (11:51 -0700)]
[InlineAdvisor] Add single quotes around caller/callee names

Clang diagnostics refer to identifier names in quotes.
This patch makes inline remarks conform to the convention.
New behavior:

```
% clang -O2 -Rpass=inline -Rpass-missed=inline -S a.c
a.c:4:25: remark: 'foo' inlined into 'bar' with (cost=-30, threshold=337) at callsite bar:0:25; [-Rpass=inline]
int bar(int a) { return foo(a); }
                        ^
```

Reviewed By: hoy

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

3 years ago[mlir] Enable specifying querying function in ValueShapeRange
Jacques Pienaar [Tue, 10 Aug 2021 18:44:20 +0000 (11:44 -0700)]
[mlir] Enable specifying querying function in ValueShapeRange

This enables querying shapes/values as shapes without mutating the IR
directly (e.g., towards enabling doing inference in analysis &
application steps, inferring function shape with constant from callsite,
...). Add a new ShapeAdaptor that abstracts over whether shape is from
Type or ShapedTypeComponents or DenseIntElementsAttribute. This adds new
accessors to ValueShapeRange to get Shape and value as shape, but
doesn't restrict or remove the previous way of accessing Type via the
Value for now, that does mean a less refined shape could be accidentally
queried and will be restricted in follow up.

Currently restricted Value query to what can be represented as Shape. So
only supports cases where constant subgraph evaluation's output is a
shape. I had considered making it more general, but without TBD extern
attribute concept or some such a user cannot today uniformly avoid
overhead.

Update TOSA ops and also the shape inference pass.

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

3 years ago[nfc] [lldb] Assertions for D106270 - [DWARF5] Fix offset check when using .debug_names
Jan Kratochvil [Tue, 10 Aug 2021 18:39:40 +0000 (20:39 +0200)]
[nfc] [lldb] Assertions for D106270 - [DWARF5] Fix offset check when using .debug_names

Skeleton vs. DWO units mismatch has been fixed in D106270. As they both
have type DWARFUnit it is a bit difficult to debug. So it is better to
make it safe against future changes.

Reviewed By: kimanh, clayborg

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

3 years ago[InstCombine] avoid infinite loops from min/max canonicalization
Sanjay Patel [Tue, 10 Aug 2021 18:30:43 +0000 (14:30 -0400)]
[InstCombine] avoid infinite loops from min/max canonicalization

The intrinsics have an extra chunk of known bits logic
compared to the normal cmp+select idiom. That allows
folding the icmp in each case to something better, but
that then opposes the canonical form of min/max that
we try to form for a select.

I'm carving out a narrow exception to preserve all
existing regression tests while avoiding the inf-loop.
It seems unlikely that this is the only bug like this
left, but this should fix:
https://llvm.org/PR51419

3 years ago[OpenMP] AlwaysInline __kmpc_parallel_51 to improve inlining hueristics
Joseph Huber [Tue, 10 Aug 2021 16:08:17 +0000 (12:08 -0400)]
[OpenMP] AlwaysInline __kmpc_parallel_51 to improve inlining hueristics

This patch adds the `AlwaysInline` attribute to the `__kmpc_parallel_51`
device runtime call. This improves inlining heuristics which encourages
the indirect function pointer arguemnt to also be inlined. This greatly
improves performance for a few applications whose outlined regions were
not inlined otherwise.

Reviewed By: jdoerfert

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