platform/upstream/llvm.git
4 years ago[lldb][NFC] Make metadata tracking type safe
Raphael Isemann [Fri, 13 Dec 2019 10:29:48 +0000 (11:29 +0100)]
[lldb][NFC] Make metadata tracking type safe

Summary:
LLDB associates additional information with Types and Declarations which it calls ClangASTMetadata.
ClangASTMetadata is stored by the ClangASTSourceCommon which is implemented by having a large map of
`void *` keys to associated `ClangASTMetadata` values. To make this whole mechanism even unsafer
we also decided to use `clang::Decl *` as one of pointers we throw in there (beside `clang::Type *`).

The Decl class hierarchy uses multiple inheritance which means that not all pointers have the
same address when they are implicitly converted to pointers of their parent classes. For example
`clang::Decl *` and `clang::DeclContext *` won't end up being the same address when they
are implicitly converted from one of the many Decl-subclasses that inherit from both.

As we use the addresses as the keys in our Metadata map, this means that any implicit type
conversions to parent classes (or anything else that changes the addresses) will break our metadata tracking
in obscure ways.

Just to illustrate how broken this whole mechanism currently is:
```lang=cpp
  // m_ast is our ClangASTContext. Let's double check that from GetTranslationUnitDecl
  // in ClangASTContext and ASTContext return the same thing (one method just calls the other).
  assert(m_ast->GetTranslationUnitDecl() == m_ast->getASTContext()->getTranslationUnitDecl());
  // Ok, both methods have the same TU*. Let's store metadata with the result of one method call.
  m_ast->SetMetadataAsUserID(m_ast->GetTranslationUnitDecl(), 1234U);
  // Retrieve the same Metadata for the TU by using the TU* from the other method... which fails?
  EXPECT_EQ(m_ast->GetMetadata(m_ast->getASTContext()->getTranslationUnitDecl())->GetUserID(), 1234U);
  // Turns out that getTranslationUnitDecl one time returns a TranslationUnitDecl* but the other time
  // we return one of the parent classes of TranslationUnitDecl (DeclContext).
```

This patch splits up the `void *` API into two where one does the `clang::Type *` tracking and one the `clang::Decl *` mapping.
Type and Decl are disjoint class hierarchies so there is no implicit conversion possible that could influence
the address values.

I had to change the storing of `clang::QualType` opaque pointers to their `clang::Type *` equivalents as
opaque pointers are already `void *` pointers to begin with. We don't seem to ever set any qualifier in any of these
QualTypes to this conversion should be NFC.

Reviewers: labath, shafik, aprantl

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

4 years agoRecommit "[AArch64][SVE] Implement intrinsics for non-temporal loads & stores"
Kerry McLaughlin [Wed, 11 Dec 2019 14:46:40 +0000 (14:46 +0000)]
Recommit "[AArch64][SVE] Implement intrinsics for non-temporal loads & stores"

Updated pred_load patterns added to AArch64SVEInstrInfo.td by this patch
to use reg + imm non-temporal loads to fix previous test failures.

Original commit message:

Adds the following intrinsics:
  - llvm.aarch64.sve.ldnt1
  - llvm.aarch64.sve.stnt1

This patch creates masked loads and stores with the
MONonTemporal flag set when used with the intrinsics above.

4 years ago[LiveDebugValues] Omit entry values for DBG_VALUEs with pre-existing expressions
David Stenberg [Fri, 13 Dec 2019 09:37:53 +0000 (10:37 +0100)]
[LiveDebugValues] Omit entry values for DBG_VALUEs with pre-existing expressions

Summary:
This is a quickfix for PR44275. An assertion that checks that the
DIExpression is valid failed due to attempting to create an entry value
for an indirect parameter. This started appearing after D69028, as the
indirect parameter started being represented using an DW_OP_deref,
rather than with the DBG_VALUE's second operand, meaning that the
isIndirectDebugValue() check in LiveDebugValues did not exclude such
parameters. A DIExpression that has an entry value operation can
currently not have any other operation, leading to the failed isValid()
check.

This patch simply makes us stop considering emitting entry values
for such parameters. To support such cases I think we at least need
to do the following changes:

 * In DIExpression::isValid(): Remove the limitation that a
   DW_OP_LLVM_entry_value operation can be the only operation in a
   DIExpression.

 * In LiveDebugValues::emitEntryValues(): Create an entry value of size
   1, so that it only wraps the register operand, and not the whole
   pre-existing expression (the DW_OP_deref).

 * In LiveDebugValues::removeEntryValue(): Check that the new debug
   value has the same debug expression as the original, rather than
   checking that the debug expression is empty.

 * In DwarfExpression::addMachineRegExpression(): Modify the logic so
   that a DW_OP_reg* expression is emitted for the entry value.
   That is how GCC emits entry values for indirect parameters. That will
   currently not happen to due the DW_OP_deref causing the
   !HasComplexExpression to fail. The LocationKind needs to be changed
   also, rather than always emitting a DW_OP_stack_value for entry values.

There are probably more things I have missed, but that could hopefully
be a good starting point for emitting such entry values.

Reviewers: djtodoro, aprantl, jmorse, vsk

Reviewed By: aprantl, vsk

Subscribers: hiraditya, llvm-commits

Tags: #debug-info, #llvm

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

4 years ago[clangd] Fix windows builds
Kadir Cetinkaya [Fri, 13 Dec 2019 09:29:39 +0000 (10:29 +0100)]
[clangd] Fix windows builds

4 years ago[lldb/cmake] Temporarily revive LLDB_DISABLE_CURSES
Pavel Labath [Fri, 13 Dec 2019 09:20:35 +0000 (10:20 +0100)]
[lldb/cmake] Temporarily revive LLDB_DISABLE_CURSES

At least one lldb bot still uses this cmake variable instead of
LLDB_ENABLE_CURSES. Add code to set the default value of the "enable"
variable based on the old value of the "disable" setting.

This should bring those bots back up, until we can update the master to
use the new setting.

4 years ago[clangd] Add "inline" keyword to prevent ODR-violations in DefineInline
Kadir Cetinkaya [Tue, 1 Oct 2019 08:39:14 +0000 (10:39 +0200)]
[clangd] Add "inline" keyword to prevent ODR-violations in DefineInline

Reviewers: ilya-biryukov, hokein

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

Tags: #clang

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

4 years ago[clangd] Introduce codeblocks
Kadir Cetinkaya [Wed, 11 Dec 2019 18:14:15 +0000 (19:14 +0100)]
[clangd] Introduce codeblocks

Summary: Follow-up to the patch D71248

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd] Introduce paragraph, the first part of new rendering structs
Kadir Cetinkaya [Tue, 10 Dec 2019 09:28:37 +0000 (10:28 +0100)]
[clangd] Introduce paragraph, the first part of new rendering structs

Summary:
Initial patch for new rendering structs in clangd.

Splitting implementation into smaller chunks, for a full view of the API see D71063.

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

Tags: #clang

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

Reviewers: sammccall

4 years ago[yaml2obj] - Add a way to override sh_flags section field.
Georgii Rymar [Thu, 12 Dec 2019 12:47:29 +0000 (15:47 +0300)]
[yaml2obj] - Add a way to override sh_flags section field.

Currently we have the `Flags` property that allows to
set flags for a section. The problem is that it does not
allow us to set an arbitrary value, because of bit fields
validation under the hood. An arbitrary values can be used
to test specific broken cases.

We probably do not want to relax the validation, so this
patch adds a `ShSize` property that allows to
override the `sh_size`. It is inline with others `Sh*` properties
we have already.

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

4 years ago[llvm-readobj] - Fix letters used for dumping section types in GNU style.
Georgii Rymar [Thu, 12 Dec 2019 14:09:55 +0000 (17:09 +0300)]
[llvm-readobj] - Fix letters used for dumping section types in GNU style.

I've noticed that when we have all regular flags set, we print "WAEXMSILoGTx"
instead of "WAXMSILOGTCE" printed by GNU readelf.

It happens because:
1) We print SHF_EXCLUDE at the wrong place.
2) We do not recognize SHF_COMPRESSED, we print "x" instead of "C".
3) We print "o" instead of "O" for SHF_OS_NONCONFORMING.

This patch fixes differences and adds test cases.

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

4 years ago[LegalizeTypes] Remove unnecessary if before calling ReplaceValueWith on the chain...
Craig Topper [Fri, 13 Dec 2019 08:02:41 +0000 (00:02 -0800)]
[LegalizeTypes] Remove unnecessary if before calling ReplaceValueWith on the chain in SoftenFloatRes_LOAD.

I believe this is a leftover from when fp128 was softened to fp128
on X86-64. In that case type legalization must have been able to
create a load that was the same as N which would make this
replacement fail or assert. Since we no longer do that, this
check should be unneeded.

4 years agoReapply [LVI] Normalize pointer behavior
Nikita Popov [Wed, 4 Dec 2019 19:51:31 +0000 (20:51 +0100)]
Reapply [LVI] Normalize pointer behavior

This is a rebase of the change over D70376, which fixes an LVI cache
invalidation issue that also affected this patch.

-----

Related to D69686. As noted there, LVI currently behaves differently
for integer and pointer values: For integers, the block value is always
valid inside the basic block, while for pointers it is only valid at
the end of the basic block. I believe the integer behavior is the
correct one, and CVP relies on it via its getConstantRange() uses.

The reason for the special pointer behavior is that LVI checks whether
a pointer is dereferenced in a given basic block and marks it as
non-null in that case. Of course, this information is valid only after
the dereferencing instruction, or in conservative approximation,
at the end of the block.

This patch changes the treatment of dereferencability: Instead of
including it inside the block value, we instead treat it as something
similar to an assume (it essentially is a non-nullness assume) and
incorporate this information in intersectAssumeOrGuardBlockValueConstantRange()
if the context instruction is the terminator of the basic block.
This happens either when determining an edge-value internally in LVI,
or when a terminator was explicitly passed to getValueAt(). The latter
case makes this change not fully NFC, because we can now fold
terminator icmps based on the dereferencability information in the
same block. This is the reason why I changed one JumpThreading test
(it would optimize the condition away without the change).

Of course, we do not want to recompute dereferencability on each
intersectAssume call, so we need a new cache for this. The
dereferencability analysis requires walking the entire basic block
and computing underlying objects of all memory operands. This was
previously done separately for each queried pointer value. In the
new implementation (both because this makes the caching simpler,
and because it is faster), I instead only walk the full BB once and
cache all the dereferenced pointers. So the traversal is now performed
only once per BB, instead of once per queried pointer value.

I think the overall model now makes more sense than before, and there
will be no more pitfalls due to differing integer/pointer behavior.

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

4 years ago[lldb] Remove xpasses after pr44037 fix committed
Muhammad Omair Javaid [Fri, 13 Dec 2019 07:03:29 +0000 (12:03 +0500)]
[lldb] Remove xpasses after pr44037 fix committed

This patch removes xpass decorator from tests which were failing due to
pr44037.

pr44037 was fixed by rev 6ce1a897b6a82e18059fd3b75b8d52ff12c2a605

4 years agoRevert an accidental commit af5ca40b47b3e85c3add81ccdc0b787c4bc355ae
Rui Ueyama [Fri, 13 Dec 2019 06:17:10 +0000 (15:17 +0900)]
Revert an accidental commit af5ca40b47b3e85c3add81ccdc0b787c4bc355ae

4 years agoUpdate the man page
Rui Ueyama [Thu, 12 Dec 2019 03:09:45 +0000 (12:09 +0900)]
Update the man page

Add a description about the compression level of the debug info.

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

4 years agotemporary
Rui Ueyama [Fri, 13 Dec 2019 05:31:57 +0000 (14:31 +0900)]
temporary

4 years agoCorrect inf typo
Andrew Gaul [Fri, 13 Dec 2019 02:58:56 +0000 (10:58 +0800)]
Correct inf typo

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: Jim, cfe-commits

Tags: #clang

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

4 years ago[libcxx] [test] Fix valarray UB and MSVC warnings.
Stephan T. Lavavej [Fri, 13 Dec 2019 01:16:00 +0000 (17:16 -0800)]
[libcxx] [test] Fix valarray UB and MSVC warnings.

[libcxx] [test] Calling min and max on an empty valarray is UB.

libcxx/test/std/numerics/numarray/template.valarray/valarray.members/min.pass.cpp
libcxx/test/std/numerics/numarray/template.valarray/valarray.members/max.pass.cpp

The calls `v1.min();` and `v1.max();` were emitting nodiscard warnings
with MSVC's STL. Upon closer inspection, these calls were triggering
undefined behavior. N4842 [valarray.members] says:

"T min() const;
8 Preconditions: size() > 0 is true.
T max() const;
10 Preconditions: size() > 0 is true."

As these tests already provide coverage for non-empty valarrays
(immediately above), I've simply deleted the code for empty valarrays.

[libcxx] [test] Add macros to msvc_stdlib_force_include.h (NFC).

libcxx/test/support/msvc_stdlib_force_include.h

These macros are being used by:
libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp
Defining them to nothing allows that test to pass.

[libcxx] [test] Silence MSVC warning C5063 for is_constant_evaluated (NFC).

libcxx/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp

This test is intentionally writing code that MSVC intentionally warns
about, so the warning should be silenced.

Additionally, comment an endif for clarity.

[libcxx] [test] Silence MSVC warning C4127 (NFC).

libcxx/test/support/charconv_test_helpers.h

MSVC avoids emitting this warning when it sees a single constexpr value
being tested, but this condition is a mix of compile-time and run-time.
Using push-disable-pop is the least intrusive way to silence this.

[libcxx] [test] Silence MSVC truncation warning (NFC).

libcxx/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp

This test is intentionally truncating float to int, which MSVC
intentionally warns about, so push-disable-pop is necessary.

[libcxx] [test] Avoid truncation warnings in erase_if tests (NFC).

libcxx/test/std/containers/associative/map/map.erasure/erase_if.pass.cpp
libcxx/test/std/containers/associative/multimap/multimap.erasure/erase_if.pass.cpp
libcxx/test/std/containers/unord/unord.map/erase_if.pass.cpp
libcxx/test/std/containers/unord/unord.multimap/erase_if.pass.cpp

These tests use maps with `short` keys and values, emitting MSVC
truncation warnings from `int`. Adding `static_cast` to `key_type`
and `mapped_type` avoids these warnings.

As these tests require C++20 mode (or newer), for brevity I've changed
the multimap tests to use emplace to initialize the test data.
This has no effect on the erase_if testing.

4 years agoRemove extra character I added to test my changes that I forgot to delete before...
Douglas Yung [Fri, 13 Dec 2019 02:22:25 +0000 (18:22 -0800)]
Remove extra character I added to test my changes that I forgot to delete before submitting.

4 years ago[NFC][AArch64] Fix typo.
Nate Voorhies [Fri, 13 Dec 2019 02:24:08 +0000 (10:24 +0800)]
[NFC][AArch64] Fix typo.

Summary: Coaleascer should be coalescer.

Reviewers: qcolombet, Jim

Reviewed By: Jim

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

Tags: #llvm

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

4 years ago[libc++] Mark all fuzzing tests as unsupported in C++03
Eric Fiselier [Fri, 13 Dec 2019 02:12:27 +0000 (21:12 -0500)]
[libc++] Mark all fuzzing tests as unsupported in C++03

4 years ago[libc++] Cleanup and enable multiple warnings.
Eric Fiselier [Fri, 13 Dec 2019 01:48:11 +0000 (20:48 -0500)]
[libc++] Cleanup and enable multiple warnings.

Too many warnings are being disabled too quickly. Warnings are
important to keeping libc++ correct. This patch re-enables two
warnings: -Wconstant-evaluated and -Wdeprecated-copy.

In future, all warnings disabled for the test suite should require
an attached bug. The bug should state the plan for re-enabling that
warning, or a strong case why it should remain disabled.

4 years agoTemporarily revert "NFC: DebugInfo: Refactor RangeSpanList to be a struct, like Debug...
Eric Christopher [Fri, 13 Dec 2019 01:55:41 +0000 (17:55 -0800)]
Temporarily revert "NFC: DebugInfo: Refactor RangeSpanList to be a struct, like DebugLocStream::List"
as it was causing bot and build failures.

This reverts commit 8e04896288d22ed8bef7ac367923374f96b753d6.

4 years ago[iOS sim] Simplify iossim_run.py script
Julian Lettner [Fri, 13 Dec 2019 01:28:54 +0000 (17:28 -0800)]
[iOS sim] Simplify iossim_run.py script

4 years ago[clangd] Fix Windows test failure by adding -fno-delayed-template-parsing to LocateSy...
Nathan Ridge [Fri, 13 Dec 2019 00:57:45 +0000 (19:57 -0500)]
[clangd] Fix Windows test failure by adding -fno-delayed-template-parsing to LocateSymbol.Ambiguous

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

Tags: #clang

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

4 years agoFix test to work correctly on 32-bit platforms.
Douglas Yung [Fri, 13 Dec 2019 01:28:06 +0000 (17:28 -0800)]
Fix test to work correctly on 32-bit platforms.

4 years agoNFC: DebugInfo: Refactor RangeSpanList to be a struct, like DebugLocStream::List
David Blaikie [Fri, 13 Dec 2019 00:53:59 +0000 (16:53 -0800)]
NFC: DebugInfo: Refactor RangeSpanList to be a struct, like DebugLocStream::List

Move these data structures closer together so their emission code can
eventually share more of its implementation.

4 years agoNFC: DebugInfo: Refactor debug_loc/loclist emission into a common function
David Blaikie [Fri, 13 Dec 2019 00:37:52 +0000 (16:37 -0800)]
NFC: DebugInfo: Refactor debug_loc/loclist emission into a common function

(except for v4 loclists, which are sufficiently different to not fit
well in this generic implementation)

In subsequent patches I intend to refactor the DebugLoc and ranges data
structures to be more similar so I can common more of the implementation
here.

4 years ago__bit_reference: fix -Wdeprecated-copy warnings
Fangrui Song [Thu, 5 Dec 2019 23:54:08 +0000 (15:54 -0800)]
__bit_reference: fix -Wdeprecated-copy warnings

Since C++11, [depr.impldec]:

The implicit definition of a copy constructor as defaulted is deprecated
if the class has a user-declared copy assignment operator or a
user-declared destructor.

At clang HEAD, -Wdeprecated-copy (included by -Wextra) will warn on such instances.

Reviewed By: EricWF

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

4 years agohwasan: add tag_offset DWARF attribute to optimized debug info
Evgenii Stepanov [Tue, 26 Nov 2019 01:47:30 +0000 (17:47 -0800)]
hwasan: add tag_offset DWARF attribute to optimized debug info

Summary:
Support alloca-referencing dbg.value in hwasan instrumentation.
Update AsmPrinter to emit DW_AT_LLVM_tag_offset when location is in
loclist format.

Reviewers: pcc

Subscribers: srhines, aprantl, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[libomptarget][nfc] Add declarations of atomic functions for amdgcn
Jon Chesterfield [Thu, 12 Dec 2019 22:56:13 +0000 (22:56 +0000)]
[libomptarget][nfc] Add declarations of atomic functions for amdgcn

Summary:
[libomptarget][nfc] Add declarations of atomic functions for amdgcn

This enables building more source for amdgcn. The functions are usually available
in a hip runtime header, but are duplicated here to decouple the implementation

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: jvesely, mgorny, jfb, openmp-commits

Tags: #openmp

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

4 years ago[IR] Include target specific intrinsic headers
Heejin Ahn [Thu, 12 Dec 2019 22:47:46 +0000 (14:47 -0800)]
[IR] Include target specific intrinsic headers

After D71320, target-specific intrinsic headers should be included.

4 years ago[libomptarget] Move resource id functions into target specific code, implement for...
Jon Chesterfield [Thu, 12 Dec 2019 22:49:01 +0000 (22:49 +0000)]
[libomptarget] Move resource id functions into target specific code, implement for amdgcn

Summary: [libomptarget] Move resource id functions into target specific code, implement for amdgcn

Reviewers: jdoerfert, ABataev, grokos

Reviewed By: jdoerfert

Subscribers: jvesely, mgorny, openmp-commits

Tags: #openmp

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

4 years agoUpdate line number after previous patch added an additional unsupported
Eric Christopher [Thu, 12 Dec 2019 22:45:05 +0000 (14:45 -0800)]
Update line number after previous patch added an additional unsupported
and comment lines.

4 years ago[AArch64][SVE] Add integer arithmetic with immediate instructions.
Danilo Carvalho Grael [Wed, 11 Dec 2019 19:14:20 +0000 (14:14 -0500)]
[AArch64][SVE] Add integer arithmetic with immediate instructions.

Summary:
Add pattern matching for the following instructions:
- add, sub, subr, sqadd, sqsub, uqadd, uqsub

This patch required complex patterns to match the immediate with optinal left shift.

I re-used the Select function from the other SVE repo to implement the complext pattern.

I plan on doing another patch to also match constant vector of the same immediate.

Reviewers: sdesmalen, huntergr, rengolin, efriedma, c-rhodes, mgudim, kmclaughlin

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

Tags: #llvm

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

4 years ago[clangd] Heuristically resolve dependent method calls
Nathan Ridge [Thu, 5 Dec 2019 23:29:32 +0000 (18:29 -0500)]
[clangd] Heuristically resolve dependent method calls

Summary:
The heuristic is to look in the definition of the primary template,
which is what you want in the vast majority of cases.

Fixes https://github.com/clangd/clangd/issues/141

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[libc++] Tolerate NaN returning random distributions for now
Eric Fiselier [Thu, 12 Dec 2019 22:10:00 +0000 (17:10 -0500)]
[libc++] Tolerate NaN returning random distributions for now

4 years ago[Attributor][FIX] Do treat byval arguments special
Johannes Doerfert [Thu, 12 Dec 2019 21:02:36 +0000 (15:02 -0600)]
[Attributor][FIX] Do treat byval arguments special

When we reason about the pointer argument that is byval we actually
reason about a local copy of the value passed at the call site. This was
not the case before and we wrongly introduced attributes based on the
surrounding function.

AAMemoryBehaviorArgument, AAMemoryBehaviorCallSiteArgument and
AANoCaptureCallSiteArgument are made aware of byval now. The code
to skip "subsuming positions" for reasoning follows a common pattern and
we should refactor it. A TODO was added.

Discovered by @efriedma as part of D69748.

4 years ago[NFC][InstSimplify] Refactoring ThreadCmpOverSelect function
Denis Bakhvalov [Thu, 12 Dec 2019 21:45:52 +0000 (22:45 +0100)]
[NFC][InstSimplify] Refactoring ThreadCmpOverSelect function

Removed code duplication in ThreadCmpOverSelect and broke it
into several smaller functions for reusing them.

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

4 years agoRevert "[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc"
Sanjay Patel [Thu, 12 Dec 2019 21:19:37 +0000 (16:19 -0500)]
Revert "[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc"

This reverts commit 8963332c3327daa652ba3e26d35f9109b6991985.
There was a logic bug typo in this code, but it wasn't visible in the asm for the tests.

4 years ago[clang] [test] Disable the test exhausting stack on NetBSD
Michał Górny [Thu, 12 Dec 2019 14:17:16 +0000 (15:17 +0100)]
[clang] [test] Disable the test exhausting stack on NetBSD

Disable the instantiation-depth-default.cpp test on NetBSD since it
requires more stack space than we have by default on NetBSD.

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

4 years ago[sanitizers] Redirect stdout and stderr to TASK_LOG
Eric Christopher [Thu, 12 Dec 2019 21:09:43 +0000 (13:09 -0800)]
[sanitizers] Redirect stdout and stderr to TASK_LOG

At some point cpplint.py became very noisy during a build spewing
a few hundred lines of "Done processing..." even with SILENT=1 in
cmake. This attempts to redirect the stdout of "Done processing" to
the task log along with any errors.

Tested by this with and without SILENT=1 to check things.

Differential Revision: https://reviews.llvm.org/D71402
Reviewed By: eugenis

4 years ago[OPENMP50]Fix possible conflict when emitting an alias for the functions
Alexey Bataev [Thu, 12 Dec 2019 20:33:18 +0000 (15:33 -0500)]
[OPENMP50]Fix possible conflict when emitting an alias for the functions
in declare variant.

If the types of the fnction are not equal, but match, at the codegen
thei may have different types. This may lead to compiler crash.

4 years ago[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc
Sanjay Patel [Thu, 12 Dec 2019 20:20:42 +0000 (15:20 -0500)]
[DAGCombiner] fold shift-trunc-shift to shift-mask-trunc

This fold is done in IR by instcombine, and we have a special
form of it already here in DAGCombiner, but we want the more
general transform too:
https://rise4fun.com/Alive/3jZm

Name: general
Pre: (C1 + zext(C2) < 64)
%s = lshr i64 %x, C1
%t = trunc i64 %s to i16
%r = lshr i16 %t, C2
=>
%s2 = lshr i64 %x, C1 + zext(C2)
%a = and i64 %s2, zext((1 << (16 - C2)) - 1)
%r = trunc %a to i16

Name: special
Pre: C1 == 48
%s = lshr i64 %x, C1
%t = trunc i64 %s to i16
%r = lshr i16 %t, C2
=>
%s2 = lshr i64 %x, C1 + zext(C2)
%r = trunc %s2 to i16

...because D58017 exposes a regression without this fold.

4 years ago[libc++] Add check to ensure oss-fuzz properly targets libc++.
Eric Fiselier [Thu, 12 Dec 2019 20:36:34 +0000 (15:36 -0500)]
[libc++] Add check to ensure oss-fuzz properly targets libc++.

4 years ago[LTO] Support for embedding bitcode section during LTO
Teresa Johnson [Thu, 12 Dec 2019 19:59:36 +0000 (11:59 -0800)]
[LTO] Support for embedding bitcode section during LTO

Summary:
This adds support for embedding bitcode in a binary during LTO. The libLTO gains supports the `-lto-embed-bitcode` flag. The option allows users of the LTO library to embed a bitcode section. For example, LLD can pass the option via `ld.lld -mllvm=-lto-embed-bitcode`.

This feature allows doing something comparable to `clang -c -fembed-bitcode`, but on the (LTO) linker level. Having bitcode alongside native code has many use-cases. To give an example, the MacOS linker can create a `-bitcode_bundle` section containing bitcode. Also, having this feature built into LLVM is an alternative to 3rd party tools such as [[ https://github.com/travitch/whole-program-llvm | wllvm ]] or [[ https://github.com/SRI-CSL/gllvm | gllvm ]]. As with these tools, this feature simplifies creating "whole-program" llvm bitcode files, but in contrast to wllvm/gllvm it does not rely on a specific llvm frontend/driver.

Patch by Josef Eisl <josef.eisl@oracle.com>

Reviewers: #llvm, #clang, rsmith, pcc, alexshap, tejohnson

Reviewed By: tejohnson

Subscribers: tejohnson, mehdi_amini, inglorion, hiraditya, aheejin, steven_wu, dexonsmith, dang, cfe-commits, llvm-commits, #llvm, #clang

Tags: #clang, #llvm

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

4 years ago[OPENMP50]Improve checks for declare variant functions compatibility.
Alexey Bataev [Thu, 12 Dec 2019 19:13:02 +0000 (14:13 -0500)]
[OPENMP50]Improve checks for declare variant functions compatibility.

Added check for functions compatibility in C and removed restriction
for functions with no prototypes in declare variant constrcut.

4 years ago[Target] Remove Target::GetScratchClangASTContext
Alex Langford [Thu, 14 Nov 2019 21:41:52 +0000 (13:41 -0800)]
[Target] Remove Target::GetScratchClangASTContext

Target doesn't really need to know about ClangASTContext more than any
other TypeSystem. We can create a method ClangASTContext::GetScratch for
anything who needs a ClangASTContext specifically instead of just a
generic TypeSystem.

4 years ago[AMDGPU] AMDGPUUsage clarify address space information and other typo and formatting...
Tony [Thu, 12 Dec 2019 05:47:56 +0000 (00:47 -0500)]
[AMDGPU] AMDGPUUsage clarify address space information and other typo and formatting fixes

Summary:
- Clarify AMDGPU address spaces.
- Correct path to AMDGPU backend since now in the mono-repo.
- Fix numerous text style and typo issues.
- Correct reStructure text formatting warnings.
- Made reStructure directive usage more consistent.
- Add references for gfx10 ISA specification.

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, jfb, llvm-commits

Tags: #llvm

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

4 years agoTypeCategory: Initialize m_enabled to false
Vedant Kumar [Thu, 12 Dec 2019 19:08:56 +0000 (11:08 -0800)]
TypeCategory: Initialize m_enabled to false

The initialization was accidentally lost in https://reviews.llvm.org/D71310, causing a ubsan failure:

/Users/buildslave/jenkins/workspace/lldb-cmake-sanitized/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h:278:35: runtime error: load of value 190, which is not a valid value for type 'bool'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/buildslave/jenkins/workspace/lldb-cmake-sanitized/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h:278:35 in

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake-sanitized/621/consoleText

4 years agoSuppress -Wwarn-unused-variables when we don't know the constructor
Erich Keane [Thu, 12 Dec 2019 19:27:10 +0000 (11:27 -0800)]
Suppress -Wwarn-unused-variables when we don't know the constructor

This warning is supposed to be suppressed when the
constructor/destructor are non-trivial, since it might be a RAII type.
However, if the type has a trivial destructor and the constructor hasn't
been resolved (since it is called with dependent arguments), we were
still warning.

This patch suppresses the warning if the type could possibly have a
be a non-trivial constructor call.  Note that this does not take the
arity of the constructors into consideration, so it might suppress
the warning in cases where it isn't possible to call a non-trivial
constructor.

4 years agoRename LoopInfo::isRotated() to LoopInfo::isRotatedForm().
Kit Barton [Thu, 12 Dec 2019 19:18:39 +0000 (14:18 -0500)]
Rename LoopInfo::isRotated() to LoopInfo::isRotatedForm().

This patch renames the LoopInfo::isRotated() method to LoopInfo::isRotatedForm()
to make it clear that the method checks whether the loop is in rotated form, not
whether the loop has been rotated by the LoopRotation pass.

4 years ago[compiler-rt] libFuzzer: update -merge_control_file= help message.
Max Moroz [Thu, 12 Dec 2019 16:52:07 +0000 (08:52 -0800)]
[compiler-rt] libFuzzer: update -merge_control_file= help message.

Summary:
The motivation for this change is to have a distinguisher in libFuzzer
that would let the runner know whether multistep merge is supported or not by
a particular fuzz target binary. Otherwise, multistep merge fails to execute
with older version of libFuzzer, and there is no way to verify that easily.

Reviewers: kcc

Subscribers: dberris, #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[PS4] Predefine the __SCE__ macro for the x86_64-scei-ps4 triple
Warren Ristow [Thu, 12 Dec 2019 18:17:30 +0000 (10:17 -0800)]
[PS4] Predefine the __SCE__ macro for the x86_64-scei-ps4 triple

4 years agoDefault to -fuse-init-array
Fangrui Song [Thu, 12 Dec 2019 05:48:59 +0000 (21:48 -0800)]
Default to -fuse-init-array

Very few ELF platforms still use .ctors/.dtors now.  Linux (glibc: 1999-07),
DragonFlyBSD, FreeBSD (2012-03) and Solaris have supported .init_array
for many years. Some architectures like AArch64/RISC-V default to
.init_array . GNU ld and gold can even convert .ctors to .init_array .

It makes more sense to flip the CC1 default, and only uses
-fno-use-init-array on platforms that don't support .init_array .
For example, OpenBSD did not support DT_INIT_ARRAY before Aug 2016
(https://github.com/openbsd/src/commit/86fa57a2792c6374b0849dd7b818a11e676e60ba)

I may miss some ELF platforms that still use .ctors, but their
maintainers can easily diagnose such problems.

Reviewed By: rnk

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

4 years ago[SystemZ] Implement the packed stack layout
Jonas Paulsson [Wed, 27 Nov 2019 16:22:43 +0000 (17:22 +0100)]
[SystemZ]  Implement the packed stack layout

Any llvm function with the "packed-stack" attribute will be compiled to use
the packed stack layout which reuses unused parts of the incoming register
save area. This is needed for building the Linux kernel.

Review: Ulrich Weigand
https://reviews.llvm.org/D70821

4 years ago[FormatEntity] Add mangled function name support
Med Ismail Bennani [Tue, 10 Dec 2019 00:46:03 +0000 (16:46 -0800)]
[FormatEntity] Add mangled function name support

Summary:
Add `function.mangled-name` key for FormatEntity to show the mangled
function names in backtraces.

rdar://54088244

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Subscribers: lldb-commits

Tags: #lldb

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

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
4 years ago[DAGCombiner] improve readability
Sanjay Patel [Thu, 12 Dec 2019 18:14:02 +0000 (13:14 -0500)]
[DAGCombiner] improve readability

This is not quite NFC because I changed the SDLoc to use the more
standard 'N' (the starting node for the fold).

This transform is a special-case of a more general fold that we
do in IR, but it seems like the general fold is needed here too
to avoid a potential regression seen in D58017.

https://rise4fun.com/Alive/3jZm

4 years ago[lldb/Core] Add missing include (2/2)
Jonas Devlieghere [Thu, 12 Dec 2019 18:05:30 +0000 (10:05 -0800)]
[lldb/Core] Add missing include (2/2)

This got flagged by the debian buildbot.

4 years ago[lldb/Core] Add missing include
Jonas Devlieghere [Thu, 12 Dec 2019 17:54:48 +0000 (09:54 -0800)]
[lldb/Core] Add missing include

This got flagged by the modules build.

4 years ago[AArch64][PowerPC] add tests for shift sandwich; NFC
Sanjay Patel [Thu, 12 Dec 2019 17:36:10 +0000 (12:36 -0500)]
[AArch64][PowerPC] add tests for shift sandwich; NFC

4 years ago[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_TERMIOS
Jonas Devlieghere [Thu, 12 Dec 2019 17:34:11 +0000 (09:34 -0800)]
[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_TERMIOS

This renames LLDB_CONFIG_TERMIOS_SUPPORTED to LLDB_ENABLE_TERMIOS. It
now also uses cmakedefine01 to keep things consistent with out other
optional dependencies. But more importantly it won't silently fail when
you forget to include Config.h.

4 years ago[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_LIBXML2
Jonas Devlieghere [Thu, 12 Dec 2019 17:25:01 +0000 (09:25 -0800)]
[lldb/Host] Use cmakedefine01 for LLDB_ENABLE_LIBXML2

This keeps things consistent with out other optional dependencies. But
more importantly it won't silently fail when you forget to include
Config.h.

4 years ago[ELF] Add a comment to handleSectionGroup(). NFC
Fangrui Song [Thu, 12 Dec 2019 17:23:06 +0000 (09:23 -0800)]
[ELF] Add a comment to handleSectionGroup(). NFC

Apply suggestion in https://reviews.llvm.org/D71157#1780834

Reviewed By: grimar, ruiu

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

4 years ago[lldb/CMake] Rename LLDB_DISABLE_LIBEDIT to LLDB_ENABLE_LIBEDIT
Jonas Devlieghere [Thu, 12 Dec 2019 17:22:34 +0000 (09:22 -0800)]
[lldb/CMake] Rename LLDB_DISABLE_LIBEDIT to LLDB_ENABLE_LIBEDIT

This matches the naming scheme used by LLVM.

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

4 years ago[BasicAA] Use GEP as context for computeKnownBits in aliasGEP.
Florian Hahn [Thu, 12 Dec 2019 17:10:43 +0000 (17:10 +0000)]
[BasicAA] Use GEP as context for computeKnownBits in aliasGEP.

In order to use assumptions, computeKnownBits needs a context
instruction. We can use the GEP, if it is an instruction. We already
pass the assumption cache, but it cannot be used without a context
instruction.

Reviewers: anemet, asbirlea, hfinkel, spatel

Reviewed By: asbirlea

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

4 years ago[lldb/CMake] Rename LLDB_DISABLE_CURSES to LLDB_ENABLE_CURSES
Jonas Devlieghere [Thu, 12 Dec 2019 17:13:04 +0000 (09:13 -0800)]
[lldb/CMake] Rename LLDB_DISABLE_CURSES to LLDB_ENABLE_CURSES

This matches the naming scheme used by LLVM.

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

4 years ago[fuzzer] Add basic support for emscripten.
Jonathan Metzman [Thu, 12 Dec 2019 16:48:54 +0000 (08:48 -0800)]
[fuzzer] Add basic support for emscripten.

Summary:
Add basic support for emscripten.

This enables libFuzzer to build (using build.sh) for emscripten and fuzz
a target compiled with
-fsanitize-coverage=inline-8bit-counters.

Basic fuzzing and bug finding work with this commit.
RSS limit and timeouts will not work because they depend on system
functions that are not implemented/widely supported in emscripten.

Reviewers: kcc, vitalybuka, hctim

Reviewed By: hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[ASTImporter] Support functions with placeholder return types ...
Gabor Marton [Thu, 12 Dec 2019 16:13:35 +0000 (17:13 +0100)]
[ASTImporter] Support functions with placeholder return types ...

Summary:
Support functions with placeholder return types even in cases when the type is
declared in the body of the function.
Example: auto f() { struct X{}; return X(); }

Reviewers: balazske, a_sidorin, a.sidorin, shafik

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, teemperor, cfe-commits

Tags: #clang

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

4 years ago[amdgpu] Fix `-Wenum-compare` warning. NFC.
Michael Liao [Thu, 12 Dec 2019 16:43:02 +0000 (11:43 -0500)]
[amdgpu] Fix `-Wenum-compare` warning. NFC.

4 years ago[clang] Turn -fno-builtin flag into an IR Attribute
Guillaume Chatelet [Mon, 9 Dec 2019 11:22:27 +0000 (12:22 +0100)]
[clang] Turn -fno-builtin flag into an IR Attribute

Summary:
This is a follow up on https://reviews.llvm.org/D61634#1742154 to turn the clang driver -fno-builtin flag into an IR attribute.
I also investigated pushing the attribute earlier on (in Sema) but it looks like this patch is simple and will cover all function calls.

Reviewers: aaron.ballman, courbet

Subscribers: cfe-commits, tejohnson

Tags: #clang

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

4 years ago[clang-tidy] Use early returns to make the code easier to read and potentially run...
Alexander Kornienko [Thu, 12 Dec 2019 15:51:08 +0000 (16:51 +0100)]
[clang-tidy] Use early returns to make the code easier to read and potentially run faster

4 years agoFix naming style. NFC.
Alexander Kornienko [Fri, 6 Dec 2019 14:38:39 +0000 (15:38 +0100)]
Fix naming style. NFC.

4 years agogn build: Merge 526244b187d
LLVM GN Syncbot [Thu, 12 Dec 2019 15:45:15 +0000 (15:45 +0000)]
gn build: Merge 526244b187d

4 years ago[Matrix] Add first set of matrix intrinsics and initial lowering pass.
Florian Hahn [Thu, 12 Dec 2019 15:27:28 +0000 (15:27 +0000)]
[Matrix] Add first set of matrix intrinsics and initial lowering pass.

This is the first patch adding an initial set of matrix intrinsics and a
corresponding lowering pass. This has been discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2019-October/136240.html

The first patch introduces four new intrinsics (transpose, multiply,
columnwise load and store) and a LowerMatrixIntrinsics pass, that
lowers those intrinsics to vector operations.

Matrixes are embedded in a 'flat' vector (e.g. a 4 x 4 float matrix
embedded in a <16 x float> vector) and the intrinsics take the dimension
information as parameters. Those parameters need to be ConstantInt.
For the memory layout, we initially assume column-major, but in the RFC
we also described how to extend the intrinsics to support row-major as
well.

For the initial lowering, we split the input of the intrinsics into a
set of column vectors, transform those column vectors and concatenate
the result columns to a flat result vector.

This allows us to lower the intrinsics without any shape propagation, as
mentioned in the RFC. In follow-up patches, we plan to submit the
following improvements:
 * Shape propagation to eliminate the embedding/splitting for each
   intrinsic.
 * Fused & tiled lowering of multiply and other operations.
 * Optimization remarks highlighting matrix expressions and costs.
 * Generate loops for operations on large matrixes.
 * More general block processing for operation on large vectors,
   exploiting shape information.

We would like to add dedicated transpose, columnwise load and store
intrinsics, even though they are not strictly necessary. For example, we
could instead emit a large shufflevector instruction instead of the
transpose. But we expect that to
  (1) become unwieldy for larger matrixes (even for 16x16 matrixes,
      the resulting shufflevector masks would be huge),
  (2) risk instcombine making small changes, causing us to fail to
      detect the transpose, preventing better lowerings

For the load/store, we are additionally planning on exploiting the
intrinsics for better alias analysis.

Reviewers: anemet, Gerolf, reames, hfinkel, andrew.w.kaylor, efriedma, rengolin

Reviewed By: anemet

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

4 years ago[ARM][MVE] findVCMPToFoldIntoVPS. NFC.
Sjoerd Meijer [Thu, 12 Dec 2019 10:45:16 +0000 (10:45 +0000)]
[ARM][MVE] findVCMPToFoldIntoVPS. NFC.

This adds ReachingDefAnalysis (RDA) to the VPTBlock pass, so that we can
reimplement findVCMPToFoldIntoVPS with just a few calls to RDA.

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

4 years ago[Alignment][NFC] Adding Align compatible methods to IntrinsicInst/IRBuilder
Guillaume Chatelet [Thu, 12 Dec 2019 14:32:19 +0000 (15:32 +0100)]
[Alignment][NFC] Adding Align compatible methods to IntrinsicInst/IRBuilder

Summary:
This is patch is part of a series to introduce an Alignment type.
See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html
See this patch for the introduction of the type: https://reviews.llvm.org/D64790

Reviewers: courbet

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years agogn build: Merge 600d123c6ff
LLVM GN Syncbot [Thu, 12 Dec 2019 15:01:28 +0000 (15:01 +0000)]
gn build: Merge 600d123c6ff

4 years ago[ARM][CMSE] Add CMSE header and builtins
Momchil Velikov [Thu, 12 Dec 2019 14:59:04 +0000 (14:59 +0000)]
[ARM][CMSE] Add CMSE header and builtins

This is patch C2 as mentioned in RFC
http://lists.llvm.org/pipermail/cfe-dev/2019-March/061834.html

This adds CMSE builtin functions, and introduces arm_cmse.h header which has
useful macros, functions, and data types for end-users of CMSE.

Patch by Javed Absar.

Diferential Revision: https://reviews.llvm.org/D70817

4 years agoAMDGPU/SILoadStoreOptimizer: Simplify function
Tom Stellard [Thu, 12 Dec 2019 13:55:14 +0000 (05:55 -0800)]
AMDGPU/SILoadStoreOptimizer: Simplify function

Reviewers: arsenm, nhaehnle

Reviewed By: arsenm

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

Tags: #llvm

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

4 years ago[OpenMP][Test] Add check for aux-triple predefined macros
Alexey Bader [Thu, 12 Dec 2019 09:52:28 +0000 (12:52 +0300)]
[OpenMP][Test] Add check for aux-triple predefined macros

Summary:
Make sure that auxiliary target specific macros are defined in OpenMP
mode.

Reviewers: ABataev, jdoerfert

Subscribers: guansong, ebevhan, cfe-commits

Tags: #clang

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

4 years ago[ARM][MVE] Sink vector shift operand
Sam Parker [Thu, 12 Dec 2019 14:30:09 +0000 (14:30 +0000)]
[ARM][MVE] Sink vector shift operand

Recommit e0b966643fc2. sub instructions were being generated for the
negated value, and for some reason they were the register only ones.
I think the problem was because I was grabbing the 'zero' from
vmovimm, which is a target constant. Now I'm just generating a new
Constant zero and so rsb instructions are now generated.

Original commit message:

The shift amount operand can be provided in a general purpose
register so sink it. Flip the vdup and negate so the existing
patterns can be used for matching.

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

4 years ago[lldb/DWARF] Fix v5 location lists for dwo files
Pavel Labath [Mon, 25 Nov 2019 13:03:51 +0000 (14:03 +0100)]
[lldb/DWARF] Fix v5 location lists for dwo files

Dwo files don't have a DW_AT_loclists_base -- set one explicitly. Also,
make sure we use the correct location list flavour for v5.

4 years ago[llvm-dwarfdump] Add blank line after printing line table
James Henderson [Thu, 12 Dec 2019 09:35:59 +0000 (09:35 +0000)]
[llvm-dwarfdump] Add blank line after printing line table

This helps delineate it in the output from later tables or other output.

Reviewed by: JDevlieghere

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

4 years ago[clangd] Implement "textDocument/documentLink" protocol support
Michael Forster [Thu, 12 Dec 2019 13:30:02 +0000 (14:30 +0100)]
[clangd] Implement "textDocument/documentLink" protocol support

Summary:
This adds an implementation for the "textDocument/documentLink" LSP request.

It returns links for all `#include` directives to the resolved target files.

Fixes https://github.com/clangd/clangd/issues/217.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

4 years ago[Diagnsotics] Small Improvement on -Wmisleading-indentation
Tyker [Tue, 10 Dec 2019 21:09:20 +0000 (22:09 +0100)]
[Diagnsotics] Small Improvement on -Wmisleading-indentation

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: xbolva00

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

4 years ago[NFC][ARM] Add some test triples
Sam Parker [Thu, 12 Dec 2019 13:51:02 +0000 (13:51 +0000)]
[NFC][ARM] Add some test triples

Add thumb and thumb2 to a couple of the test files.

4 years ago[Attributor][NFC] Fix comments and unnecessary comma
Hideto Ueno [Thu, 12 Dec 2019 13:42:40 +0000 (13:42 +0000)]
[Attributor][NFC] Fix comments and unnecessary comma

4 years ago[Attributor] [NFC] Use `checkForAllUses` helpr in `AAHeapToStackImpl::updateImpl`
Hideto Ueno [Thu, 12 Dec 2019 12:26:30 +0000 (12:26 +0000)]
[Attributor] [NFC] Use `checkForAllUses` helpr in `AAHeapToStackImpl::updateImpl`

Summary: Remove `Worklist` iteration and make use `checkForAllUses`. There is no test chage.

Reviewers: sstefan1, jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Attributor][NFC] Refactoring `AANoFreeArgument::updateImpl`
Hideto Ueno [Thu, 12 Dec 2019 12:26:09 +0000 (12:26 +0000)]
[Attributor][NFC] Refactoring `AANoFreeArgument::updateImpl`

Summary: Refactoring `AANoFreeArgument::updateImpl`. There is no test change.

Reviewers: sstefan1, jdoerfert

Reviewed By: sstefan1

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Analyzer][Docs][NFC] Add CodeChecker to the command line tools
Gabor Marton [Tue, 29 Oct 2019 14:48:45 +0000 (15:48 +0100)]
[Analyzer][Docs][NFC] Add CodeChecker to the command line tools

We add a new common html file that documents the available command line
tools. Also a new html is added for a brief description of CodeChecker,
this way complementing scan-build.

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

4 years ago[DebugInfo] Prevent invalid fragments at ISel from dropping debug info
stozer [Tue, 10 Dec 2019 14:33:17 +0000 (14:33 +0000)]
[DebugInfo] Prevent invalid fragments at ISel from dropping debug info

During SelectionDAG, if a value which is associated with a DBG_VALUE
needs to be split across multiple registers, the DBG_VALUE will be split
into a set of fragment expressions to recreate the original value.

If one or more of these fragments cannot be created, they would
previously be silently dropped, causing the old debug value to live past
its expiry date. This patch fixes this issue by keeping invalid
fragments while setting their value as Undef.

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

4 years ago[Support] Try to fix bot failure after 8ddcd1dc26
Russell Gallop [Thu, 12 Dec 2019 12:18:12 +0000 (12:18 +0000)]
[Support] Try to fix bot failure after 8ddcd1dc26

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/41755

4 years ago[clangd] Rename constructors and destructors in cross-file case
Kirill Bobyrev [Thu, 12 Dec 2019 12:10:59 +0000 (13:10 +0100)]
[clangd] Rename constructors and destructors in cross-file case

* Use ad-hoc Decl canonicalization from Clang-Rename to allow renaming
  constructors and destructors while using cross-file rename.
* Manually handle the destructor selection
* Add unit tests to prevent regressions and ensure the correct behaviour

Reviewed by: sammccall

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

4 years ago[Support] Extend TimeProfiler to support multiple threads
Russell Gallop [Thu, 5 Dec 2019 09:43:49 +0000 (09:43 +0000)]
[Support] Extend TimeProfiler to support multiple threads

This makes TimeTraceProfilerInstance thread local. Added
timeTraceProfilerFinishThread() which moves the thread local instance to
a global vector of instances. timeTraceProfilerWrite() then writes
recorded data from all instances.

Threads are identified based on their thread ids. Totals are reported
with artificial thread ids higher than the real ones.

Replaced raw pointer for TimeTraceProfilerInstance with unique_ptr.

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

4 years ago[Tooling/Syntax] Helpers to find spelled tokens touching a location.
Sam McCall [Wed, 11 Dec 2019 14:40:23 +0000 (15:40 +0100)]
[Tooling/Syntax] Helpers to find spelled tokens touching a location.

Summary: Useful when positions are used to target nodes, with before/after ambiguity.

Reviewers: ilya-biryukov, kbobyrev

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[clangd] Fix windows tests
Kadir Cetinkaya [Thu, 12 Dec 2019 11:53:58 +0000 (12:53 +0100)]
[clangd] Fix windows tests

4 years ago[NFC] - Partially revert 9c48c2f9c477007234c
Gabor Buella [Thu, 12 Dec 2019 11:46:17 +0000 (12:46 +0100)]
[NFC] - Partially revert 9c48c2f9c477007234c

4 years ago[llvm-readobj][test] - Add a test for testing regular section flags and cleanup flags...
Georgii Rymar [Wed, 11 Dec 2019 10:38:52 +0000 (13:38 +0300)]
[llvm-readobj][test] - Add a test for testing regular section flags and cleanup flags testing.

This:
1) Adds a test for testing all section flags (`section-flags.test`).
2) Renames `sec-flags.test`->`section-arch-flags.test`
   and performs a clean up.
3) Removes `compression.zlib.style.elf-x86-64` binary and a test case
   for SHF_COMPRESSED flag, because them are now excessive.
4) Adds missing MIPS flags and a test for SHF_ARM_PURECODE.

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

4 years ago[lldb] Remove ClangASTMetrics
Raphael Isemann [Thu, 12 Dec 2019 10:45:06 +0000 (11:45 +0100)]
[lldb] Remove ClangASTMetrics

Summary: Not once have I looked at these numbers in a log and considered them useful. Also this should not have been implemented via an unguarded list of globals.

Reviewers: martong, shafik

Reviewed By: shafik

Subscribers: rnkovacs, JDevlieghere, lldb-commits

Tags: #lldb

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