platform/upstream/llvm.git
3 years ago[builtins] Try to ensure single copy of emulated TLS state
Shoaib Meenai [Fri, 30 Jul 2021 01:39:04 +0000 (18:39 -0700)]
[builtins] Try to ensure single copy of emulated TLS state

Multiple copies of emulated TLS state means inconsistent results when
accessing the same thread-local variable from different shared objects
(https://github.com/android/ndk/issues/1551). Making `__emutls_get_address`
be a weak default visibility symbol should make the dynamic linker
ensure only a single copy gets used at runtime. This is best-effort, but
the more robust approach of putting emulated TLS into its own shared
object would (a) be a much bigger change, and (b) shared objects are
pretty heavyweight, and adding a new one to a space-constrained
environment isn't an easy sell. Given the expected rarity of direct
accesses to emulated TLS variables across different shared objects, the
best-effort approach should suffice.

Reviewed By: danalbert, rprichard

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

3 years agoRevert "[profile] Fix profile merging with binary IDs"
Petr Hosek [Fri, 30 Jul 2021 21:32:15 +0000 (14:32 -0700)]
Revert "[profile] Fix profile merging with binary IDs"

This reverts commit 89d6eb6f8c5d94093f30a5f37b193a2422491642, this
seemed to have break a few builders.

3 years agoRevert "[hwasan] Detect use after scope within function."
Florian Mayer [Fri, 30 Jul 2021 21:32:04 +0000 (22:32 +0100)]
Revert "[hwasan] Detect use after scope within function."

This reverts commit 84705ed913659d1d5e0ee6b5ae7b298914ec87d4.

3 years ago[LoopStrengthReduction] Fix pointer extend asserts
Brendon Cahoon [Fri, 30 Jul 2021 16:45:04 +0000 (12:45 -0400)]
[LoopStrengthReduction] Fix pointer extend asserts

Additional asserts were added to ScalarEvolution to enforce
pointer/int type rules. An assert is triggered when the LSR pass
attempts to extend a pointer SCEV in GenerateTruncates.

This patch changes GenerateTruncates to exit early if the Formaula
contains a ScaledReg or BaseReg with a pointer type.

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

3 years ago[lldb] [DWARF-5] Be lazier about loading .dwo files
Eric Leese [Fri, 30 Jul 2021 11:08:00 +0000 (13:08 +0200)]
[lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

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

3 years agoRevert "[OpenMP][AMDGCN] Initial math headers support"
Jon Chesterfield [Fri, 30 Jul 2021 21:03:23 +0000 (22:03 +0100)]
Revert "[OpenMP][AMDGCN] Initial math headers support"

Broke nvptx compilation on files including <complex>

This reverts commit 12da97ea10a941f0123340831300d09a2121e173.

3 years ago[polly] Fix up regression test config with current features.
Eli Friedman [Fri, 30 Jul 2021 20:17:45 +0000 (13:17 -0700)]
[polly] Fix up regression test config with current features.

Primarily, configure substitutions so we can copy-paste the "RUN" line
of failed tests without worrying about the paths.

3 years ago[profile] Fix profile merging with binary IDs
Petr Hosek [Fri, 30 Jul 2021 09:40:27 +0000 (02:40 -0700)]
[profile] Fix profile merging with binary IDs

This fixes support for merging profiles which broke as a consequence
of e50a38840dc3db5813f74b1cd2e10e6d984d0e67. The issue was missing
adjustment in merge logic to account for the binary IDs which are
now included in the raw profile just after header.

In addition, this change also:
* Includes the version in module signature that's used for merging
to avoid accidental attempts to merge incompatible profiles.
* Moves the binary IDs size field after version field in the header
as was suggested in the review.

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

3 years ago[AMDGPU] Autogenerate checks in kernel-args.ll
Jay Foad [Thu, 29 Jul 2021 08:43:49 +0000 (09:43 +0100)]
[AMDGPU] Autogenerate checks in kernel-args.ll

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

3 years ago[mlir][sparse] move comments from cpp files into dialect doc
Aart Bik [Fri, 30 Jul 2021 19:59:20 +0000 (12:59 -0700)]
[mlir][sparse] move comments from cpp files into dialect doc

Reviewed By: rriddle

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

3 years ago[lldb] Fix remote macOS debugging on Apple Silicon
Jonas Devlieghere [Fri, 30 Jul 2021 16:35:44 +0000 (09:35 -0700)]
[lldb] Fix remote macOS debugging on Apple Silicon

Update ARMGetSupportedArchitectureAtIndex to consider remote macOS
debugging. Currently, it defaults to an iOS triple when IsHost() returns
false. This fixes TestPlatformSDK.py on Apple Silicon.

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

3 years ago[z/OS]Remove overriding default attribute aligned value
Fanbo Meng [Fri, 30 Jul 2021 19:03:40 +0000 (15:03 -0400)]
[z/OS]Remove overriding default attribute aligned value

Make DefaultAlignForAttributeAligned consistent with SystemZ.

Reviewed By: abhina.sreeskantharajan, anirudhp

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

3 years ago[PowerPC] Fix byte ordering of ld/st with length on BE
Nemanja Ivanovic [Fri, 30 Jul 2021 19:33:55 +0000 (14:33 -0500)]
[PowerPC] Fix byte ordering of ld/st with length on BE

The builtins vec_xl_len_r and vec_xst_len_r actually use the
wrong side of the vector on big endian Power9 systems. We never
spotted this before because there was no such thing as a big
endian distro that supported Power9. Now we have AIX and the
elements are in the wrong part of the vector. This just fixes
it so the elements are loaded to and stored from the right
side of the vector.

3 years ago[doc]Added examples for generic opcodes
pooja2299 [Thu, 29 Jul 2021 11:21:28 +0000 (16:51 +0530)]
[doc]Added examples for generic opcodes

Added examples to G_BR, G_BRCOND, G_BRJT, G_BRINDIRECT

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

3 years agoExplain the symbols of basic block clusters with an example in the header comments.
Rahman Lavaee [Fri, 30 Jul 2021 02:20:12 +0000 (19:20 -0700)]
Explain the symbols of basic block clusters with an example in the header comments.

This prevents from confusion with the ``labels`` option.

Reviewed By: snehasish

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

3 years ago[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs
Leonard Chan [Fri, 30 Jul 2021 18:52:27 +0000 (11:52 -0700)]
[clang][cache] Update Fuchsia-stage2.cmake to create hwasan multilibs

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

3 years ago[InstrProfiling] Make CountersPtr in __profd_ relative
Fangrui Song [Fri, 30 Jul 2021 18:52:18 +0000 (11:52 -0700)]
[InstrProfiling] Make CountersPtr in __profd_ relative

Change `CountersPtr` in `__profd_` to a label difference, which is a link-time
constant. On ELF, when linking a shared object, this requires that `__profc_` is
either private or linkonce/linkonce_odr hidden. On COFF, we need D104564 so that
`.quad a-b` (64-bit label difference) can lower to a 32-bit PC-relative relocation.

```
# ELF: R_X86_64_PC64 (PC-relative)
.quad .L__profc_foo-.L__profd_foo

# Mach-O: a pair of 8-byte X86_64_RELOC_UNSIGNED and X86_64_RELOC_SUBTRACTOR
.quad l___profc_foo-l___profd_foo

# COFF: we actually use IMAGE_REL_AMD64_REL32/IMAGE_REL_ARM64_REL32 so
# the high 32-bit value is zero even if .L__profc_foo < .L__profd_foo
# As compensation, we truncate CountersDelta in the header so that
# __llvm_profile_merge_from_buffer and llvm-profdata reader keep working.
.quad .L__profc_foo-.L__profd_foo
```

(Note: link.exe sorts `.lprfc` before `.lprfd` even if the object writer
has `.lprfd` before `.lprfc`, so we cannot work around by reordering
`.lprfc` and `.lprfd`.)

With this change, a stage 2 (`-DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_BUILD_INSTRUMENTED=IR`)
`ld -pie` linked clang is 1.74% smaller due to fewer R_X86_64_RELATIVE relocations.
```
% readelf -r pie | awk '$3~/R.*/{s[$3]++} END {for (k in s) print k, s[k]}'
R_X86_64_JUMP_SLO 331
R_X86_64_TPOFF64 2
R_X86_64_RELATIVE 476059  # was: 607712
R_X86_64_64 2616
R_X86_64_GLOB_DAT 31
```

The absolute function address (used by llvm-profdata to collect indirect call
targets) can be converted to relative as well, but is not done in this patch.

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

3 years ago[ARM] Distribute reductions based on ascending load offset
David Green [Fri, 30 Jul 2021 18:50:07 +0000 (19:50 +0100)]
[ARM] Distribute reductions based on ascending load offset

This distributes reductions based on the relative offset of loads, if
one is found from their operands. Given chains of reductions this will
then sort them in ascending load order, which in turn can help simple
prefetches latch on to increasing strides more easily.

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

3 years ago[OpenCL] Replace test for pipe struct to test it with fixed triple
Anton Zabaznov [Fri, 30 Jul 2021 16:21:05 +0000 (19:21 +0300)]
[OpenCL] Replace test for pipe struct to test it with fixed triple

Reviewed By: Anastasia

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

3 years ago[InstCombine] add more tests for vector cmp-bitcast; NFC
Sanjay Patel [Fri, 30 Jul 2021 18:11:28 +0000 (14:11 -0400)]
[InstCombine] add more tests for vector cmp-bitcast; NFC

D107170

3 years ago[InstCombine] add more tests for vector-cmp bitcast; NFC
Sanjay Patel [Fri, 30 Jul 2021 13:26:34 +0000 (09:26 -0400)]
[InstCombine] add more tests for vector-cmp bitcast; NFC

3 years ago[compiler-rt][Fuchsia] Support HWASan on Fuchsia
Leonard Chan [Wed, 2 Jun 2021 18:19:56 +0000 (11:19 -0700)]
[compiler-rt][Fuchsia] Support HWASan on Fuchsia

This allows for hwasan to be built targetting fuchsia.

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

3 years ago[compiler-rt][hwasan] Remove __sanitizer allocation functions from hwasan interface
Leonard Chan [Thu, 25 Mar 2021 21:36:47 +0000 (14:36 -0700)]
[compiler-rt][hwasan] Remove __sanitizer allocation functions from hwasan interface

These functions should not be externally used. We also do not need them internally for Fuchsia.

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

3 years ago[libc++] Improve LIBCXX_ENABLE_INCOMPLETE_FEATURES.
Mark de Wever [Fri, 30 Jul 2021 18:35:37 +0000 (14:35 -0400)]
[libc++] Improve LIBCXX_ENABLE_INCOMPLETE_FEATURES.

@tcanens pointed out the current behavior of the macro breaks the usage
pattern described in http://wg21.link/SD6
```
#  if __has_include(<optional>)
#    include <optional>
#    if __cpp_lib_optional >= 201606
#      define have_optional 1
#    endif
```

To support this usage pattern the hard errror is removed. Instead the
header includes nothing but the `<version>` header.

Reviewed By: ldionne, #libc

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

3 years ago[InstCombine] getMaskedTypeForICmpPair - remove dead code. NFCI.
Simon Pilgrim [Fri, 30 Jul 2021 17:31:50 +0000 (18:31 +0100)]
[InstCombine] getMaskedTypeForICmpPair - remove dead code. NFCI.

Ok should be true at this point, so the early-out is dead - replace with an assert.

3 years agoSelectionDAGDumper.cpp - remove nested if-else return chain. NFCI.
Simon Pilgrim [Fri, 30 Jul 2021 16:49:03 +0000 (17:49 +0100)]
SelectionDAGDumper.cpp - remove nested if-else return chain. NFCI.

Match style and don't use an else after a return.

3 years agoSelectionDAGDumper.cpp - printrWithDepthHelper - remove dead code. NFCI.
Simon Pilgrim [Fri, 30 Jul 2021 16:32:01 +0000 (17:32 +0100)]
SelectionDAGDumper.cpp - printrWithDepthHelper - remove dead code. NFCI.

Fixes coverity warning - we have an early-out for unsigned depth == 0, so the depth < 1 early-out later on is dead code.

3 years ago[mlir][sparse] template the memory resident coordinate scheme storage
Aart Bik [Fri, 30 Jul 2021 16:48:41 +0000 (09:48 -0700)]
[mlir][sparse] template the memory resident coordinate scheme storage

Rationale:
External file formats always store the values as doubles, so this was
hard coded in the memory resident COO scheme used to pass data into the
final sparse storage scheme during setup. However, with alternative methods
on the horizon of setting up these temporary COO schemes, it is time to
properly template this data structure.

Reviewed By: gussmith23

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

3 years ago[lldb] Always codesign binaries on macOS
Jonas Devlieghere [Fri, 30 Jul 2021 18:14:19 +0000 (11:14 -0700)]
[lldb] Always codesign binaries on macOS

Always codesign binaries on macOS. Apple Silicon has stricter
codesigning requirements, for example requiring macCatalyst binaries to
be signed. Ad-hoc sign everything like we do for other Darwin platforms.

3 years ago[OpenMP] Fixing llvm-omp-device-info compilation with runtimes
Jose M Monsalve Diaz [Fri, 30 Jul 2021 16:26:26 +0000 (11:26 -0500)]
[OpenMP] Fixing llvm-omp-device-info compilation with runtimes

When using `-DLLVM_ENABLED_RUNTIMES` instead of `-DLLVM_ENABLED_PROJECTS`
the `llvm-omp-device-info` tool is not compiled or installed.
In general, no llvm tool would be build on runtimes, because the
-DLLVM_BUILD_TOOLS flag is removed by the way runtimes compilation calls
cmake again.

This patch is simple. Just forward the value of this flag to the
runtime cmake command.

I'm also removing an unnecessary comment in the compilation of the tool

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

3 years ago[gn build] Port 481ad59b9fa4
LLVM GN Syncbot [Fri, 30 Jul 2021 17:57:30 +0000 (17:57 +0000)]
[gn build] Port 481ad59b9fa4

3 years ago[nfc] improve a simple call
Walter Erquinigo [Fri, 30 Jul 2021 17:54:38 +0000 (10:54 -0700)]
[nfc] improve a simple call

@jingham correctly pointed out that this call can be simplified. So
let's better do it.

3 years ago[libcxx][ranges] Add `std::ranges::single_view`.
zoecarver [Tue, 27 Jul 2021 00:27:40 +0000 (17:27 -0700)]
[libcxx][ranges] Add `std::ranges::single_view`.

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

3 years agoTrim failing test
Paul Robinson [Fri, 30 Jul 2021 17:51:01 +0000 (10:51 -0700)]
Trim failing test

Don't try to run the non-integrated assembler; just verify that the
invocations look like what we expect.  Do verify that the integrated
assembler handles warnings as expected.

3 years ago[libc][NFC] Add dummy errno target to satisfy mixed mode builds.
Siva Chandra Reddy [Fri, 30 Jul 2021 17:38:04 +0000 (17:38 +0000)]
[libc][NFC] Add dummy errno target to satisfy mixed mode builds.

In mixed mode builds, we should not be including errno as part of
LLVM libc - errno from another library (or the system library) should be
used. But, other entrypoints which use errno list LLVM libc's errno as a
dep ta satisfy the full build mode. So, we add a dummy errno
implementation with empty files to make both mixed mode and full build
mode happy.

3 years agoGlobalISel: Have lowerLoad scalarize unaligned vectors
Matt Arsenault [Mon, 26 Jul 2021 18:10:26 +0000 (14:10 -0400)]
GlobalISel: Have lowerLoad scalarize unaligned vectors

This could be smarter by picking an ideal type, or at least splitting
the vector in half first. Also handles lower for non-power-of-2,
non-extending vector loads.

Currently this just avoids failing to legalize some odd vector AMDGPU
tests, but is a step towards removing the split logic from the
NarrowScalar logic.

3 years ago[SLP]Improve splats vectorization.
Alexey Bataev [Thu, 29 Jul 2021 20:47:57 +0000 (13:47 -0700)]
[SLP]Improve splats vectorization.

Replace insertelement instructions for splats with just single
insertelement + broadcast shuffle. Also, try to merge these instructions
if they come from the same/shuffled gather node.

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

3 years agoReland "[LV] Use lookThroughAnd with logical reductions"
Kerry McLaughlin [Fri, 30 Jul 2021 13:26:30 +0000 (14:26 +0100)]
Reland "[LV] Use lookThroughAnd with logical reductions"

If a reduction Phi has a single user which `AND`s the Phi with a type mask,
`lookThroughAnd` will return the user of the Phi and the narrower type represented
by the mask. Currently this is only used for arithmetic reductions, whereas loops
containing logical reductions will create a reduction intrinsic using the widened
type, for example:

  for.body:
    %phi = phi i32 [ %and, %for.body ], [ 255, %entry ]
    %mask = and i32 %phi, 255
    %gep = getelementptr inbounds i8, i8* %ptr, i32 %iv
    %load = load i8, i8* %gep
    %ext = zext i8 %load to i32
    %and = and i32 %mask, %ext
    ...

^ this will generate an and reduction intrinsic such as the following:
    call i32 @llvm.vector.reduce.and.v8i32(<8 x i32>...)

The same example for an add instruction would create an intrinsic of type i8:
    call i8 @llvm.vector.reduce.add.v8i8(<8 x i8>...)

This patch changes AddReductionVar to call lookThroughAnd for other integer
reductions, allowing loops similar to the example above with reductions such
as and, or & xor to vectorize.

Reviewed By: david-arm, dmgreen

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

3 years agoGlobalISel: Have load lowering handle some unaligned accesses
Matt Arsenault [Thu, 22 Jul 2021 12:11:14 +0000 (08:11 -0400)]
GlobalISel: Have load lowering handle some unaligned accesses

The code for splitting an unaligned access into 2 pieces is
essentially the same as for splitting a non-power-of-2 load for
scalars. It would be better to pick an optimal memory access size and
directly use it, but splitting in half is what the DAG does.

As-is this fixes handling of some unaligned sextload/zextloads for
AMDGPU. In the future this will help drop the ugly abuse of
narrowScalar to handle splitting unaligned accesses.

3 years agoXFAIL ppc => powerpc
Paul Robinson [Fri, 30 Jul 2021 16:39:44 +0000 (09:39 -0700)]
XFAIL ppc => powerpc

3 years agoAMDGPU/GlobalISel: Fix tests using illegal copies to physregs
Matt Arsenault [Tue, 27 Jul 2021 16:42:14 +0000 (12:42 -0400)]
AMDGPU/GlobalISel: Fix tests using illegal copies to physregs

These are unlegalizable and introduce spurious failures. Ideally the
verifier would reject them. Also avoid some weird G_INSERTs.

3 years agoAMDGPU/GlobalISel: Remove special case lowering for non-pow-2 stores
Matt Arsenault [Sun, 6 Jun 2021 16:44:24 +0000 (12:44 -0400)]
AMDGPU/GlobalISel: Remove special case lowering for non-pow-2 stores

We end up with extra copies from buildAnyExtOrTrunc if these are
lowered after the register types are legalized.

3 years ago[clang-tidy] Fix cppcoreguidelines-init-variables by removing the enum
Liuke Gehry [Wed, 21 Jul 2021 11:49:00 +0000 (11:49 +0000)]
[clang-tidy] Fix cppcoreguidelines-init-variables by removing the enum
FixIt, and add support for initialization check of scoped enum

In C++, the enumeration is never Integer, and the enumeration condition judgment is added to avoid compiling errors when it is initialized to an integer.
Add support for initialization check of scope enum.

As the following case show, clang-tidy will give a wrong automatic fix:

    enum Color {Red, Green, Blue};
    enum class Gender {Male, Female};
    void func() {
      Color color; // Color color = 0; <--- fix bug
      Gender gender; // <--- no warning
    }

Reviewd By: aaron.ballman, whisperity

Differential Revision: http://reviews.llvm.org/D106431

3 years ago[flang] Move External IO tests to use GTest
Asher Mancinelli [Wed, 28 Jul 2021 15:32:36 +0000 (09:32 -0600)]
[flang] Move External IO tests to use GTest

Port external-io test to use GTest. Remove Runtime tests directory.
Rename RuntimeGTest directory to Runtime.

This is the last in a series of patches which ported tests from the old
flang/unittests/Runtime test directory to use GTest in a temporary
unittest directory under flang/unittests/RuntimeGTest. Now that all the
tests in the old directory have been ported to use GTest, the old
directory has been removed and the GTest directory has been renamed to
flang/unittests/Runtime.

Differential Revision: https://reviews.llvm.org/D105315
Reviewed by: Meinersbur, awarzynski

3 years ago[mlir] Fully qualify MemoryEffects
Markus Böck [Fri, 30 Jul 2021 16:19:30 +0000 (18:19 +0200)]
[mlir] Fully qualify MemoryEffects

The effect name is used by tablegen when generating the getEffects method of the SideEffectInterfaces. It is currently unqualified even though the class is contained within the mlir namespace, leading to compiler errors when using namespace mlir; isn't used before including the generated cpp file.

This patch fixes that by simply fully qualifying the class name.

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

3 years agoXFAIL a test on ppc64
Paul Robinson [Fri, 30 Jul 2021 16:05:03 +0000 (09:05 -0700)]
XFAIL a test on ppc64

Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/105/builds/13141
which provides no details about why it failed, but the only failure
reports are for ppc64 bots.

3 years ago[Transforms] Remove HasValueForBlock (NFC)
Kazu Hirata [Fri, 30 Jul 2021 15:56:49 +0000 (08:56 -0700)]
[Transforms] Remove HasValueForBlock (NFC)

The function seems to be unused for at least one year.

3 years ago[AIX] Pass the -b option to linker on AIX (with fix to build break)
Anjan Kumar [Fri, 30 Jul 2021 15:50:52 +0000 (15:50 +0000)]
[AIX] Pass the -b option to linker on AIX (with fix to build break)

This patch will re-enable the patch posted under https://reviews.llvm.org/D106688 originally which was reverted due to buildbreak that was caused by mismatched diagnostic message arguments.

Reviewed By: Zarko Todorovski

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

3 years ago[OpenMP][Offloading] Remove task wait in nowait interfaces
Shilei Tian [Fri, 30 Jul 2021 15:39:38 +0000 (11:39 -0400)]
[OpenMP][Offloading] Remove task wait in nowait interfaces

All `nowait` series of interfaces in `libomptarget` accept four more arguments (`int32_t depNum, void *depList, int32_t noAliasDepNum, void *noAliasDepList`) compared with their counterparts w/o `nowait`. These extra arguments were expected for dependence resolution, potentially lowered to device side. Current implementation calls `libomp` function `__kmpc_omp_taskwait`. However, the front end simply ignores them, that these four arguments are not emitted at all. As a consequence, the `depNum` and `noAliasDepNum` are garbage, which could lead to unnecessary task wait.

Reviewed By: grokos

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

3 years ago[Bazel] Typo fix
Shivam Gupta [Fri, 30 Jul 2021 15:36:14 +0000 (08:36 -0700)]
[Bazel] Typo fix

Reviewed By: GMNGeoffrey

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

3 years ago[X86] Add some initial tests for frozen constant folds
Simon Pilgrim [Fri, 30 Jul 2021 15:36:48 +0000 (16:36 +0100)]
[X86] Add some initial tests for frozen constant folds

We currently handle scalar but not vector cases

3 years agoAdd triples to try to fix a test
Paul Robinson [Fri, 30 Jul 2021 15:35:34 +0000 (08:35 -0700)]
Add triples to try to fix a test

Buildbot failure:
https://lab.llvm.org/buildbot/#/builders/105/builds/13139
which provides no details about why it failed.

3 years ago[OpenCL] Add support of __opencl_c_pipes feature macro.
Anton Zabaznov [Fri, 30 Jul 2021 11:08:59 +0000 (14:08 +0300)]
[OpenCL] Add support of __opencl_c_pipes feature macro.

'pipe' keyword is introduced in OpenCL C 2.0: so do checks for OpenCL C version while
parsing and then later on check for language options to construct actual pipe. This feature
requires support of __opencl_c_generic_address_space, so diagnostics for that is provided as well.

This is the same patch as in D106748 but with a tiny fix in checking of diagnostic messages.
Also added tests when program scope global variables are not supported.

Reviewed By: Anastasia

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

3 years ago[SVE] Add folds for sign and zero extends of vscale
Dylan Fleming [Fri, 30 Jul 2021 14:33:06 +0000 (15:33 +0100)]
[SVE] Add folds for sign and zero extends of vscale

Reviewed By: efriedma

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

3 years agoFix test that was never run.
Paul Robinson [Fri, 30 Jul 2021 14:22:56 +0000 (07:22 -0700)]
Fix test that was never run.

Commit 83df122 (r368334) added 'REQUIRES: linux' to this test, but
because triples are not respected by REQUIRES, that meant it was
invariably Unsupported.  The correct keyword would be 'system-linux'
(checking the host rather than the target).

Because the test was always skipped, commit 0cfd9e5 (r375439) did not
notice that the test modification was incorrect.

This patch corrects the REQUIRES clause and fixes the incorrect
previous patch.

Found after implementing https://reviews.llvm.org/D107162

3 years ago[OpenMP][AMDGCN] Initial math headers support
Pushpinder Singh [Fri, 30 Jul 2021 08:56:40 +0000 (08:56 +0000)]
[OpenMP][AMDGCN] Initial math headers support

With this patch, OpenMP on AMDGCN will use the math functions
provided by ROCm ocml library. Linking device code to the ocml will be
done in the next patch.

Reviewed By: JonChesterfield, jdoerfert, scchan

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

3 years ago[NFC] clang-format OptimizationLevel.h
Mircea Trofin [Fri, 30 Jul 2021 14:44:03 +0000 (07:44 -0700)]
[NFC] clang-format OptimizationLevel.h

3 years ago[PowerPC] Emit error for Altivec vector initializations when -faltivec-src-compat...
Amy Kwan [Fri, 30 Jul 2021 13:50:44 +0000 (08:50 -0500)]
[PowerPC] Emit error for Altivec vector initializations when -faltivec-src-compat=gcc is specified

Under the -faltivec-src-compat=gcc option, AltiVec vector initialization should
be treated as if they were compiled with gcc - which is, to emit an error when
the vectors are initialized in the parenthesized or non-parenthesized manner.
This patch implements this behaviour.

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

3 years ago[mlir][Vector] Add vector to outerproduct lowering for the [reduction, parallel]...
Nicolas Vasilache [Fri, 2 Jul 2021 20:09:29 +0000 (20:09 +0000)]
[mlir][Vector] Add vector to outerproduct lowering for the [reduction, parallel] case.

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

3 years ago[OpenMP][NFC] libomp: silence warnings on unused variables.
AndreyChurbanov [Fri, 30 Jul 2021 14:04:42 +0000 (17:04 +0300)]
[OpenMP][NFC] libomp: silence warnings on unused variables.

Put declarations/definitions of unused variables under corresponding macros
to silence clang build warnings.

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

3 years ago[clang][patch][FPEnv] Fix syntax errors in pragma float_control test
Melanie Blower [Fri, 30 Jul 2021 13:59:26 +0000 (09:59 -0400)]
[clang][patch][FPEnv] Fix syntax errors in pragma float_control test

In a post-commit message to https://reviews.llvm.org/D102343
@MaskRay pointed out syntax errors in one of the test cases. This
patch fixes those problems, I had forgotten the colon after the CHECK- strings.

3 years ago[AMDGPU][OpenMP] Support linking of math libraries
Pushpinder Singh [Wed, 14 Jul 2021 14:07:04 +0000 (14:07 +0000)]
[AMDGPU][OpenMP] Support linking of math libraries

Math libraries are linked only when -lm is specified. This is because
host system could be missing rocm-device-libs.

Reviewed By: JonChesterfield, yaxunl

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

3 years ago[libc++][NFC] Fix copy-paste error in the transform_view tests
Louis Dionne [Fri, 30 Jul 2021 13:51:51 +0000 (09:51 -0400)]
[libc++][NFC] Fix copy-paste error in the transform_view tests

3 years ago[ARM] Attempt to distribute reductions
David Green [Fri, 30 Jul 2021 13:48:31 +0000 (14:48 +0100)]
[ARM] Attempt to distribute reductions

This adds a combine for adds of reductions, distributing them so that
they occur sequentially to enable better use of accumulating VADDVA
instructions. It combines:
  add(X, add(vecreduce(Y), vecreduce(Z))) ->
    add(add(X, vecreduce(Y)), vecreduce(Z))
and
  add(add(A, reduce(B)), add(C, reduce(D))) ->
    add(add(add(A, C), reduce(B)), reduce(D))

These together distribute the add's so that more reductions can be
selected to VADDVA.

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

3 years ago[libomptarget][amdcgn] Add build dependency for opt
Joachim Protze [Fri, 30 Jul 2021 13:43:30 +0000 (15:43 +0200)]
[libomptarget][amdcgn] Add build dependency for opt

This patch should fix the build we observe when building LLVM from scratch.

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

3 years ago[libc++] Handle arrays in std::destroy_at
Louis Dionne [Tue, 27 Jul 2021 19:45:09 +0000 (15:45 -0400)]
[libc++] Handle arrays in std::destroy_at

Also, improve tests for std::destroy and std::destroy_n so that they
check for array support.

These changes are part of http://wg21.link/p0896 (the One Ranges proposal).

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

3 years ago[clangd] Record remote index usage
Kadir Cetinkaya [Mon, 26 Jul 2021 15:08:03 +0000 (17:08 +0200)]
[clangd] Record remote index usage

This is a gauage metric that sets particular remote-index instances as
used. It should enable accumulation of multiple streams to see number of clangd
processes making use of remote index, broken down by remote index address.

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

3 years ago[clangd] Unify compiler invocation creation
Kadir Cetinkaya [Fri, 23 Jul 2021 14:57:33 +0000 (16:57 +0200)]
[clangd] Unify compiler invocation creation

Background-indexing is fine, because it uses GlobalCompilationDatabase
to fetch the compile commands (hence uses CommandMangler), and creates
invocation through buildCompilerInvocation.

Depends on D106639.

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

3 years ago[X86][AVX] Add test case for PR51281
Simon Pilgrim [Fri, 30 Jul 2021 13:10:29 +0000 (14:10 +0100)]
[X86][AVX] Add test case for PR51281

3 years ago[clangd] Make use of diagnostic tags for some clang diags
Kadir Cetinkaya [Tue, 27 Jul 2021 12:25:29 +0000 (14:25 +0200)]
[clangd] Make use of diagnostic tags for some clang diags

It is not great to list diag ids by hand, but I don't see any other
solution unless diagnostics are annotated with these explicitly, which is a
bigger change in clang and I am not sure if would be worth it.

Diagnostics handled by this patch is by no means exhaustive, there might be
other checks that don't mention "unused"/"deprecated" in their names. But it
feels like this should be enough to catch common diagnostics and can be extended
over time.

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

3 years ago[hwasan] Detect use after scope within function.
Florian Mayer [Tue, 27 Jul 2021 08:43:59 +0000 (09:43 +0100)]
[hwasan] Detect use after scope within function.

Reviewed By: vitalybuka

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

3 years agoRevert "[lldb] [DWARF-5] Be lazier about loading .dwo files"
Jan Kratochvil [Fri, 30 Jul 2021 12:54:27 +0000 (14:54 +0200)]
Revert "[lldb] [DWARF-5] Be lazier about loading .dwo files"

This reverts commit e7b8ba103a8411fb25237727c3822d4c431e4814.

It broke 32-bit ARM - lldb-arm-ubuntu, reported by omjavaid:
  https://lab.llvm.org/buildbot/#/builders/17/builds/9595

3 years ago[SLP]Fix an assertion for the size of user nodes.
Alexey Bataev [Thu, 29 Jul 2021 14:12:15 +0000 (07:12 -0700)]
[SLP]Fix an assertion for the size of user nodes.

For the nodes with reused scalars the user may be not only of the size
of the final shuffle but also of the size of the scalars themselves,
need to check for this. It is safe to just modify the check here, since
the order of the scalars themselves is preserved, only indeces of the
reused scalars are changed. So, the users with the same size as the
number of scalars in the node, will not be affected, they still will get
the operands in the required order.

Reported by @mstorsjo in D105020.

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

3 years ago[SLP]Do not consider deleted instruction as external users.
Alexey Bataev [Thu, 29 Jul 2021 21:29:08 +0000 (14:29 -0700)]
[SLP]Do not consider deleted instruction as external users.

If the instruction was previously deleted, it should not be treated as
an external user. This fixes cost estimation and removes dead
extractelement instructions.

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

3 years ago[clangd] Enable relative configs in check mode
Kadir Cetinkaya [Fri, 30 Jul 2021 05:39:46 +0000 (07:39 +0200)]
[clangd] Enable relative configs in check mode

See https://github.com/clangd/clangd/issues/649#issuecomment-885903316.
Also disables config support in lit tests to make sure tests are not affected by
clangd config files lying around.

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

3 years ago[SLP]Fix a crash in gathered loads analysis.
Alexey Bataev [Thu, 29 Jul 2021 12:05:29 +0000 (05:05 -0700)]
[SLP]Fix a crash in gathered loads analysis.

Need to check that the minimum acceptable vector factor is at least 2,
not 0, to avoid compiler crash during gathered loads analysis.

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

3 years ago[OMPIRBuilder] add minimalist reduction support
Alex Zinenko [Fri, 30 Jul 2021 09:46:26 +0000 (11:46 +0200)]
[OMPIRBuilder] add minimalist reduction support

This introduces a builder function for emitting IR performing reductions in
OpenMP. Reduction variable privatization and initialization to the
reduction-neutral value is expected to be handled separately. The caller
provides the reduction functions. Further commits can provide implementation of
reduction functions for the reduction operators defined in the OpenMP
specification.

This implementation was tested on an MLIR fork targeting OpenMP from C and
produced correct executable code.

Reviewed By: Meinersbur

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

3 years ago[lldb] [DWARF-5] Be lazier about loading .dwo files
Eric Leese [Fri, 30 Jul 2021 11:08:00 +0000 (13:08 +0200)]
[lldb] [DWARF-5] Be lazier about loading .dwo files

This change makes sure that DwarfUnit does not load a .dwo file until
necessary. I also take advantage of DWARF 5's guarantee that the first
support file is also the primary file to make it possible to create
a compile unit without loading the .dwo file.

Review By: jankratochvil, dblaikie

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

3 years agotsan: fix another latent race size bug in test
Dmitry Vyukov [Fri, 30 Jul 2021 10:42:35 +0000 (12:42 +0200)]
tsan: fix another latent race size bug in test

The test contains a race in memset.
The size of reported race depends on how the accessed
memory range split into granules inside of tsan runtime.
The test used to report access of size 8, because presumably
the buffer ended up being aligned to 8 bytes. But after
some unrelated changes this test started to report accesses
of size 1 (presumably .data layout changed), which makes
the test fail.
Guarantee alignment of the buf object explicitly.

Reviewed By: melver

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

3 years agotsan: Support constructor arguments via New
Marco Elver [Fri, 30 Jul 2021 10:22:07 +0000 (12:22 +0200)]
tsan: Support constructor arguments via New

Make New<>() a variadic function template and forward any arguments to
the constructor. std::forward<>() is inlined to avoid including
<utility>.

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

3 years ago[lldb][AArch64] Mark mismatched tags in tag read output
David Spickett [Mon, 12 Apr 2021 10:42:26 +0000 (11:42 +0100)]
[lldb][AArch64] Mark mismatched tags in tag read output

The "memory tag read" command will now tell you
when the allocation tag read does not match the logical
tag.

(lldb) memory tag read mte_buf+(8*16) mte_buf+(8*16)+48
Logical tag: 0x9
Allocation tags:
[0xfffff7ff7080, 0xfffff7ff7090): 0x8 (mismatch)
[0xfffff7ff7090, 0xfffff7ff70a0): 0x9
[0xfffff7ff70a0, 0xfffff7ff70b0): 0xa (mismatch)

The logical tag will be taken from the start address
so the end could have a different tag. You could for example
read from ptr_to_array_1 to ptr_to_array_2. Where the latter
is tagged differently to prevent buffer overflow.

The existing command will read 1 granule if you leave
off the end address. So you can also use it as a quick way
to check a single location.

(lldb) memory tag read mte_buf
Logical tag: 0x9
Allocation tags:
[0xfffff7ff7000, 0xfffff7ff7010): 0x0 (mismatch)

This avoids the need for a seperate "memory tag check" command.

Reviewed By: omjavaid

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

3 years ago[lldb] Correct format of qMemTags type field
David Spickett [Fri, 25 Jun 2021 13:29:12 +0000 (14:29 +0100)]
[lldb] Correct format of qMemTags type field

The type field is a signed integer.
(https://sourceware.org/gdb/current/onlinedocs/gdb/General-Query-Packets.html)

However it's not packed in the packet in the way
you might think. For example the type -1 should be:
qMemTags:<addr>,<len>:ffffffff
Instead of:
qMemTags:<addr>,<len>:-1

This change makes lldb-server's parsing more strict
and adds more tests to check that we handle negative types
correctly in lldb and lldb-server.

We only support one tag type value at this point,
for AArch64 MTE, which is positive. So this doesn't change
any of those interactions. It just brings us in line with GDB.

Also check that the test target has MTE. Previously
we just checked that we were AArch64 with a toolchain
that supports MTE.

Finally, update the tag type check for QMemTags to use
the same conversion steps that qMemTags now does.
Using static_cast can invoke UB and though we do do a limit
check to avoid this, I think it's clearer with the new method.

Reviewed By: omjavaid

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

3 years ago[mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other...
Tung D. Le [Fri, 30 Jul 2021 09:52:21 +0000 (15:22 +0530)]
[mlir][affine-loop-fusion] Fix a bug that AffineIfOp prevents fusion of the other loops

The presence of AffineIfOp inside AffineFor prevents fusion of the other loops to happen. For example:

```
  affine.for %i0 = 0 to 10 {
    affine.store %cf7, %a[%i0] : memref<10xf32>
  }
  affine.for %i1 = 0 to 10 {
    %v0 = affine.load %a[%i1] : memref<10xf32>
    affine.store %v0, %b[%i1] : memref<10xf32>
  }
  affine.for %i2 = 0 to 10 {
    affine.if #set(%i2) {
      %v0 = affine.load %b[%i2] : memref<10xf32>
    }
  }
```

The first two loops were not be fused because of `affine.if` inside the last `affine.for`.

The issue seems to come from a conservative constraint that does not allow fusion if there are ops whose number of regions != 0 (affine.if is one of them).

This patch just removes such a constraint when`affine.if` is inside `affine.for`.  The existing `canFuseLoops` method is able to handle `affine.if` correctly.

Reviewed By: bondhugula, vinayaka-polymage

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

3 years agotsan: introduce New/Alloc/Free helpers
Dmitry Vyukov [Thu, 29 Jul 2021 16:14:22 +0000 (18:14 +0200)]
tsan: introduce New/Alloc/Free helpers

We frequenty allocate sizeof(T) memory and call T ctor on that memory
(C++ new keyword effectively). Currently it's quite verbose and
usually takes 2 lines of code.
Add New<T>() helper that does it much more concisely.

Rename internal_free to Free that also sets the pointer to nullptr.
Shorter and safer.

Rename internal_alloc to Alloc, just shorter.

Reviewed By: vitalybuka, melver

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

3 years ago[mlir][spirv] Fix crash in convert-gpu-to-spirv pass with memrefs with affine maps
Butygin [Wed, 28 Jul 2021 19:31:26 +0000 (22:31 +0300)]
[mlir][spirv] Fix crash in convert-gpu-to-spirv pass with memrefs with affine maps

spirv::getElementPtr can return null (for memrefs with affine map) but patterns didn't handle this.

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

3 years ago[clang] SIGSEGV at DeduceTemplateArgumentsByTypeMatch
Ivan Murashko [Fri, 30 Jul 2021 06:20:38 +0000 (09:20 +0300)]
[clang] SIGSEGV at DeduceTemplateArgumentsByTypeMatch

There is a SIGSEGV at `DeduceTemplateArgumentsByTypeMatch`. The bug [#51171](https://bugs.llvm.org/show_bug.cgi?id=51171) was filled. The reproducer can be found at the bug description.

LIT test for the issue was added:
```
./bin/llvm-lit -v ../clang/test/SemaCXX/pr51171-crash.cpp
```

The debug stack trace is below:
```
 #0 0x00000000055afcb9 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:22
 #1 0x00000000055afd70 PrintStackTraceSignalHandler(void*) /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x00000000055add2d llvm::sys::RunSignalHandlers() /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Signals.cpp:97:20
 #3 0x00000000055af701 SignalHandler(int) /home/ivanmurashko/local/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007ffff7bc2b20 __restore_rt sigaction.c:0:0
 #5 0x00007ffff66a337f raise (/lib64/libc.so.6+0x3737f)
 #6 0x00007ffff668ddb5 abort (/lib64/libc.so.6+0x21db5)
 #7 0x00007ffff668dc89 _nl_load_domain.cold.0 loadmsgcat.c:0:0
 #8 0x00007ffff669ba76 .annobin___GI___assert_fail.end assert.c:0:0
 #9 0x000000000594b210 clang::QualType::getCommonPtr() const /home/ivanmurashko/local/llvm-project/clang/include/clang/AST/Type.h:684:5
#10 0x0000000005a12ca6 clang::QualType::getCanonicalType() const /home/ivanmurashko/local/llvm-project/clang/include/clang/AST/Type.h:6467:36
#11 0x0000000005a137a6 clang::ASTContext::getCanonicalType(clang::QualType) const /home/ivanmurashko/local/llvm-project/clang/include/clang/AST/ASTContext.h:2433:58
#12 0x0000000009204584 DeduceTemplateArgumentsByTypeMatch(clang::Sema&, clang::TemplateParameterList*, clang::QualType, clang::QualType, clang::sema::TemplateDeductionInfo&, llvm::SmallVectorImpl<clang::DeducedTemplateArgument>&, unsigned int, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:1355:54
#13 0x000000000920df0d clang::Sema::DeduceTemplateArguments(clang::FunctionTemplateDecl*, clang::TemplateArgumentListInfo*, clang::QualType, clang::FunctionDecl*&, clang::sema::TemplateDeductionInfo&, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaTemplateDeduction.cpp:4354:47
#14 0x0000000009012b09 (anonymous namespace)::AddressOfFunctionResolver::AddMatchingTemplateFunction(clang::FunctionTemplateDecl*, clang::DeclAccessPair const&) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:12026:38
#15 0x0000000009013030 (anonymous namespace)::AddressOfFunctionResolver::FindAllFunctionsThatMatchTargetTypeExactly() /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:12119:9
#16 0x0000000009012679 (anonymous namespace)::AddressOfFunctionResolver::AddressOfFunctionResolver(clang::Sema&, clang::Expr*, clang::QualType const&, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:11931:5
#17 0x0000000009013c91 clang::Sema::ResolveAddressOfOverloadedFunction(clang::Expr*, clang::QualType, bool, clang::DeclAccessPair&, bool*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:12286:42
#18 0x0000000008fed85d IsStandardConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::StandardConversionSequence&, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:1712:49
#19 0x0000000008fec8ea TryImplicitConversion(clang::Sema&, clang::Expr*, clang::QualType, bool, clang::Sema::AllowedExplicit, bool, bool, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:1433:27
#20 0x0000000008ff90ba TryCopyInitialization(clang::Sema&, clang::Expr*, clang::QualType, bool, bool, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:5273:71
#21 0x00000000090024fb clang::Sema::AddBuiltinCandidate(clang::QualType*, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&, bool, unsigned int) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:7755:32
#22 0x000000000900513f (anonymous namespace)::BuiltinOperatorOverloadBuilder::addGenericBinaryArithmeticOverloads() /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:8633:30
#23 0x0000000009007624 clang::Sema::AddBuiltinOperatorCandidates(clang::OverloadedOperatorKind, clang::SourceLocation, llvm::ArrayRef<clang::Expr*>, clang::OverloadCandidateSet&) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:9205:51
#24 0x0000000009018734 clang::Sema::LookupOverloadedBinOp(clang::OverloadCandidateSet&, clang::OverloadedOperatorKind, clang::UnresolvedSetImpl const&, llvm::ArrayRef<clang::Expr*>, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:13469:1
#25 0x0000000009018d56 clang::Sema::CreateOverloadedBinOp(clang::SourceLocation, clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*, clang::Expr*, bool, bool, clang::FunctionDecl*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaOverload.cpp:13568:24
#26 0x0000000008b24797 BuildOverloadedBinOp(clang::Sema&, clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaExpr.cpp:14606:65
#27 0x0000000008b24ed5 clang::Sema::BuildBinOp(clang::Scope*, clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaExpr.cpp:14691:73
#28 0x0000000008b245d4 clang::Sema::ActOnBinOp(clang::Scope*, clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*) /home/ivanmurashko/local/llvm-project/clang/lib/Sema/SemaExpr.cpp:14566:1
#29 0x00000000085bfafb clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*, true>, clang::prec::Level) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseExpr.cpp:630:71
#30 0x00000000085bd922 clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseExpr.cpp:177:1
#31 0x00000000085cbbcd clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&, llvm::SmallVectorImpl<clang::SourceLocation>&, llvm::function_ref<void ()>) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseExpr.cpp:3368:40
#32 0x000000000857f49c clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseDecl.cpp:2416:5
#33 0x000000000857df16 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseDecl.cpp:2092:65
#34 0x000000000855f07b clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:1138:1
#35 0x000000000855f136 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:1153:57
#36 0x000000000855e644 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:975:58
#37 0x000000000855d717 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/Parser.cpp:720:42
#38 0x0000000008558e01 clang::ParseAST(clang::Sema&, bool, bool) /home/ivanmurashko/local/llvm-project/clang/lib/Parse/ParseAST.cpp:158:37
#39 0x000000000627a221 clang::ASTFrontendAction::ExecuteAction() /home/ivanmurashko/local/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1058:11
#40 0x0000000006bdcc31 clang::CodeGenAction::ExecuteAction() /home/ivanmurashko/local/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1045:5
#41 0x0000000006279b4d clang::FrontendAction::Execute() /home/ivanmurashko/local/llvm-project/clang/lib/Frontend/FrontendAction.cpp:955:38
#42 0x00000000061c3fe9 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /home/ivanmurashko/local/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:974:42
#43 0x00000000063f9c5e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /home/ivanmurashko/local/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:278:38
#44 0x0000000002603a03 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /home/ivanmurashko/local/llvm-project/clang/tools/driver/cc1_main.cpp:246:40
#45 0x00000000025f8a39 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) /home/ivanmurashko/local/llvm-project/clang/tools/driver/driver.cpp:338:20
#46 0x00000000025f9107 main /home/ivanmurashko/local/llvm-project/clang/tools/driver/driver.cpp:415:26
#47 0x00007ffff668f493 __libc_start_main (/lib64/libc.so.6+0x23493)
#48 0x00000000025f729e _start (/data/users/ivanmurashko/llvm-project/build/bin/clang-13+0x25f729e)
```

Reviewed By: erichkeane

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

3 years agotsan: optimize test-only barrier
Dmitry Vyukov [Fri, 30 Jul 2021 06:35:11 +0000 (08:35 +0200)]
tsan: optimize test-only barrier

The updated lots_of_threads.c test with 300 threads
started running for too long on machines with low
hardware parallelism (e.g. taskset -c 0-1).
On lots of CPUs it finishes in ~2 secs. But with
taskset -c 0-1 it runs for hundreds of seconds
effectively spinning in the barrier in the sleep loop.

We now have the handy futex API in sanitizer_common.
Use it instead of the passive spin loop.
It makes the test run only faster with taskset -c 0-1,
it runs for ~1.5 secs, while with full parallelism
it still runs for ~2 secs (but consumes less CPU time).

Depends on D107131.

Reviewed By: vitalybuka

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

3 years agotsan: fix latent race size bug in test
Dmitry Vyukov [Fri, 30 Jul 2021 06:45:16 +0000 (08:45 +0200)]
tsan: fix latent race size bug in test

The test contains a race in read/write syscalls.
The size of reported race depends on how the accessed
memory range split into granules inside of tsan runtime.
The test used to report access of size 8, because presumably
the buffer ended up being aligned to 8 bytes. But after
some unrelated changes this test started to report accesses
of size 1 (presumably .data layout changed), which makes
the test fail.
Guarantee alignment of the buf object explicitly.

Reviewed By: vitalybuka, melver

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

3 years ago[ARM] Turn vecreduce_add(add(x, y)) into vecreduce(x) + vecreduce(y)
David Green [Fri, 30 Jul 2021 09:10:41 +0000 (10:10 +0100)]
[ARM] Turn vecreduce_add(add(x, y)) into vecreduce(x) + vecreduce(y)

Under MVE we can use VADDV/VADDVA's to perform integer add reductions,
so it can be beneficial to use more reductions than summing subvectors
and reducing once. Especially for VMLAV/VMLAVA the mul can be
incorporated into the reduction, producing less instructions.

Some of the test cases currently get larger due to extra integer adds,
but will be improved in a followup patch.

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

3 years ago[ARM] MVE SLP'd reduction tests. NFC
David Green [Fri, 30 Jul 2021 08:43:29 +0000 (09:43 +0100)]
[ARM] MVE SLP'd reduction tests. NFC

These are generated from SLP vectorization, for example
https://godbolt.org/z/ebxdPh1Kz. These backend tests
show cases that we can produce better code for.

3 years agoRevert "[LLDB][GUI] Expand selected thread tree item by default"
Muhammad Omair Javaid [Thu, 29 Jul 2021 11:15:27 +0000 (16:15 +0500)]
Revert "[LLDB][GUI] Expand selected thread tree item by default"

This reverts commit fed25ddc1c3de59aa1de27e95b349f86896ccb79.

There has been sporadic failures in LLDB AArch64/Arm 32 buildbots since
this commit. I am temporarily reverting it see if it fixes the issue.

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

3 years ago[OpenCL] Add std flag aliases clc++1.0 and CLC++1.0
Anastasia Stulova [Thu, 29 Jul 2021 14:10:13 +0000 (15:10 +0100)]
[OpenCL] Add std flag aliases clc++1.0 and CLC++1.0

Renamed language standard from openclcpp to openclcpp10.
Added new std values i.e. '-cl-std=clc++1.0' and
'-cl-std=CLC++1.0'.

Patch by Topotuna (Justas Janickas)!

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

3 years ago[flang] Fix `flang` (the bash wrapper script for the Flang driver)
Andrzej Warzynski [Fri, 30 Jul 2021 07:59:13 +0000 (08:59 +0100)]
[flang] Fix `flang` (the bash wrapper script for the Flang driver)

Remove erroneous `||` at the end of an `if` condition. This was
introduced in https://reviews.llvm.org/D106871.

3 years ago[AArch64][SME] Introduce feature for streaming mode
Cullen Rhodes [Fri, 30 Jul 2021 07:30:45 +0000 (07:30 +0000)]
[AArch64][SME] Introduce feature for streaming mode

The Scalable Matrix Extension (SME) introduces a new execution mode
called Streaming SVE mode. In streaming mode a substantial subset of the
SVE and SVE2 instruction set is available, along with new outer product,
load, store, extract and insert instructions that operate on the new
architectural register state for the matrix.

To support streaming mode this patch introduces a new subtarget feature
+streaming-sve. If enabled, the subset of SVE(2) instructions are
available. The existing behaviour for SVE(2) remains unchanged, the
subset of instructions that are legal in streaming mode are enabled if
either +sve[2] or +streaming-sve is specified. Instructions that are
illegal in streaming mode remain predicated on +sve[2].

The SME target feature has been updated to imply +streaming-sve rather
than +sve.

The following changes are made to the SVE(2) tests:
  * For instructions that are legal in streaming mode:
    - added RUN line to verify +streaming-sve enables the instruction.
    - updated diagnostic to 'instruction requires: streaming-sve or sve'.
  * For instructions that are illegal in streaming-mode:
    - added RUN line to verify +streaming-sve does not enable the
      instruction.

SVE(2) instructions that are legal in streaming mode have:

  if !HaveSVE[2]() && !HaveSME() then UNDEFINED;

at the top of the pseudocode in the XML.

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

Reviewed By: sdesmalen, david-arm

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

3 years ago[JITLink][ELF][x86-64] Include relocation name in missing relocation errors.
Lang Hames [Fri, 30 Jul 2021 04:26:07 +0000 (14:26 +1000)]
[JITLink][ELF][x86-64] Include relocation name in missing relocation errors.

This saves a level of manual table lookup for those of us who don't remember
ELF relocation numbers off the top of our heads.

3 years agoTake OptimizationLevel class out of Pass Builder
Tarindu Jayatilaka [Fri, 30 Jul 2021 04:42:05 +0000 (21:42 -0700)]
Take OptimizationLevel class out of Pass Builder

Pulled out the OptimizationLevel class from PassBuilder in order to be able to access it from within the PassManager and avoid include conflicts.

Reviewed By: mtrofin

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

3 years ago[OpenCL] opencl-c.h: add CL 3.0 non-generic address space atomics
Dave Airlie [Fri, 30 Jul 2021 04:46:47 +0000 (14:46 +1000)]
[OpenCL] opencl-c.h: add CL 3.0 non-generic address space atomics

CL 2.0 introduced atomics and generic address space so there were
only one set of APIs for doing atomics, however since CL 3.0
makes generic address space optional, there has to be new sets
of atomic interfaces to handle that cases.

Reviewed By: Anastasia

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

3 years agoFix scalar unit tests for all, any, maxloc, etc. that caused the ARM build
Mark Leair [Fri, 30 Jul 2021 04:13:46 +0000 (21:13 -0700)]
Fix scalar unit tests for all, any, maxloc, etc. that caused the ARM build
to fail due to warnings as errors. Note that I could not reproduce the
problem locally, but based on the messages, I think this change will fix
the errors.

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

3 years agoRevert "[OpenCL] Add support of __opencl_c_pipes feature macro."
Anton Zabaznov [Fri, 30 Jul 2021 03:34:17 +0000 (06:34 +0300)]
Revert "[OpenCL] Add support of __opencl_c_pipes feature macro."

This reverts commit d1e4b25756730576996457ba7324e9bf210e3693.

3 years ago[OpenCL] Add support of __opencl_c_pipes feature macro.
Anton Zabaznov [Fri, 30 Jul 2021 01:56:21 +0000 (04:56 +0300)]
[OpenCL] Add support of __opencl_c_pipes feature macro.

'pipe' keyword is introduced in OpenCL C 2.0: so do checks for OpenCL C version while
parsing and then later on check for language options to construct actual pipe. This feature
requires support of __opencl_c_generic_address_space, so diagnostics for that is provided as well.

Reviewed By: Anastasia

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