platform/upstream/llvm.git
3 years ago[libc] update benchmark distributions
Guillaume Chatelet [Tue, 13 Jul 2021 09:59:11 +0000 (09:59 +0000)]
[libc] update benchmark distributions

All distributions (expect D) have been updated using 7 days worth of data.
Distributions are smoother.
This patch also moves data from header file to individual csv file. It
helps the editor and allows easier export/plotting of the data.

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

3 years ago[RISCV] Pass undef VECTOR_SHUFFLE indices on to BUILD_VECTOR
Fraser Cormack [Wed, 23 Jun 2021 14:14:50 +0000 (15:14 +0100)]
[RISCV] Pass undef VECTOR_SHUFFLE indices on to BUILD_VECTOR

Often when lowering vector shuffles, we split the shuffle into two
LHS/RHS shuffles which are then blended together. To do so we split the
original indices into two, indexed into each respective vector. These
two index vectors are then separately lowered as BUILD_VECTORs.

This patch forwards on any undef indices to the BUILD_VECTOR, rather
than having the VECTOR_SHUFFLE lowering decide on an optimal concrete
index. The motiviation for ths change is so that we don't duplicate
optimization logic between the two lowering methods and let BUILD_VECTOR
do what it does best.

Propagating undef in this way allows us, for example, to generate
`vid.v` to produce the LHS indices of commonly-used interleave-type
shuffles. I have designs on further optimizing interleave-type and other
common shuffle patterns in the near future.

Reviewed By: craig.topper

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

3 years ago[remangleIntrinsicFunction] Detect and resolve name clash
Jeroen Dobbelaere [Tue, 13 Jul 2021 08:37:45 +0000 (10:37 +0200)]
[remangleIntrinsicFunction] Detect and resolve name clash

It is possible that the remangled name for an intrinsic already exists with a different (and wrong) prototype within the module.
As the bitcode reader keeps both versions of all remangled intrinsics around for a longer time, this can result in a
crash, as can be seen in https://bugs.llvm.org/show_bug.cgi?id=50923

This patch makes 'remangleIntrinsicFunction' aware of this situation. When it is detected, it moves the version with the wrong prototype to a different name. That version will be removed anyway once the module is completely loaded.

With thanks to @asbirlea for reporting this issue when trying out an lto build with the full restrict patches, and @efriedma for suggesting a sane resolution mechanism.

Reviewed By: apilipenko

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

3 years ago[sanitizer_common] Define internal_usleep on Solaris
Rainer Orth [Tue, 13 Jul 2021 09:15:03 +0000 (11:15 +0200)]
[sanitizer_common] Define internal_usleep on Solaris

The Solaris/amd64 buildbot
<https://lab.llvm.org/staging/#/builders/101/builds/2845> has recently been
broken several times, at least one of those remains unfixed:

  [63/446] Generating Sanitizer-x86_64-Test
  [...]
  Undefined first referenced
   symbol       in file
  _ZN11__sanitizer15internal_usleepEy /opt/llvm-buildbot/home/solaris11-amd64/clang-solaris11-amd64/stage1/projects/compiler-rt/lib/sanitizer_common/tests/libRTSanitizerCommon.test.x86_64.a(sanitizer_common.cpp.o)
  ld: fatal: symbol referencing errors

Thist patch fixes it by defining the missing `internal_usleep`.

Tested on `amd64-pc-solaris2.11.`

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

3 years ago[NFC] Do not track calls to inlined intrinsics in IFI.
Jeroen Dobbelaere [Tue, 13 Jul 2021 08:16:41 +0000 (10:16 +0200)]
[NFC] Do not track calls to inlined intrinsics in IFI.

Just like intrinsics are not tracked for IFI.InlinedCalls, they should not be tracked for IFI.InlinedCallSites.

In the current top-of-tree this change is a NFC, but the full restrict patches (D68484) potentially trigger an read-after-free
if intrinsics are also added to the InlindeCallSites, due to a late optimization potentially removing some of the inlined intrinsics.

Also see https://lists.llvm.org/pipermail/llvm-dev/2021-July/151722.html for a discussion about the problem.

Reviewed By: aeubanks

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

3 years agosanitizer_common: optimize memory drain
Dmitry Vyukov [Sun, 11 Jul 2021 13:12:24 +0000 (15:12 +0200)]
sanitizer_common: optimize memory drain

Currently we allocate MemoryMapper per size class.
MemoryMapper mmap's and munmap's internal buffer.
This results in 50 mmap/munmap calls under the global
allocator mutex. Reuse MemoryMapper and the buffer
for all size classes. This radically reduces number of
mmap/munmap calls. Smaller size classes tend to have
more objects allocated, so it's highly likely that
the buffer allocated for the first size class will
be enough for all subsequent size classes.

Reviewed By: melver

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

3 years ago[SelectionDAG] Check use before combining into USUBSAT
Qiu Chaofan [Tue, 13 Jul 2021 06:50:26 +0000 (14:50 +0800)]
[SelectionDAG] Check use before combining into USUBSAT

Reviewed By: RKSimon

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

3 years ago[AMDGPU] Make some VOP1 instructions rematerializable
Stanislav Mekhanoshin [Fri, 9 Jul 2021 21:05:57 +0000 (14:05 -0700)]
[AMDGPU] Make some VOP1 instructions rematerializable

This is a pilot change to verify the logic. The rest will be
done in a same way, at least the rest of VOP1.

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

3 years ago[PowerPC] Fix typo in vector shuffle combining
Qiu Chaofan [Tue, 13 Jul 2021 06:32:30 +0000 (14:32 +0800)]
[PowerPC] Fix typo in vector shuffle combining

a22ecb4 fixed a crash on big endian subtargets. This commit fixes a typo
in that commit which may cause miscompile.

3 years ago[SimplifyCFG] Fix SimplifyBranchOnICmpChain to be undef/poison safe.
hyeongyu kim [Tue, 13 Jul 2021 06:34:41 +0000 (15:34 +0900)]
[SimplifyCFG] Fix SimplifyBranchOnICmpChain to be undef/poison safe.

This patch fixes the problem of SimplifyBranchOnICmpChain that occurs
when extra values are Undef or poison.

Suppose the %mode is 51 and the %Cond is poison, and let's look at the
case below.
```
%A = icmp ne i32 %mode, 0
%B = icmp ne i32 %mode, 51
%C = select i1 %A, i1 %B, i1 false
%D = select i1 %C, i1 %Cond, i1 false
br i1 %D, label %T, label %F
=>
br i1 %Cond, label %switch.early.test, label %F
switch.early.test:
switch i32 %mode, label %T [
i32 51, label %F
i32 0, label %F
]
```
incorrectness: https://alive2.llvm.org/ce/z/BWScX

Code before transformation will not raise UB because %C and %D is false,
and it will not use %Cond. But after transformation, %Cond is being used
immediately, and it will raise UB.

This problem can be solved by adding freeze instruction.

correctness: https://alive2.llvm.org/ce/z/x9x4oY

Reviewed By: nikic

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

3 years ago[MIPS] Regenerate test after D105161. NFC
David Green [Tue, 13 Jul 2021 06:31:22 +0000 (07:31 +0100)]
[MIPS] Regenerate test after D105161. NFC

3 years ago[ARM] Introduce MVEEXT ISel lowering
David Green [Tue, 13 Jul 2021 06:21:20 +0000 (07:21 +0100)]
[ARM] Introduce MVEEXT ISel lowering

Similar to D91921 (and D104515) this introduces two MVESEXT and MVEZEXT
nodes that larger-than-legal sext and zext are lowered to. These either
get optimized away or end up becoming a series of stack loads/store, in
order to perform the extending whilst keeping the order of the lanes
correct. They are generated from v8i16->v8i32, v16i8->v16i16 and
v16i8->v16i32 extends, potentially with a intermediate extend for the
larger v16i8->v16i32 extend. A number of combines have been added for
obvious cases that come up in tests, notably MVEEXT of shuffles. More
may be needed in the future, but this seems to cover most of the cases
that come up in the tests.

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

3 years ago[NFC] Edit the comment in M68kInstrInfo::ExpandMOVSZX_RM
hyeongyu kim [Tue, 13 Jul 2021 06:10:24 +0000 (15:10 +0900)]
[NFC] Edit the comment in M68kInstrInfo::ExpandMOVSZX_RM

3 years ago[PowerPC][NFC] add test case for preparing more loads/stores
Chen Zheng [Tue, 13 Jul 2021 05:37:05 +0000 (05:37 +0000)]
[PowerPC][NFC] add test case for preparing more loads/stores

3 years ago[clang] Refactor AST printing tests to share more infrastructure
Nathan Ridge [Tue, 6 Jul 2021 05:40:24 +0000 (01:40 -0400)]
[clang] Refactor AST printing tests to share more infrastructure

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

3 years ago[NFC][scudo] Clang format a file
Vitaly Buka [Tue, 13 Jul 2021 05:23:01 +0000 (22:23 -0700)]
[NFC][scudo] Clang format a file

3 years agoRevert "[X86][SSE] X86ISD::FSETCC nodes (cmpss/cmpsd) return a 0/-1 allbits signbits...
Vitaly Buka [Tue, 13 Jul 2021 05:20:49 +0000 (22:20 -0700)]
Revert "[X86][SSE] X86ISD::FSETCC nodes (cmpss/cmpsd) return a 0/-1 allbits signbits result"

Fails here https://lab.llvm.org/buildbot/#/builders/37/builds/5267

This reverts commit e4aa6ad132164839a4a97dff0d433ea4766f77f1.

3 years ago[GlobalISel] Handle more types in narrowScalar for eq/ne G_ICMP
Jessica Paquette [Wed, 30 Jun 2021 00:01:28 +0000 (17:01 -0700)]
[GlobalISel] Handle more types in narrowScalar for eq/ne G_ICMP

Generalize the existing eq/ne case using `extractParts`. The original code only
handled narrowings for types of width 2n->n. This generalization allows for any
type that can be broken down by `extractParts`.

General overview is:

- Loop over each narrow-sized part and do exactly what the 2-register case did.
- Loop over the leftover-sized parts and do the same thing
- Widen the leftover-sized XOR results to the desired narrow size
- OR that all together and then do the comparison against 0 (just like the old
  code)

This shows up a lot when building clang for AArch64 using GlobalISel, so it's
worth fixing. For the sake of simplicity, this doesn't handle the non-eq/ne
case yet.

Also remove the code in this case that notifies the observer; we're just going
to delete MI anyway so talking to the observer shouldn't be necessary.

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

3 years agoRevert "[hwasan] More realistic setjmp test."
Vitaly Buka [Tue, 13 Jul 2021 05:15:20 +0000 (22:15 -0700)]
Revert "[hwasan] More realistic setjmp test."

Breaks https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-qemu

This reverts commit 5511bfdb671505c1e7968ab8ef6032414bba3852.

3 years ago[analyzer] Print time taken to analyze each function
SharmaRithik [Tue, 13 Jul 2021 04:52:47 +0000 (04:52 +0000)]
[analyzer] Print time taken to analyze each function
Summary: This patch is a part of an attempt to obtain more
timer data from the analyzer. In this patch, we try to use
LLVM::TimeRecord to save time before starting the analysis
and to print the time that a specific function takes while
getting analyzed.

The timer data is printed along with the
-analyzer-display-progress outputs.

ANALYZE (Syntax): test.c functionName : 0.4 ms
ANALYZE (Path,  Inline_Regular): test.c functionName : 2.6 ms
Authored By: RithikSharma
Reviewer: NoQ, xazax.hun, teemperor, vsavchenko
Reviewed By: NoQ
Differential Revision: https://reviews.llvm.org/D105565

3 years ago[OpaquePtr][ISel] Use ArgListEntry::IndirectType more
Arthur Eubanks [Tue, 13 Jul 2021 04:14:35 +0000 (21:14 -0700)]
[OpaquePtr][ISel] Use ArgListEntry::IndirectType more

3 years ago[OpaquePointers][ThreadSanitizer] Cleanup calls to PointerType::getElementType()
Arthur Eubanks [Fri, 9 Jul 2021 16:24:59 +0000 (09:24 -0700)]
[OpaquePointers][ThreadSanitizer] Cleanup calls to PointerType::getElementType()

Reviewed By: #opaque-pointers, dblaikie

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

3 years agoFix test - mistaken hardcoded path from my local machine.
David Blaikie [Tue, 13 Jul 2021 01:39:41 +0000 (18:39 -0700)]
Fix test - mistaken hardcoded path from my local machine.

3 years agoDebugInfo: Use debug_rnglists.dwo for ranges in debug_info.dwo when parsing DWARFv5
David Blaikie [Tue, 13 Jul 2021 01:10:58 +0000 (18:10 -0700)]
DebugInfo: Use debug_rnglists.dwo for ranges in debug_info.dwo when parsing DWARFv5

This call would incorrectly overwrite (with the .debug_rnglists.dwo from
the executable, if there was one) the rnglists section instead of the
correct value (from the .debug_rnglists.dwo in the .dwo file) that's
applied in DWARFUnit::tryExtractDIEsIfNeeded

3 years ago[mlir][sparse] add support for AND and OR operations
Aart Bik [Mon, 12 Jul 2021 22:22:31 +0000 (15:22 -0700)]
[mlir][sparse] add support for AND and OR operations

Integral AND and OR follow the simple conjunction and disjuction rules
for lattice building. This revision also completes some of the Merge
refactoring by moving the remainder parts that are merger specific from
sparsification into utils files.

Reviewed By: gussmith23

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

3 years ago[llc] Default MCUseDwarfDirectory to true
Fangrui Song [Tue, 13 Jul 2021 00:44:02 +0000 (17:44 -0700)]
[llc] Default MCUseDwarfDirectory to true

For Clang, `MCUseDwarfDirectory` is true by default for the majority cases
(-fintegrated-as or -gdwarf-5; most targets use -fintegrated-as by default).
Defaulting MCUseDwarfDirectory to true can reduce the differences between clang
and llc.

Reviewed By: #debug-info, dblaikie

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

3 years ago[mlir][Linalg] Add 3D pooling named ops to Linalg.
Hanhan Wang [Tue, 13 Jul 2021 00:25:55 +0000 (17:25 -0700)]
[mlir][Linalg] Add 3D pooling named ops to Linalg.

Reviewed By: gysit, hanchung

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

3 years ago[compiler-rt][hwasan] Refactor kAliasRegionStart usage
Leonard Chan [Fri, 9 Jul 2021 20:41:48 +0000 (13:41 -0700)]
[compiler-rt][hwasan] Refactor kAliasRegionStart usage

This moves logic for setting kAliasRegionStart into hwasan_allocator.cpp
so other platforms that do not support aliasing mode will not need to define
kAliasRegionStart.

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

3 years agosanitizer_common: Fix build for tests
Marco Elver [Mon, 12 Jul 2021 22:39:17 +0000 (15:39 -0700)]
sanitizer_common: Fix build for tests

It turns out that COMPILER_RT_TEST_COMPILER_CFLAGS is actually a string
that is being appended to and not a list.

Therefore, append the thread-safety flags to the string. Because CMake
separates list elements by ';' when turning into a string, also
substitute ';' with ' '.

Reviewed By: hctim

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

3 years ago[Driver] Let -fno-integrated-as -gdwarf-5 use -fdwarf-directory-asm
Fangrui Song [Mon, 12 Jul 2021 22:46:20 +0000 (15:46 -0700)]
[Driver] Let -fno-integrated-as -gdwarf-5 use -fdwarf-directory-asm

While GNU as only allows the directory form of the .file directive for DWARF v5,
the integrated assembler prefers the directory form on all DWARF versions
(-fdwarf-directory-asm).

We currently set CC1 -fno-dwarf-directory-asm for -fno-integrated-as -gdwarf-5
which may cause the directory entry 0 and the filename entry 0 to be incorrect
(see D105662 and the example below). This patch makes -fno-integrated-as -gdwarf-5 use
-fdwarf-directory-asm as well.

```
cd /tmp/c

before
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -S -o - | grep '\.file.*0'
        .file   0 "/tmp/c/e/a.c" md5 0x97e31cee64b4e58a4af8787512d735b6
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -c
% llvm-dwarfdump a.o | grep include_directories
include_directories[  0] = "/tmp/c/e"

after
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -S -o - | grep '\.file.*0'
        .file   0 "/tmp/c" "e/a.c" md5 0x97e31cee64b4e58a4af8787512d735b6
% clang -g -gdwarf-5 -fno-integrated-as e/a.c -c
% llvm-dwarfdump a.o | grep include_directories
include_directories[  0] = "/tmp/c"
```

Reviewed By: #debug-info, dblaikie, osandov

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

3 years ago[mlir][tosa] Added shape propagation for TOSA pool operations.
Rob Suderman [Thu, 8 Jul 2021 22:17:15 +0000 (15:17 -0700)]
[mlir][tosa] Added shape propagation for TOSA pool operations.

Pool operations perform the same shape propagation. Included the shape
propagation and tests for these avg_pool2d and max_pool2d.

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

3 years ago[AArch64] Dump a little more info about unimplemented reg-to-reg copies. NFC
Jon Roelofs [Mon, 12 Jul 2021 22:36:36 +0000 (15:36 -0700)]
[AArch64] Dump a little more info about unimplemented reg-to-reg copies. NFC

3 years ago[AArch64] Optimize overflow checks for [s|u]mul.with.overflow.i32.
Eli Friedman [Mon, 12 Jul 2021 22:28:09 +0000 (15:28 -0700)]
[AArch64] Optimize overflow checks for [s|u]mul.with.overflow.i32.

Saves one instruction for signed, uses a cheaper instruction for
unsigned.

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

3 years ago[WebAssembly] Fixed LLD generation of 64-bit __wasm_init_memory
Wouter van Oortmerssen [Mon, 12 Jul 2021 22:05:11 +0000 (15:05 -0700)]
[WebAssembly] Fixed LLD generation of 64-bit __wasm_init_memory

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

3 years ago[mlir][sparse] add restrictive versions of division support
Aart Bik [Fri, 9 Jul 2021 20:45:23 +0000 (13:45 -0700)]
[mlir][sparse] add restrictive versions of division support

Right now, we only accept x/c with nonzero c, since this
conceptually can be treated as a x*(1/c) conjunction for both
FP and INT as far as lattice computations go. The codegen
keeps the division though to preserve precise semantics.

See discussion:
https://llvm.discourse.group/t/sparse-tensors-in-mlir/3389/28

Reviewed By: gussmith23

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

3 years ago[SelectionDAG][RISCV] Support @llvm.vscale.i64() on 32-bit targets.
Eli Friedman [Mon, 12 Jul 2021 20:06:23 +0000 (13:06 -0700)]
[SelectionDAG][RISCV] Support @llvm.vscale.i64() on 32-bit targets.

Not really useful on its own, but D105673 depends on it.

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

3 years ago[libc++] ci: Properly target macOS nodes per-os
Louis Dionne [Mon, 12 Jul 2021 21:26:16 +0000 (17:26 -0400)]
[libc++] ci: Properly target macOS nodes per-os

3 years ago[libc++] Add the 'os=macos' tag to macOS nodes to workaround lack of wildcard matching
Louis Dionne [Mon, 12 Jul 2021 21:22:26 +0000 (17:22 -0400)]
[libc++] Add the 'os=macos' tag to macOS nodes to workaround lack of wildcard matching

3 years agoRevert "Revert "Reset the wakeup timeout when we re-enter the continue wait.""
Jim Ingham [Fri, 9 Jul 2021 01:08:11 +0000 (18:08 -0700)]
Revert "Revert "Reset the wakeup timeout when we re-enter the continue wait.""

This reverts commit 82a38837150099288a1262391ef43e1fd69ffde4.

The original version had a copy-paste error: using the Interrupt timeout
for the ResumeSynchronous wait, which is clearly wrong.  This error would
have been evident with real use, but the interrupt is long enough that it
only caused one testsuite failure (in the Swift fork).

Anyway, I found that mistake and fixed it and checked all the other places
where I had to plumb through a timeout, and added a test with a short
interrupt timeout stepping over a function that takes 3x the interrupt timeout
to complete, so that should detect a similar mistake in the future.

3 years ago[PowerPC] Fix the splat immediate in PPCMIPeephole depending on if we have an Altivec...
Amy Kwan [Mon, 12 Jul 2021 21:19:15 +0000 (16:19 -0500)]
[PowerPC] Fix the splat immediate in PPCMIPeephole depending on if we have an Altivec and VSX splat instruction.

An assertion of the following can occur because Altivec and VSX splats use a different operand number for the immediate:
```
int64_t llvm::MachineOperand::getImm() const: Assertion `isImm() && "Wrong MachineOperand accessor"' failed.
```
This patch updates PPCMIPeephole.cpp assign the correct splat immediate.

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

3 years ago[libc++][ci] Clean up the Docker image
Louis Dionne [Thu, 8 Jul 2021 16:31:06 +0000 (12:31 -0400)]
[libc++][ci] Clean up the Docker image

- Remove symlinks that are not used anymore
- Stop installing GCC 10, which isn't tested anymore

3 years ago[libc++] Use 'os' tags to target Linux libc++ builders
Louis Dionne [Mon, 12 Jul 2021 20:25:29 +0000 (16:25 -0400)]
[libc++] Use 'os' tags to target Linux libc++ builders

3 years ago[clang] Document llvm options controlling pragma unroll
Yaxun (Sam) Liu [Mon, 28 Jun 2021 15:19:43 +0000 (11:19 -0400)]
[clang] Document llvm options controlling pragma unroll

Reviewed by: Artem Belevich

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

3 years ago[mlir][sparse] Add Merger unit tests (with gcc5 build fix)
Gus Smith [Mon, 12 Jul 2021 18:18:23 +0000 (18:18 +0000)]
[mlir][sparse] Add Merger unit tests (with gcc5 build fix)

This is a fix of https://reviews.llvm.org/D104956, which broke the gcc5 build.

We opt to use unit tests rather than check tests as the lattice/merger code is a small C++ component with a well-defined API. Testing this API via check tests would be far less direct and readable. In addition, as the check tests will only be able to test the API indirectly, the tests may break based on unrelated changes; e.g. changes in linalg.

Reviewed By: aartbik

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

3 years ago[libcxx] [test] Fix spurious failures in the thread join test on Windows
Martin Storsjö [Wed, 7 Jul 2021 21:06:08 +0000 (21:06 +0000)]
[libcxx] [test] Fix spurious failures in the thread join test on Windows

Make sure that the detached thread has started up before exiting
the process.

This is exactly the same fix as D105592, with the same pattern
being present in a different test case.

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

3 years ago[clang-tidy] performance-unnecessary-copy-initialization: Do not remove comments...
Felix Berger [Fri, 9 Jul 2021 20:58:01 +0000 (16:58 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Do not remove comments on new lines.

When deleting the copy assignment statement because copied variable is not used
only remove trailing comments on the same line.

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

Reviewed-by: ymandel
3 years ago[vscode] fix ubsan problem in the progress event reporter
Walter Erquinigo [Mon, 12 Jul 2021 18:46:36 +0000 (11:46 -0700)]
[vscode] fix ubsan problem in the progress event reporter

The error

UndefinedBehaviorSanitizer: undefined-behavior /Users/buildslave/jenkins/workspace/lldb-cmake-sanitized/llvm-project/lldb/tools/lldb-vscode/ProgressEvent.cpp:89:64 in

was found in https://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake-sanitized/1910/consoleFull#-15641370498254eaf0-7326-4999-85b0-388101f2d404

It turns out that we were not setting m_event_type when initializatin
and update case. The fix is very simple.

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

3 years ago[Attributes] Determine attribute properties from TableGen data
Nikita Popov [Sun, 11 Jul 2021 14:54:03 +0000 (16:54 +0200)]
[Attributes] Determine attribute properties from TableGen data

Continuing from D105763, this allows placing certain properties
about attributes in the TableGen definition. In particular, we
store whether an attribute applies to fn/param/ret (or a combination
thereof). This information is used by the Verifier, as well as the
ForceFunctionAttrs pass. I also plan to use this in LLParser,
which also duplicates info on which attributes are valid where.

This keeps metadata about attributes in one place, and makes it
more likely that it stays in sync, rather than in various
functions spread across the codebase.

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

3 years ago[libcxx][docs] Update the ranges status document to reflect the current state of...
zoecarver [Mon, 12 Jul 2021 20:09:55 +0000 (13:09 -0700)]
[libcxx][docs] Update the ranges status document to reflect the current state of the world.

Marks a few things as done. Marks a few things as in progress. Assigns a few things to me.

3 years ago[WebAssembly] fix typo in range check for Asm locals
Wouter van Oortmerssen [Mon, 12 Jul 2021 20:06:54 +0000 (13:06 -0700)]
[WebAssembly] fix typo in range check for Asm locals

3 years ago[libc++] Encode the arch and OS in buildkite agent tags
Louis Dionne [Mon, 12 Jul 2021 20:01:32 +0000 (16:01 -0400)]
[libc++] Encode the arch and OS in buildkite agent tags

3 years ago[Attributes] Remove duplicate attribute in typeIncompatible() (NFC)
Nikita Popov [Mon, 12 Jul 2021 19:59:29 +0000 (21:59 +0200)]
[Attributes] Remove duplicate attribute in typeIncompatible() (NFC)

InAlloca was listed twice, once as a normal attribute, once as a
type attribute.

3 years ago[Attributes] Replace doesAttrKindHaveArgument() (NFC)
Nikita Popov [Mon, 12 Jul 2021 19:25:46 +0000 (21:25 +0200)]
[Attributes] Replace doesAttrKindHaveArgument() (NFC)

This is now the same as isIntAttrKind(), so use that instead, as
it does not require manual maintenance. The naming is also more
accurate in that both int and type attributes have an argument,
but this method was only targeting int attributes.

I initially wanted to tighten the AttrBuilder assertion, but we
have some in-tree uses that would violate it.

3 years ago[Bazel] ignore build files under libcxx's copy of google-benchmark
Geoffrey Martin-Noble [Mon, 12 Jul 2021 19:14:11 +0000 (12:14 -0700)]
[Bazel] ignore build files under libcxx's copy of google-benchmark

https://github.com/llvm/llvm-project/commit/5208ec5c66dc updated the
of google-benchmark under libcxx adding a BUILD.bazel file. This upsets
Bazel in our overlay configuration because it tries to interpret this
file.

Currently this is breaking the CI:
https://buildkite.com/llvm-project/upstream-bazel-rbe/builds/1828

Tested (same command the CI uses)
`bazel query //... + @llvm-project//... | xargs bazel test --config=generic-clang --config=rbe --test_output=errors --test_tag_filters=-nobuildkite --build_tag_filters=-nobuildkite`

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

3 years ago[libc++] Exit from macos-ci-setup upon error
Louis Dionne [Mon, 12 Jul 2021 19:44:28 +0000 (15:44 -0400)]
[libc++] Exit from macos-ci-setup upon error

3 years ago[CostModel][X86] Adjust fptosi/fptoui SSE/AVX legalized costs based on llvm-mca reports.
Simon Pilgrim [Mon, 12 Jul 2021 16:34:38 +0000 (17:34 +0100)]
[CostModel][X86] Adjust fptosi/fptoui SSE/AVX legalized costs based on llvm-mca reports.

Update (mainly) vXf32/vXf64 -> vXi8/vXi16 fptosi/fptoui costs based on the worst case costs from the script in D103695.

Move to using legalized types wherever possible, which allows us to prune the cost tables.

3 years ago[ARC] Add disassembly for the conditioned move immediate instruction
Thomas Johnson [Thu, 8 Jul 2021 23:45:45 +0000 (16:45 -0700)]
[ARC] Add disassembly for the conditioned move immediate instruction

This change is a step towards implementing codegen for __builtin_clz().
Full support for CLZ with a regression test will follow shortly.
Differential Revision: https://reviews.llvm.org/D105560

3 years ago[libc++][ci] Add arch and os tags to the macOS CI builders
Louis Dionne [Mon, 12 Jul 2021 19:34:17 +0000 (15:34 -0400)]
[libc++][ci] Add arch and os tags to the macOS CI builders

3 years ago[PowerPC][AIX] Fix Zero-width bit fields wrt MaxFieldAlign.
Steven Wan [Mon, 12 Jul 2021 19:31:15 +0000 (15:31 -0400)]
[PowerPC][AIX] Fix Zero-width bit fields wrt MaxFieldAlign.

On AIX when there is a pragma pack, or pragma align in effect then zero-width bitfields should pad out to the end of the bitfield container but not increase the alignment requirements of the struct greater then the max field align.

Reviewed By: ZarkoCA

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

3 years ago[Attributes] Simplify attribute sorting (NFCI)
Nikita Popov [Mon, 12 Jul 2021 19:08:41 +0000 (21:08 +0200)]
[Attributes] Simplify attribute sorting (NFCI)

It's not necessary to explicitly sort by enum/int/type attribute,
as the attribute kinds are already sorted this way. We can directly
sort by kind.

3 years ago[Attributes] Assert correct attribute constructor is used (NFCI)
Nikita Popov [Mon, 12 Jul 2021 18:54:58 +0000 (20:54 +0200)]
[Attributes] Assert correct attribute constructor is used (NFCI)

Assert that enum/int/type attributes go through the constructor
they are supposed to use.

To make sure this can't happen via invalid bitcode, explicitly
verify that the attribute kind if correct there.

3 years agoRevert "sanitizer_common: add simpler ThreadRegistry ctor"
Vitaly Buka [Mon, 12 Jul 2021 18:58:01 +0000 (11:58 -0700)]
Revert "sanitizer_common: add simpler ThreadRegistry ctor"

Breaks https://lab.llvm.org/buildbot/#/builders/sanitizer-x86_64-linux-android

This reverts commit 6062c672bc5e560a4c3dc73741f9e82b39d08527.
This reverts commit 8e489b4b96e31cfb004e03cfa1393c425c504013.

3 years agoAdd newline to fix documentation build
Krzysztof Drewniak [Mon, 12 Jul 2021 16:36:27 +0000 (16:36 +0000)]
Add newline to fix documentation build

Reviewed By: xgupta

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

3 years ago[Attributes] Make type attribute handling more generic (NFCI)
Nikita Popov [Sat, 10 Jul 2021 16:36:00 +0000 (18:36 +0200)]
[Attributes] Make type attribute handling more generic (NFCI)

Followup to D105658 to make AttrBuilder automatically work with
new type attributes. TableGen is tweaked to emit First/LastTypeAttr
markers, based on which we can handle type attributes
programmatically.

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

3 years ago[Bazel] Update configuration to HEAD
Geoffrey Martin-Noble [Mon, 12 Jul 2021 18:24:13 +0000 (11:24 -0700)]
[Bazel] Update configuration to HEAD

Bazel configuration updates for
https://github.com/llvm/llvm-project/commit/75e5f0aac97d,
https://github.com/llvm/llvm-project/commit/c282d55a3857, and
https://github.com/llvm/llvm-project/commit/26e59cc19f86

Tested: `bazel test ... @llvm-project//...`

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

3 years agoRevert "sanitizer_common: optimize memory drain"
Nikita Popov [Mon, 12 Jul 2021 18:28:28 +0000 (20:28 +0200)]
Revert "sanitizer_common: optimize memory drain"

This reverts commit 072669521456a369409cf9db30739a3fac740173.

This causes the following build failure with gcc 10.3.0:

/home/nikic/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h:114:31: error: declaration of â€˜typedef class __sanitizer::MemoryMapper<__sanitizer::SizeClassAllocator64<Params> > __sanitizer::SizeClassAllocator64<Params>::MemoryMapper’ changes meaning of â€˜MemoryMapper’ [-fpermissive]
  114 |   typedef MemoryMapper<ThisT> MemoryMapper;

3 years ago[libc++] Update Google benchmark to v 1.5.5
Louis Dionne [Mon, 12 Jul 2021 17:15:34 +0000 (13:15 -0400)]
[libc++] Update Google benchmark to v 1.5.5

3 years ago[PowerPC] Custom Lowering BUILD_VECTOR for v2i64 for P7 as well
Jinsong Ji [Mon, 12 Jul 2021 17:04:54 +0000 (17:04 +0000)]
[PowerPC] Custom Lowering BUILD_VECTOR for v2i64 for P7 as well

The lowering for v2i64 is now guarded with hasDirectMove,
however, the current lowering can handle the pattern correctly,
only lowering it when there is efficient patterns and corresponding
instructions.

The original guard was added in D21135, and was for Legal action.
The code has evloved now, this guard is not necessary anymore.

Reviewed By: #powerpc, nemanjai

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

3 years ago[lld/mac] Implement -application_extension
Nico Weber [Mon, 12 Jul 2021 14:26:54 +0000 (10:26 -0400)]
[lld/mac] Implement -application_extension

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

3 years ago[WebAssembly] Custom combines for f32x4.demote_zero_f64x2
Thomas Lively [Mon, 12 Jul 2021 17:32:18 +0000 (10:32 -0700)]
[WebAssembly] Custom combines for f32x4.demote_zero_f64x2

Replace the clang builtin function and LLVM intrinsic for
f32x4.demote_zero_f64x2 with combines from normal SDNodes. Also add missing
combines for i32x4.trunc_sat_zero_f64x2_{s,u}, which share the same pattern.

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

3 years agosanitizer_common: optimize memory drain
Dmitry Vyukov [Sun, 11 Jul 2021 13:12:24 +0000 (15:12 +0200)]
sanitizer_common: optimize memory drain

Currently we allocate MemoryMapper per size class.
MemoryMapper mmap's and munmap's internal buffer.
This results in 50 mmap/munmap calls under the global
allocator mutex. Reuse MemoryMapper and the buffer
for all size classes. This radically reduces number of
mmap/munmap calls. Smaller size classes tend to have
more objects allocated, so it's highly likely that
the buffer allocated for the first size class will
be enough for all subsequent size classes.

Reviewed By: melver

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

3 years ago[NFC][compiler-rt][hwasan] Move shadow bound variables to hwasan.cpp
Leonard Chan [Fri, 9 Jul 2021 22:14:20 +0000 (15:14 -0700)]
[NFC][compiler-rt][hwasan] Move shadow bound variables to hwasan.cpp

This way, other platforms can define these values.

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

3 years ago[X86] Teach X86FloatingPoint's handleCall to only erase the FP stack if there is...
Craig Topper [Mon, 12 Jul 2021 17:09:15 +0000 (10:09 -0700)]
[X86] Teach X86FloatingPoint's handleCall to only erase the FP stack if there is a regmask operand that clobbers the FP stack.

There are some calls to functions like `__alloca` that are missing
a regmask operand. Lack of a regmask operand means that all
registers that aren't mentioned by def operands are preserved.
__alloca only updates EAX and ESP and has def operands for
them so this is ok. Because there is no regmask the register
allocator won't spill the FP registers across the call. Assuming
we want to keep the FP stack untoched across these calls, we
need to handle this is in the FP stackifier.

We might want to add a proper regmask operand to the code that
creates these calls to indicate all registers are preserved, but we'd
still need this change to the FP stackifier to know to preserve the
FP stack for such a regmask.

The test is kind of long, but bugpoint wasn't able to reduce it
any further.

Fixes PR50782

Reviewed By: pengfei

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

3 years ago[llvm-readobj] Switch command line parsing from llvm::cl to OptTable
Fangrui Song [Mon, 12 Jul 2021 17:14:42 +0000 (10:14 -0700)]
[llvm-readobj] Switch command line parsing from llvm::cl to OptTable

Users should generally observe no difference as long as they don't use
unintended option forms. Behavior changes:

* `-t=d` is removed. Use `-t d` instead.
* `--demangle=false` and `--demangle=0` cannot be used. Omit the option or use `--no-demangle`. Other flag-style options don't have `--no-` forms.
* `--help-list` is removed. This is a `cl::` specific option.
* llvm-readobj now supports grouped short options as well.
* `--color` is removed. This is generally not useful (only apply to errors/warnings) but was inherited from Support.

Some adjustment to the canonical forms
(usually from GNU readelf; currently llvm-readobj has too many redundant aliases):

* --dyn-syms is canonical. --dyn-symbols is a hidden alias
* --file-header is canonical. --file-headers is a hidden alias
* --histogram is canonical. --elf-hash-histogram is a hidden alias
* --relocs is canonical. --relocations is a hidden alias
* --section-groups is canonical. --elf-section-groups is a hidden alias

OptTable avoids global option collision if we decide to support multiplexing for binary utilities.

* Most one-dash long options are still supported. `-dt, -sd, -st, -sr` are dropped due to their conflict with grouped short options.
* `--section-mapping=false` (D57365) is strange but is kept for now.
* Many `cl::opt` variables were unnecessarily external. I added `static` whenever appropriate.

Reviewed By: jhenderson

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

3 years ago[flang][nfc] Simplify CMake
Andrzej Warzynski [Mon, 12 Jul 2021 14:55:47 +0000 (14:55 +0000)]
[flang][nfc] Simplify CMake

Folds `list(APPEND <list> [<element>...])` into the definition of
`<list>`.

3 years ago[mlir][tosa] Added more shape inference for tosa ops
Rob Suderman [Sat, 3 Jul 2021 00:00:20 +0000 (17:00 -0700)]
[mlir][tosa] Added more shape inference for tosa ops

Added shape inference for:
- scatter
- gather
- transpose
- slice
- pad
- concat
- reduction operations

Also updated reshape for more aggressive shape inference.

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

3 years ago[test] Move AMDGPU reloc test from Object to tools/llvm-readobj and simplify it
Fangrui Song [Mon, 12 Jul 2021 17:04:31 +0000 (10:04 -0700)]
[test] Move AMDGPU reloc test from Object to tools/llvm-readobj and simplify it

We already have some reloc-types-elf-*.test serving the similar purpose.

Reviewed By: jhenderson

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

3 years ago[AIX] Emit version string in .file directive
Jinsong Ji [Mon, 12 Jul 2021 03:37:06 +0000 (03:37 +0000)]
[AIX] Emit version string in .file directive

AIX .file directive support including compiler version string.
https://www.ibm.com/docs/en/aix/7.2?topic=ops-file-pseudo-op

This patch adds the support so that it will be easier to identify build
compiler in objects.

Reviewed By: #powerpc, shchenz

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

3 years ago[ARM] Expand types in VQDMULH tests. NFC
David Green [Mon, 12 Jul 2021 16:56:11 +0000 (17:56 +0100)]
[ARM] Expand types in VQDMULH tests. NFC

3 years ago[OpenMP] Remove TSAN annotations from libomp
Joachim Protze [Fri, 4 Jun 2021 12:05:05 +0000 (14:05 +0200)]
[OpenMP] Remove TSAN annotations from libomp

The annotations in libomp were never built by default. The annotations are
also superseded by the annotations which the OMPT tool libarcher.so provides.
With respect to libarcher, libomp behaves as if libarcher would be the last
element of OMP_TOOL_LIBARARIES. I.e., if no other OMPT tool gets active,
libarcher will check if an OpenMP application is built with TSan.

Since libarcher gets loaded by default, enabling LIBOMP_TSAN_SUPPORT would
result in redundant annotations for TSan, which slightly differ in details
and coverage (e.g. task dependencies are not handled well by the annotations
in libomp).

This patch removes all TSan annotations from the OpenMP runtime code.

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

3 years ago[libc++] Remove random [[nodiscard]] in the test suite
Louis Dionne [Mon, 12 Jul 2021 16:31:51 +0000 (12:31 -0400)]
[libc++] Remove random [[nodiscard]] in the test suite

3 years ago[PowerPC] Implement trap and conversion builtins for XL compatibility
Albion Fung [Mon, 12 Jul 2021 03:16:27 +0000 (22:16 -0500)]
[PowerPC] Implement trap and conversion builtins for XL compatibility

This patch implements trap and FP to and from double conversions. The builtins
generate code that mirror what is generated from the XL compiler. Intrinsics
are named conventionally with builtin_ppc, but are aliased to provide the same
builtin names as the XL compiler.

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

3 years ago[llvm-objcopy] Improve performance of long pattern lists
Fangrui Song [Mon, 12 Jul 2021 16:03:33 +0000 (09:03 -0700)]
[llvm-objcopy] Improve performance of long pattern lists

Some users use a long list of fixed patterns (PR50404) and
O(|patterns|*|symbols|) can be too slow. Such usage typically does not use
--regex or --wildcard. We can use a DenseSet<CachedHashStringRef> to optimize
name lookups.

Reviewed By: jhenderson

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

3 years agosanitizer_common: Suppress another thread safety warning
Benjamin Kramer [Mon, 12 Jul 2021 15:55:49 +0000 (17:55 +0200)]
sanitizer_common: Suppress another thread safety warning

Another follow-up to 0da172b1766e1559ef677aa836dce4f1995dfef3

compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'CandidateTSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:95:21: note: mutex acquired here
      CandidateTSD->lock();
                    ^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'TSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:101:8: note: mutex acquired here
  TSD->lock();
       ^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:103:1: error: mutex 'TSDs[Index].Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.cpp:80:23: note: mutex acquired here
      if (TSDs[Index].tryLock()) {
                      ^

3 years agosanitizer_common: Fix the build for platforms that use shared TSDs
Benjamin Kramer [Mon, 12 Jul 2021 15:47:46 +0000 (17:47 +0200)]
sanitizer_common: Fix the build for platforms that use shared TSDs

Looks like an oversight in 0da172b1766e1559ef677aa836dce4f1995dfef3

compiler-rt/lib/scudo/scudo_tsd_shared.inc:53:1: error: mutex 'TSD->Mutex' is not held on every path through here [-Werror,-Wthread-safety-analysis]
}
^
compiler-rt/lib/scudo/scudo_tsd_shared.inc:49:12: note: mutex acquired here
  if (TSD->tryLock())
           ^

3 years ago[langref] attempt to clarify semantics of inttoptr/ptrtoint for non-integral types
Philip Reames [Mon, 12 Jul 2021 15:47:42 +0000 (08:47 -0700)]
[langref] attempt to clarify semantics of inttoptr/ptrtoint for non-integral types

In review discussion on D104322, Eli and Roman quite reasonable raised concerns about the LangRef not really providing a precise definition for inttoptr/ptrtoint on non-integral types. These had previously been disallowed, but I'd pragmatically allowed them in ac81cb7e6. This is my attempt to improve the situation.

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

3 years ago[Altivec] Use signed comparison for vec_all_* and vec_any_* interfaces
Bardia Mahjour [Mon, 12 Jul 2021 15:41:16 +0000 (11:41 -0400)]
[Altivec] Use signed comparison for vec_all_* and vec_any_* interfaces

We are currently being inconsistent in using signed vs unsigned comparisons for
vec_all_* and vec_any_* interfaces that use vector bool types. For example we
use signed comparison for vec_all_ge(vector signed char, vector bool char) but
unsigned comparison for when the arguments are swapped. GCC and XL use signed
comparison instead. This patch makes clang consistent with itself and with XL
and GCC.

Reviewed By: nemanjai

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

3 years agoReland "[clang-repl] Implement partial translation units and error recovery."
Vassil Vassilev [Mon, 12 Jul 2021 13:35:20 +0000 (13:35 +0000)]
Reland "[clang-repl] Implement partial translation units and error recovery."

Original commit message:

[clang-repl] Implement partial translation units and error recovery.

https://reviews.llvm.org/D96033 contained a discussion regarding efficient
modeling of error recovery. @rjmccall has outlined the key ideas:

Conceptually, we can split the translation unit into a sequence of partial
translation units (PTUs). Every declaration will be associated with a unique PTU
that owns it.

The first key insight here is that the owning PTU isn't always the "active"
(most recent) PTU, and it isn't always the PTU that the declaration
"comes from". A new declaration (that isn't a redeclaration or specialization of
anything) does belong to the active PTU. A template specialization, however,
belongs to the most recent PTU of all the declarations in its signature - mostly
that means that it can be pulled into a more recent PTU by its template
arguments.

The second key insight is that processing a PTU might extend an earlier PTU.
Rolling back the later PTU shouldn't throw that extension away. For example, if
the second PTU defines a template, and the third PTU requires that template to
be instantiated at float, that template specialization is still part of the
second PTU. Similarly, if the fifth PTU uses an inline function belonging to the
fourth, that definition still belongs to the fourth. When we go to emit code in
a new PTU, we map each declaration we have to emit back to its owning PTU and
emit it in a new module for just the extensions to that PTU. We keep track of
all the modules we've emitted for a PTU so that we can unload them all if we
decide to roll it back.

Most declarations/definitions will only refer to entities from the same or
earlier PTUs. However, it is possible (primarily by defining a
previously-declared entity, but also through templates or ADL) for an entity
that belongs to one PTU to refer to something from a later PTU. We will have to
keep track of this and prevent unwinding to later PTU when we recognize it.
Fortunately, this should be very rare; and crucially, we don't have to do the
bookkeeping for this if we've only got one PTU, e.g. in normal compilation.
Otherwise, PTUs after the first just need to record enough metadata to be able
to revert any changes they've made to declarations belonging to earlier PTUs,
e.g. to redeclaration chains or template specialization lists.

It should even eventually be possible for PTUs to provide their own slab
allocators which can be thrown away as part of rolling back the PTU. We can
maintain a notion of the active allocator and allocate things like Stmt/Expr
nodes in it, temporarily changing it to the appropriate PTU whenever we go to do
something like instantiate a function template. More care will be required when
allocating declarations and types, though.

We would want the PTU to be efficiently recoverable from a Decl; I'm not sure
how best to do that. An easy option that would cover most declarations would be
to make multiple TranslationUnitDecls and parent the declarations appropriately,
but I don't think that's good enough for things like member function templates,
since an instantiation of that would still be parented by its original class.
Maybe we can work this into the DC chain somehow, like how lexical DCs are.

We add a different kind of translation unit `TU_Incremental` which is a
complete translation unit that we might nonetheless incrementally extend later.
Because it is complete (and we might want to generate code for it), we do
perform template instantiation, but because it might be extended later, we don't
warn if it declares or uses undefined internal-linkage symbols.

This patch teaches clang-repl how to recover from errors by disconnecting the
most recent PTU and update the primary PTU lookup tables. For instance:

```./clang-repl
clang-repl> int i = 12; error;
In file included from <<< inputs >>>:1:
input_line_0:1:13: error: C++ requires a type specifier for all declarations
int i = 12; error;
            ^
error: Parsing failed.
clang-repl> int i = 13; extern "C" int printf(const char*,...);
clang-repl> auto r1 = printf("i=%d\n", i);
i=13
clang-repl> quit
```

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

3 years ago[SelectionDAG] Simplify PromoteIntRes_INSERT_SUBVECTOR to only handle result
Bradley Smith [Thu, 8 Jul 2021 11:28:38 +0000 (11:28 +0000)]
[SelectionDAG] Simplify PromoteIntRes_INSERT_SUBVECTOR to only handle result

Let other parts of legalization handle the rest of the node, this allows
re-use of existing optimizations elsewhere.

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

3 years ago[lld/mac] Make tbd files in one test valid
Nico Weber [Mon, 12 Jul 2021 15:12:11 +0000 (11:12 -0400)]
[lld/mac] Make tbd files in one test valid

No behavior change, but ld64 can't load .tbd files without the
trailing `...`, so include them to make it easier to run tests
with l64 too.

3 years ago[libc++] Test on Clang ToT by default
Louis Dionne [Mon, 12 Jul 2021 15:10:59 +0000 (11:10 -0400)]
[libc++] Test on Clang ToT by default

This is what ffccf96e90d6b should have enabled, however the symlink
in the Docker image was not pointing to the right compiler, so we were
testing with Clang 12 instead of ToT.

3 years ago[SLP] add test for multiple logical reductions; NFC
Sanjay Patel [Mon, 12 Jul 2021 13:49:59 +0000 (09:49 -0400)]
[SLP] add test for multiple logical reductions; NFC

More coverage for:
D105730

3 years agosanitizer_common: support printing __m128i type
Dmitry Vyukov [Mon, 10 May 2021 13:35:14 +0000 (15:35 +0200)]
sanitizer_common: support printing __m128i type

__m128i is vector SSE type used in tsan.
It's handy to be able to print it for debugging.

Reviewed By: vitalybuka

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

3 years agoRemove unused parameter from parseMSInlineAsm.
Simon Tatham [Mon, 12 Jul 2021 14:05:12 +0000 (15:05 +0100)]
Remove unused parameter from parseMSInlineAsm.

No implementation uses the `LocCookie` parameter at all. Errors are
reported from inside that function by `llvm::SourceMgr`, and the
instance of that at the clang call site arranges to pass the error
messages back to a `ClangAsmParserCallback`, which is where the clang
SourceLocation for the error is computed.

(This is part of a patch series working towards the ability to make
SourceLocation into a 64-bit type to handle larger translation units.
But this particular change seems beneficial in its own right.)

Reviewed By: miyuki

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

3 years ago[analyzer] LoopUnrolling: fix crash when a loop counter is captured in a lambda by...
Abbas Sabra [Mon, 12 Jul 2021 14:04:56 +0000 (17:04 +0300)]
[analyzer] LoopUnrolling: fix crash when a loop counter is captured in a lambda by reference

Reviewed By: vsavchenko

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

3 years ago[AArch64] Silence unused variable warning. NFC.
Benjamin Kramer [Mon, 12 Jul 2021 14:01:11 +0000 (16:01 +0200)]
[AArch64] Silence unused variable warning. NFC.

AArch64ISelLowering.cpp:15167:8: warning: unused variable 'OpCode' [-Wunused-variable]
  auto OpCode = N->getOpcode();
       ^

3 years ago[libc++] NFC: Fix synopsis comments and sort includes in ranges
Louis Dionne [Mon, 12 Jul 2021 13:54:53 +0000 (09:54 -0400)]
[libc++] NFC: Fix synopsis comments and sort includes in ranges

3 years ago[clang-tidy] performance-unnecessary-copy-initialization: Disable structured bindings.
Felix Berger [Fri, 9 Jul 2021 19:53:40 +0000 (15:53 -0400)]
[clang-tidy] performance-unnecessary-copy-initialization: Disable structured bindings.

Structured bindings can currently trigger the check and lead to a wrong
fix. Because the DecompositionDecl itself is not used and the check does not
iterate through its the decl's bindings to verify whether the bindings' holding
vars are used this leads to the whole statement to be deleted.

To support structured bindings properly 3 cases would need to be considered.

  1. All holding vars are not used -> The statement can be deleted.
  2. All holding vars are used as const or not used -> auto can be converted to const auto&.
  3. Neither case is true -> leave unchanged.

In the check we'll have to separate the logic that determines this from the code
that produces the diagnostic and fixes and first determine which of the cases
we're dealing with before creating fixes.

Since this is a bigger refactoring we'll disable structured bindings for now to
prevent incorrect fixes.

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

Reviewed-by: ymandel
3 years agosanitizer_common: allow COMMON_INTERCEPTOR_ENTER to use labels
Dmitry Vyukov [Sun, 11 Jul 2021 12:25:40 +0000 (14:25 +0200)]
sanitizer_common: allow COMMON_INTERCEPTOR_ENTER to use labels

The memcpy interceptor is the only one that uses COMMON_INTERCEPTOR_ENTER
more than once in a single function. This does not allow COMMON_INTERCEPTOR_ENTER
to use labels, because they are global for the whole function (not block scoped).
Don't include COMMON_INTERCEPTOR_ENTER code twice.

Reviewed By: melver

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

3 years ago[lldb][NFC] Use ArrayRef in TypeSystemClang::SetFunctionParameters
Raphael Isemann [Mon, 12 Jul 2021 13:16:44 +0000 (15:16 +0200)]
[lldb][NFC] Use ArrayRef in TypeSystemClang::SetFunctionParameters

The implementation converts the pointer/size pair anyway back to ArrayRef.