platform/upstream/llvm.git
4 years agoFix broken comment phrasing and indentation
Matt Arsenault [Thu, 21 Nov 2019 05:54:44 +0000 (11:24 +0530)]
Fix broken comment phrasing and indentation

4 years agoAMDGPU/GlobalISel: Add AGPR bank and RegBankSelect mfma intrinsics
Austin Kerbow [Wed, 27 Nov 2019 23:07:56 +0000 (15:07 -0800)]
AMDGPU/GlobalISel: Add AGPR bank and RegBankSelect mfma intrinsics

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

4 years ago[SCEV] Make SCEV verification available from command line with new PM
Daniil Suchkov [Tue, 19 Nov 2019 07:16:39 +0000 (14:16 +0700)]
[SCEV] Make SCEV verification available from command line with new PM

New pass manager doesn't use verifyAnalysis, so currently there is no
way to call SCEV verification from command line when new PM is used.
This patch adds a pass that allows you to do that.

Reviewers: reames, fhahn, sanjoy.google, nikic

Reviewed By: fhahn

Subscribers: hiraditya, javed.absar, llvm-commits

Tags: #llvm

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

4 years agoRevert "[Examples] Add IRTransformations directory to examples."
Florian Hahn [Sun, 1 Dec 2019 22:19:05 +0000 (22:19 +0000)]
Revert "[Examples] Add IRTransformations directory to examples."

This breaks LLVMExports.cmake in some build configurations.

PR44197

This reverts commits ceb72d07b004af9c428c4a3c73a98ea97d49a713
                     7d0b1d77b3d4d47df477519fd1bf099b3df6f899.

4 years agoRevert "[clang][modules] Add support for merging lifetime-extended temporaries"
Tyker [Sun, 1 Dec 2019 21:38:31 +0000 (22:38 +0100)]
Revert "[clang][modules] Add support for merging lifetime-extended temporaries"

This reverts commit a3cbe1a202df6ec8e23bd55e14db254e4bc33021.

4 years ago[clang][modules] Add support for merging lifetime-extended temporaries
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries

Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

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

4 years ago[X86][InstCombine] Move non-X86 specific instcombine test from test/CodeGen/X86/...
Craig Topper [Sun, 1 Dec 2019 05:53:28 +0000 (21:53 -0800)]
[X86][InstCombine] Move non-X86 specific instcombine test from test/CodeGen/X86/ to test/Transforms/InstCombine/

4 years ago[X86][InstCombine] Move instcombine test from test/CodeGen/X86 to test/Transforms...
Craig Topper [Sun, 1 Dec 2019 05:47:41 +0000 (21:47 -0800)]
[X86][InstCombine] Move instcombine test from test/CodeGen/X86 to test/Transforms/InstCombine/ and replace grep with FileCheck

4 years ago[libunwind] Emit dependent libraries only when detected by CMake
Michał Górny [Sat, 30 Nov 2019 14:13:56 +0000 (15:13 +0100)]
[libunwind] Emit dependent libraries only when detected by CMake

996e62eef75 added Linux-specific dependent libraries to libunwind
sources.  As a result, building libunwind with modern LLD on *BSD
started failing due to trying to link libdl.  Instead, add those
libraries only if they were detected by CMake.

While technically we could create a long list of systems that need -ldl
and -lpthread, maintaining a duplicate list makes little sense when
CMake needs to detect it for non-LLD systems anyway.  Remove existing
system exceptions since they should be covered by the CMake check
anyway.

Remove -D_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA since it is no longer
explicitly needed, if we make the library-specific defines dependent
on presence of this pragma support.

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

4 years agoremove UB from test by making GV alignment explicit
Nuno Lopes [Sun, 1 Dec 2019 15:16:31 +0000 (15:16 +0000)]
remove UB from test by making GV alignment explicit

4 years agoRevert "[clang][modules] Add support for merging lifetime-extended temporaries"
Tyker [Sun, 1 Dec 2019 10:58:14 +0000 (11:58 +0100)]
Revert "[clang][modules] Add support for merging lifetime-extended temporaries"

This reverts commit 85c74384778909789389b9012a75cfcca7964a28.

4 years ago[clang][modules] Add support for merging lifetime-extended temporaries
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries

Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

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

4 years ago[Format] Add format check for coroutine keywords with negative numbers
Brian Gesiak [Sat, 30 Nov 2019 20:36:35 +0000 (15:36 -0500)]
[Format] Add format check for coroutine keywords with negative numbers

Summary:
As a followup to D69144, this diff fixes the coroutine keyword spacing
for co_yield / co_returning negative numbers.

Reviewers: modocache, sammccall, Quuxplusone

Reviewed By: modocache

Subscribers: cfe-commits

Tags: #clang

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

Patch by Jonathan Thomas (jonathoma)!

4 years ago[X86] Add floating point execution domain to comi/ucomi/cvtss2si/cvtsd2si/cvttss2si...
Craig Topper [Sat, 30 Nov 2019 19:12:07 +0000 (11:12 -0800)]
[X86] Add floating point execution domain to comi/ucomi/cvtss2si/cvtsd2si/cvttss2si/cvttsd2si/cvtsi2ss/cvtsi2sd instructions.

4 years ago[InstCombine] Expand usub_sat patterns to handle constants
David Green [Sat, 30 Nov 2019 16:39:29 +0000 (16:39 +0000)]
[InstCombine] Expand usub_sat patterns to handle constants

The constants come through as add %x, -C, not a sub as would be
expected. They need some extra matchers to canonicalise them towards
usub_sat.

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

4 years ago[InstCombine] Adjust usub_sat fold one use checks
David Green [Sat, 30 Nov 2019 14:20:55 +0000 (14:20 +0000)]
[InstCombine] Adjust usub_sat fold one use checks

This adjusts the one use checks in the the usub_sat fold code to not
increase instruction count, but otherwise do the fold. Reviewed as a
part of D69514.

4 years ago[InstCombine] More usub_sat tests. NFC.
David Green [Sat, 30 Nov 2019 14:14:55 +0000 (14:14 +0000)]
[InstCombine] More usub_sat tests. NFC.

4 years agoRevert "[clang][modules] Add support for merging lifetime-extended temporaries"
Tyker [Sat, 30 Nov 2019 16:52:26 +0000 (17:52 +0100)]
Revert "[clang][modules] Add support for merging lifetime-extended temporaries"

This reverts commit 3c7f6b439699a9cbbc0ac8d288cc70aff357446b.

4 years ago[clang][modules] Add support for merging lifetime-extended temporaries
Tyker [Sat, 30 Nov 2019 15:42:33 +0000 (16:42 +0100)]
[clang][modules] Add support for merging lifetime-extended temporaries

Summary: Add support for merging lifetime-extended temporaries

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: xbolva00, cfe-commits

Tags: #clang

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

4 years agoRevert 651f07908a1 "[AArch64] Don't combine callee-save and local stack adjustment...
Hans Wennborg [Sat, 30 Nov 2019 13:20:11 +0000 (14:20 +0100)]
Revert 651f07908a1 "[AArch64] Don't combine callee-save and local stack adjustment when optimizing for size"

This caused asserts (and perhaps also miscompiles) while building for Windows
on AArch64. See the discussion on D68530 for details and reproducer.

Reverting until this can be investigated and fixed.

> For arm64, D18619 introduced the ability to combine bumping the stack pointer
> upfront in case it needs to be bumped for both the callee-save area as well as
> the local stack area.
>
> That diff already remarks that "This change can cause an increase in
> instructions", but argues that even when that happens, it should be still be a
> performance benefit because the number of micro-ops is reduced.
>
> We have observed that this code-size increase can be significant in practice.
> This diff disables combining stack bumping for methods that are marked as
> optimize-for-size.
>
> Example of a prologue with the behavior before this diff (combining stack bumping when possible):
>   sub        sp, sp, #0x40
>   stp        d9, d8, [sp, #0x10]
>   stp        x20, x19, [sp, #0x20]
>   stp        x29, x30, [sp, #0x30]
>   add        x29, sp, #0x30
>   [... compute x8 somehow ...]
>   stp        x0, x8, [sp]
>
> And after this  diff, if the method is marked as optimize-for-size:
>   stp        d9, d8, [sp, #-0x30]!
>   stp        x20, x19, [sp, #0x10]
>   stp        x29, x30, [sp, #0x20]
>   add        x29, sp, #0x20
>   [... compute x8 somehow ...]
>   stp        x0, x8, [sp, #-0x10]!
>
> Note that without combining the stack bump there are two auto-decrements,
> nicely folded into the stp instructions, whereas otherwise there is a single
> sub sp, ... instruction, but not folded.
>
> Patch by Nikolai Tillmann!
>
> Differential Revision: https://reviews.llvm.org/D68530

4 years agoUpdated the OCaml/bitwriter.ml test for OCaml 4.06+
Dmitri Gribenko [Sat, 30 Nov 2019 12:31:16 +0000 (13:31 +0100)]
Updated the OCaml/bitwriter.ml test for OCaml 4.06+

Since OCaml 4.02 (released in 2014), strings and bytes are different
types, but up until OCaml 4.06, the compiler defaulted to a
compatibility mode "unsafe-string". OCaml 4.06 flips the default to
"safe-string", breaking the test.

This change should be compatible with OCaml 4.02+, but is only truly
necessary for OCaml 4.06+.

For more information, see:

https://caml.inria.fr/pub/docs/manual-ocaml/libref/String.html
https://ocaml.org/releases/4.02.html

4 years agoFix a typo.
Hans Wennborg [Sat, 30 Nov 2019 12:23:49 +0000 (13:23 +0100)]
Fix a typo.

4 years agoRevert "[clangd] Rethink how SelectionTree deals with macros and #includes."
Sam McCall [Fri, 29 Nov 2019 18:59:02 +0000 (19:59 +0100)]
Revert "[clangd] Rethink how SelectionTree deals with macros and #includes."

This reverts commit 19daa21f841ad45290c923689ee3d25198651a4c.

It causes a bunch of failures on a bot that I've been unable to
reproduce so far:
http://45.33.8.238/mac/3308/step_7.txt

4 years ago[PowerPC][AIX] Add support for lowering int/float/double formal arguments.
Sean Fertile [Fri, 29 Nov 2019 17:44:56 +0000 (12:44 -0500)]
[PowerPC][AIX] Add support for lowering int/float/double formal arguments.

This patch adds LowerFormalArguments_AIX, support is added for lowering
int, float, and double formal arguments into general purpose and
floating point registers only.

The aix calling convention testcase have been redone to test for caller
and callee functionality in the same lit test.

Patch by Zarko Todorovski!

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

4 years agoRevert "[ARM] Allocatable Global Register Variables for ARM"
Carey Williams [Fri, 29 Nov 2019 17:01:05 +0000 (17:01 +0000)]
Revert "[ARM] Allocatable Global Register Variables for ARM"

This reverts commit 2d739f98d8a53e38bf9faa88cdb6b0c2a363fb77.

4 years agoRevert "[NFC] Fix test reserve_global_reg.ll after 2d739f9"
Carey Williams [Fri, 29 Nov 2019 17:00:55 +0000 (17:00 +0000)]
Revert "[NFC] Fix test reserve_global_reg.ll after 2d739f9"

This reverts commit aea7578fade2563cb5ea60548914667b515c457a.

4 years agoOn Windows, fix fuse-ld.c test when lld is provided explictly in -DCMAKE_LINKER
Alexandre Ganea [Fri, 29 Nov 2019 16:28:49 +0000 (11:28 -0500)]
On Windows, fix fuse-ld.c test when lld is provided explictly in -DCMAKE_LINKER

4 years ago[CIndex] Fix annotate-deep-statements test when using a Debug build
Alexandre Ganea [Fri, 29 Nov 2019 15:52:13 +0000 (10:52 -0500)]
[CIndex] Fix annotate-deep-statements test when using a Debug build

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

4 years ago[clangd] Rethink how SelectionTree deals with macros and #includes.
Sam McCall [Wed, 20 Nov 2019 22:25:17 +0000 (23:25 +0100)]
[clangd] Rethink how SelectionTree deals with macros and #includes.

Summary:
The exclusive-claim model is successful at resolving conflicts over tokens
between parent/child or siblings. However claims at the spelled-token
level do the wrong thing for macro expansions, where siblings can be
equally associated with the macro invocation.
Moreover, any model that only uses the endpoints in a range can fail when
a macro invocation occurs inside the node.

To address this, we use the existing TokenBuffer in more depth.
Claims are expressed in terms of expanded tokens, so there is no need to worry
about macros, includes etc.

Once we know which expanded tokens were claimed, they are mapped onto
spelled tokens for hit-testing.
This mapping is fairly flexible, currently the handling of macros is
pretty simple (map macro args onto spellings, other macro expansions onto the
macro name token).
This mapping is in principle token-by-token for correctness (though
there's some batching for performance).

The aggregation of the selection enum is now more principled as we need to be
able to aggregate several hit-test results together.

For simplicity i removed the ability to determine selectedness of TUDecl.
(That was originally implemented in 90a5bf92ff97b1, but doesn't seem to be very
important or worth the complexity any longer).

The expandedTokens(SourceLocation) helper could be added locally, but seems to
make sense on TokenBuffer.

Fixes https://github.com/clangd/clangd/issues/202
Fixes https://github.com/clangd/clangd/issues/126

Reviewers: hokein

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

Tags: #clang

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

4 years ago[LLDB] [ARM] Use r11 as frame pointer on Windows on ARM
Martin Storsjö [Tue, 15 Oct 2019 21:08:28 +0000 (00:08 +0300)]
[LLDB] [ARM] Use r11 as frame pointer on Windows on ARM

Extend EmulateMOVRdRm to identify "mov r11, sp" in thumb mode as
setting the frame pointer, if r11 is the frame pointer register.

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

4 years ago[lldb][NFC] Remove unused ClangASTContext::GetBasicType(ConstString)
Raphael Isemann [Fri, 29 Nov 2019 13:08:01 +0000 (14:08 +0100)]
[lldb][NFC] Remove unused ClangASTContext::GetBasicType(ConstString)

4 years ago[lldb][NFC] Remove ClangASTContext::GetBuiltinTypeForEncodingAndBitSize overload
Raphael Isemann [Fri, 29 Nov 2019 12:43:23 +0000 (13:43 +0100)]
[lldb][NFC] Remove ClangASTContext::GetBuiltinTypeForEncodingAndBitSize overload

4 years ago[lldb][NFC] Explicitly ask for a ClangASTContext in ClangASTSource
Raphael Isemann [Fri, 29 Nov 2019 12:02:41 +0000 (13:02 +0100)]
[lldb][NFC] Explicitly ask for a ClangASTContext in ClangASTSource

ClangASTSource currently takes a clang::ASTContext and keeps that
around, but a lot of LLDB's functionality for doing operations
on a clang::ASTContext is in its ClangASTContext twin class. We
currently constantly recompute the respective ClangASTContext
from the clang::ASTContext while we instead could just pass and
store a ClangASTContext in the ClangASTSource. This also allows
us to get rid of a bunch of unreachable error checking for cases
where recomputation fails for some reason.

4 years ago[InstCombine] Run the cast.ll test a twice, now also testing little endian. NFC
Bjorn Pettersson [Fri, 29 Nov 2019 12:24:13 +0000 (13:24 +0100)]
[InstCombine] Run the cast.ll test a twice, now also testing little endian. NFC

Some tests in test/Transforms/InstCombine/cast.ll depend on
endianness. Added a second run line to run the tests with both
big and little endian. In the past we only compiled for big
endian, and then it was hard to see if any big endian bugfixes
would impact the little endian result etc.

4 years ago[lldb][NFC] Early exit in ClangASTContext::CreateInstance
Raphael Isemann [Fri, 29 Nov 2019 11:40:19 +0000 (12:40 +0100)]
[lldb][NFC] Early exit in ClangASTContext::CreateInstance

4 years ago[lldb] Fix windows build for 38870af
Pavel Labath [Fri, 29 Nov 2019 11:48:25 +0000 (12:48 +0100)]
[lldb] Fix windows build for 38870af

4 years ago[lldb][NFC] Simplify regex_chars in CommandCompletions
Raphael Isemann [Fri, 29 Nov 2019 11:26:33 +0000 (12:26 +0100)]
[lldb][NFC] Simplify regex_chars in CommandCompletions

4 years ago[lldb][NFC] Remove dead logging code from DWARFASTParserClang::CompleteRecordType
Raphael Isemann [Fri, 29 Nov 2019 11:05:47 +0000 (12:05 +0100)]
[lldb][NFC] Remove dead logging code from DWARFASTParserClang::CompleteRecordType

This code is behind a `if (log)` that is always a nullptr as the initializer
was commented out. One could uncomment the initializer code, but then this logging
code just leads to a deadlock as it tries to aquire the module lock.
This removes the logging code until I get this working again.

4 years ago[clangd] Fix 407ac2e, which was broken and committed too soon
Sam McCall [Fri, 29 Nov 2019 11:05:00 +0000 (12:05 +0100)]
[clangd] Fix 407ac2e, which was broken and committed too soon

4 years ago[lldb] Remove FileSpec->CompileUnit inheritance
Pavel Labath [Thu, 28 Nov 2019 15:22:44 +0000 (16:22 +0100)]
[lldb] Remove FileSpec->CompileUnit inheritance

Summary:
CompileUnit is a complicated class. Having it be implicitly convertible
to a FileSpec makes reasoning about it even harder.

This patch replaces the inheritance by a simple member and an accessor
function. This avoid the need for casting in places where one needed to
force a CompileUnit to be treated as a FileSpec, and does not add much
verbosity elsewhere.

It also fixes a bug where we were wrongly comparing CompileUnit& and a
CompileUnit*, which compiled due to a combination of this inheritance
and the FileSpec*->FileSpec implicit constructor.

Reviewers: teemperor, JDevlieghere, jdoerfert

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[ARM] Fix instruction selection for ARMISD::CMOV with f16 type
Victor Campos [Tue, 19 Nov 2019 09:55:16 +0000 (09:55 +0000)]
[ARM] Fix instruction selection for ARMISD::CMOV with f16 type

Summary:
In the cases where the CMOV (f16) SDNode is used with condition codes
LT, LE, VC or NE, it is successfully selected into a VSEL instruction.

In the remaining cases, however, instruction selection fails since VSEL
does not support other condition codes.

This patch handles such cases by using the single-precision version of
the VMOV instruction.

Reviewers: ostannard, dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Syntax] Build SimpleDeclaration node that groups multiple declarators
Ilya Biryukov [Fri, 29 Nov 2019 10:32:58 +0000 (11:32 +0100)]
[Syntax] Build SimpleDeclaration node that groups multiple declarators

Summary:
Also remove the temporary TopLevelDeclaration node and add
UnknownDeclaration to represent other unknown nodes.

See the follow-up change for building more top-level declarations.
Adding declarators is also pretty involved and will be done in another
follow-up patch.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: merge_guards_bot, cfe-commits

Tags: #clang

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

4 years ago[lldb][NFC] Fix header guard comment in ThreadSafeDenseMap.h
Raphael Isemann [Fri, 29 Nov 2019 10:34:18 +0000 (11:34 +0100)]
[lldb][NFC] Fix header guard comment in ThreadSafeDenseMap.h

4 years ago[AST] Remove unused and undefined `TypeLoc::IgnoreMacroDefinitions` function. NFC
Ilya Biryukov [Fri, 29 Nov 2019 10:10:01 +0000 (11:10 +0100)]
[AST] Remove unused and undefined `TypeLoc::IgnoreMacroDefinitions` function. NFC

Looks like an accidental leftover from the older version of the code.

4 years ago[clangd] Log cc1 args at verbose level.
Sam McCall [Thu, 28 Nov 2019 18:22:50 +0000 (19:22 +0100)]
[clangd] Log cc1 args at verbose level.

Summary: This will help debugging driver issues.

Reviewers: kbobyrev

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

Tags: #clang

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

4 years ago[clangd] Correct the file path in Edit::replacements when generating the rename edit.
Haojian Wu [Thu, 28 Nov 2019 15:48:49 +0000 (16:48 +0100)]
[clangd] Correct the file path in Edit::replacements when generating the rename edit.

Summary:
The file path was set to the file content previously, and it isn't
covered by normal clangd & unittest code path (as we only uses the
offset, length, replacement text).

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[Syntax] Add a comment explaining the pointer keys in std::map<Token*, ...>. NFC
Ilya Biryukov [Fri, 29 Nov 2019 08:48:00 +0000 (09:48 +0100)]
[Syntax] Add a comment explaining the pointer keys in std::map<Token*, ...>. NFC

4 years ago[Syntax] Remove unused parameter from `TreeBuilder::markChildToken`. NFC
Ilya Biryukov [Fri, 29 Nov 2019 08:44:25 +0000 (09:44 +0100)]
[Syntax] Remove unused parameter from `TreeBuilder::markChildToken`. NFC

4 years ago[llvm-readelf][test] - Update comment in elf-verdef-invalid.test. NFC.
Georgii Rymar [Fri, 29 Nov 2019 08:38:27 +0000 (11:38 +0300)]
[llvm-readelf][test] - Update comment in elf-verdef-invalid.test. NFC.

It was suggested to change it during review of D70810,
but I've forgotten to update it before commit.

4 years ago[llvm-readelf/llvm-readobj] - Check version of SHT_GNU_verdef section entries when...
Georgii Rymar [Thu, 28 Nov 2019 10:20:25 +0000 (13:20 +0300)]
[llvm-readelf/llvm-readobj] - Check version of SHT_GNU_verdef section entries when dumping.

Elfxx_Verdef contains the following field:

vd_version
Version revision. This field shall be set to 1.
(https://refspecs.linuxfoundation.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/symversion.html)

Our code should check the struct version for correctness. This patch does that.
(This will help to simplify or eliminate ELFDumper<ELFT>::LoadVersionDefs() which
has it's own logic to parse version definitions for no reason. It checks the
struct version currently).

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

4 years ago[libcxx] Add -Wno-deprecated-copy to the test config
David Zarzycki [Fri, 29 Nov 2019 07:22:56 +0000 (09:22 +0200)]
[libcxx] Add -Wno-deprecated-copy to the test config

4 years ago[yaml2obj] - Add a way to describe content of the SHT_GNU_verneed section with "Content".
Georgii Rymar [Thu, 28 Nov 2019 13:27:01 +0000 (16:27 +0300)]
[yaml2obj] - Add a way to describe content of the SHT_GNU_verneed section with "Content".

There is no way to set raw content for SHT_GNU_verneed section.
This patch implements it.

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

4 years ago[Attributor] Deduce dereferenceable based on accessed bytes map
Hideto Ueno [Fri, 29 Nov 2019 06:55:58 +0000 (06:55 +0000)]
[Attributor] Deduce dereferenceable based on accessed bytes map

Summary:
This patch introduces the deduction based on load/store instructions whose pointer operand is a non-inbounds GEP instruction.
For example if we have,
```
void f(int *u){
 u[0] = 0;
 u[1] = 1;
 u[2] = 2;
}
```
then u must be dereferenceable(12).

This patch is inspired by D64258

Reviewers: jdoerfert, spatel, hfinkel, RKSimon, sstefan1, xbolva00, dtemirbulatov

Reviewed By: jdoerfert

Subscribers: jfb, lebedev.ri, xbolva00, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Attributor] Remove dereferenceable_or_null when nonull is present
Hideto Ueno [Fri, 29 Nov 2019 06:45:07 +0000 (06:45 +0000)]
[Attributor] Remove dereferenceable_or_null when nonull is present

Summary: This patch prevents the simultaneous presence of `dereferenceable` and `dereferenceable_or_null` attribute

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert

Subscribers: lebedev.ri, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[PassInstrumentation] Remove excess newline for the new pass manager
Fangrui Song [Fri, 29 Nov 2019 00:42:27 +0000 (16:42 -0800)]
[PassInstrumentation] Remove excess newline for the new pass manager

This also removes excess newline for the legacy pass manager when -filter-print-funcs is specified.

4 years agogn build: Add a toggle for building against the commandline tools SDK on macOS
Nico Weber [Fri, 29 Nov 2019 00:30:21 +0000 (19:30 -0500)]
gn build: Add a toggle for building against the commandline tools SDK on macOS

4 years ago[LegalizeTypes] Add strict FP support to SoftenFloatRes_FP_ROUND. Fix mistake in...
Craig Topper [Thu, 28 Nov 2019 23:28:27 +0000 (15:28 -0800)]
[LegalizeTypes] Add strict FP support to SoftenFloatRes_FP_ROUND. Fix mistake in SoftenFloatRes_FP_EXTEND.

These will be needed for ARM fp-instrinsics.ll which is currently
XFAILed.

One of the getOperand calls in SoftenFloatRes_FP_EXTEND was not
taking strict FP into account. It only affected the call
to setTypeListBeforeSoften which only has an effect on some targets.

4 years ago[LegalizeTypes] In SoftenFloatRes_FNEG, always generate integer arithmetic, never...
Craig Topper [Thu, 28 Nov 2019 19:36:55 +0000 (11:36 -0800)]
[LegalizeTypes] In SoftenFloatRes_FNEG, always generate integer arithmetic, never fall back to using fsub.

We would previously fallback if the type wasn't f32/f64/f128. But
I don't think any of the other floating point types ever go through
the softening code anyway. So this code is dead.

4 years ago[LegalizeTypes] Use SoftenFloatRes_Unary in SoftenFloatRes_FCBRT to reduce code.
Craig Topper [Thu, 28 Nov 2019 18:40:50 +0000 (10:40 -0800)]
[LegalizeTypes] Use SoftenFloatRes_Unary in SoftenFloatRes_FCBRT to reduce code.

We don't have a STRICT_CBRT ISD opcode, but we can still
use SoftenFloatRes_Unary to simplify some code.

4 years ago[DAGCombiner] Peek through vector concats when trying to combine shuffles.
Amaury Séchet [Fri, 22 Nov 2019 22:39:18 +0000 (23:39 +0100)]
[DAGCombiner] Peek through vector concats when trying to combine shuffles.

Summary: This combine showed up as needed when exploring the regression when processing the DAG in topological order.

Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[OpenMP] build offload plugins before testing them
Bryan Chan [Thu, 28 Nov 2019 07:46:18 +0000 (02:46 -0500)]
[OpenMP] build offload plugins before testing them

Summary:
"make check-all" or "make check-libomptarget" would attempt to run offloading
tests before the offload plugins are built. This patch corrects that by adding
dependencies to the libomptarget CMake rules.

Reviewers: jdoerfert

Subscribers: mgorny, guansong, openmp-commits

Tags: #openmp

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

4 years ago[LegacyPassManager] Simplify FunctionPass::assignPassManager
Fangrui Song [Thu, 28 Nov 2019 22:00:12 +0000 (14:00 -0800)]
[LegacyPassManager] Simplify FunctionPass::assignPassManager

And make it clear the parameter PreferredType is unused for FunctionPass.

4 years ago[Clang] Bypass distro detection on non-Linux hosts
Alexandre Ganea [Thu, 28 Nov 2019 20:56:00 +0000 (15:56 -0500)]
[Clang] Bypass distro detection on non-Linux hosts

Skip distro detection when we're not running on Linux, or when the target triple is not Linux. This saves a few OS calls for each invocation of clang.exe.

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

4 years ago[LegacyPassManager] Simplify PMStack pop
Fangrui Song [Thu, 28 Nov 2019 21:34:32 +0000 (13:34 -0800)]
[LegacyPassManager] Simplify PMStack pop

4 years ago[ORC][JITLink] Add support for weak references, and improve handling of static
Lang Hames [Tue, 26 Nov 2019 05:57:27 +0000 (21:57 -0800)]
[ORC][JITLink] Add support for weak references, and improve handling of static
libraries.

This patch substantially updates ORCv2's lookup API in order to support weak
references, and to better support static archives. Key changes:

-- Each symbol being looked for is now associated with a SymbolLookupFlags
   value. If the associated value is SymbolLookupFlags::RequiredSymbol then
   the symbol must be defined in one of the JITDylibs being searched (or be
   able to be generated in one of these JITDylibs via an attached definition
   generator) or the lookup will fail with an error. If the associated value is
   SymbolLookupFlags::WeaklyReferencedSymbol then the symbol is permitted to be
   undefined, in which case it will simply not appear in the resulting
   SymbolMap if the rest of the lookup succeeds.

   Since lookup now requires these flags for each symbol, the lookup method now
   takes an instance of a new SymbolLookupSet type rather than a SymbolNameSet.
   SymbolLookupSet is a vector-backed set of (name, flags) pairs. Clients are
   responsible for ensuring that the set property (i.e. unique elements) holds,
   though this is usually simple and SymbolLookupSet provides convenience
   methods to support this.

-- Lookups now have an associated LookupKind value, which is either
   LookupKind::Static or LookupKind::DLSym. Definition generators can inspect
   the lookup kind when determining whether or not to generate new definitions.
   The StaticLibraryDefinitionGenerator is updated to only pull in new objects
   from the archive if the lookup kind is Static. This allows lookup to be
   re-used to emulate dlsym for JIT'd symbols without pulling in new objects
   from archives (which would not happen in a normal dlsym call).

-- JITLink is updated to allow externals to be assigned weak linkage, and
   weak externals now use the SymbolLookupFlags::WeaklyReferencedSymbol value
   for lookups. Unresolved weak references will be assigned the default value of
   zero.

Since this patch was modifying the lookup API anyway, it alo replaces all of the
"MatchNonExported" boolean arguments with a "JITDylibLookupFlags" enum for
readability. If a JITDylib's associated value is
JITDylibLookupFlags::MatchExportedSymbolsOnly then the lookup will only
match against exported (non-hidden) symbols in that JITDylib. If a JITDylib's
associated value is JITDylibLookupFlags::MatchAllSymbols then the lookup will
match against any symbol defined in the JITDylib.

4 years ago[mips] Check that features required by built-ins are enabled
Simon Atanasyan [Wed, 27 Nov 2019 16:09:50 +0000 (19:09 +0300)]
[mips] Check that features required by built-ins are enabled

Now Clang does not check that features required by built-in functions
are enabled. That causes errors in the backend reported in PR44018.

This patch fixes this bug by checking that required features
are enabled.

This should fix PR44018.

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

4 years ago[IVDescriptors] Skip FOR where we have multiple sink points for now.
Florian Hahn [Thu, 28 Nov 2019 21:08:05 +0000 (22:08 +0100)]
[IVDescriptors] Skip FOR where we have multiple sink points for now.

This fixes a crash with instructions where multiple operands are
first-order-recurrences.

4 years ago[lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Konrad Kleine [Thu, 28 Nov 2019 15:54:15 +0000 (16:54 +0100)]
[lldb] NFC: refactor CompileUnit::ResolveSymbolContext

Summary:
I found the above named method hard to read because it had

a) many nested blocks,
b) one return statement at the end with some logic involved,
c) a duplicated while-loop with just small differences in it.

I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.
I also replaced the two while-loops with just one.

This is a non-functional change (NFC).

Reviewers: jdoerfert, teemperor

Reviewed By: teemperor

Subscribers: labath, teemperor, lldb-commits

Tags: #lldb

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

4 years ago[LLDB] On Windows, force error message formatting to English
Alexandre Ganea [Thu, 28 Nov 2019 19:15:13 +0000 (14:15 -0500)]
[LLDB] On Windows, force error message formatting to English

This fixes the Utility/StatusTest.ErrorWin32 unit test on non-English locales.

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

4 years ago[LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope
Alexandre Ganea [Thu, 28 Nov 2019 16:16:55 +0000 (11:16 -0500)]
[LLDB] Fix wrong argument in CommandObjectThreadStepWithTypeAndScope

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

4 years agoAMDGPU: Reuse carry out register during FI elimination
Austin Kerbow [Fri, 22 Nov 2019 20:25:13 +0000 (12:25 -0800)]
AMDGPU: Reuse carry out register during FI elimination

Summary:
Pre gfx9 we need to scavenge a 64-bit SGPR to use as the carry out for an Add.
If only one SGPR was available this crashed when trying to scavenge another
32bit SGPR to materialize the offset.

Instead, reuse a 32-bit SGPR from the carry out as the offset register.

Also prefer to use vcc for the unused carry out when it is available.

Reviewers: arsenm, rampitec

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

Tags: #llvm

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

4 years ago[AArch64][v8.3a] Don't emit LDRA '[xN]!' alias in disassembly.
Simon Tatham [Thu, 28 Nov 2019 15:31:41 +0000 (15:31 +0000)]
[AArch64][v8.3a] Don't emit LDRA '[xN]!' alias in disassembly.

Summary:
In rG643ac6c0420b, the syntax `ldraa x1, [x0]!` was added as an alias
for `ldraa x1, [x0, #0]!`. That syntax is less obvious in meaning, and
also will not be accepted by assemblers that haven't been updated yet.
So it would be better not to emit it as the preferred disassembly for
that instruction.

This change lowers the EmitPriority of the new alias so that the more
explicit syntax `[x0, #0]!` is preferred by the disassembler. The new
syntax is still accepted by the assembler.

Reviewers: ab, ostannard

Reviewed By: ostannard

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[OpenMP][test] Fix test on MIPS-based buildbots
Miloš Stojanović [Thu, 28 Nov 2019 15:18:28 +0000 (16:18 +0100)]
[OpenMP][test] Fix test on MIPS-based buildbots

On MIPS `zeroext` or `signext` can appear in the output.

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

4 years ago[lldb][NFC] Remove CompilerDeclContext::IsClang
Raphael Isemann [Thu, 28 Nov 2019 14:43:26 +0000 (15:43 +0100)]
[lldb][NFC] Remove CompilerDeclContext::IsClang

This method is only used in ClangASTContext.

Also removes the includes we only needed for the ClangASTContext RTTI check
in the CompilerDecl[Context].cpp files.

4 years ago[lldb][NFC] Remove unused variable in ClangASTSource::CompleteType
Raphael Isemann [Thu, 28 Nov 2019 14:29:09 +0000 (15:29 +0100)]
[lldb][NFC] Remove unused variable in ClangASTSource::CompleteType

Now that CompilerDeclContext is a trivial class, Clang started warning
that this unused variable is in fact unused. Let's remove it.

4 years ago[lldb][NFC] Simplify CompilerDecl and CompilerDeclContext initialization
Raphael Isemann [Thu, 28 Nov 2019 14:14:24 +0000 (15:14 +0100)]
[lldb][NFC] Simplify CompilerDecl and CompilerDeclContext initialization

4 years ago[lldb][NFC] Remove unused CompilerDecl::IsClang
Raphael Isemann [Thu, 28 Nov 2019 14:05:10 +0000 (15:05 +0100)]
[lldb][NFC] Remove unused CompilerDecl::IsClang

4 years ago[lldb] refactor FileSpec::Equal
Pavel Labath [Thu, 28 Nov 2019 12:48:05 +0000 (13:48 +0100)]
[lldb] refactor FileSpec::Equal

The logic of this function was quite hard to follow. Replace it with a
much simpler, equivalent, implementation.

4 years ago[lldb] Add FileSpec::Equal unit tests
Pavel Labath [Thu, 28 Nov 2019 12:47:58 +0000 (13:47 +0100)]
[lldb] Add FileSpec::Equal unit tests

this is in preparation of a refactor of this method.

4 years ago[lldb] Simplify and improve FileSpecTest
Pavel Labath [Thu, 28 Nov 2019 12:30:39 +0000 (13:30 +0100)]
[lldb] Simplify and improve FileSpecTest

Summary:
A most of these tests create FileSpecs with a hardcoded style. Add
utility functions which create a file spec of a given style to simplify
things.

While in there add SCOPED_TRACE messages to tests which loop over
multiple inputs to ensure it's clear which of the inputs failed.

Reviewers: teemperor

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoRevert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"
Raphael Isemann [Thu, 28 Nov 2019 13:25:46 +0000 (14:25 +0100)]
Revert "[lldb] NFC: refactor CompileUnit::ResolveSymbolContext"

This reverts commit 373e2a4f69d623e59329ff801f261d8b299e12d2.

This broke breakpoint setting.

4 years ago[include-fixer] Python 3 support for clang-include-fixer.py
Benjamin Kramer [Thu, 28 Nov 2019 13:21:33 +0000 (14:21 +0100)]
[include-fixer] Python 3 support for clang-include-fixer.py

Patch by Yannick Brehon!

4 years ago[lldb][NFC] Remove unused STLUtil include and STLUtil.h header
Raphael Isemann [Thu, 28 Nov 2019 13:07:44 +0000 (14:07 +0100)]
[lldb][NFC] Remove unused STLUtil include and STLUtil.h header

4 years ago[lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key
Raphael Isemann [Thu, 28 Nov 2019 12:41:18 +0000 (13:41 +0100)]
[lldb][NFC] Use llvm::StringRef instead of C-strings as multimap key

4 years ago[lldb] NFC: refactor CompileUnit::ResolveSymbolContext
Konrad Kleine [Wed, 27 Nov 2019 09:57:06 +0000 (10:57 +0100)]
[lldb] NFC: refactor CompileUnit::ResolveSymbolContext

Summary:
I found the above named method hard to read because it had

a) many nested blocks and
b) one return statement at the end with some logic involved.

I decided to refactor this function by employing an early exit strategy.
In order to capture the logic in the return statement and to not have it
repeated more than once I chose to implement a very small lamda function
that captures all the variables it needs.

This is a non-functional change (NFC).

Reviewers: jdoerfert

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[clangd] Don't perform rename when the refs result from index is incomplete.
Haojian Wu [Thu, 28 Nov 2019 11:47:32 +0000 (12:47 +0100)]
[clangd] Don't perform rename when the refs result from index is incomplete.

Summary:
Also do an early return if the number of affected files > limit to save
some unnecessary FileURI computations.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[lldb][NFC] Remove unused CStringToDIEMap typedef
Raphael Isemann [Thu, 28 Nov 2019 12:27:25 +0000 (13:27 +0100)]
[lldb][NFC] Remove unused CStringToDIEMap typedef

4 years ago[clangd] Prefer the left character if the character on the right of the cursor is...
Haojian Wu [Thu, 28 Nov 2019 10:24:04 +0000 (11:24 +0100)]
[clangd] Prefer the left character if the character on the right of the cursor is semicolon.

Summary: This would make go-to-def works on the cases like int A = abc^;

Reviewers: sammccall

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

Tags: #clang

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

4 years ago[clangd] Tweak the no-index error message for rename, NFC.
Haojian Wu [Thu, 28 Nov 2019 10:39:48 +0000 (11:39 +0100)]
[clangd] Tweak the no-index error message for rename, NFC.

Summary: The current error message doesn't fit well for cross-file rename.

Reviewers: ilya-biryukov

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

Tags: #clang

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

4 years ago[lldb][NFC] Remove forward declaration of PrivateAutoCompleteMembers
Raphael Isemann [Thu, 28 Nov 2019 11:45:47 +0000 (12:45 +0100)]
[lldb][NFC] Remove forward declaration of PrivateAutoCompleteMembers

That's declared directly above the actual definition, so it serves no use.

4 years ago[lldb][NFC] Make GetAsCXXRecordDecl static
Raphael Isemann [Thu, 28 Nov 2019 11:24:08 +0000 (12:24 +0100)]
[lldb][NFC] Make GetAsCXXRecordDecl static

All other casting functions there are static, so this should
be too.

4 years ago[LLDB] [test] Add a missing "REQUIRES: arm" line
Martin Storsjö [Thu, 28 Nov 2019 11:18:15 +0000 (13:18 +0200)]
[LLDB] [test] Add a missing "REQUIRES: arm" line

4 years agoAMDGPU: Fix lit test checks with dag option
David Stuttard [Thu, 21 Nov 2019 11:31:41 +0000 (11:31 +0000)]
AMDGPU: Fix lit test checks with dag option

Summary:
I was seeing some failures on a test with slightly different instruction
ordering. Adding in some DAG directives solved the issue.

Change-Id: If5a3d3969055fb19279943bd45161bb70a3dabce

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, tpr, t-tye, llvm-commits

Tags: #llvm

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

4 years ago[lldb][NFC] Split up DWARFASTParserClang::CompleteTypeFromDWARF
Raphael Isemann [Thu, 28 Nov 2019 09:33:36 +0000 (10:33 +0100)]
[lldb][NFC] Split up DWARFASTParserClang::CompleteTypeFromDWARF

Moving the different parts into their own functions without any additional
cleanup/refactoring, so this is NFC.

4 years ago[llvm-readelf] - Make GNU style dumping of invalid SHT_GNU_verdef be consistent with...
Georgii Rymar [Wed, 27 Nov 2019 10:45:04 +0000 (13:45 +0300)]
[llvm-readelf] - Make GNU style dumping of invalid SHT_GNU_verdef be consistent with LLVM style.

When we dump SHT_GNU_verdef section that has sh_link that references a non-existent section,
llvm-readobj reports a warning and continues dump, but llvm-readelf fails with a error.

This patch fixes the issue and opens road for futher follow-ups for
improving the printGNUVersionSectionProlog().

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

4 years ago[LLDB] Always interpret arm instructions as thumb on windows
Martin Storsjö [Tue, 15 Oct 2019 21:05:06 +0000 (00:05 +0300)]
[LLDB] Always interpret arm instructions as thumb on windows

Windows on ARM always uses thumb mode, and doesn't have most of the
mechanisms that are used in e.g. ELF for distinguishing between arm
and thumb.

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

4 years ago[LLDB] [PECOFF] Look for the truncated ".eh_fram" section name
Martin Storsjö [Tue, 15 Oct 2019 21:01:15 +0000 (00:01 +0300)]
[LLDB] [PECOFF] Look for the truncated ".eh_fram" section name

COFF section names can either be stored truncated to 8 chars, in the
section header, or as a longer section name, stored separately in the
string table.

libunwind locates the .eh_frame section by runtime introspection,
which only works for section names stored in the section header (as
the string table isn't mapped at runtime). To support this behaviour,
lld always truncates the section names for sections that will be
mapped, like .eh_frame.

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

4 years ago[LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. NFCI.
Martin Storsjö [Wed, 27 Nov 2019 12:08:01 +0000 (14:08 +0200)]
[LLDB] [PECOFF] Factorize mapping section names to types using StringSwitch. NFCI.

Keep the existing special cases based on combinations of section name,
flags and sizes/offsets.

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

4 years ago[lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES
Raphael Isemann [Thu, 28 Nov 2019 09:21:47 +0000 (10:21 +0100)]
[lldb] Remove debugging code used for LLDB_DWARF_DONT_COMPLETE_TYPENAMES

Reviewers: labath, clayborg, shafik

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[llvm-readelf][llvm-readobj][test] - Cleanup test cases for versioning sections.
Georgii Rymar [Wed, 27 Nov 2019 15:26:54 +0000 (18:26 +0300)]
[llvm-readelf][llvm-readobj][test] - Cleanup test cases for versioning sections.

Currently we have 2 tests for testing versioning sections:
1) elf-versioninfo.test
2) elf-invalid-versioning.test

The first one currently checks how versioning sections are dumped +
how tools dump invalid SHT_GNU_verdef section.

The second despite of its name contains only tests for invalid SHT_GNU_verneed section.

In this patch I`ve renamed elf-invalid-versioning.test->elf-verneed-invalid.test,
and moved a few tests from elf-versioninfo.test to a new elf-verdef-invalid.test.

It will help to maintain these and a new tests for broken versioning sections.

Differential revision: