lldb.git
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

2 years ago[AArch64] Flip default for register renaming in the ld/st optimizier.
Florian Hahn [Wed, 26 Feb 2020 11:05:59 +0000 (11:05 +0000)]
[AArch64] Flip default for register renaming in the ld/st optimizier.

Turn on register renaming again after disabling it for the 10.0 release,
to help flushing out any issues.

2 years ago[docs][llvm-objcopy][llvm-strip] Move --wildcard description earlier
James Henderson [Wed, 26 Feb 2020 10:36:08 +0000 (10:36 +0000)]
[docs][llvm-objcopy][llvm-strip] Move --wildcard description earlier

This moves it above the response file description, which should be at
the end.

2 years ago[docs][llvm-symbolizer] Fix indentation of inline option examples
James Henderson [Wed, 26 Feb 2020 10:29:47 +0000 (10:29 +0000)]
[docs][llvm-symbolizer] Fix indentation of inline option examples

The examples for different options were inconsistently indented in
the HTML display. As they are tied to the options, this change
normalises to indent them the same as the option description body.

2 years ago[docs][llvm-symbolizer] Fix --functions description
James Henderson [Wed, 26 Feb 2020 10:24:50 +0000 (10:24 +0000)]
[docs][llvm-symbolizer] Fix --functions description

"--functions none" and "--functions=none" are not the same. One is the
option "--functions" with its default value of "linkage", followed by an
input address of "none", and the other is "--functions" with the value
"none". This patch fixes the doc to match the actual behaviour by adding
an extra '=' sign in the allowed values description.

2 years agoAMDGPU: Fix some incorrect FUNC-LABEL checks
Jay Foad [Wed, 26 Feb 2020 09:41:41 +0000 (09:41 +0000)]
AMDGPU: Fix some incorrect FUNC-LABEL checks

2 years agoFix typo in clang lit config
serge-sans-paille [Wed, 26 Feb 2020 09:37:04 +0000 (10:37 +0100)]
Fix typo in clang lit config

Typo introduced in e058667a2e017d3225a9bb067dbac7f2159576f7

2 years agoSupport -fuse-ld=lld for riscv
serge-sans-paille [Mon, 17 Feb 2020 12:42:00 +0000 (13:42 +0100)]
Support -fuse-ld=lld for riscv

Add a configure feature test to filter out tests that explicitly depend on platform linker.

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

2 years ago[lldb/gdb-remote] Add support for the qOffsets packet
Pavel Labath [Thu, 13 Feb 2020 13:30:04 +0000 (14:30 +0100)]
[lldb/gdb-remote] Add support for the qOffsets packet

Summary:
This packet is necessary to make lldb work with the remote-gdb stub in
user mode qemu when running position-independent binaries. It reports
the relative position (load bias) of the loaded executable wrt. the
addresses in the file itself.

Lldb needs to know this information in order to correctly set the load
address of the executable. Normally, lldb would be able to find this out
on its own by following the breadcrumbs in the process auxiliary vector,
but we can't do this here because qemu does not support the
qXfer:auxv:read packet.

This patch does not implement full scope of the qOffsets packet (it only
supports packets with identical code, data and bss offsets), because it
is not fully clear how should the different offsets be handled and I am
not aware of a producer which would make use of this feature (qemu will
always
<https://github.com/qemu/qemu/blob/master/linux-user/elfload.c#L2436>
return the same value for code and data offsets). In fact, even gdb
ignores the offset for the bss sections, and uses the "data" offset
instead.  So, until the we need more of this packet, I think it's best
to stick to the simplest solution possible. This patch simply rejects
replies with non-uniform offsets.

Reviewers: clayborg, jasonmolenda

Subscribers: lldb-commits

Tags: #lldb

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

2 years agoFix the clangd-fuzzer build error.
Haojian Wu [Wed, 26 Feb 2020 09:12:49 +0000 (10:12 +0100)]
Fix the clangd-fuzzer build error.

2 years ago[clangd] Expose the rename LimitFiles option to the C++ API, NFC.
Haojian Wu [Wed, 19 Feb 2020 14:37:36 +0000 (15:37 +0100)]
[clangd] Expose the rename LimitFiles option to the C++ API, NFC.

Reviewers: sammccall

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

Tags: #clang

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

2 years agoStrip preceeding -Xclang when stripping -fcolor-diagnostics or -fdiagnostics-color
Kadir Cetinkaya [Wed, 26 Feb 2020 08:03:03 +0000 (09:03 +0100)]
Strip preceeding -Xclang when stripping -fcolor-diagnostics or -fdiagnostics-color

Summary: Fixes https://github.com/clangd/clangd/issues/279. We were removing the color options but not the preceeding -Xclang which causes errors since the -Xclang would now apply to the next option in the list of options. Now, when removing a color option, we check if there was a preceeding -Xclang and remove it as well.

Patch By @DaanDeMeyer !

Reviewers: sammccall, kadircet

Reviewed By: sammccall

Subscribers: ilya-biryukov, usaxena95

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

2 years agoRemove no un-necessary require for load_extension.ll
serge-sans-paille [Wed, 26 Feb 2020 07:26:53 +0000 (08:26 +0100)]
Remove no un-necessary require for load_extension.ll

Local testing on OSX no longer exhibit the linking error mentioned in
https://reviews.llvm.org/D71959#1860286

2 years agoAdd missing dependency to fix shared library build.
Michael Liao [Wed, 26 Feb 2020 06:58:12 +0000 (01:58 -0500)]
Add missing dependency to fix shared library build.

2 years ago[SimpleLoopUnswitch] Canonicalize variable names
Juneyoung Lee [Wed, 26 Feb 2020 06:33:02 +0000 (15:33 +0900)]
[SimpleLoopUnswitch] Canonicalize variable names

2 years ago[ARC][NFC] Remove trailing space
Jim Lin [Tue, 25 Feb 2020 08:12:22 +0000 (16:12 +0800)]
[ARC][NFC] Remove trailing space

2 years agoAdd a llvm-gsymutil tool that can convert object files to GSYM and perform lookups.
Greg Clayton [Thu, 20 Feb 2020 01:31:27 +0000 (17:31 -0800)]
Add a llvm-gsymutil tool that can convert object files to GSYM and perform lookups.

Summary:
This patch creates the llvm-gsymutil binary that can convert object files to GSYM using the --convert <path> option. It can also dump and lookup addresses within GSYM files that have been saved to disk.

To dump a file:

llvm-gsymutil /path/to/a.gsym

To perform address lookups, like with atos, on GSYM files:

llvm-gsymutil --address 0x1000 --address 0x1100 /path/to/a.gsym

To convert a mach-o or ELF file, including any DWARF debug info contained within the object files:

llvm-gsymutil --convert /path/to/a.out --out-file /path/to/a.out.gsym

Conversion highlights:
- convert DWARF debug info in mach-o or ELF files to GSYM
- convert symbols in symbol table to GSYM and don't convert symbols that overlap with DWARF debug info
- extract UUID from object files
- extract .text (read + execute) section address ranges and filter out any DWARF or symbols that don't fall in those ranges.
- if .text sections are extracted, and if the last gsym::FunctionInfo object has no size, cap the size to the end of the section the function was contained in

Dumping GSYM files will dump all sections of the GSYM file in textual format.

Reviewers: labath, aadsm, serhiy.redko, jankratochvil, xiaobai, wallace, aprantl, JDevlieghere, jdoerfert

Subscribers: mgorny, hiraditya, llvm-commits

Tags: #llvm

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

2 years ago[SimpleLoopUnswitch] Fix introduction of UB when hoisted condition may be undef or...
Juneyoung Lee [Wed, 26 Feb 2020 02:33:34 +0000 (11:33 +0900)]
[SimpleLoopUnswitch] Fix introduction of UB when hoisted condition may be undef or poison

Summary:
Loop unswitch hoists branches on loop-invariant conditions. However, if this
condition is poison/undef and the branch wasn't originally reachable, loop
unswitch introduces UB (since the optimized code will branch on poison/undef and
the original one didn't)).
We fix this problem by freezing the condition to ensure we don't introduce UB.

We will now transform the following:
  while (...) {
    if (C) { A }
    else   { B }
  }

Into:
  C' = freeze(C)
  if (C') {
    while (...) { A }
  } else {
    while (...) { B }
  }

This patch fixes the root cause of the following bug reports (which use the old loop unswitch, but can be reproduced with minor changes in the code and -enable-nontrivial-unswitch):
- https://llvm.org/bugs/show_bug.cgi?id=27506
- https://llvm.org/bugs/show_bug.cgi?id=31652

Reviewers: reames, majnemer, chenli, sanjoy, hfinkel

Reviewed By: reames

Subscribers: hiraditya, jvesely, nhaehnle, filcab, regehr, trentxintong, nlopes, llvm-commits, mzolotukhin

Tags: #llvm

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

2 years ago[PowerPC] Fix the unexpected modification caused by D62993 in LowerSELECT_CC for...
Kang Zhang [Wed, 26 Feb 2020 02:59:03 +0000 (02:59 +0000)]
[PowerPC] Fix the unexpected modification caused by D62993 in LowerSELECT_CC for power9

Summary:
The patch D62993 : `[PowerPC] Emit scalar min/max instructions with unsafe fp math`
has modified the functionality when `Subtarget.hasP9Vector() && (!HasNoInfs || !HasNoNaNs)`,
 this modification is not expected.

Reviewed By: nemanjai

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

2 years ago[MC] Default MCContext::UseNamesOnTempLabels to false and only set it to true for...
Fangrui Song [Tue, 25 Feb 2020 02:09:27 +0000 (18:09 -0800)]
[MC] Default MCContext::UseNamesOnTempLabels to false and only set it to true for MCAsmStreamer

Only MCAsmStreamer (assembly output) needs to keep names of temporary labels created by
MCContext::createTempSymbol().

This change made the rL236642 optimization available for cc2as and
probably some other users.

This eliminates a behavior difference between llvm-mc -filetype=obj and cc1as, which caused
https://reviews.llvm.org/D74006#1890487

Reviewed By: efriedma

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

2 years ago[MC][ARM] Don't create multiple .ARM.exidx associated to one .text
Fangrui Song [Tue, 25 Feb 2020 01:54:39 +0000 (17:54 -0800)]
[MC][ARM] Don't create multiple .ARM.exidx associated to one .text

Fixed an issue exposed by D74006.

In clang cc1as, MCContext::UseNamesOnTempLabels is true.
When parsing a .fnstart directive, FnStart gets redefined to a temporary symbol of a different name (.Ltmp0, .Ltmp1, ...).
MCContext::getELFSection() called by SwitchToEHSection() will create a different .ARM.exidx each time.

llvm-mc uses `Ctx.setUseNamesOnTempLabels(false);` and FnStart is unnamed.
MCContext::getELFSection() called by SwitchToEHSection() will reuse the same .ARM.exidx .

Reviewed By: efriedma

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

2 years ago[Analysis] Fix -Wrange-loop-analysis after D69876
Fangrui Song [Wed, 26 Feb 2020 02:03:47 +0000 (18:03 -0800)]
[Analysis] Fix -Wrange-loop-analysis after D69876

2 years ago[docs] dump-ast-matchers removes const from Matcher args and handles template functio...
Nathan James [Wed, 26 Feb 2020 01:56:21 +0000 (01:56 +0000)]
[docs] dump-ast-matchers removes const from Matcher args and handles template functions slightly better

Reviewers: aaron.ballman, gribozavr2, joerg

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

2 years agoRemove namespace lld { namespace coff { from COFF LLD cpp files
Reid Kleckner [Thu, 20 Feb 2020 01:05:42 +0000 (17:05 -0800)]
Remove namespace lld { namespace coff { from COFF LLD cpp files

Instead, use `using namespace lld(::coff)`, and fully qualify the names
of free functions where they are defined in cpp files.

This effectively reverts d79c3be618 to follow the new style guide added
in 236fcbc21a7a8872.

Reviewed By: MaskRay

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

2 years ago[compiler-rt] Fix a typo in a comment in FuzzedDataProvider.h.
Max Moroz [Wed, 26 Feb 2020 01:10:16 +0000 (17:10 -0800)]
[compiler-rt] Fix a typo in a comment in FuzzedDataProvider.h.

2 years ago[SelectionDAG][PowerPC][AArch64][X86][ARM] Add chain input and output the ISD::FLT_RO...
Craig Topper [Wed, 26 Feb 2020 00:57:42 +0000 (16:57 -0800)]
[SelectionDAG][PowerPC][AArch64][X86][ARM] Add chain input and output the ISD::FLT_ROUNDS_

This node reads the rounding control which means it needs to be ordered properly with operations that change the rounding control. So it needs to be chained to maintain order.

This patch adds a chain input and output to the node and connects it to the chain in SelectionDAGBuilder. I've update all in-tree targets to connect their chain through their lowering code.

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

2 years agoRemove std::shared_ptr::allocate_shared
zoecarver [Wed, 26 Feb 2020 00:50:57 +0000 (16:50 -0800)]
Remove std::shared_ptr::allocate_shared

std::shared_ptr::allocate_shared isn't in the standard. This commit removes it from libc++. It updates std::allocate_shared to use __create_with_cntrl_block.

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

2 years ago[ORC] Remove the JITDylib::SymbolTableEntry::isInMaterializingState() method.
Lang Hames [Wed, 26 Feb 2020 00:04:41 +0000 (16:04 -0800)]
[ORC] Remove the JITDylib::SymbolTableEntry::isInMaterializingState() method.

It was being used inconsistently. Uses have been replaced with direct checks
on the symbol state.

2 years agoFix a null dereference in the LLDB data formatters.
Adrian Prantl [Wed, 26 Feb 2020 00:42:53 +0000 (16:42 -0800)]
Fix a null dereference in the LLDB data formatters.

2 years agoRevert "[libTooling] Add function to determine associated text of a declaration."
Nico Weber [Wed, 26 Feb 2020 00:21:52 +0000 (19:21 -0500)]
Revert "[libTooling] Add function to determine associated text of a declaration."

This reverts commit 9c54f6154f748e707ad2385ddf6d66e812890c6a.
Breaks two tests on Windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/14505/steps/stage%201%20check/logs/stdio

2 years ago[GISel][KnownBits] Update a comment regarding the effect of cache on PHIs
Quentin Colombet [Tue, 25 Feb 2020 22:03:21 +0000 (14:03 -0800)]
[GISel][KnownBits] Update a comment regarding the effect of cache on PHIs

Unlike what I claimed in my previous commit. The caching is
actually not NFC on PHIs.

When we put a big enough max depth, we end up simulating loops.
The cache is effectively cutting the simulation short and we
get less information as a result.
E.g.,
```
v0 = G_CONSTANT i8 0xC0
jump
v1 = G_PHI i8 v0, v2
v2 = G_LSHR i8 v1, 1
```

Let say we want the known bits of v1.
- With cache:
Set v1 cache to we know nothing
v1 is v0 & v2
v0 gives us 0xC0
v2 gives us known bits of v1 >> 1
v1 is in the cache
=> v1 is 0, thus v2 is 0x80
Finally v1 is v0 & v2 => 0x80

- Without cache and enough depth to do two iteration of the loop:
v1 is v0 & v2
v0 gives us 0xC0
v2 gives us known bits of v1 >> 1
v1 is v0 & v2
v0 is 0xC0
v2 is v1 >> 1
Reach the max depth for v1...
unwinding
v1 is know nothing
v2 is 0x80
v0 is 0xC0
v1 is 0x80
v2 is 0xC0
v0 is 0xC0
v1 is 0xC0

Thus now v1 is 0xC0 instead of 0x80.

I've added a unittest demonstrating that.

NFC

2 years ago[mlir] [VectorOps] Add vector.print to EDSC
aartbik [Tue, 25 Feb 2020 22:57:35 +0000 (14:57 -0800)]
[mlir] [VectorOps] Add vector.print to EDSC

Summary: This prepares using the operation in model builder runner.

Reviewers: nicolasvasilache, andydavis1

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

2 years ago[NFC][libc++] Refactor some future tests to reduce code duplication
Louis Dionne [Tue, 25 Feb 2020 23:15:56 +0000 (18:15 -0500)]
[NFC][libc++] Refactor some future tests to reduce code duplication

The same test was being repeated over and over again.
That's what functions are for.

2 years ago[mlir][DenseElementsAttr] Fix storage size for bfloat16 when parsing from hex.
River Riddle [Tue, 25 Feb 2020 22:56:24 +0000 (14:56 -0800)]
[mlir][DenseElementsAttr] Fix storage size for bfloat16 when parsing from hex.

Summary: bfloat16 is stored internally as a double, so we can't direct use Type::getIntOrFloatBitWidth.

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

2 years agoRe-land Unwind past an interrupt handler correctly on arm or at pc==0
Jason Molenda [Tue, 25 Feb 2020 22:55:47 +0000 (14:55 -0800)]
Re-land Unwind past an interrupt handler correctly on arm or at pc==0

Updated the patch to only fetch $pc on a Return Address-using
target only if we're in a trap frame *and* if there is a saved
location for $pc in the trap frame's unwind rules.  If not,
we fall back to fetching the Return Address register (eg $lr).

Original commit msg:

    Unwind past an interrupt handler correctly on arm or at pc==0

    Fix RegisterContextLLDB::InitializeNonZerothFrame so that it
    will fetch a FullUnwindPlan instead of falling back to the
    architectural default unwind plan -- GetFullUnwindPlan knows
    how to spot a jmp 0x0 that results in a fault, which may be
    the case when we see a trap handler on the stack.

    Fix RegisterContextLLDB::SavedLocationForRegister so that when
    the pc value is requested from a trap handler frame, where we
    have a complete register context available to us, don't provide
    the Return Address register (lr) instead of the pc.  We have
    an actual pc value here, and it's pointing to the instruction
    that faulted.

    Differential revision: https://reviews.llvm.org/D75007
    <rdar://problem/59416588>