lldb.git
2 years ago[libc] Add an optional `NAME` argument to `add_entrypoint_object` rule.
Siva Chandra Reddy [Fri, 21 Feb 2020 06:05:52 +0000 (22:05 -0800)]
[libc] Add an optional `NAME` argument to `add_entrypoint_object` rule.

This argument can be used to specify the entrypoint name if it is different
from the target name.

Reviewers: gchatelet, abrachet

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

2 years agoSome fixes for open breaks on MacOS and UBSan
ogiroux [Thu, 27 Feb 2020 00:49:37 +0000 (16:49 -0800)]
Some fixes for open breaks on MacOS and UBSan

2 years agoFix buildbot break after c46b85aaf4d4
Nemanja Ivanovic [Thu, 27 Feb 2020 03:56:11 +0000 (21:56 -0600)]
Fix buildbot break after c46b85aaf4d4

I added test cases that rely on the availability of the PPC target into
the general directory for the loop vectorizer. This causes failures on
bots that don't build the PPC target. Moving them to the PowerPC directory
to fix this.

2 years ago[LoopVectorize] Fix cost for calls to functions that have vector versions
Nemanja Ivanovic [Wed, 26 Feb 2020 23:13:14 +0000 (17:13 -0600)]
[LoopVectorize] Fix cost for calls to functions that have vector versions

A recent commit
(https://reviews.llvm.org/rG66c120f02560ef528a60924104ead66f330190f1) changed
the cost for calls to functions that have a vector version for some
vectorization factor. However, no check is performed for whether the
vectorization factor matches the current one being cost modeled. This leads to
attempts to widen call instructions to a vectorization factor for which such a
function does not exist, which in turn leads to an assertion failure.

This patch adds the check for vectorization factor (i.e. not just that the
called function has a vector version for some VF, but that it has a vector
version for this VF).

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

2 years agoAMDGPU/GlobalISel: Add missing test for G_UMULH
Matt Arsenault [Thu, 27 Feb 2020 03:29:33 +0000 (22:29 -0500)]
AMDGPU/GlobalISel: Add missing test for G_UMULH

2 years agoGlobalISel: Fix lowering for G_UADDE/G_USUBE
Matt Arsenault [Wed, 26 Feb 2020 22:21:10 +0000 (17:21 -0500)]
GlobalISel: Fix lowering for G_UADDE/G_USUBE

The type parameter passed into lower is invalid and should be removed
from the function.

2 years agoAMDGPU/GlobalISel: Add missing G_[US]ADDE/G_[US]SUBE tests
Matt Arsenault [Wed, 26 Feb 2020 22:12:54 +0000 (17:12 -0500)]
AMDGPU/GlobalISel: Add missing G_[US]ADDE/G_[US]SUBE tests

The s64 case currently crashes, so leave that for later.

2 years agoGlobalISel: Cleanup code with MachineIRBuilder features
Matt Arsenault [Wed, 26 Feb 2020 22:18:43 +0000 (17:18 -0500)]
GlobalISel: Cleanup code with MachineIRBuilder features

2 years ago[docs][LoopTerminology] Add Loop Simplify Form description.
Stefanos Baziotis [Thu, 27 Feb 2020 02:36:11 +0000 (20:36 -0600)]
[docs][LoopTerminology] Add Loop Simplify Form description.

Information taken from https://youtu.be/3pRhvQi7Z10?t=481 and
comments in LoopSimplify.h.

Reviewed By: Meinersbur

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

2 years ago[X86] Add test cases showing incorrect setting of nofpexcept flag due to CSE occuring...
Craig Topper [Thu, 27 Feb 2020 02:06:59 +0000 (18:06 -0800)]
[X86] Add test cases showing incorrect setting of nofpexcept flag due to CSE occuring during SelectionDAG creation.

These tests generate two nodes that are identical except for the
metadata that indicates their exception behavior. The nodes get
CSEd by SelectionDAG, but the nofpexcept flag is being set based
only on the fpexcept.ignore node being created last.

We need to detect this case and intersect the flags similar to
what is already done with fast math flags.

2 years ago[ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"
Fangrui Song [Thu, 27 Feb 2020 00:24:58 +0000 (16:24 -0800)]
[ELF][test] Rename SHF_LINK_ORDER related "metadata" to "linkorder"

Test cleanups.

2 years agoCost Annotation Writer for InlineCost
Kirill Naumov [Wed, 26 Feb 2020 23:44:42 +0000 (15:44 -0800)]
Cost Annotation Writer for InlineCost

Add extra diagnostics for the inline cost analysis under
-print-instruction-deltas cl option. When enabled along with
-debug-only=inline-cost it prints the IR of inline candidate
annotated with cost and threshold change per every instruction.

Reviewed By: apilipenko, davidxl, mtrofin

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

2 years ago[X86] Add proper MachinePointerInfo to stack store created in LowerWin64_i128OP.
Craig Topper [Thu, 27 Feb 2020 00:54:38 +0000 (16:54 -0800)]
[X86] Add proper MachinePointerInfo to stack store created in LowerWin64_i128OP.

2 years ago[libc++] Workaround unused variable warning in test
Louis Dionne [Thu, 27 Feb 2020 00:29:49 +0000 (19:29 -0500)]
[libc++] Workaround unused variable warning in test

This only showed up in C++11/C++14 where the static_assert below was
ifdef'd out, and the variable was indeed unused.

2 years ago[X86] Explicitly pass Destination VT and debug location to BuildFILD. NFC
Craig Topper [Thu, 27 Feb 2020 00:16:03 +0000 (16:16 -0800)]
[X86] Explicitly pass Destination VT and debug location to BuildFILD. NFC

We'd already passed most everything else. Might was well pass
these two things and stop passing Op.

2 years ago[X86] Explicitly pass Pointer, MachinePointerInfo and Alignment to BuildFILD.
Craig Topper [Thu, 27 Feb 2020 00:02:32 +0000 (16:02 -0800)]
[X86] Explicitly pass Pointer, MachinePointerInfo and Alignment to BuildFILD.

Previously this code was called into two ways, either a FrameIndexSDNode
was passed in StackSlot. Or a load node was passed in the argument
called StackSlot. This was determined by a dyn_cast to FrameIndexSDNode.

In the case of a load, we had to go find the real pointer from
operand 0 and cast the node to MemSDNode to find the pointer info.

For the stack slot case, the code assumed that the stack slot
was perfectly aligned despite not being the creator of the slot.

This commit modifies the interface to make the caller responsible
for passing all of the required information to avoid all the
guess work and reverse engineering.

I'm not aware of any issues with the original code after an
earlier commit to fix the alignment of one of the stack objects.
This is just clean up to make the code less surprising.

2 years agoRevert "[libc++] Do not set the `availability=XXX` feature when not testing against...
Louis Dionne [Thu, 27 Feb 2020 00:14:34 +0000 (19:14 -0500)]
Revert "[libc++] Do not set the `availability=XXX` feature when not testing against a system libc++"

This reverts commit 7dd6a862e, which broke more tests than it fixed.

2 years ago[libc++] Temporarily disable availability markup for the C++20 Synchronization library
Louis Dionne [Thu, 27 Feb 2020 00:09:07 +0000 (19:09 -0500)]
[libc++] Temporarily disable availability markup for the C++20 Synchronization library

The markup wasn't quite right, and that broke compilation with availability
markup enabled. I'm disabling it until I have time to fix it properly to
get the CI mostly green again.

2 years agoPR44978: Accept as an extension some cases where destructor name lookup
Richard Smith [Wed, 26 Feb 2020 22:50:04 +0000 (14:50 -0800)]
PR44978: Accept as an extension some cases where destructor name lookup
is ambiguous, but only one of the possible lookup results could possibly
be right.

Clang recently started diagnosing ambiguity in more cases, and this
broke the build of Firefox. GCC, ICC, MSVC, and previous versions of
Clang all accept some forms of ambiguity here (albeit different ones in
each case); this patch mostly accepts anything any of those compilers
accept.

2 years agoDisable memory leak checking in a test to work around a bot failure
Erik Pilkington [Wed, 26 Feb 2020 22:47:02 +0000 (14:47 -0800)]
Disable memory leak checking in a test to work around a bot failure

This leak is expected, see the discussion on commit 85fb997

2 years agoVisit previously unreachable nodes in the debug info metadata verifier.
Adrian Prantl [Wed, 26 Feb 2020 22:12:30 +0000 (14:12 -0800)]
Visit previously unreachable nodes in the debug info metadata verifier.

This allows for diagnosing malformed LLVM IR debug info metadata such
as the one in the testcase.

<rdar://problem/59756060>

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

2 years ago[X86] Query constant pool object alignment instead of hardcoding.
Craig Topper [Wed, 26 Feb 2020 22:11:19 +0000 (14:11 -0800)]
[X86] Query constant pool object alignment instead of hardcoding.

2 years ago[X86] Use proper alignment for stack temporary and correct MachinePointerInfo for...
Craig Topper [Wed, 26 Feb 2020 22:10:50 +0000 (14:10 -0800)]
[X86] Use proper alignment for stack temporary and correct MachinePointerInfo for stack accesses in LowerUINT_TO_FP.

2 years ago[X86] Use correct MachineMemOperand for stack load in LowerFLT_ROUNDS_
Craig Topper [Wed, 26 Feb 2020 21:41:00 +0000 (13:41 -0800)]
[X86] Use correct MachineMemOperand for stack load in LowerFLT_ROUNDS_

2 years ago[X86] Add proper MachinePointerInfo to the loads/stores created for moving data betwe...
Craig Topper [Wed, 26 Feb 2020 19:46:40 +0000 (11:46 -0800)]
[X86] Add proper MachinePointerInfo to the loads/stores created for moving data between SSE and X87 in X86DAGToDAGISel::PreprocessISelDAG

2 years ago[ObjectFileMachO] Fix a build error on embedded.
Davide Italiano [Wed, 26 Feb 2020 22:31:06 +0000 (14:31 -0800)]
[ObjectFileMachO] Fix a build error on embedded.

2 years ago[AArch64][GlobalISel] Fixup <32b heterogeneous regbanks of G_PHIs just before selection.
Amara Emerson [Mon, 24 Feb 2020 22:27:32 +0000 (14:27 -0800)]
[AArch64][GlobalISel] Fixup <32b heterogeneous regbanks of G_PHIs just before selection.

Since all types <32b on gpr end up being assigned gpr32 regclasses, we can end
up with PHIs here which try to select between a gpr32 and an fpr16. Ideally RBS
shouldn't be selecting heterogenous regbanks for operands if possible, but we
still need to be able to deal with it here.

To fix this, if we have a gpr-bank operand < 32b in size and at least one other
operand is on the fpr bank, then we add cross-bank copies to homogenize the
operand banks. For simplicity the bank that we choose to settle on is whatever
bank the def operand has. For example:

%endbb:
  %dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2:fpr(s16), %bb2
 =>
%bb2:
  ...
  %in2_copy:gpr(s16) = COPY %in2:fpr(s16)
  ...
%endbb:
  %dst:gpr(s16) = G_PHI %in1:gpr(s16), %bb1, %in2_copy:gpr(s16), %bb2

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

2 years ago[ASTMatchers] HasNameMatcher handles `extern "C"`
Nathan James [Wed, 26 Feb 2020 22:06:38 +0000 (22:06 +0000)]
[ASTMatchers] HasNameMatcher handles `extern "C"`

Summary: Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=42193 | hasName AST matcher is confused by extern "C" in namespace. ]]

Reviewers: klimek, aaron.ballman, gribozavr2

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[DebugInfo][NFC] Remove handler with ErrorPolicy from DWARFContext.
Alexey Lapshin [Tue, 25 Feb 2020 15:45:42 +0000 (18:45 +0300)]
[DebugInfo][NFC] Remove handler with ErrorPolicy from DWARFContext.

Summary:
Current LLVM code base does not use error handler with ErrorPolicy.
This patch removes ErrorPolicy from DWARFContext.

This patch is extracted from the D74308.

Reviewers: jhenderson, dblaikie, grimar, aprantl, JDevlieghere

Reviewed By: grimar

Subscribers: hiraditya, llvm-commits

Tags: #llvm, #debug-info

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

2 years agoUpdate the ARC docs for non-trivial ownership in structs.
John McCall [Wed, 26 Feb 2020 21:40:46 +0000 (16:40 -0500)]
Update the ARC docs for non-trivial ownership in structs.

2 years ago[MC] Pull out a relaxFragment helper [NFC]
Philip Reames [Wed, 26 Feb 2020 21:29:07 +0000 (13:29 -0800)]
[MC] Pull out a relaxFragment helper [NFC]

Having this as it's own function helps to reduce indentation and allows use of return instead of wiring a value over the switch.  A lambda would have also worked, but with slightly deeper nesting.

2 years ago[llvm-objcopy] Enable --discard-all for MachO
Alexander Shaposhnikov [Wed, 26 Feb 2020 19:32:44 +0000 (11:32 -0800)]
[llvm-objcopy] Enable --discard-all for MachO

In this diff we enable the option --discard-all for MachO.

Test plan: make check-all

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

2 years ago[mlir][spirv] Refactoring to avoid calling the same function twice
Lei Zhang [Wed, 26 Feb 2020 20:35:46 +0000 (15:35 -0500)]
[mlir][spirv] Refactoring to avoid calling the same function twice

2 years ago[scudo][standalone] Various improvements wrt RSS
Kostya Kortchinsky [Tue, 25 Feb 2020 22:23:34 +0000 (14:23 -0800)]
[scudo][standalone] Various improvements wrt RSS

Summary:
This patch includes several changes to reduce the overall footprint
of the allocator:
- for realloc'd chunks: only keep the same chunk when lowering the size
  if the delta is within a page worth of bytes;
- when draining a cache: drain the beginning, not the end; we add pointers
  at the end, so that meant we were draining the most recently added
  pointers;
- change the release code to account for an freed up last page: when
  scanning the pages, we were looking for pages fully covered by blocks;
  in the event of the last page, if it's only partially covered, we
  wouldn't mark it as releasable - even what follows the last chunk is
  all 0s. So now mark the rest of the page as releasable, and adapt the
  test;
- add a missing `setReleaseToOsIntervalMs` to the cacheless secondary;
- adjust the Android classes based on more captures thanks to pcc@'s
  tool.

Reviewers: pcc, cferris, hctim, eugenis

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

2 years ago[libc] Fix typo of namespace in round implementation.
Paula Toth [Wed, 26 Feb 2020 20:15:26 +0000 (12:15 -0800)]
[libc] Fix typo of namespace in round implementation.

Summary: Fixed typos in namespace declarations and comments in the files under `src/math/round`.

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: MaskRay, tschuett, libc-commits

Tags: #libc-project

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

2 years agoFix for the test failues introduced in https://reviews.llvm.org/D74704.
Leonard Chan [Wed, 26 Feb 2020 20:23:15 +0000 (12:23 -0800)]
Fix for the test failues introduced in https://reviews.llvm.org/D74704.

2 years ago[dsymutil] Avoid copying swiftinterfaces from the SDK into the dsym bundle
Adrian Prantl [Wed, 26 Feb 2020 17:35:00 +0000 (09:35 -0800)]
[dsymutil] Avoid copying swiftinterfaces from the SDK into the dsym bundle

This patch fixes a bug that would cause dsymutil to collect
.swiftinterface files for the Swift stdlib and other SDK
modules. There is no advantage in copying these since they should be
loaded from the ones bundled with LLDB's embedded Swift compiler
instead and copying them will cause LLDB to recompile them from source
instead of loading their prebuilt cached counterparts in the SDK.

rdar://problem/57463247

Differential Revisions: https://reviews.llvm.org/D75196

2 years ago[ms] Rename ParsingInlineAsm functions/variables to reflect MS-specificity.
Eric Astor [Wed, 26 Feb 2020 20:12:52 +0000 (15:12 -0500)]
[ms] Rename ParsingInlineAsm functions/variables to reflect MS-specificity.

Summary: ParsingInlineAsm was a misleading name. These values are only set for MS-style inline assembly.

Reviewed By: rnk

Tags: #clang, #llvm

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

2 years ago[VectorCombine] add a debug flag to skip all transforms
Sanjay Patel [Wed, 26 Feb 2020 20:14:35 +0000 (15:14 -0500)]
[VectorCombine] add a debug flag to skip all transforms

As suggested in D75145 -

I'm not sure why, but several passes have this kind of disable/enable flag
implemented at the pass manager level. But that means we have to duplicate
the flag for both pass managers and add code to check the flag every time
the pass appears in the pipeline.

We want a debug option to see if this pass is misbehaving regardless of the
pass managers, so just add a disablement check at the single point before
any transforms run.

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

2 years ago[mlir][spirv] Add some folders for spv.LogicalAnd/spv.LogicalOr
Lei Zhang [Wed, 26 Feb 2020 17:47:02 +0000 (12:47 -0500)]
[mlir][spirv] Add some folders for spv.LogicalAnd/spv.LogicalOr

This commit handles folding spv.LogicalAnd/spv.LogicalOr when
one of the operands is constant true/false.

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

2 years ago[clang] fix error detection in consteval calls
Tyker [Wed, 26 Feb 2020 17:59:09 +0000 (18:59 +0100)]
[clang] fix error detection in consteval calls

Summary:
code like:
```
consteval int f() {
  int *A = new int(0);
  return *A;
}

int i1 = f();
```
currently doesn't generate any error.

Reviewers: rsmith

Reviewed By: rsmith

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

2 years ago[SimpleLoopUnswitch] Remove unnecessary include; NFC
Nikita Popov [Wed, 26 Feb 2020 19:40:43 +0000 (20:40 +0100)]
[SimpleLoopUnswitch] Remove unnecessary include; NFC

2 years ago[CVP] Simplify cmp of local phi node
Nikita Popov [Fri, 3 Jan 2020 17:40:18 +0000 (18:40 +0100)]
[CVP] Simplify cmp of local phi node

CVP currently does not simplify cmps with instructions in the same
block, because LVI getPredicateAt() currently does not provide
much useful information for that case (D69686 would change that,
but is stuck.) However, if the instruction is a Phi node, then
LVI can compute the result of the predicate by threading it into
the predecessor blocks, which allows it simplify some conditions
that nothing else can handle. Relevant code:
https://github.com/llvm/llvm-project/blob/6d6a4590c5d4c7fc7445d72fe685f966b0a8cafb/llvm/lib/Analysis/LazyValueInfo.cpp#L1904-L1927

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

2 years ago[TSan] Add CMake check for minimal SDK requirements on Darwin
Julian Lettner [Wed, 26 Feb 2020 18:33:18 +0000 (10:33 -0800)]
[TSan] Add CMake check for minimal SDK requirements on Darwin

Fails with the following message in the error case:
```
CMake Error at /path/to/llvm-project/compiler-rt/lib/tsan/CMakeLists.txt:119 (message):
  Building the TSan runtime requires at least macOS SDK 10.12
```

Fixes #44682.
https://bugs.llvm.org/show_bug.cgi?id=44682

Reviewed By: dmajor, delcypher

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

2 years ago[InstCombine] Simplify DCE code; NFC
Nikita Popov [Wed, 26 Feb 2020 19:10:09 +0000 (20:10 +0100)]
[InstCombine] Simplify DCE code; NFC

As pointed out on D75008, MadeIRChange is already set by
eraseInstFromFunction(), which also already does a debug print.

2 years ago[CVP] Add test for cmp of local phi; NFC
Nikita Popov [Fri, 3 Jan 2020 17:39:20 +0000 (18:39 +0100)]
[CVP] Add test for cmp of local phi; NFC

2 years ago[AVR] Fix private label prefix
Ayke van Laethem [Tue, 25 Feb 2020 16:15:34 +0000 (17:15 +0100)]
[AVR] Fix private label prefix

This is a small pet peeve from me. This change makes sure the AVR backend uses
the correct private label prefix (.L) so that private labels are hidden in
avr-objdump.

Example code:

    define i8 @foo(i1 %cond) {
      br i1 %cond, label %then, label %else
    then:
      ret i8 3
    else:
      ret i8 5
    }

When compiling this:
  llc -march=avr -filetype=obj -o test.o test.ll
and then dumping it:
  avr-objdump -d test.o
You would previously get an ugly temporary label:

    00000000 <foo>:
       0:        81 70       andi       r24, 0x01    ; 1
       2:        80 30       cpi        r24, 0x00    ; 0
       4:        f9 f3       breq       .-2          ; 0x4 <foo+0x4>
       6:        83 e0       ldi        r24, 0x03    ; 3
       8:        08 95       ret

    0000000a <LBB0_2>:
       a:        85 e0       ldi        r24, 0x05    ; 5
       c:        08 95       ret

This patch fixes that, the output is now:

    00000000 <foo>:
       0:        81 70       andi       r24, 0x01    ; 1
       2:        80 30       cpi        r24, 0x00    ; 0
       4:        01 f0       breq       .+0          ; 0x6 <foo+0x6>
       6:        83 e0       ldi        r24, 0x03    ; 3
       8:        08 95       ret
       a:        85 e0       ldi        r24, 0x05    ; 5
       c:        08 95       ret

Note that as you can see the breq operand is different. However it is
still the same after linking:

       4:        11 f0       breq       .+4

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

2 years ago[AVR] Don't adjust addresses by 2 for absolute values
Ayke van Laethem [Fri, 7 Feb 2020 12:06:40 +0000 (13:06 +0100)]
[AVR] Don't adjust addresses by 2 for absolute values

Adjusting by 2 breaks DWARF output. With this fix, programs start to
compile and produce valid DWARF output.

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

2 years ago[InstCombine] Remove trivially empty ranges from end
Nikita Popov [Sat, 22 Feb 2020 17:37:10 +0000 (18:37 +0100)]
[InstCombine] Remove trivially empty ranges from end

InstCombine removes pairs of start+end intrinsics that don't
have anything in between them. Currently this is done by starting
at the start intrinsic and scanning forwards. This patch changes
it to start at the end intrinsic and scan backwards.

The motivation here is as follows: When we process the start
intrinsic, we have not yet looked at the following instructions,
which may still get folded/removed. If they do, we will only be
able to remove the start/end pair on the next iteration. When we
process the end intrinsic, all the instructions before it have
already been visited, and we don't run into this problem.

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

2 years agoFix LLP64 detection in SwapByteOrder.h
Reid Kleckner [Wed, 26 Feb 2020 18:41:59 +0000 (10:41 -0800)]
Fix LLP64 detection in SwapByteOrder.h

MSVC does not define __LONG_MAX__, so we were just getting lucky in this
conditional:
  #if __LONG_MAX__ == __INT_MAX__

Undefined identifiers evaluate to zero in preprocessor conditionals, so
this became true, which happens to work for MSVC platforms.

Instead, use this pattern and let the compiler constant fold:
  return sizeof(long) == sizeof(int) ? SwapByteOrder_32((uint32_t)C)
                                     : SwapByteOrder_64((uint64_t)C);

2 years ago[Hexagon] Improve casting of boolean HVX vectors to scalars
Krzysztof Parzyszek [Wed, 26 Feb 2020 15:56:12 +0000 (09:56 -0600)]
[Hexagon] Improve casting of boolean HVX vectors to scalars

- Mark memory access for bool vectors as disallowed in target lowering.
  This will prevent combining bitcasts of bool vectors with stores.
- Replace the actual bitcasting code with a faster version.
- Handle casting of v16i1 to i16.

2 years agoInline basic_string::erase for fastpath where __n == npos
Martijn Vels [Wed, 26 Feb 2020 18:25:43 +0000 (13:25 -0500)]
Inline basic_string::erase for fastpath where __n == npos

Summary:
This change checks for the case where people want to erase a string to the end, i.e., __n == npos, and inlines the call if so.

This also demonstrates keeping the ABI intact for V1, but inlining the erase() method for unstable.

Reviewers: EricWF, mclow.lists, ldionne

Reviewed By: EricWF, ldionne

Subscribers: smeenai, dexonsmith, christof, libcxx-commits

Tags: #libc

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

2 years agoRemove unneeded Compiler.h and DataTypes.h includes, NFC
Reid Kleckner [Wed, 26 Feb 2020 18:34:12 +0000 (10:34 -0800)]
Remove unneeded Compiler.h and DataTypes.h includes, NFC

2 years ago[ELF] --orphan-handling=: don't warn/error for input SHT_REL[A] retained by --emit...
Fangrui Song [Wed, 26 Feb 2020 00:39:31 +0000 (16:39 -0800)]
[ELF] --orphan-handling=: don't warn/error for input SHT_REL[A] retained by --emit-relocs

They are purposefully skipped by input section descriptions (rL295324).
Similarly, --orphan-handling= should not warn/error for them.
This behavior matches GNU ld.

Reviewed By: grimar

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

2 years agoFix buildbots after recent GSYM commit.
Greg Clayton [Wed, 26 Feb 2020 18:30:04 +0000 (10:30 -0800)]
Fix buildbots after recent GSYM commit.

Added llvm-gsymutil to LLVM_TEST_DEPENDS.

2 years ago[lldb/test] Skip running a test under ASan, it intentionally double-frees
Vedant Kumar [Wed, 26 Feb 2020 18:11:39 +0000 (10:11 -0800)]
[lldb/test] Skip running a test under ASan, it intentionally double-frees

2 years ago[SDAG] Add SDNode::values() = make_range(values_begin(), values_end())
Krzysztof Parzyszek [Wed, 26 Feb 2020 16:54:18 +0000 (10:54 -0600)]
[SDAG] Add SDNode::values() = make_range(values_begin(), values_end())

Also use it in a few places to simplify code a little bit.  NFC

2 years ago[TTI] Let getOperationCost assume that Freeze is free
Juneyoung Lee [Wed, 26 Feb 2020 17:56:01 +0000 (02:56 +0900)]
[TTI] Let getOperationCost assume that Freeze is free

2 years ago[libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build
Mikhail Maltsev [Wed, 26 Feb 2020 17:54:43 +0000 (17:54 +0000)]
[libcxx] Fix _LIBCPP_HAS_THREAD_API_EXTERNAL build

Summary:
The definition of `__libcpp_timed_backoff_policy` and the declaration of
`__libcpp_thread_poll_with_backoff` must not be guarded by
  #if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
because the definitions of `__libcpp_timed_backoff_policy::operator()`
and `__libcpp_thread_poll_with_backoff` aren't guarded by this macro
(and this is correct because these two functions are implemented in
terms of other libc++ functions and don't interact with the host
threading library).

Reviewers: ldionne, __simt__, EricWF, mclow.lists

Reviewed By: ldionne

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

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

2 years agoDevirtualize a call on alloca without waiting for post inline cleanup and next
Hiroshi Yamauchi [Sat, 1 Feb 2020 00:13:44 +0000 (16:13 -0800)]
Devirtualize a call on alloca without waiting for post inline cleanup and next
DevirtSCCRepeatedPass iteration.  Needs ReviewPublic

This aims to fix a missed inlining case.

If there's a virtual call in the callee on an alloca (stack allocated object) in
the caller, and the callee is inlined into the caller, the post-inline cleanup
would devirtualize the virtual call, but if the next iteration of
DevirtSCCRepeatedPass doesn't happen (under the new pass manager), which is
based on a heuristic to determine whether to reiterate, we may miss inlining the
devirtualized call.

This enables inlining in clang/test/CodeGenCXX/member-function-pointer-calls.cpp.

2 years ago[mlir][spirv] NFC: move folders and canonicalizers in a separate file
Lei Zhang [Wed, 26 Feb 2020 14:12:56 +0000 (09:12 -0500)]
[mlir][spirv] NFC: move folders and canonicalizers in a separate file

This gives us better file organization and faster compilation time
by avoid having a gigantic SPIRVOps.cpp file.

2 years ago[compiler-rt] Build all alias in builtin as private external on Darwin
Steven Wu [Wed, 26 Feb 2020 17:17:03 +0000 (09:17 -0800)]
[compiler-rt] Build all alias in builtin as private external on Darwin

Summary:
For builtin compiler-rt, it is built with visibility hidden by default
to avoid the client exporting symbols from libclang static library. The
compiler option -fvisibility=hidden doesn't work on the aliases in c files
because they are created with inline assembly. On Darwin platform,
thoses aliases are exported by default if they are reference by the client.

Fix the issue by adding ".private_extern" to all the aliases if the
library is built with visibility hidden.

rdar://problem/58960296

Reviewers: dexonsmith, arphaman, delcypher, kledzik

Reviewed By: delcypher

Subscribers: dberris, jkorous, ributzka, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

2 years ago[PowerPC][NFC] Convert grep usage to FileCheck in lit test.
Sean Fertile [Wed, 26 Feb 2020 14:52:43 +0000 (09:52 -0500)]
[PowerPC][NFC] Convert grep usage to FileCheck in lit test.

2 years agoUse virtual functions in ParsedAttrInfo instead of function pointers
John Brawn [Wed, 26 Feb 2020 16:31:24 +0000 (16:31 +0000)]
Use virtual functions in ParsedAttrInfo instead of function pointers

This doesn't do anything on its own, but it's the first step towards
allowing plugins to define attributes. It does simplify the
ParsedAttrInfo generation in ClangAttrEmitter a little though.

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

2 years ago[libc] Fix build when -DBUILD_SHARED_LIBS=On
Alex Brachet [Wed, 26 Feb 2020 17:19:09 +0000 (12:19 -0500)]
[libc] Fix build when -DBUILD_SHARED_LIBS=On

Reviewers: gchatelet, sivachandra

Reviewed By: gchatelet, sivachandra

Subscribers: libc-commits, mgorny, MaskRay, tschuett

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

2 years agoAvoid SmallString.h include in MD5.h, NFC
Reid Kleckner [Wed, 26 Feb 2020 16:49:53 +0000 (08:49 -0800)]
Avoid SmallString.h include in MD5.h, NFC

Saves 200 includes, which is mostly immaterial.

2 years ago[llvm-objcopy][test] Improve empty section tests
Fangrui Song [Wed, 19 Feb 2020 23:27:59 +0000 (15:27 -0800)]
[llvm-objcopy][test] Improve empty section tests

empty-sections.test: add two tests adapted from @jhenderson's https://reviews.llvm.org/D74755#1882221
strip-non-alloc.test: improve. D74755 will change the attribution of an empty section.

They mostly test the behavior of Object.cpp:sectionWithinSegment : how we attribute sections to segments.
`ParentSegment` can affect some subtle layout decisions.

Reviewed By: jhenderson

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

2 years ago[ELF] --orphan-handling=: don't warn/error for unused synthesized sections
Fangrui Song [Tue, 25 Feb 2020 23:02:04 +0000 (15:02 -0800)]
[ELF] --orphan-handling=: don't warn/error for unused synthesized sections

This makes --orphan-handling= less noisy.
This change also improves our compatibility with GNU ld.

GNU ld special cases .symtab, .strtab and .shstrtab . We need output section
descriptions for .symtab, .strtab and .shstrtab to suppress:

  <internal>:(.symtab) is being placed in '.symtab'
  <internal>:(.shstrtab) is being placed in '.shstrtab'
  <internal>:(.strtab) is being placed in '.strtab'

With --strip-all, .symtab and .strtab can be omitted (note, --strip-all is not compatible with --emit-relocs).

Reviewed By: nickdesaulniers

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

2 years ago[clangd] Clean-up XRefs.cpp from Lexer usages and unnecessary SourceLoc transformations
Kadir Cetinkaya [Wed, 26 Feb 2020 12:39:46 +0000 (13:39 +0100)]
[clangd] Clean-up XRefs.cpp from Lexer usages and unnecessary SourceLoc transformations

Summary:
Get rid of calls to lexer and unnecessary source location
transformations.

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

2 years ago[DAGCombiner] avoid narrowing fake fneg vector op
Sanjay Patel [Wed, 26 Feb 2020 16:16:50 +0000 (11:16 -0500)]
[DAGCombiner] avoid narrowing fake fneg vector op

This may inhibit vector narrowing in general, but there's
already an inconsistency in the way that we deal with this
pattern as shown by the test diff.

We may want to add a dedicated function for narrowing fneg.
It's often folded into some other op, so moving it away from
other math ops may cause regressions that we would not see
for normal binops.

See D73978 for more details.

2 years ago[gn build] Port 3c36d8dad57
LLVM GN Syncbot [Wed, 26 Feb 2020 16:09:48 +0000 (16:09 +0000)]
[gn build] Port 3c36d8dad57

2 years agoIntroduce DWARFDataExtractor::getInitialLength
Pavel Labath [Thu, 13 Feb 2020 15:47:31 +0000 (16:47 +0100)]
Introduce DWARFDataExtractor::getInitialLength

Summary:
This patch introduces a function to house the code needed to do the
DWARF64 detection dance. The function decodes the initial length field
and returns it as a pair containing the actual length, and the DWARF
encoding.

This patch does _not_ attempt to handle the problem of detecting lengths
which extend past the size of the section, or cases when reads of a
single contribution accidentally escape beyond its specified length, but
I think it's useful in its own right.

Reviewers: dblaikie, jhenderson, ikudrin

Subscribers: hiraditya, probinson, aprantl, JDevlieghere, llvm-commits

Tags: #llvm

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

2 years agoAdd _LIBCPP_BUILTIN_CONSTANT_P support.
Martijn Vels [Thu, 30 Jan 2020 19:12:44 +0000 (14:12 -0500)]
Add _LIBCPP_BUILTIN_CONSTANT_P support.

Summary:
This change adds the macros _LIBCPP_COMPILER_HAS_BUILTIN_CONSTANT and _LIBCPP_BUILTIN_CONSTANT_P to detect compile time constants, and optimze the code accordingly.

A planned usage example:
The implementation of basic_string::assign() can short-cut a compile time known short string assignent into a fast and compact inlined assignment:

```
basic_string::assign(const value_type* __s) {
  if (_LIBCPP_BUILTIN_CONSTANT_P(__s[0]) && length(__s) < __min_cap) {
    copy(pointer(), _s, length(__s) + 1);
    set_size(length(__s));
  } else {
    // delegate / tail call out of line implementation
  }
}
```

Subscribers: christof, libcxx-commits

Tags: #libc

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

2 years ago[AArch64] add tests for fake fneg; NFC
Sanjay Patel [Wed, 26 Feb 2020 15:55:15 +0000 (10:55 -0500)]
[AArch64] add tests for fake fneg; NFC

See comments in D73978 for background.

2 years agoAdd unit tests for RangeDataVector::FindEntryIndexesThatContain
Unnar Freyr Erlendsson [Wed, 26 Feb 2020 15:43:43 +0000 (16:43 +0100)]
Add unit tests for RangeDataVector::FindEntryIndexesThatContain

Summary: This adds unit tests for FindEntryIndexesThatContain, this is done in preparation for changing the logic of the function.

Reviewers: labath, teemperor

Reviewed By: labath

Subscribers: arphaman, JDevlieghere, lldb-commits

Tags: #lldb

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

2 years ago[DAG] visitRotate - modulo non-uniform constant rotation amounts
Simon Pilgrim [Wed, 26 Feb 2020 15:39:52 +0000 (15:39 +0000)]
[DAG] visitRotate - modulo non-uniform constant rotation amounts

2 years agoRecommit "[DWARFDebugLine] Avoid dumping prologue members we did not parse"
Pavel Labath [Mon, 24 Feb 2020 12:32:31 +0000 (13:32 +0100)]
Recommit "[DWARFDebugLine] Avoid dumping prologue members we did not parse"

The patch was reverted in 69da40033 because of test failures on windows.
The problem was the unpredictable order of some of the error messages,
which I've tried to strenghten in that patch.

It turns out this is not possible to do in verbose mode because there
the data is being writted as it is being parsed. No amount of flushing
(as I've done in the non-verbose mode) will help that. Indeed, even
without any buffering the warning messages can end in the middle of a
line in non-verbose mode.

In this patch, I have reverted the changes which tested the relative
position of the warning message, except for the messages about
unsupported initial length, which are the ones I really wanted to test,
and which do come out reasonably.

The original commit message was:

This patch if motivated by D74560, specifically the subthread about what
to print upon encountering reserved initial length values.

If the debug_line prologue has an unsupported version, we skip parsing
the rest of the data. If we encounter an reserved initial length field,
we don't even parse the version. However, we still print out all members
(with value 0) in the dump function.

This patch introduces early exits in the Prologue::dump function so that
we print only the fields that were parsed successfully. In case of an
unsupported version, we skip printing all subsequent prologue fields --
because we don't even know if this version has those fields. In case of a
reserved unit length, we don't print anything -- if the very first field
of the prologue is invalid, it's hard to say if we even have a prologue
to begin with.

Note that the user will still be able to see the invalid/reserved
initial length value in the error message. I've modified (reordered)
debug_line_invalid.test to show that the error message comes straight
after the debug_line offset. I've also added some flush() calls to the
dumping code to ensure this is the case in all situations (without that,
the warnings could get out of sync if the output was not a terminal -- I
guess this is why std::iostreams have the tie() function).

Reviewers: jhenderson, ikudrin, dblaikie

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[clang-format] Special handling of spaces for C# code
Jonathan Coe [Wed, 26 Feb 2020 15:13:09 +0000 (15:13 +0000)]
[clang-format] Special handling of spaces for C# code

Summary:
Ensure that there are spaces around braces '{', '}'.

Ensure that there is a space before and after '=>'.

Ensure that 'async' and 'when' are considered as keywords when inserting spaces.

Reviewers: krasimir, MyDeveloperDay

Reviewed By: krasimir

Tags: #clang-format

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

2 years ago[clangd] use printQualifiedName to skip the inlinenamespace qualifiers.
Haojian Wu [Wed, 26 Feb 2020 14:22:56 +0000 (15:22 +0100)]
[clangd] use printQualifiedName to skip the inlinenamespace qualifiers.

Summary:
symbols in libcpp are inside the inline namespace, printQualifierAsString will
print the inline namespace, which is unexpected.

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

2 years agoFull fix for "AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after...
Nicolai Hähnle [Wed, 26 Feb 2020 15:21:25 +0000 (16:21 +0100)]
Full fix for "AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible" (hopefully)

Properly preserve the MachineDominatorTree in all cases.

Change-Id: I54cf0c0a20934168a356920ba8ed5097a93c4131

2 years ago[ARM,MVE] Add predicated intrinsics for many unary functions.
Simon Tatham [Wed, 26 Feb 2020 14:10:43 +0000 (14:10 +0000)]
[ARM,MVE] Add predicated intrinsics for many unary functions.

Summary:
This commit adds the predicated MVE intrinsics for the same set of
unary operations that I added in their unpredicated forms in

* D74333 (vrint)
* D74334 (vrev)
* D74335 (vclz, vcls)
* D74336 (vmovl)
* D74337 (vmovn)

but since the predicated versions are a lot more similar to each
other, I've kept them all together in a single big patch. Everything
here is done in the standard way we've been doing other predicated
operations: an IR intrinsic called `@llvm.arm.mve.foo.predicated` and
some isel rules that match that alongside whatever they accept for the
unpredicated version of the same instruction.

In order to write the isel rules conveniently, I've refactored the
existing isel rules for the affected instructions into multiclasses
parametrised by a vector-type class, in the usual way. All those
refactorings are intended to leave the existing isel rules unchanged:
the only difference should be that new ones for the predicated
intrinsics are introduced.

The only tiny infrastructure change I needed in this commit was to
change the implementation of `IntrinsicMX` in `arm_mve_defs.td` so
that the records it defines are anonymous rather than named (and use
`NameOverride` to set the output intrinsic name), which allows me to
call it twice in two multiclasses with the same `NAME` without a
tablegen-time error.

Reviewers: dmgreen, MarkMurrayARM, miyuki, ostannard

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

2 years ago[AIX] Remove whitelist checking for ExternalSymbolSDNodes
Xiangling Liao [Wed, 26 Feb 2020 14:42:04 +0000 (09:42 -0500)]
[AIX] Remove whitelist checking for ExternalSymbolSDNodes

Allow all ExternalSymbolSDNode on AIX, and rely on the linker error to find
symbols which we don't have definitions from any library/compiler-rt.

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

2 years agoPut microsoft template parameter shadow warning behind separate flag (PR44794)
Hans Wennborg [Tue, 25 Feb 2020 15:58:36 +0000 (16:58 +0100)]
Put microsoft template parameter shadow warning behind separate flag (PR44794)

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

2 years agoQuick fix for bot failure on "AMDGPU/SIInsertSkips: Fix the determination of whether...
Nicolai Hähnle [Wed, 26 Feb 2020 15:01:57 +0000 (16:01 +0100)]
Quick fix for bot failure on "AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible"

Apparently the dominator tree update is incorrect, will investigate.

Change-Id: Ie76f8d11b22a552af1f098c893773f3d85e02d4f

2 years ago[libTooling] Add function to determine associated text of a declaration.
Yitzhak Mandelbaum [Wed, 26 Feb 2020 13:14:19 +0000 (08:14 -0500)]
[libTooling] Add function to determine associated text of a declaration.

Summary:
Second attempt -- the first was reverted in commit 0e480b39c66143ad142f9a30d8d40e49d7d7b0ce, because of test breakages. This revision fixes the cause of the test breakages.

Original description follows:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would conceptually be associated with the decl by the
reader. This includes comments, whitespace, and separators like ';'.

Reviewers: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

2 years agoAMDGPU: Fix some more incorrect check lines
Jay Foad [Wed, 26 Feb 2020 09:46:07 +0000 (09:46 +0000)]
AMDGPU: Fix some more incorrect check lines

2 years agoAMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible
Nicolai Hähnle [Fri, 21 Feb 2020 12:36:01 +0000 (13:36 +0100)]
AMDGPU/SIInsertSkips: Fix the determination of whether early-exit-after-kill is possible

Summary:
The old code made some incorrect assumptions about the order in which
basic blocks are laid out in a function. This could lead to incorrect
early-exits, especially when kills occurred inside of loops.

The new approach is to check whether the point where the conditional
kill occurs dominates all reachable code. If that is the case, there
cannot be any other threads in the wave that are waiting to rejoin
at a later point in the CFG, i.e. if exec=0 at that point, then all
threads really are dead and we can exit the wave.

Make some other minor cleanups to the pass while we're at it.

v2: preserve the dominator tree

Reviewers: arsenm, cdevadas, foad, critson

Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits

Tags: #llvm

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

Change-Id: Ia0d2b113ac944ad642d1c622b6da1b20aa1aabcc

2 years ago[mlir][Linalg] NFC - Refactor LinalgStructuredOps towards "named" Linalg ops
Nicolas Vasilache [Wed, 26 Feb 2020 14:21:47 +0000 (09:21 -0500)]
[mlir][Linalg] NFC - Refactor LinalgStructuredOps towards "named" Linalg ops

This revision performs some basic refactoring towards more easily defining Linalg "named" ops. Such named ops form the backbone of operations that are ubiquitous in the ML application domain.

2 years ago[OpenCL] Add atomic type builtins
Sven van Haastregt [Wed, 26 Feb 2020 14:08:23 +0000 (14:08 +0000)]
[OpenCL] Add atomic type builtins

Add atomic types and builtins operating on those atomic types to
`-fdeclare-opencl-builtins`.  The _explicit variants are left out of
this commit, as these take enum arguments that are not yet supported
by the `-fdeclare-opencl-builtins` machinery.

2 years ago[gn build] re-"gn format" all gn files
Nico Weber [Wed, 26 Feb 2020 13:38:18 +0000 (08:38 -0500)]
[gn build] re-"gn format" all gn files

2 years ago[Assembler] Allow assembling empty index with non-zero flags
evgeny [Wed, 26 Feb 2020 13:34:11 +0000 (16:34 +0300)]
[Assembler] Allow assembling empty index with non-zero flags

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

2 years ago[gn build] (manually) port 2f6cc21f44e
Nico Weber [Wed, 26 Feb 2020 13:24:02 +0000 (08:24 -0500)]
[gn build] (manually) port 2f6cc21f44e

2 years ago[OpenMP] Fix the test by generating output file in temporary directory
Kirill Bobyrev [Wed, 26 Feb 2020 13:07:13 +0000 (14:07 +0100)]
[OpenMP] Fix the test by generating output file in temporary directory

Related Revison: D74925
Commit: 396b7253944e927878dff2f6321efabb3aaa0f45

2 years ago[clang][Tooling] Add a way to tokenize a FileRange
Kadir Cetinkaya [Fri, 21 Feb 2020 14:15:36 +0000 (15:15 +0100)]
[clang][Tooling] Add a way to tokenize a FileRange

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

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

2 years ago[clangd] Bump index version number.
Haojian Wu [Wed, 26 Feb 2020 12:43:11 +0000 (13:43 +0100)]
[clangd] Bump index version number.

Summary:
Though we don't have new changes to the index format, we have changes to
symbol collector, e.g. collect marcos, spelled references. Bump the
version to force background-index to rebuild.

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

2 years ago[gn build] (manually) merge e058667a2e01
Nico Weber [Wed, 26 Feb 2020 12:33:32 +0000 (07:33 -0500)]
[gn build] (manually) merge e058667a2e01

2 years agoRevert "[compiler-rt] Add a critical section when flushing gcov counters"
Hans Wennborg [Wed, 26 Feb 2020 12:23:56 +0000 (13:23 +0100)]
Revert "[compiler-rt] Add a critical section when flushing gcov counters"

See discussion on PR44792.

This reverts commit 02ce9d8ef5a84bc884de4105eae5f8736ef67634.

It also reverts the follow-up commits
8f46269f0 "[profile] Don't dump counters when forking and don't reset when calling exec** functions"
62c7d8402 "[profile] gcov_mutex must be static"

2 years agotsan: fix pthread_detach with called_from_lib suppressions
Dmitry Vyukov [Wed, 19 Feb 2020 13:18:53 +0000 (14:18 +0100)]
tsan: fix pthread_detach with called_from_lib suppressions

Generally we ignore interceptors coming from called_from_lib-suppressed libraries.
However, we must not ignore critical interceptors like e.g. pthread_create,
otherwise runtime will lost track of threads.
pthread_detach is one of these interceptors we should not ignore as it affects
thread states and behavior of pthread_join which we don't ignore as well.
Currently we can produce very obscure false positives. For more context see:
https://groups.google.com/forum/#!topic/thread-sanitizer/ecH2P0QUqPs
The added test captures this pattern.

While we are here rename ThreadTid to ThreadConsumeTid to make it clear that
it's not just a "getter", it resets user_id to 0. This lead to confusion recently.

Reviewed in https://reviews.llvm.org/D74828

2 years ago[AArch64][SVE] Add SVE2 intrinsics for bit permutation & table lookup
Kerry McLaughlin [Wed, 26 Feb 2020 09:49:50 +0000 (09:49 +0000)]
[AArch64][SVE] Add SVE2 intrinsics for bit permutation & table lookup

Summary:
Implements the following intrinsics:
 - @llvm.aarch64.sve.bdep.x
 - @llvm.aarch64.sve.bext.x
 - @llvm.aarch64.sve.bgrp.x
 - @llvm.aarch64.sve.tbl2
 - @llvm.aarch64.sve.tbx

The SelectTableSVE2 function in this patch is used to select the TBL2
intrinsic & ensures that the vector registers allocated are consecutive.

Reviewers: sdesmalen, andwar, dancgr, cameron.mcinally, efriedma, rengolin

Reviewed By: efriedma

Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits

Tags: #llvm

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

2 years ago[ARM][RDA] add getUniqueReachingMIDef
Sam Parker [Wed, 26 Feb 2020 11:14:54 +0000 (11:14 +0000)]
[ARM][RDA] add getUniqueReachingMIDef

Add getUniqueReachingMIDef to RDA which performs a global search for
a machine instruction that produces a unique definition of a given
register at a given point. Also add two helper functions
(getMIOperand) that wrap around this functionality to get the
incoming definition uses of a given instruction. These now replace
the uses of getReachingMIDef in ARMLowOverheadLoops. getReachingMIDef
has been renamed to getReachingLocalMIDef and has been made private
along with getInstFromId.

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