3 years ago[pstl] Remove our custom FindTBB CMake file
Louis Dionne [Thu, 11 Apr 2019 17:23:18 +0000 (17:23 +0000)]
[pstl] Remove our custom FindTBB CMake file

The TBBConfig file installed by TBB 2019 Update 5 works properly, so we
don't need this workaround anymore.

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358196

3 years agoFix PR41465 - Use __builtin_mul_overflow instead of hand-rolled check.
Eric Fiselier [Thu, 11 Apr 2019 17:16:35 +0000 (17:16 +0000)]
Fix PR41465 - Use __builtin_mul_overflow instead of hand-rolled check.

On ARM the hand-rolled check causes a call to __aeabi_uidiv,
which we may not have a definition for.

Using the builtin avoids the generation of any library call.

llvm-svn: 358195

3 years agoNew document skeleton describing how to add a constrained floating-point
Kevin P. Neal [Thu, 11 Apr 2019 17:16:03 +0000 (17:16 +0000)]
New document skeleton describing how to add a constrained floating-point

Reviewed by: andrew.w.kaylor, cameron.mcinally
Differential Revision: https://reviews.llvm.org/D59833

llvm-svn: 358194

3 years ago[pstl] Setup the _PSTL_VERSION macro like _LIBCPP_VERSION, and add release notes
Louis Dionne [Thu, 11 Apr 2019 17:08:55 +0000 (17:08 +0000)]
[pstl] Setup the _PSTL_VERSION macro like _LIBCPP_VERSION, and add release notes

Reviewers: rodgert, MikeDvorskiy

Subscribers: mgorny, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358193

3 years ago[ConstantFold] ExtractConstantBytes - handle shifts on large integer types
Simon Pilgrim [Thu, 11 Apr 2019 16:39:31 +0000 (16:39 +0000)]
[ConstantFold] ExtractConstantBytes - handle shifts on large integer types

Use APInt instead of getZExtValue from the ConstantInt until we can confirm that the shift amount is in range.

Reduced from OSS-Fuzz #14169 - https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=14169

llvm-svn: 358192

3 years ago[NFC] Correct outdated links to the Itanium C++ ABI documentation
Louis Dionne [Thu, 11 Apr 2019 16:37:07 +0000 (16:37 +0000)]
[NFC] Correct outdated links to the Itanium C++ ABI documentation

Those are now hosted on GitHub.


llvm-svn: 358191

3 years ago[libFuzzer] Fallback to default Mutate when MutateWithMask fails.
Max Moroz [Thu, 11 Apr 2019 16:24:53 +0000 (16:24 +0000)]
[libFuzzer] Fallback to default Mutate when MutateWithMask fails.

In case the current corpus input doesn't have bytes going into the
focus function, MutateWithMask is useless and may fail gently, allowing the
default mutation routine happen, rather than crashing on an assertion.

For more context and the initial fix suggestion, see:

Reviewers: kcc, morehouse

Reviewed By: kcc

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 358190

3 years ago[libc++] Make sure we don't eagerly diagnose non-const comparators for containers...
Louis Dionne [Thu, 11 Apr 2019 16:14:56 +0000 (16:14 +0000)]
[libc++] Make sure we don't eagerly diagnose non-const comparators for containers of incomplete types

In r348529, I improved the library-defined diagnostic for using containers
with a non-const comparator/hasher. However, the check is now performed
too early, which leads to the diagnostic being emitted in cases where it
shouldn't. See PR41360 for details.

This patch moves the diagnostic to the destructor of the containers, which
means that the diagnostic will only be emitted when the container is instantiated
at a point where the comparator and the key/value are required to be complete.
We still retain better diagnostics than before r348529, because the diagnostics
are performed in the containers themselves instead of __tree and __hash_table.

As a drive-by fix, I improved the diagnostic to mention that we can't find
a _viable_ const call operator, as suggested by EricWF in PR41360.

Reviewers: EricWF, mclow.lists

Subscribers: christof, jkorous, dexonsmith, libcxx-commits, zoecarver

Tags: #libc

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

llvm-svn: 358189

3 years ago[lldb] [lit/Register] Mark x86-mm-xmm-read XFAIL on Windows
Michal Gorny [Thu, 11 Apr 2019 16:06:14 +0000 (16:06 +0000)]
[lldb] [lit/Register] Mark x86-mm-xmm-read XFAIL on Windows

llvm-svn: 358188

3 years ago[DAGCombiner] refactor narrowing of extracted vector binop; NFC
Sanjay Patel [Thu, 11 Apr 2019 15:59:47 +0000 (15:59 +0000)]
[DAGCombiner] refactor narrowing of extracted vector binop; NFC

There's a TODO comment about handling patterns with insert_subvector,
and we do want to match that.

llvm-svn: 358187

3 years ago[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMV3 mask support
Simon Pilgrim [Thu, 11 Apr 2019 15:29:15 +0000 (15:29 +0000)]
[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMV3 mask support

Completes SimplifyDemandedVectorElts's basic variable shuffle mask support which should help D60512 + D60562

llvm-svn: 358186

3 years agoMake llvm-nm -help great again
Serge Guelton [Thu, 11 Apr 2019 15:22:48 +0000 (15:22 +0000)]
Make llvm-nm -help great again

Only display help from the llvm-nm category instead of all llvm options, which make it much more usable.
There's still an issue with -s, which is probably a bug in llvm::cl and worth another commit.

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

llvm-svn: 358185

3 years ago[lldb] [lit/Register] Fix test to use %clangxx
Michal Gorny [Thu, 11 Apr 2019 15:13:17 +0000 (15:13 +0000)]
[lldb] [lit/Register] Fix test to use %clangxx

llvm-svn: 358184

3 years ago[RISCV] Diagnose invalid second input register operand when using %tprel_add
Roger Ferrer Ibanez [Thu, 11 Apr 2019 15:13:12 +0000 (15:13 +0000)]
[RISCV] Diagnose invalid second input register operand when using %tprel_add

RISCVMCCodeEmitter::expandAddTPRel asserts that the second operand must be
x4/tp. As we are not currently checking this in the RISCVAsmParser, the assert
is easy to trigger due to wrong assembly input.

This patch does a late check of this constraint.

An alternative could be using a singleton register class for x4/tp similar to
the current one for sp. Unfortunately it does not result in a good diagnostic.
Because add is an overloaded mnemonic, if no matching is possible, the
diagnostic of the first failing alternative seems to be used as the diagnostic
itself. This means that this case the %tprel_add is diagnosed as an invalid
operand (because the real add instruction only has 3 operands).

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

llvm-svn: 358183

3 years ago[X86][AVX] Tweak X86ISD::VPERMV3 demandedelts test
Simon Pilgrim [Thu, 11 Apr 2019 15:09:03 +0000 (15:09 +0000)]
[X86][AVX] Tweak X86ISD::VPERMV3 demandedelts test

Original test was too dependent on the order of the combines that could cause the inserted element being demanded after all

llvm-svn: 358182

3 years agoFixed possible out of bound array access.
Andrey Churbanov [Thu, 11 Apr 2019 15:03:44 +0000 (15:03 +0000)]
Fixed possible out of bound array access.

The check of index value moved to before the write to the array.

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

llvm-svn: 358181

3 years ago[test] Convert CommandScriptImmediateOutput from pexpect to lit
Jonas Devlieghere [Thu, 11 Apr 2019 15:03:07 +0000 (15:03 +0000)]
[test] Convert CommandScriptImmediateOutput from pexpect to lit

This converts the CommandScriptImmediateOutput test from a python test
using pexpect to a lit test.

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

llvm-svn: 358180

3 years ago[X86] Add MM register mapping from CodeView to MC register id
Luo, Yuanke [Thu, 11 Apr 2019 15:01:03 +0000 (15:01 +0000)]
[X86] Add MM register mapping from CodeView to MC register id

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

Change-Id: I2183a6d825d0284b22705d423b88882992b236c5
llvm-svn: 358179

3 years ago[lldb] [Process/NetBSD] Fix wrongly mapping mm* registers
Michal Gorny [Thu, 11 Apr 2019 14:58:48 +0000 (14:58 +0000)]
[lldb] [Process/NetBSD] Fix wrongly mapping mm* registers

Fix mistake that mapped mm* registers into the space for xmm* registers,
rather than the one shared with st* registers.  In other words,
'register read mmN' now correctly shows the mmN register rather than
part of xmmN.

Includes a minimal lit regression test.

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

llvm-svn: 358178

3 years ago[llvm] [lit] Add target-x86* features
Michal Gorny [Thu, 11 Apr 2019 14:58:39 +0000 (14:58 +0000)]
[llvm] [lit] Add target-x86* features

Add a 'target-x86' and 'target-x86_64' feature sthat indicates that
the default target is 32-bit or 64-bit x86, appropriately.  Combined
with 'native' feature, we're going to use this to control x86-specific
LLDB native process tests.

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

llvm-svn: 358177

3 years agoYAMLIO: Fix serialization of strings with embedded nuls
Pavel Labath [Thu, 11 Apr 2019 14:57:34 +0000 (14:57 +0000)]
YAMLIO: Fix serialization of strings with embedded nuls

A bug/typo in Output::scalarString caused us to round-trip a StringRef
through a const char *. This meant that any strings with embedded nuls
were unintentionally cut short at the first such character. (It also
could have caused accidental buffer overruns, but it seems that all
StringRefs coming into this functions were formed from null-terminated

This patch fixes the bug and adds an appropriate test.

Reviewers: sammccall, jhenderson

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 358176

3 years ago[X86][AVX] Add X86ISD::VPERMV3 demandedelts test
Simon Pilgrim [Thu, 11 Apr 2019 14:48:46 +0000 (14:48 +0000)]
[X86][AVX] Add X86ISD::VPERMV3 demandedelts test

llvm-svn: 358175

3 years ago[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMV mask support
Simon Pilgrim [Thu, 11 Apr 2019 14:35:45 +0000 (14:35 +0000)]
[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMV mask support

llvm-svn: 358174

3 years ago[X86][AVX] Add X86ISD::VPERMV demandedelts test
Simon Pilgrim [Thu, 11 Apr 2019 14:26:32 +0000 (14:26 +0000)]
[X86][AVX] Add X86ISD::VPERMV demandedelts test

llvm-svn: 358173

3 years ago[DAGCombiner][x86] scalarize inserted vector FP ops
Sanjay Patel [Thu, 11 Apr 2019 14:21:57 +0000 (14:21 +0000)]
[DAGCombiner][x86] scalarize inserted vector FP ops

// bo (build_vec ...undef, x, undef...), (build_vec ...undef, y, undef...) -->
// build_vec ...undef, (bo x, y), undef...

The lifetime of the nodes in these examples is different for variables versus constants,
but they are all build vectors briefly, so I'm proposing to catch them in this form to
handle all of the leading examples in the motivating test file.

Before we have build vectors, we might have insert_vector_element. After that, we might
have scalar_to_vector and constant pool loads.

It's going to take more work to ensure that FP vector operands are getting simplified
with undef elements, so this transform can apply more widely. In a non-loose FP environment,
we are likely simplifying FP elements to NaN values rather than undefs.

We also need to allow more opcodes down this path. Eg, we don't handle FP min/max flavors

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

llvm-svn: 358172

3 years ago[AArch64] Add lowering pattern for llvm.aarch64.neon.vcvtfxs2fp.f16.i64
Diogo N. Sampaio [Thu, 11 Apr 2019 14:19:43 +0000 (14:19 +0000)]
[AArch64] Add lowering pattern for llvm.aarch64.neon.vcvtfxs2fp.f16.i64

Summary:  Add lowering pattern for llvm.aarch64.neon.vcvtfxs2fp.f16.i64

Reviewers: pbarrio, DavidSpickett, LukeGeeson

Reviewed By: LukeGeeson

Subscribers: javed.absar, kristof.beyls, llvm-commits

Tags: #llvm

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

llvm-svn: 358171

3 years ago[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMILPV mask support
Simon Pilgrim [Thu, 11 Apr 2019 14:15:01 +0000 (14:15 +0000)]
[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMILPV mask support

llvm-svn: 358170

3 years agoMinidump: extend UUID byte-swapping to windows platform
Pavel Labath [Thu, 11 Apr 2019 14:14:07 +0000 (14:14 +0000)]
Minidump: extend UUID byte-swapping to windows platform

D59433 added code to swap bytes UUIDs coming from minidump files, but
only enabled it for apple platforms. Based on my research, I believe
this is the correct thing to do for windows as well, as the natural way
of printing U(G)UIDs on this platforms is to print the first three
components as (4 or 2)-byte integers printed in natural (big-endian)
order. This makes the UUID string coming out of lldb match the strings
produced by other windows tools.

The decision to byte-swap the age field is somewhat arbitrary, because
the age field is usually printed separately from the file GUID (and
often in decimal). However, for our purposes (telling whether two files
are identical), including it in the UUID is correct, and printing it in
big-endian makes it easier to recognize the age value.

This also makes the UUIDs generated here (almost) match up with the
UUIDs computed for breakpad symbol files
(BreakpadRecords.cpp:parseModuleId), which already implemented the
byte-swapping. The "almost" is here because ObjectFileBreakpad does not
swap the age field, but I'll fix that in a follow-up.

There is no UUID support in ObjectFileCOFF at the moment, but ideally
the algorithms used here and in ObjectFileCOFF should be in sync so that
object file matching works correctly.

Reviewers: clayborg, amccarth, markmentovai, asmith

Subscribers: lldb-commits

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

llvm-svn: 358169

3 years ago[X86][AVX] Add X86ISD::VPERMILPV demandedelts tests
Simon Pilgrim [Thu, 11 Apr 2019 14:09:35 +0000 (14:09 +0000)]
[X86][AVX] Add X86ISD::VPERMILPV demandedelts tests

llvm-svn: 358168

3 years ago[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMIL2 mask support
Simon Pilgrim [Thu, 11 Apr 2019 14:04:19 +0000 (14:04 +0000)]
[X86] SimplifyDemandedVectorElts - add X86ISD::VPERMIL2 mask support

llvm-svn: 358167

3 years ago[X86][XOP] Add X86ISD::VPERMIL2 demandedelts test
Simon Pilgrim [Thu, 11 Apr 2019 13:52:43 +0000 (13:52 +0000)]
[X86][XOP] Add X86ISD::VPERMIL2 demandedelts test

llvm-svn: 358166

3 years ago[X86] SimplifyDemandedVectorElts - add VPPERM support
Simon Pilgrim [Thu, 11 Apr 2019 13:30:38 +0000 (13:30 +0000)]
[X86] SimplifyDemandedVectorElts - add VPPERM support

We need to add support for all variable shuffle mask ops, but VPPERM is the only one that already has test coverage.

llvm-svn: 358165

3 years ago[libunwind] Fix the typo in unw_save_vfp_as_X alias
Petr Hosek [Thu, 11 Apr 2019 13:08:44 +0000 (13:08 +0000)]
[libunwind] Fix the typo in unw_save_vfp_as_X alias

This was accidentaly introduced in r357640.

llvm-svn: 358164

3 years ago[ValueTracking] Change if-else chain into switch in computeKnownBitsFromAssume
Sander de Smalen [Thu, 11 Apr 2019 13:02:19 +0000 (13:02 +0000)]
[ValueTracking] Change if-else chain into switch in computeKnownBitsFromAssume

This is a follow-up patch to D60504 to further improve
performance issues in computeKnownBitsFromAssume.

The patch is NFC, but may improve compile-time performance
if the compiler isn't clever enough to do the optimization

llvm-svn: 358163

3 years agoTest commit access
Oliver Stannard [Thu, 11 Apr 2019 12:53:33 +0000 (12:53 +0000)]
Test commit access

llvm-svn: 358162

3 years agoUse llvm::lower_bound. NFC
Fangrui Song [Thu, 11 Apr 2019 10:25:41 +0000 (10:25 +0000)]
Use llvm::lower_bound. NFC

llvm-svn: 358161

3 years ago[MCA] Remove wrong comments from a test. NFC
Andrea Di Biagio [Thu, 11 Apr 2019 10:15:04 +0000 (10:15 +0000)]
[MCA] Remove wrong comments from a test. NFC

llvm-svn: 358160

3 years ago[clangd] Use identifiers in file as completion candidates when build is not ready.
Eric Liu [Thu, 11 Apr 2019 09:36:36 +0000 (09:36 +0000)]
[clangd] Use identifiers in file as completion candidates when build is not ready.

o Lex the code to get the identifiers and put them into a "symbol" index.
o Adds a new completion mode without compilation/sema into code completion workflow.
o Make IncludeInserter work even when no compile command is present, by avoiding
inserting non-verbatim headers.

Reviewers: sammccall

Reviewed By: sammccall

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

Tags: #clang

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

llvm-svn: 358159

3 years ago[ADT] Fix template parameter names of llvm::{upper|lower}_bound
Ilya Biryukov [Thu, 11 Apr 2019 09:00:36 +0000 (09:00 +0000)]
[ADT] Fix template parameter names of llvm::{upper|lower}_bound

Rename template parameter for a search value from 'ForwardIt' to 'T'.
While here, also use perfect forwarding to pass the value to STL algos.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: dexonsmith, llvm-commits

Tags: #llvm

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

llvm-svn: 358158

3 years ago[clangd] Include compile command heuristic in logs
Sam McCall [Thu, 11 Apr 2019 08:17:15 +0000 (08:17 +0000)]
[clangd] Include compile command heuristic in logs

llvm-svn: 358157

3 years agotry to fix the sphinx build some more
Hans Wennborg [Thu, 11 Apr 2019 07:46:25 +0000 (07:46 +0000)]
try to fix the sphinx build some more

llvm-svn: 358156

3 years agoFix two sphinx warnings
Hans Wennborg [Thu, 11 Apr 2019 07:31:03 +0000 (07:31 +0000)]
Fix two sphinx warnings

llvm-svn: 358155

3 years agoTry to fix the shpinx build
Hans Wennborg [Thu, 11 Apr 2019 07:30:56 +0000 (07:30 +0000)]
Try to fix the shpinx build

llvm-svn: 358154

3 years ago[llvm-exegesis] Fix serialization/deserialization of special NoRegister register...
Roman Lebedev [Thu, 11 Apr 2019 07:20:50 +0000 (07:20 +0000)]
[llvm-exegesis] Fix serialization/deserialization of special NoRegister register (PR41448)

A *lot* of instructions have this special register.
It seems this never really worked, but i finally noticed it only
because it happened to break for `CMOV16rm` instruction.

We serialized that register as "" (empty string), which is naturally
'ignored' during deserialization, so we re-create a `MCInst` with
too few operands.

And when we then happened to try to resolve variant sched class
for this mis-serialized instruction, and the variant predicate
tried to read an operand that was out of bounds since we got less operands,
we crashed.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=41448 | PR41448 ]].

Reviewers: craig.topper, courbet

Reviewed By: courbet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 358153

3 years agoAdd { } to silence compiler warning [NFC]
Mikael Holmen [Thu, 11 Apr 2019 06:57:12 +0000 (06:57 +0000)]
Add { } to silence compiler warning [NFC]

At least clang 3.6 warns on the original code:

../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:829:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 1>({Address(nullptr, CharUnits::Zero())});
                                 {                                  }
../tools/clang/lib/CodeGen/CGNonTrivialStruct.cpp:833:34: error: suggest braces around initialization of subobject [-Werror,-Wmissing-braces]
  return std::array<Address, 2>({Address(nullptr, CharUnits::Zero()),
2 errors generated.

llvm-svn: 358152

3 years ago[OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue...
Alexey Sotkin [Thu, 11 Apr 2019 06:18:17 +0000 (06:18 +0000)]
[OpenCL] Re-fix invalid address space generation for clk_event_t arguments of enqueue_kernel builtin function

https://reviews.llvm.org/D53809 fixed wrong address space(assert in debug build)
generated for event_ret argument. But exactly the same problem exists for
event_wait_list argument. This patch should fix both.

Reviewers: Anastasia, yaxunl

Reviewed By:  Anastasia

Subscribers: kristina, ebevhan, cfe-commits

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

llvm-svn: 358151

3 years ago[RISCV] Put data smaller than eight bytes to small data section
Shiva Chen [Thu, 11 Apr 2019 04:59:13 +0000 (04:59 +0000)]
[RISCV] Put data smaller than eight bytes to small data section

Because of gp = sdata_start_address + 0x800, gp with signed twelve-bit offset
could covert most of the small data section. Linker relaxation could transfer
the multiple data accessing instructions to a gp base with signed twelve-bit
offset instruction.

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

llvm-svn: 358150

3 years agoProspective test fix in response to r358104.
John McCall [Thu, 11 Apr 2019 03:04:04 +0000 (03:04 +0000)]
Prospective test fix in response to r358104.

llvm-svn: 358149

3 years ago[DWARF] Set discriminator to 0 for DW_LNS_copy
Fangrui Song [Thu, 11 Apr 2019 02:02:44 +0000 (02:02 +0000)]
[DWARF] Set discriminator to 0 for DW_LNS_copy

Make DW_LNS_copy set the discriminator register to 0, to conform to
DWARF 4 & 5: "Then it sets the discriminator register to 0, and sets the
basic_block, prologue_end and epilogue_begin registers to false."

Because all of DW_LNE_end_sequence, DN_LNS_copy, and special opcodes reset
discriminator to 0, we can move discriminator=0 to appendRowToMatrix.

Also, make DW_LNS_copy print before appending the row, as it is similar
to a address+=0,line+=0 special opcode, which prints before appending
the row.

Reviewers: dblaikie, probinson, aprantl

Reviewed By: dblaikie

Subscribers: danielcdh, llvm-commits

Tags: #llvm

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

llvm-svn: 358148

3 years agoRemove repeated words from BuildingLibcxx.rst
Jonathan Metzman [Wed, 10 Apr 2019 23:44:27 +0000 (23:44 +0000)]
Remove repeated words from BuildingLibcxx.rst

Summary: Remove repeated words from docs.

Reviewers: phosek

Reviewed By: phosek

Subscribers: christof

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

llvm-svn: 358147

3 years agoFix a hang when lowering __builtin_dynamic_object_size
Erik Pilkington [Wed, 10 Apr 2019 23:42:11 +0000 (23:42 +0000)]
Fix a hang when lowering __builtin_dynamic_object_size

If the ObjectSizeOffsetEvaluator fails to fold the object size call, then it may
litter some unused instructions in the function. When done repeatably in
InstCombine, this results in an infinite loop. Fix this by tracking the set of
instructions that were inserted, then removing them on failure.


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

llvm-svn: 358146

3 years ago[NFC] Use clearer naming for local variables
JF Bastien [Wed, 10 Apr 2019 23:23:17 +0000 (23:23 +0000)]
[NFC] Use clearer naming for local variables

llvm-svn: 358145

3 years ago[AArch64][GlobalISel] Make <2 x p0> = G_BUILD_VECTOR legal.
Amara Emerson [Wed, 10 Apr 2019 23:06:14 +0000 (23:06 +0000)]
[AArch64][GlobalISel] Make <2 x p0> = G_BUILD_VECTOR legal.

The existing isel support already works for p0 once the legalizer accepts it.

llvm-svn: 358144

3 years ago[AArch64][GlobalISel] Add legalizer support for <8 x s16> and <16 x s8> G_ADD.
Amara Emerson [Wed, 10 Apr 2019 23:06:11 +0000 (23:06 +0000)]
[AArch64][GlobalISel] Add legalizer support for <8 x s16> and <16 x s8> G_ADD.

llvm-svn: 358143

3 years ago[AArch64][GlobalISel] Scalarize vector SDIV.
Amara Emerson [Wed, 10 Apr 2019 23:06:08 +0000 (23:06 +0000)]
[AArch64][GlobalISel] Scalarize vector SDIV.

llvm-svn: 358142

3 years ago[X86] Add SSE1 command line to atomic-fp.ll and atomic-non-integer.ll. NFC
Craig Topper [Wed, 10 Apr 2019 22:35:32 +0000 (22:35 +0000)]
[X86] Add SSE1 command line to atomic-fp.ll and atomic-non-integer.ll. NFC

llvm-svn: 358141

3 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Wed, 10 Apr 2019 22:35:24 +0000 (22:35 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 358140

3 years ago[X86] Teach foldMaskedShiftToScaledMask to look through an any_extend from i32 to...
Craig Topper [Wed, 10 Apr 2019 21:42:08 +0000 (21:42 +0000)]
[X86] Teach foldMaskedShiftToScaledMask to look through an any_extend from i32 to i64 between the and & shl

foldMaskedShiftToScaledMask tries to reorder and & shl to enable the shl to fold into an LEA. But if there is an any_extend between them it doesn't work.

This patch modifies the code to look through any_extend from i32 to i64 when the and mask only uses bits that weren't from the extended part.

This will prevent a regression from D60358 caused by 64-bit SHL being narrowed to 32-bits when their upper bits aren't demanded.

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

llvm-svn: 358139

3 years ago[X86] Make _Int instructions the preferred instructon for the assembly parser and...
Craig Topper [Wed, 10 Apr 2019 21:29:41 +0000 (21:29 +0000)]
[X86] Make _Int instructions the preferred instructon for the assembly parser and disassembly parser to remove inconsistencies between VEX and EVEX.

Many of our instructions have both a _Int form used by intrinsics and a form
used by other IR constructs. In the EVEX space the _Int versions usually cover
all the capabilities include broadcasting and rounding. While the other version
only covers simple register/register or register/load forms. For this reason
in EVEX, the non intrinsic form is usually marked isCodeGenOnly=1.

In the VEX encoding space we were less consistent, but usually the _Int version
was the isCodeGenOnly version.

This commit makes the VEX instructions match the EVEX instructions. This was
done by manually studying the AsmMatcher table so its possible I missed some
cases, but we should be closer now.

I'm thinking about using the isCodeGenOnly bit to simplify the EVEX2VEX
tablegen code that disambiguates the _Int and non _Int versions. Currently it
checks register class sizes and Record the memory operands come from. I have
some other changes I was looking into for D59266 that may break the memory check.

I had to make a few scheduler hacks to keep the _Int versions from being treated
differently than the non _Int version.

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

llvm-svn: 358138

3 years agoFix undefined behavior in DWARFASTParser::ParseChildArrayInfo()
Adrian Prantl [Wed, 10 Apr 2019 21:18:44 +0000 (21:18 +0000)]
Fix undefined behavior in DWARFASTParser::ParseChildArrayInfo()

PR40827: https://bugs.llvm.org/show_bug.cgi?id=40827

llvm-svn: 358137

3 years agoFix a test, NFC
Erik Pilkington [Wed, 10 Apr 2019 21:18:21 +0000 (21:18 +0000)]
Fix a test, NFC

This test was duplicated, and the last declaration had some syntax errors since
the invalid attribute caused the @implementation to be skipped by the parser.

llvm-svn: 358136

3 years ago[NFC] Remove ASCII lines from comments
Jonas Devlieghere [Wed, 10 Apr 2019 20:48:55 +0000 (20:48 +0000)]
[NFC] Remove ASCII lines from comments

A lot of comments in LLDB are surrounded by an ASCII line to delimit the
begging and end of the comment.

Its use is not really consistent across the code base, sometimes the
lines are longer, sometimes they are shorter and sometimes they are
omitted. Furthermore, it looks kind of weird with the 80 column limit,
where the comment actually extends past the line, but not by much.
Furthermore, when /// is used for Doxygen comments, it looks
particularly odd. And when // is used, it incorrectly gives the
impression that it's actually a Doxygen comment.

I assume these lines were added to improve distinguishing between
comments and code. However, given that todays editors and IDEs do a
great job at highlighting comments, I think it's worth to drop this for
the sake of consistency. The alternative is fixing all the
inconsistencies, which would create a lot more churn.

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

llvm-svn: 358135

3 years agoCheck i < FD->getNumParams() before querying
Dmitri Gribenko [Wed, 10 Apr 2019 20:25:07 +0000 (20:25 +0000)]
Check i < FD->getNumParams() before querying

As was already stated in a previous comment, the parameter isn't
necessarily referring to one of the DeclContext's parameter. We
should check the index is within the range to avoid out-of-boundary

Reviewers: gribozavr, rsmith, lebedev.ri

Reviewed By: gribozavr, rsmith

Subscribers: lebedev.ri, cfe-commits

Tags: #clang

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

Patch by Violet.

llvm-svn: 358134

3 years ago[clang][ASTContext] Try to exit early before loading serialized comments from AST...
Jan Korous [Wed, 10 Apr 2019 20:23:33 +0000 (20:23 +0000)]
[clang][ASTContext] Try to exit early before loading serialized comments from AST files

Loading external comments is expensive. This change probably doesn't apply to common cases but is almost for free and would save some work in case none of the declaration needs external comments to be loaded.

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

llvm-svn: 358133

3 years agoAdd IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.
John McCall [Wed, 10 Apr 2019 19:57:20 +0000 (19:57 +0000)]
Add IRGen APIs to fetch ctor/dtor helper functions for non-trivial structs.

Patch by Tony Allevato!

llvm-svn: 358132

3 years ago[pstl] Move to single underscore-capital for macros and include guards
Louis Dionne [Wed, 10 Apr 2019 19:51:40 +0000 (19:51 +0000)]
[pstl] Move to single underscore-capital for macros and include guards

Summary: Per the LLVM convention.

Reviewers: rodgert

Subscribers: jkorous, dexonsmith, jdoerfert, libcxx-commits

Tags: #libc

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

llvm-svn: 358131

3 years ago[pstl] Fix incorrect forward declaration of __pattern_unique_copy
Louis Dionne [Wed, 10 Apr 2019 19:48:18 +0000 (19:48 +0000)]
[pstl] Fix incorrect forward declaration of __pattern_unique_copy

The forward declaration didn't take an execution policy, but the
definition does.

llvm-svn: 358130

3 years ago[pstl] Add missing forward declarations for equal
Louis Dionne [Wed, 10 Apr 2019 19:35:42 +0000 (19:35 +0000)]
[pstl] Add missing forward declarations for equal

We added the 4-iterator variants of std::equal in r357613, but we
forgot to add the corresponding forward declarations.

llvm-svn: 358129

3 years ago[ARM] Add an extra test for constant hoist. NFC
David Green [Wed, 10 Apr 2019 19:18:58 +0000 (19:18 +0000)]
[ARM] Add an extra test for constant hoist. NFC

llvm-svn: 358128

3 years agoclangd-fuzzer: repair the build
Saleem Abdulrasool [Wed, 10 Apr 2019 19:16:14 +0000 (19:16 +0000)]
clangd-fuzzer: repair the build

The inclusion of private headers of clangd percolates into the fuzzer.

llvm-svn: 358127

3 years ago[OPENMP]Improve detection of number of teams, threads in target
Alexey Bataev [Wed, 10 Apr 2019 19:11:33 +0000 (19:11 +0000)]
[OPENMP]Improve detection of number of teams, threads in target

Added more complex analysis for number of teams and number of threads in
the target regions, also merged related common code between CGOpenMPRuntime
and CGOpenMPRuntimeNVPTX classes.

llvm-svn: 358126

3 years agoFix for different build configurations.
John McCall [Wed, 10 Apr 2019 19:11:32 +0000 (19:11 +0000)]
Fix for different build configurations.

llvm-svn: 358125

3 years ago[X86] Add test case for LEA formation regression seen with D60358. NFC
Craig Topper [Wed, 10 Apr 2019 19:09:06 +0000 (19:09 +0000)]
[X86] Add test case for LEA formation regression seen with D60358. NFC

If we have an (add X, (and (aext (shl Y, C1)), C2)), we can pull the shift through and+aext to fold into an LEA with the.
Assuming C1 is small enough and C2 masks off all of the extend bits.

This pattern showed up in D60358. And we need to handle it to prevent a regression.

llvm-svn: 358124

3 years ago[X86] Replace some if statements in isel address matching that should never be true...
Craig Topper [Wed, 10 Apr 2019 19:08:59 +0000 (19:08 +0000)]
[X86] Replace some if statements in isel address matching that should never be true with asserts. And move them earlier before we looked through operands that don't change size. NFC

These ifs were ensuring we don't have to handle types larger than 64 bits probably because we use getZExtValue in several places below them.

None of the callers of this code pass types larger than 64-bits so we can just assert instead of branching in release code.

I've also moved them earlier since we're just looking through operations that don't effect bit width.

This is prep work for some refactoring I plan to do to the (and (shl)) handling code.

llvm-svn: 358123

3 years ago[X86AsmPrinter] refactor to limit use of Modifier. NFC
Nick Desaulniers [Wed, 10 Apr 2019 19:01:44 +0000 (19:01 +0000)]
[X86AsmPrinter] refactor to limit use of Modifier. NFC

The Modifier memory operands is used in 2 cases of memory references
(H & P ExtraCodes). Rather than pass around the likely nullptr Modifier,
refactor the handling of the Modifier out from printOperand().

The refactorings in this patch:
- Don't forward declare printOperand, move its definition up.
  - The diff makes it look like there's a change to printPCRelImm
    (narrator: there's not).
- Create printModifiedOperand()
  - Move logic for Modifier to there from printOperand
  - Use printModifiedOperand in 3 call sites that actually create
- Remove now unused Modifier parameter from printOperand
- Remove default parameter from printLeaMemReference as it only has 1
  call site that explicitly passes a parameter.
- Remove default parameter from printMemReference, make call lone call
  site explicitly pass nullptr.
- Drop Modifier parameter from printIntelMemReference, as Intel style
  memory references don't support the Modifiers in question.

This will allow future changes to printOperand() to make it a pure virtual
method on the base AsmPrinter class, allowing for more generic handling
of some architecture generic constraints. X86AsmPrinter was the only
derived class of AsmPrinter to have additional parameters on its
printOperand function.

Reviewers: craig.topper, echristo

Reviewed By: echristo

Subscribers: hiraditya, llvm-commits, srhines

Tags: #llvm

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

llvm-svn: 358122

3 years agoFix header inclusion order failures
Louis Dionne [Wed, 10 Apr 2019 18:52:24 +0000 (18:52 +0000)]
Fix header inclusion order failures

Summary: See https://bugs.llvm.org/show_bug.cgi?id=41432

Subscribers: libcxx-commits

Tags: #libc

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

llvm-svn: 358121

3 years ago[llvm] Non-functional change: declared a local variable as const.
Ali Tamur [Wed, 10 Apr 2019 18:30:03 +0000 (18:30 +0000)]
[llvm] Non-functional change: declared a local variable as const.

llvm-svn: 358120

3 years ago[PDB Docs] Start documenting CodeView Type Records.
Zachary Turner [Wed, 10 Apr 2019 18:26:51 +0000 (18:26 +0000)]
[PDB Docs] Start documenting CodeView Type Records.

This puts the general layout of the document in place and fully
describes 1 simple type record.  Followups will fill out more

llvm-svn: 358119

3 years ago[X86] X86ScheduleBdVer2: use !listsplat operator to cleanup loadres calculation
Roman Lebedev [Wed, 10 Apr 2019 18:26:42 +0000 (18:26 +0000)]
[X86] X86ScheduleBdVer2: use !listsplat operator to cleanup loadres calculation

The problem is that one can't concatenate an empty list
(implied all-ones) with non-empty list here. The result
will be the non-empty list, and it won't match the length
of the ExePorts list.

The problems begin when LoadRes != 1 here,
which is the case in PdWriteResYMMPair,
and more importantly i think it will be the case for PdWriteResExPair.

llvm-svn: 358118

3 years ago[TableGen] Introduce !listsplat 'binary' operator
Roman Lebedev [Wed, 10 Apr 2019 18:26:36 +0000 (18:26 +0000)]
[TableGen] Introduce !listsplat 'binary' operator

``!listsplat(a, size)``
    A list value that contains the value ``a`` ``size`` times.
    Example: ``!listsplat(0, 2)`` results in ``[0, 0]``.

I plan to use this in X86ScheduleBdVer2.td for LoadRes handling.

This is a little bit controversial because unlike every other binary operator
the types aren't identical.

Reviewers: stoklund, javed.absar, nhaehnle, craig.topper

Reviewed By: javed.absar

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 358117

3 years ago[kate] Add '!mul' operator that was introduced in D58775
Roman Lebedev [Wed, 10 Apr 2019 18:26:23 +0000 (18:26 +0000)]
[kate] Add '!mul' operator that was introduced in D58775

llvm-svn: 358116

3 years agoFix an off-by-one mistake in IRGen's copy-construction
John McCall [Wed, 10 Apr 2019 18:07:18 +0000 (18:07 +0000)]
Fix an off-by-one mistake in IRGen's copy-construction
special cases in the presence of zero-length arrays.

Patch by Joran Bigalet!

llvm-svn: 358115

3 years ago[ARM] Add an extra constant hoisting test. NFC
David Green [Wed, 10 Apr 2019 18:05:57 +0000 (18:05 +0000)]
[ARM] Add an extra constant hoisting test. NFC

This adds a simple extra test for constant hoisting to show it's
usefulness with constant addresses like those seen in memory
mapped registers in embedded systems.

llvm-svn: 358114

3 years agoRevert rL357745: [SelectionDAG] Compute known bits of CopyFromReg
David Green [Wed, 10 Apr 2019 18:00:41 +0000 (18:00 +0000)]
Revert rL357745: [SelectionDAG] Compute known bits of CopyFromReg

Certain optimisations from ConstantHoisting and CGP rely on Selection DAG not
seeing through to the constant in other blocks. Revert this patch while we come
up with a better way to handle that.

I will try to follow this up with some better tests.

llvm-svn: 358113

3 years agollvm-undname: Fix another crash-on-invalid
Nico Weber [Wed, 10 Apr 2019 17:31:34 +0000 (17:31 +0000)]
llvm-undname: Fix another crash-on-invalid

This fixes a regression from https://reviews.llvm.org/D60354. We used to

  SymbolNode *Symbol = demangleEncodedSymbol(MangledName, QN);
  if (Symbol) {
    Symbol->Name = QN;

but changed that to
  SymbolNode *Symbol = demangleEncodedSymbol(MangledName, QN);
  if (Error)
    return nullptr;
  Symbol->Name = QN;

and one branch somewhere returned a nullptr without setting Error.

Looking at the code changed in r340083 and r340710 that branch looks
like a remnant from an earlier attempt to demangle RTTI descriptors
that has since been rewritten -- so just remove this branch. It
shouldn't change behavior for correctly mangled symbols.

llvm-svn: 358112

3 years agoGlobalISel: Move computeValueLLTs
Matt Arsenault [Wed, 10 Apr 2019 17:27:56 +0000 (17:27 +0000)]
GlobalISel: Move computeValueLLTs

Call lowering should use this directly instead of going through the
EVT version, but more work is needed to deal with this (mostly the
passing of the IR type pointer instead of the relevant properties in

llvm-svn: 358111

3 years agoGlobalISel: Fix invoke lowering creating invalid type registers
Matt Arsenault [Wed, 10 Apr 2019 17:27:55 +0000 (17:27 +0000)]
GlobalISel: Fix invoke lowering creating invalid type registers

Unlike the call handling, this wasn't checking for void results and
creating a register with the invalid LLT

llvm-svn: 358110

3 years agoGlobalISel: Support legalizing G_CONSTANT with irregular breakdown
Matt Arsenault [Wed, 10 Apr 2019 17:27:53 +0000 (17:27 +0000)]
GlobalISel: Support legalizing G_CONSTANT with irregular breakdown

llvm-svn: 358109

3 years ago[AArch64] Teach getTestBitOperand to look through ANY_EXTENDS
Craig Topper [Wed, 10 Apr 2019 17:27:29 +0000 (17:27 +0000)]
[AArch64] Teach getTestBitOperand to look through ANY_EXTENDS

This patch teach getTestBitOperand to look through ANY_EXTENDs when the extended bits aren't used. The test case changed here is based what D60358 did to test16 in tbz-tbnz.ll. So this patch will avoid that regression.

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

llvm-svn: 358108

3 years agobuild: add binary dir to the unittests
Saleem Abdulrasool [Wed, 10 Apr 2019 17:25:14 +0000 (17:25 +0000)]
build: add binary dir to the unittests

Missed part of the change to make clangd build on Darwin.  Fixes the build after
SVN r358103.

llvm-svn: 358107

3 years ago[libc++abi] Create a macro for the 32 bit guard setting on ARM platforms
Louis Dionne [Wed, 10 Apr 2019 17:12:06 +0000 (17:12 +0000)]
[libc++abi] Create a macro for the 32 bit guard setting on ARM platforms

The goal is to use a descriptive name for this feature, instead of just
using __arm__.

Reviewers: EricWF

Subscribers: javed.absar, kristof.beyls, christof, jkorous, dexonsmith, libcxx-commits

Tags: #libc

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

llvm-svn: 358106

3 years agoGlobalISel: Handle odd breakdowns for bit ops
Matt Arsenault [Wed, 10 Apr 2019 17:07:56 +0000 (17:07 +0000)]
GlobalISel: Handle odd breakdowns for bit ops

llvm-svn: 358105

3 years agoDon't emit an unreachable return block.
John McCall [Wed, 10 Apr 2019 17:03:09 +0000 (17:03 +0000)]
Don't emit an unreachable return block.

Patch by Brad Moody.

llvm-svn: 358104

3 years agoclangd: fix the build with XPC
Saleem Abdulrasool [Wed, 10 Apr 2019 16:48:52 +0000 (16:48 +0000)]
clangd: fix the build with XPC

`Transport.h` does not include `Features.inc`.  However, since it is used in a
subdirectory, it cannot directly include the header as it is not available.
Include `Features.inc` in `ClangdLSPServer.h` prior to the inclusion of
`Transport.h` which will provide the interfaces in `ClangdMain.cpp` where the
symbol `newXPCTransport` will not be defined due to it being preprocessed away
since the configuration is not passed along to the initial inclusion.

llvm-svn: 358103

3 years agoadd FIXME: as per echristo
Nick Desaulniers [Wed, 10 Apr 2019 16:38:44 +0000 (16:38 +0000)]
add FIXME: as per echristo

llvm-svn: 358102

3 years ago[AsmPrinter] refactor to remove remove AsmVariant. NFC
Nick Desaulniers [Wed, 10 Apr 2019 16:38:43 +0000 (16:38 +0000)]
[AsmPrinter] refactor to remove remove AsmVariant. NFC

The InlineAsm::AsmDialect is only required for X86; no architecture
makes use of it and as such it gets passed around between arch-specific
and general code while being unused for all architectures but X86.

Since the AsmDialect is queried from a MachineInstr, which we also pass
around, remove the additional AsmDialect parameter and query for it deep
in the X86AsmPrinter only when needed/as late as possible.

This refactor should help later planned refactors to AsmPrinter, as this
difference in the X86AsmPrinter makes it harder to make AsmPrinter more

Reviewers: craig.topper

Subscribers: jholewinski, arsenm, dschuff, jyknight, dylanmckay, sdardis, nemanjai, jvesely, nhaehnle, javed.absar, sbc100, jgravelle-google, eraman, hiraditya, aheejin, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, PkmX, jocewei, jsji, llvm-commits, peter.smith, srhines

Tags: #llvm

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

llvm-svn: 358101

3 years ago[InstCombine] Handle ssubo always overflow
Nikita Popov [Wed, 10 Apr 2019 16:32:15 +0000 (16:32 +0000)]
[InstCombine] Handle ssubo always overflow

Following D60483 and D60497, this adds support for AlwaysOverflows
handling for ssubo. This is the last case we can handle right now.

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

llvm-svn: 358100

3 years ago[InstCombine] ssubo X, C -> saddo X, -C
Nikita Popov [Wed, 10 Apr 2019 16:27:36 +0000 (16:27 +0000)]
[InstCombine] ssubo X, C -> saddo X, -C

ssubo X, C is equivalent to saddo X, -C. Make the transformation in
InstCombine and allow the logic implemented for saddo to fold prior
usages of add nsw or sub nsw with constants.

Patch by Dan Robertson.

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

llvm-svn: 358099

3 years ago[clangd] Fix non-indexing of builtin functions like printf when the TU is C
Sam McCall [Wed, 10 Apr 2019 16:26:58 +0000 (16:26 +0000)]
[clangd] Fix non-indexing of builtin functions like printf when the TU is C

llvm-svn: 358098

3 years agoImprove compile-time performance in computeKnownBitsFromAssume.
Sander de Smalen [Wed, 10 Apr 2019 16:24:48 +0000 (16:24 +0000)]
Improve compile-time performance in computeKnownBitsFromAssume.

This patch changes the order of pattern matching by first testing
a compare instruction's predicate, before doing the pattern
match for the whole expression tree.

Patch by Paul Walker.

Reviewed By: spatel

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

llvm-svn: 358097