platform/upstream/llvm.git
4 years agollvm: Use quotes around MSVC_DIA_SDK_DIR CMake variable
Cristian Adam [Tue, 18 Feb 2020 12:42:19 +0000 (14:42 +0200)]
llvm: Use quotes around MSVC_DIA_SDK_DIR CMake variable

MSVC_DIA_SDK_DIR variable will point to a path which contains spaces,
and without quotes it will fail to configure the project.

4 years ago[lldb] Fix another instance where we pass a nullptr as TypeSourceInfo to NonTypeTempl...
Raphael Isemann [Tue, 18 Feb 2020 12:25:08 +0000 (13:25 +0100)]
[lldb] Fix another instance where we pass a nullptr as TypeSourceInfo to NonTypeTemplateParmDecl::Create

Summary:
Follow up to an issue pointed out in the review of D73808. We shouldn't just pass in a nullptr TypeSourceInfo
in case Clang decided to access it.

Reviewers: shafik, vsk

Reviewed By: shafik, vsk

Subscribers: kristof.beyls, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[lldb][test] Remove expected failure decorator from test_copy_from_dummy_target ...
Tatyana Krasnukha [Tue, 18 Feb 2020 12:02:58 +0000 (15:02 +0300)]
[lldb][test] Remove expected failure decorator from test_copy_from_dummy_target (TestScriptedResolver)

This test case doesn't check that breakpoint's locations are resolved, and it passes on Windows too.

4 years ago[CGP] Add uaddo test with math used, SPARC/AArch64 variants.
Florian Hahn [Mon, 17 Feb 2020 15:35:57 +0000 (16:35 +0100)]
[CGP] Add uaddo test with math used, SPARC/AArch64 variants.

4 years ago[llvm-readobj] - Report a warning when an unexpected DT_SYMENT tag value is met.
Georgii Rymar [Wed, 12 Feb 2020 13:12:09 +0000 (16:12 +0300)]
[llvm-readobj] - Report a warning when an unexpected DT_SYMENT tag value is met.

There was a short discussion about this:
https://reviews.llvm.org/D73484#inline-676942

To summarize:
It is a bit unclear to me why the `DT_SYMENT` tag exist.
LLD has the code that does:
"addInt(DT_SYMENT, sizeof(Elf_Sym));" and I guess other linkers has the same logic.
It is unclear why it can be possible to have other values rather than values of
a size of platform symbol. Seems it is not possible, and atm for me it looks that
this tag should not be used. This patch starts reporting the warning when the
value it contains differs from a symbol size for a 32/64 bit platform for safety.
It keeps the rest of the logic we have unchanged. Before this patch we did not handle
the tag at all.

Differential review: https://reviews.llvm.org/D74479

4 years agoFix riscv/lld test interaction
serge-sans-paille [Tue, 18 Feb 2020 11:31:11 +0000 (12:31 +0100)]
Fix riscv/lld test interaction

Fix for dd230142d8a00f5f30c3930a2407000e845dcfbf, in case ld.lld is not
available.

4 years ago[CSInfo][TailDuplicator] Delete the call site info when removing dead MBBs
Djordje Todorovic [Tue, 18 Feb 2020 08:08:10 +0000 (09:08 +0100)]
[CSInfo][TailDuplicator] Delete the call site info when removing dead MBBs

This is needed for the debug entry values feature.

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

4 years ago[lldb][NFC] Remove unused parameter
Tatyana Krasnukha [Wed, 12 Feb 2020 13:16:57 +0000 (16:16 +0300)]
[lldb][NFC] Remove unused parameter

Rename search-filter's CopyForBreakpoint to CreateCopy, since they don't
do anything with breakpoints.

4 years ago[lldb] Make shared_from_this-related code safer
Tatyana Krasnukha [Thu, 13 Feb 2020 12:51:13 +0000 (15:51 +0300)]
[lldb] Make shared_from_this-related code safer

Pass TargetSP to filters' CreateFromStructuredData, don't let them guess
whether target object is managed by a shared_ptr.

Make Breakpoint sure that m_target.shared_from_this() is safe by passing TargetSP
to all its static Create*** member-functions. This should be enough, since Breakpoint's
constructors are private/protected and never called directly (except by Target itself).

4 years ago[lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor
Tatyana Krasnukha [Thu, 13 Feb 2020 13:48:38 +0000 (16:48 +0300)]
[lldb] Don't call CopyForBreakpoint from a Breakpoint's constructor

Some implementations (BreakpointResolverScripted) try calling the breakpoint's shared_from_this(),
that makes LLDB crash.

4 years ago[AArch64][SVE] Add remaining SVE2 intrinsics for widening DSP operations
Kerry McLaughlin [Tue, 18 Feb 2020 10:08:41 +0000 (10:08 +0000)]
[AArch64][SVE] Add remaining SVE2 intrinsics for widening DSP operations

Summary:
Implements the following intrinsics:
 - llvm.aarch64.sve.[s|u]mullb_lane
 - llvm.aarch64.sve.[s|u]mullt_lane
 - llvm.aarch64.sve.sqdmullb_lane
 - llvm.aarch64.sve.sqdmullt_lane
 - llvm.aarch64.sve.[s|u]addwb
 - llvm.aarch64.sve.[s|u]addwt
 - llvm.aarch64.sve.[s|u]shllb
 - llvm.aarch64.sve.[s|u]shllt
 - llvm.aarch64.sve.[s|u]subwb
 - llvm.aarch64.sve.[s|u]subwt

Reviewers: sdesmalen, dancgr, efriedma, c-rhodes, rengolin

Reviewed By: sdesmalen

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

Tags: #llvm

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

4 years ago[lldb][NFC] Fix compilation of SymbolFilePDBTests.cpp after FindNamespace API change
Raphael Isemann [Tue, 18 Feb 2020 10:24:48 +0000 (11:24 +0100)]
[lldb][NFC] Fix compilation of SymbolFilePDBTests.cpp after FindNamespace API change

Since f9568a95493aea3ea813bd37cb8c084ec4294e38 this function takes a
CompilerDeclContext reference instead of a pointer. It overlooked this function
when I fixed the compilation for FindTypes.

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

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

4 years ago[ARM,CDE] Cosmetic changes, additonal driver tests
Mikhail Maltsev [Tue, 18 Feb 2020 10:22:37 +0000 (10:22 +0000)]
[ARM,CDE] Cosmetic changes, additonal driver tests

Summary:
This is a follow-up patch addressing post-commit comments in
https://reviews.llvm.org/D74044:
* Add more Clang driver tests (-march=armv8.1m.main and -march=armv8.1m.main+mve.fp)
* Clang-format a chunk in ARMAsmParser.cpp
* Add a missing copyright header to ARMInstrCDE.td

Reviewers: SjoerdMeijer, simon_tatham, dmgreen

Reviewed By: SjoerdMeijer

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

Tags: #clang, #llvm

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

4 years ago[lldb] Don't model std::atomic as a transparent data structure in the data formatter
Raphael Isemann [Tue, 18 Feb 2020 10:19:02 +0000 (11:19 +0100)]
[lldb] Don't model std::atomic as a transparent data structure in the data formatter

Summary:
Currently the data formatter is treating `std::atomic` variables as transparent wrappers
around their underlying value type. This causes that when printing `std::atomic<A *>`, the data
formatter will forward all requests for the children of the atomic variable to the `A *` pointer type
which will then return the respective members of `A`. If `A` in turn has a member that contains
the original atomic variable, this causes LLDB to infinitely recurse when printing an object with
such a `std::atomic` pointer member.

We could implement a workaround similar to whatever we do for pointer values but this patch
just implements the `std::atomic` formatter in the same way as we already implement other
formatters (e.g. smart pointers or `std::optional`) that just model the contents of the  as a child
"Value". This way LLDB knows when it actually prints a pointer and can just use its normal
workaround if "Value" is a recursive pointer.

Fixes rdar://59189235

Reviewers: JDevlieghere, jingham, shafik

Reviewed By: shafik

Subscribers: shafik, christof, jfb, abidh, lldb-commits

Tags: #lldb

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

4 years ago[lldb/DWARF] Support the debug_str_offsets section in dwp files
Pavel Labath [Mon, 17 Feb 2020 16:29:55 +0000 (17:29 +0100)]
[lldb/DWARF] Support the debug_str_offsets section in dwp files

Summary:
In dwp files a constant (from the debug_cu_index section) needs to be
added to each reference into the debug_str_offsets section.

I've tried to implement this to roughly match the llvm flow: I've
changed the DWARFormValue to stop resolving the indirect string
references directly -- instead, it calls into DWARFUnit, which resolves
this for it (similar to how it already resolves indirect range and
location list references). I've also done a small refactor of the string
offset base computation code in DWARFUnit in order to make it easier to
access the debug_cu_index base offset.

Reviewers: JDevlieghere, aprantl, clayborg

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[OpenCL] Add Arm dot product builtin functions
Sven van Haastregt [Tue, 18 Feb 2020 10:02:06 +0000 (10:02 +0000)]
[OpenCL] Add Arm dot product builtin functions

Add the Arm dot product builtin functions from the OpenCL extension
available at
https://www.khronos.org/registry/OpenCL/extensions/arm/cl_arm_integer_dot_product.txt

Patch by Pierre Gondois and Sven van Haastregt.

4 years ago[lldb] Fix compilation of SymbolFilePDBTests.cpp after FindTypes API change
Raphael Isemann [Tue, 18 Feb 2020 09:51:13 +0000 (10:51 +0100)]
[lldb] Fix compilation of SymbolFilePDBTests.cpp after FindTypes API change

Since f9568a95493aea3ea813bd37cb8c084ec4294e38 this function takes a
CompilerDeclContext reference instead of a pointer.

4 years ago[lldb] Remove DataExtractor::GetPointer
Pavel Labath [Tue, 18 Feb 2020 09:37:04 +0000 (10:37 +0100)]
[lldb] Remove DataExtractor::GetPointer

This function is equivalent to GetAddress, but getAddress is also
present on the llvm version of the data extractor.

4 years ago[ARM,MVE] Add the vmovnbq,vmovntq intrinsic family.
Simon Tatham [Mon, 17 Feb 2020 17:06:20 +0000 (17:06 +0000)]
[ARM,MVE] Add the vmovnbq,vmovntq intrinsic family.

Summary:
These are in some sense the inverse of vmovl[bt]q: they take a vector
of n wide elements and truncate each to half its width. So they only
write half a vector's worth of output data, and therefore they also
take an 'inactive' parameter to provide the other half of the data in
the output vector. So vmovnb overwrites the even lanes of 'inactive'
with the narrowed values from the main input, and vmovnt overwrites
the odd lanes.

LLVM had existing codegen which generates these MVE instructions in
response to IR that takes two vectors of wide elements, or two vectors
of narrow ones. But in this case, we have one vector of each. So my
clang codegen strategy is to narrow the input vector of wide elements
by simply reinterpreting it as the output type, and then we have two
narrow vectors and can represent the operation as a vector shuffle
that interleaves lanes from both of them.

Even so, not all the cases I needed ended up being selected as a
single MVE instruction, so I've added a couple more patterns that spot
combinations of the 'MVEvmovn' and 'ARMvrev32' SDNodes which can be
generated as a VMOVN instruction with operands swapped.

This commit adds the unpredicated forms only.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: dmgreen

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

Tags: #clang, #llvm

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

4 years ago[ARM,MVE] Add the vmovlbq,vmovltq intrinsic family.
Simon Tatham [Mon, 17 Feb 2020 17:06:05 +0000 (17:06 +0000)]
[ARM,MVE] Add the vmovlbq,vmovltq intrinsic family.

Summary:
These intrinsics take a vector of 2n elements, and return a vector of
n wider elements obtained by sign- or zero-extending every other
element of the input vector. They're represented in IR as a
shufflevector that extracts the odd or even elements of the input,
followed by a sext or zext.

Existing LLVM codegen already matches this pattern and generates the
VMOVLB instruction (which widens the even-index input lanes). But no
existing isel rule was generating VMOVLT, so I've added some. However,
the new rules currently only work in little-endian MVE, because the
pattern they expect from isel lowering includes a bitconvert which
doesn't have the right semantics in big-endian.

The output of one existing codegen test is improved by those new
rules.

This commit adds the unpredicated forms only.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: dmgreen

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

Tags: #clang, #llvm

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

4 years ago[ARM] Allow `ARMVectorRegCast` to match bitconverts too. (NFC)
Simon Tatham [Mon, 17 Feb 2020 17:05:52 +0000 (17:05 +0000)]
[ARM] Allow `ARMVectorRegCast` to match bitconverts too. (NFC)

Summary:
When we start putting instances of `ARMVectorRegCast` in complex isel
patterns, it will be awkward that they're often turned into the more
standard `bitconvert` in little-endian mode. We'd rather not have to
write separate isel patterns for the two endiannesses, matching
different but equivalent cast operations.

This change aims to fix that awkwardness in advance, by turning the
Tablegen record `ARMVectorRegCast` from a simple `SDNode` instance
into a `PatFrags` that can match either kind of cast – with a
predicate that prevents it matching a bitconvert in the big-endian
case, where bitconvert isn't semantically identical.

No existing code generation should be affected by this change, but it
will enable the patterns introduced by D74336 to work in both
endiannesses.

Reviewers: dmgreen

Reviewed By: dmgreen

Subscribers: kristof.beyls, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM,MVE] Add intrinsics vclzq and vclsq.
Simon Tatham [Mon, 17 Feb 2020 17:05:39 +0000 (17:05 +0000)]
[ARM,MVE] Add intrinsics vclzq and vclsq.

Summary:
vclzq maps nicely to the existing target-independent @llvm.ctlz IR
intrinsic. But vclsq ('count leading sign bits') has no corresponding
target-independent intrinsic, so I've made up @llvm.arm.mve.vcls.

This commit adds the unpredicated forms only.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: miyuki

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

Tags: #clang, #llvm

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

4 years ago[ARM,MVE] Add the vrev16q, vrev32q, vrev64q family.
Simon Tatham [Mon, 17 Feb 2020 17:05:26 +0000 (17:05 +0000)]
[ARM,MVE] Add the vrev16q, vrev32q, vrev64q family.

Summary:
These intrinsics just reorder the lanes of a vector, so the natural IR
representation is as a shufflevector operation. Existing LLVM codegen
already recognizes those particular shufflevectors and generates the
MVE VREV instruction.

This commit adds the unpredicated forms only.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: dmgreen

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

4 years ago[ARM,MVE] Add intrinsics for FP rounding operations.
Simon Tatham [Mon, 17 Feb 2020 17:05:13 +0000 (17:05 +0000)]
[ARM,MVE] Add intrinsics for FP rounding operations.

Summary:
This adds the unpredicated forms of six different MVE intrinsics which
all round a vector of floating-point numbers to integer values,
leaving them still in FP format, differing only in rounding mode and
exception settings.

Five of them map to existing target-independent intrinsics in LLVM IR,
such as @llvm.trunc and @llvm.rint. The sixth, mapping to the `vrintn`
instruction, is done by inventing a target-specific intrinsic.

(`vrintn` behaves the same as `vrintx` in terms of the output value:
the side effects on the FPSCR flags are the only difference between
the two. But ACLE specifies separate user-callable intrinsics for the
two, so the side effects matter enough to make sure we generate the
right one of the two instructions in each case.)

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: miyuki

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

Tags: #clang, #llvm

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

4 years ago[ARM,MVE] Add intrinsics for int <-> float conversion.
Simon Tatham [Mon, 17 Feb 2020 17:04:21 +0000 (17:04 +0000)]
[ARM,MVE] Add intrinsics for int <-> float conversion.

Summary:
This adds the unpredicated versions of the family of vcvtq intrinsics
that convert between a vector of floats and a vector of the same size
of integer. These are represented in IR using the standard fptosi,
fptoui, sitofp and uitofp operations, which existing LLVM codegen
already handles.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

4 years ago[ARM,MVE] Add intrinsics for abs, neg and not operations.
Simon Tatham [Mon, 17 Feb 2020 17:03:52 +0000 (17:03 +0000)]
[ARM,MVE] Add intrinsics for abs, neg and not operations.

Summary:
This commit adds the unpredicated intrinsics for the unary operations
vabsq (absolute value), vnegq (arithmetic negation), vmvnq (bitwise
complement), vqabsq and vqnegq (saturating versions of abs and neg for
signed integers, in the sense that they give INT_MAX if an input lane
is INT_MIN).

This is done entirely in clang: all of these operations have existing
isel patterns and existing tests for them on the LLVM side, so I've
just made clang emit the same IR that those patterns already match.

Reviewers: dmgreen, miyuki, MarkMurrayARM, ostannard

Reviewed By: MarkMurrayARM

Subscribers: kristof.beyls, cfe-commits

Tags: #clang

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

4 years ago[lldb][NFC] Documention that OptionDefinition::completion_type contains enum values
Raphael Isemann [Tue, 18 Feb 2020 09:32:00 +0000 (10:32 +0100)]
[lldb][NFC] Documention that OptionDefinition::completion_type contains enum values

This should be just the enum type but that's a larger refactoring, so document that
this is not just an integer until we can make this just the type of the enum.

4 years ago[lldb] Remove the mutable specifier from DataExtractor's member
Pavel Labath [Tue, 18 Feb 2020 09:22:31 +0000 (10:22 +0100)]
[lldb] Remove the mutable specifier from DataExtractor's member

Having m_data_sp mutable sounds like a very bad idea. Fortunately,
nothing relies on this possibility.

4 years ago[lldb][NFC] Modernize documentation in lldb-private-types.h
Raphael Isemann [Tue, 18 Feb 2020 09:10:37 +0000 (10:10 +0100)]
[lldb][NFC] Modernize documentation in lldb-private-types.h

4 years ago[LLD][ELF][AArch64] Change the semantics of -z pac-plt.
Daniel Kiss [Tue, 18 Feb 2020 08:53:39 +0000 (09:53 +0100)]
[LLD][ELF][AArch64] Change the semantics of -z pac-plt.

Summary:
Generate PAC protected plt only when "-z pac-plt" is passed to the
linker. GNU toolchain generates when it is explicitly requested[1].
When pac-plt is requested then set the GNU_PROPERTY_AARCH64_FEATURE_1_PAC
note even when not all function compiled with PAC but issue a warning.
Harmonizing the warning style for BTI/PAC/IBT.
Generate BTI protected PLT if case of "-z force-bti".

[1] https://www.sourceware.org/ml/binutils/2019-03/msg00021.html

Reviewers: peter.smith, espindola, MaskRay, grimar

Reviewed By: peter.smith, MaskRay

Subscribers: tatyana-krasnukha, emaste, arichardson, kristof.beyls, MaskRay, llvm-commits

Tags: #llvm

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

4 years ago[lldb] Refactor and test TypeSystemClang::GetEnumerationIntegerType
Raphael Isemann [Tue, 18 Feb 2020 08:10:16 +0000 (09:10 +0100)]
[lldb] Refactor and test TypeSystemClang::GetEnumerationIntegerType

4 years ago[InstCombin] Avoid nested Create calls, to guarantee order.
Florian Hahn [Tue, 18 Feb 2020 08:44:11 +0000 (09:44 +0100)]
[InstCombin] Avoid nested Create calls, to guarantee order.

The original code allowed creating the != checks in unpredictable order,
causing http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/34014
to fail.

4 years ago[InstCombine] Simplify a umul overflow check to a != 0 && b != 0.
Florian Hahn [Tue, 18 Feb 2020 07:48:43 +0000 (08:48 +0100)]
[InstCombine] Simplify a umul overflow check to a != 0 && b != 0.

This patch adds a simplification if an OR weakens the overflow condition
for umul.with.overflow by treating any non-zero result as overflow. In that
case, we overflow if both umul.with.overflow operands are != 0, as in that
case the result can only be 0, iff the multiplication overflows.

Code like this is generated by code using __builtin_mul_overflow with
negative integer constants, e.g.
   bool test(unsigned long long v, unsigned long long *res) {
     return __builtin_mul_overflow(v, -4775807LL, res);
   }

```
----------------------------------------
Name: D74141
  %res = umul_overflow {i8, i1} %a, %b
  %mul = extractvalue {i8, i1} %res, 0
  %overflow = extractvalue {i8, i1} %res, 1
  %cmp = icmp ne %mul, 0
  %ret = or i1 %overflow, %cmp
  ret i1 %ret
=>
  %t0 = icmp ne i8 %a, 0
  %t1 = icmp ne i8 %b, 0
  %ret = and i1 %t0, %t1
  ret i1 %ret
  %res = umul_overflow {i8, i1} %a, %b
  %mul = extractvalue {i8, i1} %res, 0
  %cmp = icmp ne %mul, 0
  %overflow = extractvalue {i8, i1} %res, 1

Done: 1
Optimization is correct!

```

Reviewers: nikic, lebedev.ri, spatel, Bigcheese, dexonsmith, aemerson

Reviewed By: lebedev.ri

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

4 years ago[lldb][NFC] Document TypeSystemClang
Raphael Isemann [Tue, 18 Feb 2020 07:59:31 +0000 (08:59 +0100)]
[lldb][NFC] Document TypeSystemClang

4 years ago[lldb][NFC] Make all CompilerDeclContext parameters references instead of pointers
Raphael Isemann [Mon, 17 Feb 2020 18:25:52 +0000 (19:25 +0100)]
[lldb][NFC] Make all CompilerDeclContext parameters references instead of pointers

Summary:
All of our lookup APIs either use `CompilerDeclContext &` or `CompilerDeclContext *` semi-randomly it seems.
This leads to us constantly converting between those two types (and doing nullptr checks when going from
pointer to reference). It also leads to the confusing situation where we have two possible ways to express
that we don't have a CompilerDeclContex: either a nullptr or an invalid CompilerDeclContext (aka a default
constructed CompilerDeclContext).

This moves all APIs to use references and gets rid of all the nullptr checks and conversions.

Reviewers: labath, mib, shafik

Reviewed By: labath, shafik

Subscribers: shafik, arphaman, abidh, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[Support] Check for atomics64 when deciding if '-latomic' is needed
Gokturk Yuksek [Tue, 18 Feb 2020 07:52:29 +0000 (07:52 +0000)]
[Support] Check for atomics64 when deciding if '-latomic'  is needed

The CheckAtomic module performs two tests to determine if passing
'-latomic' to the linker is required: one for 64-bit atomics, and
another for non-64-bit atomics. Include the missing check for 64-bit
atomics.

Reviewers: beanz, compnerd
Reviewed By: beanz, compnerd
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69444

4 years ago[InstCombine] Precommit umul.with.overflow sign check test.
Florian Hahn [Mon, 17 Feb 2020 20:08:07 +0000 (21:08 +0100)]
[InstCombine] Precommit umul.with.overflow sign check test.

Precommit tests for D74141.

4 years ago[lldb] Replace #pragma once with header guard
Jonas Devlieghere [Tue, 18 Feb 2020 07:34:32 +0000 (23:34 -0800)]
[lldb] Replace #pragma once with header guard

This got messed up when updating the header guard. Remove the
`pragma once` and use a header guard instead.

4 years ago[ASTImporter] Prevent the ASTImporter from creating multiple main FileIDs.
Raphael Isemann [Mon, 17 Feb 2020 18:43:33 +0000 (19:43 +0100)]
[ASTImporter] Prevent the ASTImporter from creating multiple main FileIDs.

Summary:
When importing the main FileID the ASTImporter currently gives it no include location. This means
that any SourceLocations produced for this FileID look to Clang as if they are coming from the
main FileID (as the main FileID has no include location).

Clang seems to expect that there is only one main FileID in one translation unit (which makes sense
during normal compilation), so this behavior leads to several problems when producing diagnostics,
one being that when calling `SourceManager::isBeforeInTranslationUnit` on two SourceLocations
that come from two different ASTContext instances, Clang fails to sort the SourceLocations as
the include chains of the FileIDs don't end up in a single FileID. This causes that Clang crashes
with "Unsortable locations found" in this function.

This patch gives any imported main FileIDs the main FileID of the To ASTContext as its include
location. This allows Clang to sort all imported SourceLocations as now all include chains point
to the main FileID of the To ASTContext. The exact include location is currently set to the start
of the To main file (just because that should always be a valid SourceLocation).

Reviewers: martong, a_sidorin, a.sidorin, shafik, balazske

Reviewed By: martong, a_sidorin, shafik

Subscribers: balazske, rnkovacs, cfe-commits

Tags: #clang

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

4 years ago[Debuginfo][NFC] add comments for WithColor routines.
Alexey Lapshin [Mon, 17 Feb 2020 23:05:56 +0000 (02:05 +0300)]
[Debuginfo][NFC] add comments for WithColor routines.

Summary:
This patch is follow-up for D74481. It adds comments
to WithColor::defaultErrorHandler() and
WithColor::defaultWarningHandler().

Reviewers: jhenderson, dblaikie, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: llvm-commits

Tags: #llvm

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

4 years ago[lldb] Update header guards to be consistent and compliant with LLVM (NFC)
Jonas Devlieghere [Mon, 17 Feb 2020 23:57:45 +0000 (15:57 -0800)]
[lldb] Update header guards to be consistent and compliant with LLVM (NFC)

LLDB has a few different styles of header guards and they're not very
consistent because things get moved around or copy/pasted. This patch
unifies the header guards across LLDB and converts everything to match
LLVM's style.

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

4 years ago[lldb] Replace empty ctor en dtor bodies with =default (NFC)
Jonas Devlieghere [Tue, 18 Feb 2020 06:57:06 +0000 (22:57 -0800)]
[lldb] Replace empty ctor en dtor bodies with =default (NFC)

Use = default instead of empty constructor and destructor bodies in the
API layer.

4 years agoRevert "[analyzer] Teach scan-build how to rebuild index.html without analyzing."
Artem Dergachev [Tue, 18 Feb 2020 06:47:38 +0000 (09:47 +0300)]
Revert "[analyzer] Teach scan-build how to rebuild index.html without analyzing."

This reverts commit a807a068e6ae58c6b53ad9b0b2004ea0ed0a939f.

Buildbot failures :)

4 years ago[X86] Move avx512 code that forces zeros to the false side of vselects above a check...
Craig Topper [Tue, 18 Feb 2020 05:32:29 +0000 (21:32 -0800)]
[X86] Move avx512 code that forces zeros to the false side of vselects above a check for legal types.

This helps this transform occur earlier so we can fold the not
with setcc. If we delay it until after type legalization we might
have introduced instructions to widen the mask if the vselect was
widened. This can prevent the not from making it to the setcc.

We could of course add more DAG combines to handle that, but
moving this earlier is easier.

4 years ago[analyzer] Teach scan-build how to rebuild index.html without analyzing.
Artem Dergachev [Tue, 18 Feb 2020 06:00:05 +0000 (09:00 +0300)]
[analyzer] Teach scan-build how to rebuild index.html without analyzing.

This is useful for performing custom build system integration that works by appending '--analyze --analyzer-output html' to all clang build commands.
For such users there is now still a way to have the fancy index.html file
in the output.

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

4 years ago[analyzer] VforkChecker: allow execve after vfork.
Artem Dergachev [Tue, 18 Feb 2020 05:40:02 +0000 (08:40 +0300)]
[analyzer] VforkChecker: allow execve after vfork.

In the path-sensitive vfork() checker that keeps a list of operations
allowed after a successful vfork(), unforget to include execve() in the list.

Patch by Jan Včelák!

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

4 years agoRevert new files from new pass manager coro-split/coro-elide
Brian Gesiak [Tue, 18 Feb 2020 05:32:46 +0000 (00:32 -0500)]
Revert new files from new pass manager coro-split/coro-elide

This reverts
https://reviews.llvm.org/rG7125d66f9969605d886b5286780101a45b5bed67 and
https://reviews.llvm.org/rG00fec8004aca6588d8d695a2c3827c3754c380a0 due
to buildbot failures:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/34004

Previous revert 11053a1cc61afaabf2df2b8345d8d392c88cd508 missed newly
added files, this commit removes those as well.

4 years ago[lldb/Plugins] Add missing initialize/terminate calls
Jonas Devlieghere [Tue, 18 Feb 2020 05:21:32 +0000 (21:21 -0800)]
[lldb/Plugins] Add missing initialize/terminate calls

Add missing initialize and terminate calls for DynamicLoaderHexagonDYLD
and ObjectFileJIT.

4 years ago[lldb/Plugins] Conditionally build OperatingSystemPython.
Jonas Devlieghere [Tue, 18 Feb 2020 05:14:30 +0000 (21:14 -0800)]
[lldb/Plugins] Conditionally build OperatingSystemPython.

Only build the Python Operating System Plugin when LLDB_ENABLE_PYTHON is
set to true.

4 years agoRevert "[lldb/lldb-server] Add target.xml support for qXfer request."
Muhammad Omair Javaid [Tue, 18 Feb 2020 05:16:52 +0000 (10:16 +0500)]
Revert "[lldb/lldb-server] Add target.xml support for qXfer request."

This patch cause floating point registers to fail on LLDB aarch64-linux
buildbot.

http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu/builds/1713

This reverts commit aedc196101e33bd58f7443c5b93398418ce55edf.

4 years agoRevert new pass manager coro-split and coro-elide
Brian Gesiak [Tue, 18 Feb 2020 04:55:10 +0000 (23:55 -0500)]
Revert new pass manager coro-split and coro-elide

This reverts
https://reviews.llvm.org/rG7125d66f9969605d886b5286780101a45b5bed67 and
https://reviews.llvm.org/rG00fec8004aca6588d8d695a2c3827c3754c380a0 due
to buildbot failures:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/34004

4 years ago[Coroutines][3/6] New pass manager: coro-elide
Brian Gesiak [Thu, 26 Dec 2019 13:00:00 +0000 (08:00 -0500)]
[Coroutines][3/6] New pass manager: coro-elide

Summary:
Depends on https://reviews.llvm.org/D71899.

The third in a series of patches that ports the LLVM coroutines passes
to the new pass manager infrastructure. This patch implements 'coro-elide'.

The new pass manager infrastructure does not implicitly repeat CGSCC
pass pipelines when a function is devirtualized, and so the tests
for the new pass manager that rely on that behavior now explicitly
specify `repeat<2>`.

Reviewers: GorNishanov, lewissbaker, chandlerc, jdoerfert, junparser, deadalnix, wenlei

Reviewed By: wenlei

Subscribers: wenlei, EricWF, Prazek, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Coroutines][2/6] New pass manager: coro-split
Brian Gesiak [Thu, 26 Dec 2019 13:00:00 +0000 (08:00 -0500)]
[Coroutines][2/6] New pass manager: coro-split

Summary:
This patch has four dependencies:

1. The first in this series of patches that implement coroutine passes in the
   new pass manager: https://reviews.llvm.org/D71898.
2. A patch that introduces an API for CGSCC passes to add new reference
   edges to a `LazyCallGraph`, `updateCGAndAnalysisManagerForCGSCCPass`:
   https://reviews.llvm.org/D72025.
3. A patch that introduces a `CallGraphUpdater` helper class that is
   capable of mutating internal `LazyCallGraph` state in order to insert
   new function nodes into a specific SCC: https://reviews.llvm.org/D70927.
4. And finally, a small edge case fix for updating `LazyCallGraph` that
   patch 3 above happens to run into: https://reviews.llvm.org/D72226.

This is the second in a series of patches that ports the LLVM coroutines
passes to the new pass manager infrastructure. This patch implements
'coro-split'.

Some notes:
* Using the new CGSCC pass manager resulted in IR being printed in the
  reverse order in some tests. To prevent FileCheck checks from failing due
  to these reversed orders, this patch splits up test files that test
  multiple different coroutine functions: specifically
  coro-alloc-with-param.ll, coro-split-eh.ll, and coro-eh-aware-edge-split.ll.
* CoroSplit.cpp contained 2 overloads of `splitCoroutine`, one of which
  dispatched to the other based on the coroutine ABI being used (C++20
  switch-based versus Swift returned-continuation-based). I found this
  confusing, especially with the additional branching based on `CallGraph`
  vs. `LazyCallGraph`, so I removed the ABI-checking overload of
  `splitCoroutine`.

Reviewers: GorNishanov, lewissbaker, chandlerc, jdoerfert, junparser, deadalnix, wenlei

Reviewed By: wenlei

Subscribers: wenlei, qcolombet, EricWF, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Plugins] Rename initializers to match their plugin name.
Jonas Devlieghere [Tue, 18 Feb 2020 03:59:03 +0000 (19:59 -0800)]
[lldb/Plugins] Rename initializers to match their plugin name.

Use LLDB_PLUGIN_DEFINE_ADV to make the name of the generated initializer
match the name of the plugin. This is a step towards generating the
initializers with a def file. I'm landing this change in pieces so I can
narrow down what exactly breaks the Windows bot.

4 years ago[lldb/Plugins] Initialize all ABI plugins by their plugin name
Jonas Devlieghere [Tue, 18 Feb 2020 03:46:28 +0000 (19:46 -0800)]
[lldb/Plugins] Initialize all ABI plugins by their plugin name

4 years ago[X86] Use isScalarFPTypeInSSEReg to simplify code in LowerSELECT. NFC
Craig Topper [Tue, 18 Feb 2020 03:43:26 +0000 (19:43 -0800)]
[X86] Use isScalarFPTypeInSSEReg to simplify code in LowerSELECT. NFC

4 years ago[lldb/Plugins] Remove PLUGIN from libraries that aren't really plugins.
Jonas Devlieghere [Tue, 18 Feb 2020 03:18:37 +0000 (19:18 -0800)]
[lldb/Plugins] Remove PLUGIN from libraries that aren't really plugins.

Although their name and location suggests otherwise, these libraries are
not really plugins but rather support the real plugins.

4 years ago[lldb/Plugins] Rename lldbPluginDisassemblerLLVM (NFC)
Jonas Devlieghere [Tue, 18 Feb 2020 03:14:01 +0000 (19:14 -0800)]
[lldb/Plugins] Rename lldbPluginDisassemblerLLVM (NFC)

4 years agoRevert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"
Jonas Devlieghere [Tue, 18 Feb 2020 03:02:25 +0000 (19:02 -0800)]
Revert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

This is still failing spectacularly on the Windows bot and I still have
no clue what's going on.

4 years ago[NFC] Remove trailing space
Jim Lin [Tue, 18 Feb 2020 02:48:38 +0000 (10:48 +0800)]
[NFC] Remove trailing space

sed -Ei 's/[[:space:]]+$//' include/**/*.{def,h,td} lib/**/*.{cpp,h,td}

4 years ago[XCore][NFC] Remove trailing space
Jim Lin [Tue, 18 Feb 2020 02:32:58 +0000 (10:32 +0800)]
[XCore][NFC] Remove trailing space

4 years ago[X86] Add one use check to '0-x == y --> x+y == 0' in EmitCmp.
Craig Topper [Mon, 17 Feb 2020 22:49:17 +0000 (14:49 -0800)]
[X86] Add one use check to '0-x == y --> x+y == 0' in EmitCmp.

I failed to copy it when I moved this in
b62de210cf50ccb6822260e4075dd93333adb23e

4 years ago[lldb/Plugin] Unconditionally build Darwin-Kernel
Jonas Devlieghere [Tue, 18 Feb 2020 02:14:24 +0000 (18:14 -0800)]
[lldb/Plugin] Unconditionally build Darwin-Kernel

4 years ago[lldb/Plugin] Fix some issues on Windows
Jonas Devlieghere [Tue, 18 Feb 2020 01:20:47 +0000 (17:20 -0800)]
[lldb/Plugin] Fix some issues on Windows

 - Don't initialize NativePDB.
 - Initialize ProcessWindows after any Process*Core plugins.
 - Don't initialize DynamicLoaderDarwinKernel on non-Darwin platforms.

4 years ago[HotColdSplit] Mark entire function cold when entry block is cold
Vedant Kumar [Mon, 17 Feb 2020 23:56:12 +0000 (15:56 -0800)]
[HotColdSplit] Mark entire function cold when entry block is cold

rdar://58855712

4 years ago[TBLGEN] Inhibit generation of unneeded psets
Stanislav Mekhanoshin [Mon, 17 Feb 2020 18:29:06 +0000 (10:29 -0800)]
[TBLGEN] Inhibit generation of unneeded psets

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

4 years agoLowerMatrixIntrinsics: Avoid use of deprecated CreateCall methods
Nicolai Hähnle [Sat, 15 Feb 2020 20:18:25 +0000 (21:18 +0100)]
LowerMatrixIntrinsics: Avoid use of deprecated CreateCall methods

Reviewers: t.p.northover

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoCoroutines: avoid use of deprecated CreateLoad and CreateCall methods
Tim Northover [Tue, 17 Dec 2019 10:07:03 +0000 (10:07 +0000)]
Coroutines: avoid use of deprecated CreateLoad and CreateCall methods

Summary: Patch originally by Tim Northover

Reviewers: t.p.northover

Subscribers: EricWF, hiraditya, modocache, llvm-commits

Tags: #llvm

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

4 years agoCGBuiltin: Remove uses of deprecated CreateCall overloads
Nicolai Hähnle [Wed, 27 Nov 2019 03:58:14 +0000 (04:58 +0100)]
CGBuiltin: Remove uses of deprecated CreateCall overloads

Reviewers: t.p.northover

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

4 years agoRe-land "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"
Jonas Devlieghere [Mon, 17 Feb 2020 22:03:14 +0000 (14:03 -0800)]
Re-land "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

This patch changes the way we initialize and terminate the plugins in
the system initializer. It uses an approach similar to LLVM's
TARGETS_TO_BUILD with a def file that enumerates the plugins.

The previously landed patch got reverted because it was lacking:

 (1) A plugin definition for the Objective-C language runtime,
 (2) The dependency between the Static and WASM dynamic loader,
 (3) Explicit initialization of ScriptInterpreterNone for lldb-test.

All issues have been addressed in this patch.

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

4 years ago[dsymutil] Explicitly link against libatomic when necessary
Gokturk Yuksek [Mon, 17 Feb 2020 22:26:59 +0000 (22:26 +0000)]
[dsymutil] Explicitly link against libatomic when necessary

In some systems, such as RISC-V, atomic support requires explicit linking
against '-latomic' (see https://github.com/riscv/riscv-gcc/issues/12).

Reviewers: davezarzycki, hhb, beanz, jfb, JDevlieghere
Reviewed By: beanz, JDevlieghere
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D69003

4 years ago[LiveDebugValues] Visit open var locs just once in transferRegisterDef, NFC
Vedant Kumar [Mon, 17 Feb 2020 21:53:59 +0000 (13:53 -0800)]
[LiveDebugValues] Visit open var locs just once in transferRegisterDef, NFC

For a file in WebKit, this brings the time spent in LiveDebugValues down
from 16 minutes to 2 minutes. The reduction comes from iterating the set
of open variable locations just once in transferRegisterDef. Post-patch,
the most expensive item inside of transferRegisterDef is a call to
VarLoc::isDescribedByReg, which we have to do.

Testing: I built LNT using the Os-g cmake cache with & without this
patch, then diffed the object files to verify there was no binary diff.

rdar://59446577

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

4 years agoRe-land "Add LazyCallGraph API to add function to RefSCC"
Brian Gesiak [Mon, 17 Feb 2020 21:46:33 +0000 (16:46 -0500)]
Re-land "Add LazyCallGraph API to add function to RefSCC"

This re-commits https://reviews.llvm.org/D70927, which I reverted in
https://reviews.llvm.org/rG28213680b2a7d1fdeea16aa3f3a368879472c72a due
to a buildbot error:
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/13251

I no longer include a test case that appears to crash when built with the
buildbot's compiler, GCC 5.4.0.

4 years ago[Polly] Run polly-update-format after commit 55cfb1. NFC.
Michael Kruse [Mon, 17 Feb 2020 21:55:09 +0000 (15:55 -0600)]
[Polly] Run polly-update-format after commit 55cfb1. NFC.

4 years ago[mlir] Fix multiple titles
Jacques Pienaar [Mon, 17 Feb 2020 21:38:25 +0000 (13:38 -0800)]
[mlir] Fix multiple titles

We have one title in every doc which corresponds to `#`, in the some
there are multiple and it is expected to be h1 headers (visual elements
rather than organizational). Indent every nesting by one in all of the
docs with multiple titles.

Also fixing trailing whitespace.

4 years ago[lldb/Plugin] Update ProcessWindows plugin for revert
Jonas Devlieghere [Mon, 17 Feb 2020 21:53:07 +0000 (13:53 -0800)]
[lldb/Plugin] Update ProcessWindows plugin for revert

4 years ago[X86] Add missing isel pattern for BLCFILL producing flags.
Craig Topper [Mon, 17 Feb 2020 21:08:39 +0000 (13:08 -0800)]
[X86] Add missing isel pattern for BLCFILL producing flags.

4 years agoRevert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"
Jonas Devlieghere [Mon, 17 Feb 2020 20:32:53 +0000 (12:32 -0800)]
Revert "[lldb/CMake] Auto-generate the Initialize and Terminate calls for plugin"

This temporarily reverts commit 7d6da329dee1eda1761430d9097d1323f32c4c0c
because it's causing test failures on the bots.

4 years agoAMDGPU/GlobalISel: Fix RegBankSelect for G_SHUFFLE_VECTOR
Matt Arsenault [Sun, 16 Feb 2020 04:22:00 +0000 (23:22 -0500)]
AMDGPU/GlobalISel: Fix RegBankSelect for G_SHUFFLE_VECTOR

4 years agoAMDGPU/GlobalISel: Custom lower 32-bit G_SDIV/G_SREM
Matt Arsenault [Wed, 12 Feb 2020 01:48:45 +0000 (20:48 -0500)]
AMDGPU/GlobalISel: Custom lower 32-bit G_SDIV/G_SREM

4 years ago[gn build] (manually) merge e9849d519
Nico Weber [Mon, 17 Feb 2020 19:37:43 +0000 (14:37 -0500)]
[gn build] (manually) merge e9849d519

4 years agoAMDGPU/GlobalISel: Allow arbitrary global values
Matt Arsenault [Sun, 16 Feb 2020 03:34:37 +0000 (22:34 -0500)]
AMDGPU/GlobalISel: Allow arbitrary global values

Treat unknown address spaces as global

4 years ago[X86] Change how the alignment for the stack object is created in LowerFLT_ROUNDS_.
Craig Topper [Mon, 17 Feb 2020 19:20:36 +0000 (11:20 -0800)]
[X86] Change how the alignment for the stack object is created in LowerFLT_ROUNDS_.

We don't need FrameInfo's concept of the stack alignment. We just
need to tell it the desired alignment. Which in this case is 2.

4 years ago[X86] Move '0-x == y --> x+y == 0' and similar combines to EmitCmp.
Craig Topper [Mon, 17 Feb 2020 06:13:11 +0000 (22:13 -0800)]
[X86] Move '0-x == y --> x+y == 0' and similar combines to EmitCmp.

AArch64 handles this pattern in their lowering code. By emitting
CMN. ARM handles it as an isel pattern.

4 years agoRevert "Add LazyCallGraph API to add function to RefSCC"
Brian Gesiak [Mon, 17 Feb 2020 19:25:10 +0000 (14:25 -0500)]
Revert "Add LazyCallGraph API to add function to RefSCC"

This reverts commit https://reviews.llvm.org/rG449a13509190b1c57e5fcf5cd7e8f0f647f564b4,
due to buildbot failures such as
http://lab.llvm.org:8011/builders/clang-cmake-x86_64-avx2-linux/builds/13251.

4 years agoGlobalISel: Allow running localizer earlier
Matt Arsenault [Mon, 10 Feb 2020 01:38:37 +0000 (20:38 -0500)]
GlobalISel: Allow running localizer earlier

This required legal and regbankselected MIR for seemingly no
reason. For AMDGPU this wouldn't see legalized G_GLOBAL_VALUEs.

4 years agoFix modules build after https://reviews.llvm.org/D73835 (IRBuilder virtualization...
Vedant Kumar [Mon, 17 Feb 2020 19:21:32 +0000 (11:21 -0800)]
Fix modules build after https://reviews.llvm.org/D73835 (IRBuilder virtualization change)

I readily admit that I don't know why this fixes the modules build, but
it seems to get things building again. Previously I saw the error
message:

http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/9404/consoleFull#-361314398a1ca8a51-895e-46c6-af87-ce24fa4cd561

```
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/IRBuilderFolder.h:18:10: fatal error: cyclic dependency in module 'LLVM_intrinsic_gen': LLVM_intrinsic_gen -> LLVM_IR -> LLVM_intrinsic_gen

         ^
While building module 'LLVM_intrinsic_gen' imported from /Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/IR/IRBuilder.cpp:14:
In file included from <module-includes>:1:
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/include/llvm/IR/Argument.h:19:10: fatal error: could not build module 'LLVM_IR'
 ~~~~~~~~^~~~~~~~~~~~~~~~~
/Users/buildslave/jenkins/workspace/lldb-cmake/llvm-project/llvm/lib/IR/IRBuilder.cpp:14:10: fatal error: could not build module 'LLVM_intrinsic_gen'
```

And reproduced with:

cmake -G Ninja /Users/vsk/src/llvm-backup-master/llvm -DCLANG_ENABLE_ARCMT=Off -DCLANG_ENABLE_STATIC_ANALYZER=Off -DLLVM_ENABLE_PROJECTS='clang;clang-tools-extra;lld;libcxx;libcxxabi;compiler-rt;libunwind;lldb' -DLLDB_USE_SYSTEM_DEBUGSERVER=On -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLLVM_ENABLE_ASSERTIONS=On -DLLVM_ENABLE_MODULES=On

4 years ago[lldb/Plugin] Remove PLUGIN from Process POSIX & Linux
Jonas Devlieghere [Mon, 17 Feb 2020 19:20:17 +0000 (11:20 -0800)]
[lldb/Plugin] Remove PLUGIN from Process POSIX & Linux

ProcessPOSIX and ProcessLinux are not real plugins and should not be
marked as such. This should fix the Linux bots.

4 years agoAMDGPU/GlobalISel: Custom lower 32-bit G_UDIV/G_UREM
Matt Arsenault [Wed, 12 Feb 2020 01:51:02 +0000 (20:51 -0500)]
AMDGPU/GlobalISel: Custom lower 32-bit G_UDIV/G_UREM

AMDGPUCodeGenPrepare expands this most of the time, but not always. We
will always at least need a fallback option here. This is the 3rd
implementation of the same expansion in the backend. Eventually I
would like to eliminate the IR expansion (and the DAG version
obviously).

Currently the new legalizer path produces a better result, since the
IR expansion results in extra operations which need to be combined
out. Notably, the IR expansion results in multiplies by 0.

4 years ago[CMake] CheckAtomic.cmake: catch false positives in RISC-V
Gokturk Yuksek [Mon, 17 Feb 2020 18:36:18 +0000 (18:36 +0000)]
[CMake] CheckAtomic.cmake: catch false positives in RISC-V

The check for 'HAVE_CXX_ATOMICS_WITHOUT_LIB' may create false
positives in RISC-V. This is reproducible when compiling LLVM natively
using GCC on a rv64gc (rv64imafdgc) host. Due to the 'A' (atomic)
extension, g++ replaces calls to libatomic operations on the
std::atomic<int> type with the native hardware instructions. As a
result, the compilation succeeds and the build system thinks it
doesn't need to pass '-latomic'.

Improve the reliability of the 'HAVE_CXX_ATOMICS_WITHOUT_LIB' test in
two steps:

1. Force a pre-increment on x (++x), which should force a call to a
libatomic function;

2. Because step 1 would resolve the increment to 'amoadd.w.aq' under
the 'A' extension, force the same operation on sub-word types, for
which there is no hardware support.

Reviewers: jfb, hintonda, smeenai, mgorny, JDevlieghere, jyknight
Reviewed By: jfb
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68964

4 years agoGlobalISel: Extend narrowing to G_ASHR
Matt Arsenault [Sun, 9 Feb 2020 20:48:31 +0000 (15:48 -0500)]
GlobalISel: Extend narrowing to G_ASHR

4 years ago[Coroutines][1/6] New pass manager: coro-early
Brian Gesiak [Thu, 26 Dec 2019 13:00:00 +0000 (08:00 -0500)]
[Coroutines][1/6] New pass manager: coro-early

Summary:
The first in a series of patches that ports the LLVM coroutines passes
to the new pass manager infrastructure. This patch implements
'coro-early'.

NB: All coroutines passes begin by checking that coroutine intrinsics are
declared within the LLVM IR module they're operating on. To do so, they call
`coro::declaresIntrinsics`. The next 3 patches in this series, which add new
pass manager implementations of the 'coro-split', 'coro-elide', and
'coro-cleanup' passes, use a similar pattern as the one used here: a static
function is shared across both old and new passes to detect if relevant
coroutine intrinsics are delcared. To make this pattern easier to read, this
patch adds `const` keywords to the parameters of `coro::declaresIntrinsics`.

Reviewers: GorNishanov, lewissbaker, junparser, chandlerc, deadalnix, wenlei

Reviewed By: wenlei

Subscribers: ychen, wenlei, EricWF, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[lldb/Plugin] Fix plugin definition for ProcessWindows
Jonas Devlieghere [Mon, 17 Feb 2020 18:23:43 +0000 (10:23 -0800)]
[lldb/Plugin] Fix plugin definition for ProcessWindows

This should fix the unresolved external symbol error.

4 years ago[FPEnv][ARM] Don't call mutateStrictFPToFP when lowering
John Brawn [Mon, 17 Feb 2020 16:55:32 +0000 (16:55 +0000)]
[FPEnv][ARM] Don't call mutateStrictFPToFP when lowering

mutateStrictFPToFP can delete the node and replace it with another with the same
value which can later cause problems, and returning the result of
mutateStrictFPToFP doesn't work because SelectionDAGLegalize expects that the
returned value has the same number of results as the original. Instead handle
things by doing the mutation manually.

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

4 years agoReapply "[IRBuilder] Virtualize IRBuilder"
Nikita Popov [Sun, 16 Feb 2020 16:10:09 +0000 (17:10 +0100)]
Reapply "[IRBuilder] Virtualize IRBuilder"

Relative to the original commit, this fixes some warnings,
and is based on the deletion of the IRBuilder copy constructor
in D74693. The automatic copy constructor would no longer be
safe.

-----

Related llvm-dev thread:
http://lists.llvm.org/pipermail/llvm-dev/2020-February/138951.html

This patch moves the IRBuilder from templating over the constant
folder and inserter towards making both of these virtual.
There are a couple of motivations for this:

1. It's not possible to share code between use-sites that use
different IRBuilder folders/inserters (short of templating the code
and moving it into headers).
2. Methods currently defined on IRBuilderBase (which is not templated)
do not use the custom inserter, resulting in subtle bugs (e.g.
incorrect InstCombine worklist management). It would be possible to
move those into the templated IRBuilder, but...
3. The vast majority of the IRBuilder implementation has to live
in the header, because it depends on the template arguments.
4. We have many unnecessary dependencies on IRBuilder.h,
because it is not easy to forward-declare. (Significant parts of
the backend depend on it via TargetLowering.h, for example.)

This patch addresses the issue by making the following changes:

* IRBuilderDefaultInserter::InsertHelper becomes virtual.
  IRBuilderBase accepts a reference to it.
* IRBuilderFolder is introduced as a virtual base class. It is
 implemented by ConstantFolder (default), NoFolder and TargetFolder.
  IRBuilderBase has a reference to this as well.
* All the logic is moved from IRBuilder to IRBuilderBase. This means
  that methods can in the future replace their IRBuilder<> & uses
  (or other specific IRBuilder types) with IRBuilderBase & and thus
  be usable with different IRBuilders.
* The IRBuilder class is now a thin wrapper around IRBuilderBase.
  Essentially it only stores the folder and inserter and takes care
  of constructing the base builder.

What this patch doesn't do, but should be simple followups after this change:

* Fixing use of the inserter for creation methods originally defined
  on IRBuilderBase.
* Replacing IRBuilder<> uses in arguments with IRBuilderBase, where useful.
* Moving code from the IRBuilder header to the source file.

From the user perspective, these changes should be mostly transparent:
The only thing that consumers using a custom inserted may need to do is
inherit from IRBuilderDefaultInserter publicly and mark their InsertHelper
as public.

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

4 years ago[Polly] Fix build after IRBuilder changes
Nikita Popov [Mon, 17 Feb 2020 18:01:18 +0000 (19:01 +0100)]
[Polly] Fix build after IRBuilder changes

Simply dropping the createPollyIRBuilder() function here, because
it doesn't do much. Also directly initialize Expander in
ScopExpander instead of going through the copy-constructor.

4 years agoAdd LazyCallGraph API to add function to RefSCC
Brian Gesiak [Tue, 4 Feb 2020 03:50:39 +0000 (22:50 -0500)]
Add LazyCallGraph API to add function to RefSCC

Summary:
Depends on https://reviews.llvm.org/D70927.

`LazyCallGraph::addNewFunctionIntoSCC` allows users to insert a new
function node into a call graph, into a specific, existing SCC.

Extend this interface such that functions can be added even when they do
not belong in any existing SCC, but instead in a new SCC within an
existing RefSCC.

The ability to insert new functions as part of a RefSCC is necessary for
outlined functions that do not form a strongly connected cycle with the
function they are outlined from. An example of such a function would be the
coroutine funclets 'f.resume', etc., which are outlined from a coroutine 'f'.
Coroutine 'f' only references the funclets' addresses, it does not call
them directly.

Reviewers: jdoerfert, chandlerc, wenlei, hfinkel

Reviewed By: jdoerfert

Subscribers: hfinkel, JonChesterfield, mehdi_amini, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[ARM,MVE] Add vector-scalar intrinsics
Mikhail Maltsev [Mon, 17 Feb 2020 17:47:05 +0000 (17:47 +0000)]
[ARM,MVE] Add vector-scalar intrinsics

Summary:
This patch adds vector-scalar variants to the following families of
MVE intrinsics:
* vaddq
* vsubq
* vmulq
* vqaddq
* vqsubq
* vhaddq
* vhsubq
* vqdmulhq
* vqrdmulhq

The vector-scalar variants perform a splat operation on the scalar
operand and then perform the same operations as their vector-vector
counterparts. Code generation is done accordingly (using LLVM IR 'insert'
and 'shuffle' operations which are later converted into an ARMvdup
SDNode).

Reviewers: simon_tatham, dmgreen, MarkMurrayARM, ostannard

Reviewed By: dmgreen

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

Tags: #clang, #llvm

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

4 years agoGlobalISel: Fix missing const
Matt Arsenault [Mon, 17 Feb 2020 17:08:39 +0000 (12:08 -0500)]
GlobalISel: Fix missing const