platform/upstream/llvm.git
5 years agoRemove esan.
Nico Weber [Mon, 11 Mar 2019 20:23:40 +0000 (20:23 +0000)]
Remove esan.

It hasn't seen active development in years, and it hasn't reached a
state where it was useful.

Remove the code until someone is interested in working on it again.

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

llvm-svn: 355862

5 years agoFix some comment typos.
Med Ismail Bennani [Mon, 11 Mar 2019 20:23:34 +0000 (20:23 +0000)]
Fix some comment typos.

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
llvm-svn: 355861

5 years ago[SDAG][AArch64] Legalize VECREDUCE
Nikita Popov [Mon, 11 Mar 2019 20:22:13 +0000 (20:22 +0000)]
[SDAG][AArch64] Legalize VECREDUCE

Fixes https://bugs.llvm.org/show_bug.cgi?id=36796.

Implement basic legalizations (PromoteIntRes, PromoteIntOp,
ExpandIntRes, ScalarizeVecOp, WidenVecOp) for VECREDUCE opcodes.
There are more legalizations missing (esp float legalizations),
but there's no way to test them right now, so I'm not adding them.

This also includes a few more changes to make this work somewhat
reasonably:

 * Add support for expanding VECREDUCE in SDAG. Usually
   experimental.vector.reduce is expanded prior to codegen, but if the
   target does have native vector reduce, it may of course still be
   necessary to expand due to legalization issues. This uses a shuffle
   reduction if possible, followed by a naive scalar reduction.
 * Allow the result type of integer VECREDUCE to be larger than the
   vector element type. For example we need to be able to reduce a v8i8
   into an (nominally) i32 result type on AArch64.
 * Use the vector operand type rather than the scalar result type to
   determine the action, so we can control exactly which vector types are
   supported. Also change the legalize vector op code to handle
   operations that only have vector operands, but no vector results, as
   is the case for VECREDUCE.
 * Default VECREDUCE to Expand. On AArch64 (only target using VECREDUCE),
   explicitly specify for which vector types the reductions are supported.

This does not handle anything related to VECREDUCE_STRICT_*.

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

llvm-svn: 355860

5 years ago[OPENMP]Fix codegen for declare target link in target regions.
Alexey Bataev [Mon, 11 Mar 2019 19:51:42 +0000 (19:51 +0000)]
[OPENMP]Fix codegen for declare target link in target regions.

If the declare target link global is used in the target region
indirectly (used in the inner parallel, teams, etc. regions), we may
miss this variable and it leads to incorrect codegen.

llvm-svn: 355858

5 years agogn build: Merge r355777
Nico Weber [Mon, 11 Mar 2019 19:30:13 +0000 (19:30 +0000)]
gn build: Merge r355777

llvm-svn: 355857

5 years agogn build: Merge r355835
Nico Weber [Mon, 11 Mar 2019 19:14:22 +0000 (19:14 +0000)]
gn build: Merge r355835

llvm-svn: 355856

5 years agogn build: Merge r355834
Nico Weber [Mon, 11 Mar 2019 19:11:15 +0000 (19:11 +0000)]
gn build: Merge r355834

llvm-svn: 355855

5 years ago[RegAlloc] Avoid compile time regression with multiple copy hints.
Jonas Paulsson [Mon, 11 Mar 2019 19:00:37 +0000 (19:00 +0000)]
[RegAlloc]  Avoid compile time regression with multiple copy hints.

As a fix for https://bugs.llvm.org/show_bug.cgi?id=40986 ("excessive compile
time building opencollada"), this patch makes sure that no phys reg is hinted
more than once from getRegAllocationHints().

This handles the case were many virtual registers are assigned to the same
physreg. The previous compile time fix (r343686) in weightCalcHelper() only
made sure that physical/virtual registers are passed no more than once to
addRegAllocationHint().

Review: Dimitry Andric, Quentin Colombet
https://reviews.llvm.org/D59201

llvm-svn: 355854

5 years ago[clang] Add install targets for API headers
Shoaib Meenai [Mon, 11 Mar 2019 18:53:57 +0000 (18:53 +0000)]
[clang] Add install targets for API headers

Add an install target for clang's API headers, which allows them to be
included in distributions. The install rules already existed, but they
lacked a component and a target, making them only accessible via a full
install. These headers are useful for writing clang-based tooling, for
example. They're the clang equivalent to the llvm-headers target and
complement the clang-libraries target.

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

llvm-svn: 355853

5 years ago[coroutines][PR40979] Ignore unreachable uses across suspend points
Brian Gesiak [Mon, 11 Mar 2019 18:31:28 +0000 (18:31 +0000)]
[coroutines][PR40979] Ignore unreachable uses across suspend points

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

https://bugs.llvm.org/show_bug.cgi?id=40979 describes a bug in which the
-coro-split pass would assert that a use was across a suspend point from
a definition. Normally this would mean that a value would "spill" across
a suspend point and thus need to be stored in the coroutine frame. However,
in this case the use was unreachable, and so it would not be necessary
to store the definition on the frame.

To prevent the assert, simply remove unreachable basic blocks from a
coroutine function before computing spills. This avoids the assert
reported in PR40979.

Reviewers: GorNishanov, tks2103

Reviewed By: GorNishanov

Subscribers: EricWF, jdoerfert, llvm-commits, lewissbaker

Tags: #llvm

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

llvm-svn: 355852

5 years agoDetect malformed LC_LINKER_COMMANDs in Mach-O binaries
Michael Trent [Mon, 11 Mar 2019 18:29:25 +0000 (18:29 +0000)]
Detect malformed LC_LINKER_COMMANDs in Mach-O binaries

Summary:
llvm-objdump can be tricked into reading beyond valid memory and
segfaulting if LC_LINKER_COMMAND strings are not null terminated. libObject
does have code to validate the integrity of the LC_LINKER_COMMAND struct,
but this validator improperly assumes linker command strings are null
terminated.

The solution is to report an error if a string extends beyond the end of
the LC_LINKER_COMMAND struct.

Reviewers: lhames, pete

Reviewed By: pete

Subscribers: rupprecht, llvm-commits

Tags: #llvm

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

llvm-svn: 355851

5 years agoFix a crasher in StackFrame::GetValueForVariableExpressionPath()
Greg Clayton [Mon, 11 Mar 2019 18:16:20 +0000 (18:16 +0000)]
Fix a crasher in StackFrame::GetValueForVariableExpressionPath()

There was a crash that would happen if an IDE would ask for a child of a shared pointer via any SB API call that ends up calling StackFrame::GetValueForVariableExpressionPath(). The previous code expects an error to be set describing why the synthetic child of a type was not able to be found, but we have some synthetic child providers that weren't setting the error and returning an empty value object shared pointer. This fixes that to ensure we don't lose our debug session by crashing, fully tests GetValueForVariableExpressionPath functionality, and ensures we don't crash on GetValueForVariableExpressionPath() in the future.

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

llvm-svn: 355850

5 years ago[X86] Extend widening comparison test.
Simon Pilgrim [Mon, 11 Mar 2019 18:08:20 +0000 (18:08 +0000)]
[X86] Extend widening comparison test.

Ensure we test both v2i16 unary and binary comparisons.

llvm-svn: 355849

5 years ago[NFC][PowerPC] Add comment for PPCAsmPrinter::printOperand
Jinsong Ji [Mon, 11 Mar 2019 17:57:49 +0000 (17:57 +0000)]
[NFC][PowerPC] Add comment for PPCAsmPrinter::printOperand

Patch by Yi-Hong Lyu

llvm-svn: 355848

5 years ago[DAG] FoldSetCC - reuse valuetype + ensure its simple.
Simon Pilgrim [Mon, 11 Mar 2019 17:56:18 +0000 (17:56 +0000)]
[DAG] FoldSetCC - reuse valuetype + ensure its simple.

llvm-svn: 355847

5 years ago[Utils] Extract EliminateUnreachableBlocks (NFC)
Brian Gesiak [Mon, 11 Mar 2019 17:51:57 +0000 (17:51 +0000)]
[Utils] Extract EliminateUnreachableBlocks (NFC)

Summary:
Extract the functionality of eliminating unreachable basic blocks
within a function, previously encapsulated within the
-unreachableblockelim pass, and make it available as a function within
BlockUtils.h. No functional change intended other than making the logic
reusable.

Exposing this logic makes it easier to implement
https://reviews.llvm.org/D59068, which fixes coroutines bug
https://bugs.llvm.org/show_bug.cgi?id=40979.

Reviewers: mkazantsev, wmi, davidxl, silvas, davide

Reviewed By: davide

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 355846

5 years ago[DAG] Move SetCC NaN handling into FoldSetCC
Simon Pilgrim [Mon, 11 Mar 2019 17:43:10 +0000 (17:43 +0000)]
[DAG] Move SetCC NaN handling into FoldSetCC

llvm-svn: 355845

5 years ago[HWASan] Remove address significance from tag_mismatch.
Mitch Phillips [Mon, 11 Mar 2019 17:34:17 +0000 (17:34 +0000)]
[HWASan] Remove address significance from tag_mismatch.

Actually fix the issue referenced in rL355840.

llvm-svn: 355844

5 years agoMakefile.rules: Upstream SDKROOT handling code for Darwin.
Adrian Prantl [Mon, 11 Mar 2019 17:24:10 +0000 (17:24 +0000)]
Makefile.rules: Upstream SDKROOT handling code for Darwin.

llvm-svn: 355843

5 years ago[Reproducers] Replace callbacks with void*
Jonas Devlieghere [Mon, 11 Mar 2019 17:17:51 +0000 (17:17 +0000)]
[Reproducers] Replace callbacks with void*

Callbacks in the LLDB_RECORD_DUMMY macros were causing build failures
with the Xcode project. This patch replaces the function pointers with
void pointers so they can be logged.

llvm-svn: 355842

5 years agoBring Doxygen comment syntax in sync with LLVM coding style.
Adrian Prantl [Mon, 11 Mar 2019 17:09:29 +0000 (17:09 +0000)]
Bring Doxygen comment syntax in sync with LLVM coding style.
This changes '@' prefix to '\'.

llvm-svn: 355841

5 years ago[HWASan] Fixed minor AArch64/GCC build error.
Mitch Phillips [Mon, 11 Mar 2019 17:06:39 +0000 (17:06 +0000)]
[HWASan] Fixed minor AArch64/GCC build error.

Fixed buildbot clang-cmake-aarch64-lld by ensuring clang-only features
are guarded by clang-only #defines.

llvm-svn: 355840

5 years agoUse bitset for assembler predicates
Stanislav Mekhanoshin [Mon, 11 Mar 2019 17:04:35 +0000 (17:04 +0000)]
Use bitset for assembler predicates

AMDGPU target run out of Subtarget feature flags hitting the limit of 64.
AssemblerPredicates uses at most uint64_t for their representation.
At the same time CodeGen has exhausted this a long time ago and switched
to a FeatureBitset with the current limit of 192 bits.

This patch completes transition to the bitset for feature bits extending
it to asm matcher and MC code emitter.

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

llvm-svn: 355839

5 years ago[lldb] [test] Mark more tests flakey on NetBSD
Michal Gorny [Mon, 11 Mar 2019 17:01:31 +0000 (17:01 +0000)]
[lldb] [test] Mark more tests flakey on NetBSD

llvm-svn: 355838

5 years ago[TableGen] Replace a dyn_cast with isa to avoid an unused variable warning introduced...
Craig Topper [Mon, 11 Mar 2019 16:51:37 +0000 (16:51 +0000)]
[TableGen] Replace a dyn_cast with isa to avoid an unused variable warning introduced in r355785. NFC

llvm-svn: 355837

5 years ago[AMDGPU] Mark enum types in SIDefines.h as unsigned
Stanislav Mekhanoshin [Mon, 11 Mar 2019 16:49:32 +0000 (16:49 +0000)]
[AMDGPU] Mark enum types in SIDefines.h as unsigned

MSVC issues some warnings about signed/unsigned comparison.

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

llvm-svn: 355836

5 years ago[clang-tidy] Add the abseil-time-compare check
Hyrum Wright [Mon, 11 Mar 2019 16:47:45 +0000 (16:47 +0000)]
[clang-tidy] Add the abseil-time-compare check

This is an analog of the abseil-duration-comparison check, but for the
absl::Time domain. It has a similar implementation and tests.

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

llvm-svn: 355835

5 years agoFail early if an output file is not writable
Rui Ueyama [Mon, 11 Mar 2019 16:30:55 +0000 (16:30 +0000)]
Fail early if an output file is not writable

Fixes https://bugs.llvm.org/show_bug.cgi?id=36478

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

llvm-svn: 355834

5 years ago[SimplifyCFG] Retain debug info when threading jumps with critical edges
Jeremy Morse [Mon, 11 Mar 2019 16:23:59 +0000 (16:23 +0000)]
[SimplifyCFG] Retain debug info when threading jumps with critical edges

Fixes bug 38023: https://bugs.llvm.org/show_bug.cgi?id=38023

The SimplifyCFG pass will perform jump threading in some cases where
doing so is trivial and would simplify the CFG. When folding a series
of blocks with redundant conditional branches into an unconditional "critical
edge" block, it does not keep the debug location associated with the previous
conditional branch.

This patch fixes the bug described by copying the debug info from the
old conditional branch to the new unconditional branch instruction, and
adds a regression test for the SimplifyCFG pass that covers this case.

Patch by Stephen Tozer!

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

llvm-svn: 355833

5 years ago[yaml2obj] - Simplify. NFC.
George Rimar [Mon, 11 Mar 2019 16:10:02 +0000 (16:10 +0000)]
[yaml2obj] - Simplify. NFC.

llvm-svn: 355832

5 years agoclang-format: distinguish ObjC call subexpressions after r355434
Krasimir Georgiev [Mon, 11 Mar 2019 16:02:52 +0000 (16:02 +0000)]
clang-format: distinguish ObjC call subexpressions after r355434

Summary:
The revision r355434 had the unfortunate side-effect that it started to
recognize certain ObjC expressions with a call subexpression followed by a
`a->b` subexpression as C++ lambda expressions.

This patch adds a bit of logic to handle these cases and documents them in
tests.

The commented-out test cases in the new test suite are ones that were
problematic before r355434.

Reviewers: MyDeveloperDay, gribozavr

Reviewed By: MyDeveloperDay, gribozavr

Subscribers: MyDeveloperDay, cfe-commits

Tags: #clang

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

llvm-svn: 355831

5 years ago[lldb] [test] Mark a few tests flakey on NetBSD
Michal Gorny [Mon, 11 Mar 2019 15:46:07 +0000 (15:46 +0000)]
[lldb] [test] Mark a few tests flakey on NetBSD

llvm-svn: 355830

5 years ago[libc++] Remove empty header xlocale/xlocale.h
Louis Dionne [Mon, 11 Mar 2019 15:41:51 +0000 (15:41 +0000)]
[libc++] Remove empty header xlocale/xlocale.h

Summary:
I can't think of a reason for shipping this empty header. If there is
a reason to do so, then hopefully this review can uncover it.

Reviewers: mclow.lists, EricWF

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

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

llvm-svn: 355829

5 years ago[DAG] TargetLowering::SimplifySetCC - call FoldSetCC early to handle constant/commute...
Simon Pilgrim [Mon, 11 Mar 2019 15:01:31 +0000 (15:01 +0000)]
[DAG] TargetLowering::SimplifySetCC - call FoldSetCC early to handle constant/commute folds.

Noticed while looking at PR40800 (and also D57921)

llvm-svn: 355828

5 years agoAttempt to fix MSVC build error after r355824
Pavel Labath [Mon, 11 Mar 2019 15:00:11 +0000 (15:00 +0000)]
Attempt to fix MSVC build error after r355824

Adding parens should be enough to fix the "'operator bool': is
ambiguous or is not a member of 'lldb::SBFoo'" errors.

llvm-svn: 355827

5 years ago[MIPS][microMIPS] Add a pattern to match TruncIntFP
Petar Jovanovic [Mon, 11 Mar 2019 14:13:31 +0000 (14:13 +0000)]
[MIPS][microMIPS] Add a pattern to match TruncIntFP

A pattern needed to match TruncIntFP was missing. This was causing multiple
tests from llvm test suite to fail during compilation for micromips.

Patch by Mirko Brkusanin.

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

llvm-svn: 355825

5 years agoAdd "operator bool" to SB APIs
Pavel Labath [Mon, 11 Mar 2019 13:58:46 +0000 (13:58 +0000)]
Add "operator bool" to SB APIs

Summary:
Our python version of the SB API has (the python equivalent of)
operator bool, but the C++ version doesn't.

This is because our python operators are added by modify-python-lldb.py,
which performs postprocessing on the swig-generated interface files.

In this patch, I add the "operator bool" to all SB classes which have an
IsValid method (which is the same logic used by modify-python-lldb.py).
This way, we make the two interfaces more constent, and it allows us to
rely on swig's automatic syntesis of python __nonzero__ methods instead
of doing manual fixups.

Reviewers: zturner, jingham, clayborg, jfb, serge-sans-paille

Subscribers: jdoerfert, lldb-commits

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

llvm-svn: 355824

5 years ago[CGP] Limit distance between overflow math and cmp
Sam Parker [Mon, 11 Mar 2019 13:19:46 +0000 (13:19 +0000)]
[CGP] Limit distance between overflow math and cmp

Inserting an overflowing arithmetic intrinsic can increase register
pressure by producing two values at a point where only one is needed,
while the second use maybe several blocks away. This increase in
pressure is likely to be more detrimental on performance than
rematerialising one of the original instructions.

So, check that the arithmetic and compare instructions are no further
apart than their immediate successor/predecessor.

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

llvm-svn: 355823

5 years ago[JumpThreading] Retain debug info when replacing branch instructions
Jeremy Morse [Mon, 11 Mar 2019 11:48:57 +0000 (11:48 +0000)]
[JumpThreading] Retain debug info when replacing branch instructions

Fixes bug 37966: https://bugs.llvm.org/show_bug.cgi?id=37966

The Jump Threading pass will replace certain conditional branch
instructions with unconditional branches when it can prove that only one
branch can occur. Prior to this patch, it would not carry the debug
info from the old instruction to the new one.

This patch fixes the bug described by copying the debug info from the
conditional branch instruction to the new unconditional branch
instruction, and adds a regression test for the Jump Threading pass that
covers this case.

Patch by Stephen Tozer!

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

llvm-svn: 355822

5 years ago[llvm-objcopy] - Fix --compress-debug-sections when there are relocations.
George Rimar [Mon, 11 Mar 2019 11:01:24 +0000 (11:01 +0000)]
[llvm-objcopy] - Fix --compress-debug-sections when there are relocations.

When --compress-debug-sections is given,
llvm-objcopy removes the uncompressed sections and adds compressed to the section list.
This makes all the pointers to old sections to be outdated.

Currently, code already has logic for replacing the target sections of the relocation
sections. But we also have to update the relocations by themselves.

This fixes https://bugs.llvm.org/show_bug.cgi?id=40885.

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

llvm-svn: 355821

5 years ago[clangd] Respect Origin option in createStaticIndexingAction
Kadir Cetinkaya [Mon, 11 Mar 2019 11:01:14 +0000 (11:01 +0000)]
[clangd] Respect Origin option in createStaticIndexingAction

Summary:
Currently createStaticIndexingAction always set Origin to Static, which
makes it hard to change it later on by different indexers(One needs to go over
each symbol making a new copy).

This patch changes that behavior to rather respect it if set by user.

Reviewers: ioeric

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

Tags: #clang

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

llvm-svn: 355820

5 years agoRemove an unnecessary -f when cp'ing to a file that was just deleted. NFC.
Benjamin Kramer [Mon, 11 Mar 2019 10:44:10 +0000 (10:44 +0000)]
Remove an unnecessary -f when cp'ing to a file that was just deleted. NFC.

llvm-svn: 355819

5 years ago[MIPS GlobalISel] Silence uninitialized variable warning
Benjamin Kramer [Mon, 11 Mar 2019 10:39:15 +0000 (10:39 +0000)]
[MIPS GlobalISel] Silence uninitialized variable warning

The control flow here cannot ever use the uninitialized value, but it's
too hard for the compiler to figure that out. Clang warns:

llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2600:28: error: variable 'CarrySum' is used uninitialized whenever 'for' loop exits because its condition is false [-Werror,-Wsometimes-uninitialized]
      for (unsigned i = 2; i < Factors.size(); ++i)
                           ^~~~~~~~~~~~~~~~~~
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2604:26: note: uninitialized use occurs here
    CarrySumPrevDstIdx = CarrySum;
                         ^~~~~~~~
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2600:28: note: remove the condition if it is always true
      for (unsigned i = 2; i < Factors.size(); ++i)
                           ^~~~~~~~~~~~~~~~~~
llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp:2583:22: note: initialize the variable 'CarrySum' to silence this warning
    unsigned CarrySum;
                     ^
                      = 0

llvm-svn: 355818

5 years agoFix invalid use of StringRef::data in Socket::DecodeHostAndPort
Pavel Labath [Mon, 11 Mar 2019 10:34:57 +0000 (10:34 +0000)]
Fix invalid use of StringRef::data in Socket::DecodeHostAndPort

the input StringRef is not guaranteed to be null-terminated, so using
data to get the c string is wrong. Luckily, in two of the usages the
target function already accepts a StringRef so we can just drop the
data() call, and the third one is easily replaced by a stringref-aware
function.

Issue found by msan.

llvm-svn: 355817

5 years ago[Serialization] Add missing include
Benjamin Kramer [Mon, 11 Mar 2019 10:30:51 +0000 (10:30 +0000)]
[Serialization] Add missing include

forward decl is not sufficient for destroying a unique_ptr<MemoryBuffer>.

llvm-svn: 355816

5 years ago[MIPS GlobalISel] NarrowScalar G_UMULH
Petar Avramovic [Mon, 11 Mar 2019 10:08:44 +0000 (10:08 +0000)]
[MIPS GlobalISel] NarrowScalar G_UMULH

NarrowScalar G_UMULH in LegalizerHelper
using multiplyRegisters helper function.
NarrowScalar G_UMULH for MIPS32.

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

llvm-svn: 355815

5 years ago[MIPS GlobalISel] NarrowScalar G_MUL
Petar Avramovic [Mon, 11 Mar 2019 10:00:17 +0000 (10:00 +0000)]
[MIPS GlobalISel] NarrowScalar G_MUL

Narrow Scalar G_MUL for MIPS32.
Revisit NarrowScalar implementation in LegalizerHelper.
Introduce new helper function multiplyRegisters.
It performs generic multiplication of values held in multiple registers.
Generated instructions use only types NarrowTy and i1.
Destination can be same or two times size of the source.

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

llvm-svn: 355814

5 years agoAttempt to fix build errors caused by r355812
Pavel Labath [Mon, 11 Mar 2019 09:23:30 +0000 (09:23 +0000)]
Attempt to fix build errors caused by r355812

llvm-svn: 355813

5 years ago[Support/Endian] Add support for endian-specific enums
Pavel Labath [Mon, 11 Mar 2019 09:06:18 +0000 (09:06 +0000)]
[Support/Endian] Add support for endian-specific enums

Summary:
Binary formats often include various enumerations or bitsets, but using
endian-specific types for accessing them is tricky because they
currently only support integral types. This is particularly true for
scoped enums (enum class), as these are not implicitly convertible to
integral types, and so one has to perform two casts just to read the
enum value.

This fixes that support by adding first-class support for enumeration
types to endian-specific types. The support for them was already almost
working -- all I needed to do was overload getSwappedBytes for
enumeration types (which casts the enum to its underlying type and performs the
conversion there). I also add some convenience template aliases to simplify
declaring endian-specific enums.

Reviewers: Bigcheese, zturner

Subscribers: kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 355812

5 years ago[clangd] Add TOC section to clangd doc.
Haojian Wu [Mon, 11 Mar 2019 08:45:56 +0000 (08:45 +0000)]
[clangd] Add TOC section to clangd doc.

Reviewers: gribozavr

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

Tags: #clang

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

llvm-svn: 355811

5 years ago[X86] Enable sse2_cvtsd2ss intrinsic to use an EVEX encoded instruction.
Craig Topper [Mon, 11 Mar 2019 06:01:04 +0000 (06:01 +0000)]
[X86] Enable sse2_cvtsd2ss intrinsic to use an EVEX encoded instruction.

llvm-svn: 355810

5 years ago[X86] Remove apparently unneeded patterns for storing a bitcasted extractelement.
Craig Topper [Mon, 11 Mar 2019 06:01:02 +0000 (06:01 +0000)]
[X86] Remove apparently unneeded patterns for storing a bitcasted extractelement.

I suspect if this pattern was seen, DAG combine would just change the type of the store to eliminate the bitcast.

llvm-svn: 355809

5 years ago[X86] Use 'UseAVX' in place of 'HasAVX, NoAVX512'. NFC
Craig Topper [Mon, 11 Mar 2019 06:01:00 +0000 (06:01 +0000)]
[X86] Use 'UseAVX' in place of 'HasAVX, NoAVX512'. NFC

They mean the same thing, but 'HasAVX, NoAVX512' only appears in this one place. Every other place uses UseAVX.

llvm-svn: 355808

5 years ago[X86] Add SCALAR_SINT_TO_FP/SCALAR_UINT_TO_FP ISD opcodes without rounding mode.
Craig Topper [Mon, 11 Mar 2019 04:37:01 +0000 (04:37 +0000)]
[X86] Add SCALAR_SINT_TO_FP/SCALAR_UINT_TO_FP ISD opcodes without rounding mode.

After this we no longer need to match FROUND_CURRENT or FROUND_NO_EXC during isel so I remove those.

llvm-svn: 355807

5 years ago[X86] Split SCALEF(S) ISD opcodes into a version without rounding mode.
Craig Topper [Mon, 11 Mar 2019 04:36:59 +0000 (04:36 +0000)]
[X86] Split SCALEF(S) ISD opcodes into a version without rounding mode.

llvm-svn: 355806

5 years ago[X86] Split RCP28/RSQRT/GETEXP/EXP2 ISD opcodes into SAE and current direction nodes...
Craig Topper [Mon, 11 Mar 2019 04:36:57 +0000 (04:36 +0000)]
[X86] Split RCP28/RSQRT/GETEXP/EXP2 ISD opcodes into SAE and current direction nodes. Remove rounding mode operand.

llvm-svn: 355805

5 years ago[X86] Rename _RND versions of RANGE/REDUCE/GETMANT/RDNSCALE ISD opcodes to _SAE....
Craig Topper [Mon, 11 Mar 2019 04:36:55 +0000 (04:36 +0000)]
[X86] Rename _RND versions of RANGE/REDUCE/GETMANT/RDNSCALE ISD opcodes to _SAE. Remove SAE operand.

No need to explicitly store it and match it during isel.

llvm-svn: 355804

5 years ago[X86] Rename X86ISD::CVTPH2PS_RND to CVTPH2PS_SAE. Remove SAE operand.
Craig Topper [Mon, 11 Mar 2019 04:36:53 +0000 (04:36 +0000)]
[X86] Rename X86ISD::CVTPH2PS_RND to CVTPH2PS_SAE. Remove SAE operand.

llvm-svn: 355803

5 years ago[X86] Rename the CVTT*_RND ISD nodes to _SAE and remove the SAE operand. Split VFPROU...
Craig Topper [Mon, 11 Mar 2019 04:36:51 +0000 (04:36 +0000)]
[X86] Rename the CVTT*_RND ISD nodes to _SAE and remove the SAE operand. Split VFPROUNDS_RND/VFPEXT(S)_RND into versions without rounding operand.

For VFPEXT(S) we only need current rounding mode and an SAE version. Neither need extra operand.

llvm-svn: 355802

5 years ago[X86] Rename X86ISD::CMPM_RND and X86ISD::FSETCCM_RND to _SAE instead of _RND. Remove...
Craig Topper [Mon, 11 Mar 2019 04:36:49 +0000 (04:36 +0000)]
[X86] Rename X86ISD::CMPM_RND and X86ISD::FSETCCM_RND to _SAE instead of _RND. Remove rounding operand.

The operand could only be the SAE encoding so no need to include it.

llvm-svn: 355801

5 years ago[X86] Split the VFIXUPIMM/VFIXUPIMMS nodes into a current rounding mode and SAE ISD...
Craig Topper [Mon, 11 Mar 2019 04:36:47 +0000 (04:36 +0000)]
[X86] Split the VFIXUPIMM/VFIXUPIMMS nodes into a current rounding mode and SAE ISD opcode.

Remove matching of FROUND_CURRENT and FROUND_NO_EXC for these nodes from isel table.

llvm-svn: 355800

5 years ago[X86] Begin removing matching of FROUND_CURRENT and FROUND_NO_EXC from isel tables.
Craig Topper [Mon, 11 Mar 2019 04:36:44 +0000 (04:36 +0000)]
[X86] Begin removing matching of FROUND_CURRENT and FROUND_NO_EXC from isel tables.

Instead I plan to have dedicated nodes for FROUND_CURRENT and FROUND_NO_EXC.

This patch starts with FADDS/FSUBS/FMULS/FDIVS/FMAXS/FMINS/FSQRTS.

llvm-svn: 355799

5 years ago[PowerPC] Remove the override of isMachineVerifierClean() to open machine verifier
Zi Xuan Wu [Mon, 11 Mar 2019 03:31:09 +0000 (03:31 +0000)]
[PowerPC] Remove the override of isMachineVerifierClean() to open machine verifier
After fix all asserts found by machine verifier in PowerPC target with following patches,
we can activate machine verifier as default.

rL293769, rL348566, rL349030, rL349029, rL350113, rL350111,
rL350799, rL350165, rL355378, rL352174, rL354762, rL350115

It's also found in PR#27456, https://bugs.llvm.org/show_bug.cgi?id=27456

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

llvm-svn: 355798

5 years agoAdd test case for add to sub post legalization. NFC
Amaury Sechet [Mon, 11 Mar 2019 01:25:48 +0000 (01:25 +0000)]
Add test case for add to sub post legalization. NFC

llvm-svn: 355797

5 years ago[X86] Remove unneeded isel patterns from VCVTSI2SDZ and VCVTUSI2SDZ. NFC
Craig Topper [Mon, 11 Mar 2019 01:20:38 +0000 (01:20 +0000)]
[X86] Remove unneeded isel patterns from VCVTSI2SDZ and VCVTUSI2SDZ. NFC

We had patterns using X86ISD::SCALAR_SINT_TO_FP_RND/SCALAR_UINT_TO_FP_RND for
these instructions. There's nothing to round. Instead, we use a regular
sint_to_fp/uint_to_fp and a movsd as the pattern for these.

llvm-svn: 355796

5 years ago[X86] Remove VCVTSI2SDZrrb_Int as it shouldn't exist.
Craig Topper [Mon, 11 Mar 2019 01:20:37 +0000 (01:20 +0000)]
[X86] Remove VCVTSI2SDZrrb_Int as it shouldn't exist.

This would convert a signed 32-bit integer to double precision with rounding. But there's nothing to round.

llvm-svn: 355795

5 years agoRemove redundant extractBooleanFlip argument. NFC
Amaury Sechet [Mon, 11 Mar 2019 00:37:01 +0000 (00:37 +0000)]
Remove redundant extractBooleanFlip argument. NFC

llvm-svn: 355794

5 years agoQuiet command regex instructions during batch execution
Dave Lee [Sun, 10 Mar 2019 23:15:48 +0000 (23:15 +0000)]
Quiet command regex instructions during batch execution

Summary:
Within .lldbinit, regex commands can be structured as a list of substitutions over
multiple lines. It's possible that this is uninentional, but it works and has
benefits.

For example:

    command regex <command-name>
    s/pat1/repl1/
    s/pat2/repl2/
    ...

I use this form of `command regex` in my `~/.lldbinit`, because it makes it
clearer to write and read compared to a single line definition, because
multiline substitutions don't need to be quoted, and are broken up one per line.

However, multiline definitions result in usage instructions being printed for
each use. The result is that every time I run `lldb`, I get a dozen or more
lines of noise. With this change, the instructions are only printed when
`command regex` is invoked interactively, or from a terminal, neither of which
are true when lldb is sourcing `~/.lldbinit`.

Reviewers: clayborg, jingham

Reviewed By: clayborg

Subscribers: jdoerfert, kastiglione, xiaobai, keith, lldb-commits

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

llvm-svn: 355793

5 years ago[x86] add x86-specific opcodes to extractelement scalarization list
Sanjay Patel [Sun, 10 Mar 2019 18:56:21 +0000 (18:56 +0000)]
[x86] add x86-specific opcodes to extractelement scalarization list

llvm-svn: 355792

5 years ago[CGP] fix comments; NFC
Sanjay Patel [Sun, 10 Mar 2019 18:42:30 +0000 (18:42 +0000)]
[CGP] fix comments; NFC

llvm-svn: 355791

5 years ago[X86] Remove unused variable. NFC
Craig Topper [Sun, 10 Mar 2019 17:36:41 +0000 (17:36 +0000)]
[X86] Remove unused variable. NFC

llvm-svn: 355790

5 years ago[X86] Make lowering of intrinsics with rounding mode stricter so that only valid...
Craig Topper [Sun, 10 Mar 2019 17:20:45 +0000 (17:20 +0000)]
[X86] Make lowering of intrinsics with rounding mode stricter so that only valid rounding modes are lowered. Update tests accordingly

Many of our tests were not using valid rounding mode immediates. Clang verifies this in the frontend when it creates the intrinsics from builtins, but the backend would still lower invalid immediates.

With this change we will now leave them as intrinsics if the immediate is invalid. This will cause an isel selection failure.

llvm-svn: 355789

5 years ago[X86] Remove dead code from the handler for INTR_TYPE_SCALAR_MASK_RM.
Craig Topper [Sun, 10 Mar 2019 17:20:42 +0000 (17:20 +0000)]
[X86] Remove dead code from the handler for INTR_TYPE_SCALAR_MASK_RM.

The code in here handles nodes with 6 or 7 operands. But only the 6 operand case is ever used these days.

llvm-svn: 355788

5 years ago[AArch64] Add tests for saddsat/ssubsat; NFC
Nikita Popov [Sun, 10 Mar 2019 12:21:36 +0000 (12:21 +0000)]
[AArch64] Add tests for saddsat/ssubsat; NFC

Signed versions of the existing unsigned tests.

llvm-svn: 355787

5 years ago[lldb] [test] Make 2lwp_process_SIGSEGV test more portable
Michal Gorny [Sun, 10 Mar 2019 09:50:36 +0000 (09:50 +0000)]
[lldb] [test] Make 2lwp_process_SIGSEGV test more portable

Fix 2lwp_process_SIGSEGV NetBSD core test to terminate inside regular
function rather than libc call, in order to get reproducible backtrace
on different platforms.

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

llvm-svn: 355786

5 years ago[TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher contradictory...
Craig Topper [Sun, 10 Mar 2019 06:44:09 +0000 (06:44 +0000)]
[TableGen] Make CheckImmAllOnesVMatcher and CheckImmAllZerosVMatcher contradictory matchers.

This improves X86 factoring a little bit.

llvm-svn: 355785

5 years agoRecommit r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAll...
Craig Topper [Sun, 10 Mar 2019 05:21:52 +0000 (05:21 +0000)]
Recommit r355224 "[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary."

Includes a fix to emit a CheckOpcode for build_vector when immAllZerosV/immAllOnesV is used as a pattern root. This means it can't be used to look through bitcasts when used as a root, but that's probably ok. This extra CheckOpcode will ensure that the first match in the isel table will be a SwitchOpcode which is needed by the caching optimization in the ISel Matcher.

Original commit message:

Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts.

By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up.

This removes something like 40,000 bytes from the X86 isel table.

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

llvm-svn: 355784

5 years ago[runtime] Use --strip-all rather than --strip-sections
Petr Hosek [Sun, 10 Mar 2019 04:26:54 +0000 (04:26 +0000)]
[runtime] Use --strip-all rather than --strip-sections

We need to preserve section headers for shared libraries.

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

llvm-svn: 355783

5 years ago[git-llvm] Only use --force-interactive when supported
Shoaib Meenai [Sun, 10 Mar 2019 01:34:42 +0000 (01:34 +0000)]
[git-llvm] Only use --force-interactive when supported

The --force-interactive option was introduced in SVN 1.8, and trying to
pass it to older SVN clients causes an error; CentOS 7 includes SVN 1.7,
for example, so this makes `git llvm` not usable out of the box. Older
clients would be interactive by default anyway [1], so just don't pass
the option if it's not supported.

An alternative would be to check the version instead of checking the
help text, but I think directly detecting the presence of the option is
more direct.

[1] http://svn.apache.org/viewvc?view=revision&revision=1424037

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

llvm-svn: 355782

5 years ago[ValueTracking] Move constant range computation into ValueTracking; NFC
Nikita Popov [Sat, 9 Mar 2019 21:17:42 +0000 (21:17 +0000)]
[ValueTracking] Move constant range computation into ValueTracking; NFC

InstructionSimplify currently has some code to determine the constant
range of integer instructions for some simple cases. It is used to
simplify icmps.

This change moves the relevant code into ValueTracking as
llvm::computeConstantRange(), so it can also be reused for other
purposes.

In particular this is with the optimization of overflow checks in
mind (ref D59071), where constant ranges cover some cases that
known bits don't.

llvm-svn: 355781

5 years agoStop relying on allocator behaviour in modules unit test
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 20:15:01 +0000 (20:15 +0000)]
Stop relying on allocator behaviour in modules unit test

Another fixup for r355778 for Windows bots, this time to stop
accidentally relying on allocator behaviour for the test to pass.

llvm-svn: 355780

5 years agoFix slashes in path references in -Rmodule-import test from r355778
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 19:33:32 +0000 (19:33 +0000)]
Fix slashes in path references in -Rmodule-import test from r355778

Fixup for r355778 to fix all the Windows bots.  Apparently I already
forgot the lesson from r355482 :/.

llvm-svn: 355779

5 years agoModules: Invalidate out-of-date PCMs as they're discovered
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:44:01 +0000 (17:44 +0000)]
Modules: Invalidate out-of-date PCMs as they're discovered

Leverage the InMemoryModuleCache to invalidate a module the first time
it fails to import (and to lock a module as soon as it's built or
imported successfully).  For implicit module builds, this optimizes
importing deep graphs where the leaf module is out-of-date; see example
near the end of the commit message.

Previously the cache finalized ("locked in") all modules imported so far
when starting a new module build.  This was sufficient to prevent
loading two versions of the same module, but was somewhat arbitrary and
hard to reason about.

Now the cache explicitly tracks module state, where each module must be
one of:

- Unknown: module not in the cache (yet).
- Tentative: module in the cache, but not yet fully imported.
- ToBuild: module found on disk could not be imported; need to build.
- Final: module in the cache has been successfully built or imported.

Preventing repeated failed imports avoids variation in builds based on
shifting filesystem state.  Now it's guaranteed that a module is loaded
from disk exactly once.  It now seems safe to remove
FileManager::invalidateCache, but I'm leaving that for a later commit.

The new, precise logic uncovered a pre-existing problem in the cache:
the map key is the module filename, and different contexts use different
filenames for the same PCM file.  (In particular, the test
Modules/relative-import-path.c does not build without this commit.
r223577 started using a relative path to describe a module's base
directory when importing it within another module.  As a result, the
module cache sees an absolute path when (a) building the module or
importing it at the top-level, and a relative path when (b) importing
the module underneath another one.)

The "obvious" fix is to resolve paths using FileManager::getVirtualFile
and change the map key for the cache to a FileEntry, but some contexts
(particularly related to ASTUnit) have a shorter lifetime for their
FileManager than the InMemoryModuleCache.  This is worth pursuing
further in a later commit; perhaps by tying together the FileManager and
InMemoryModuleCache lifetime, or moving the in-memory PCM storage into a
VFS layer.

For now, use the PCM's base directory as-written for constructing the
filename to check the ModuleCache.

Example
=======

To understand the build optimization, first consider the build of a
module graph TU -> A -> B -> C -> D with an empty cache:

    TU builds A'
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

If we build TU again, where A, B, C, and D are in the cache and D is
out-of-date, we would previously get this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A'
       A' imports B
          imports C
          imports D (out-of-date)
          builds B'
          B' imports C
             imports D (out-of-date)
             builds C'
             C' imports D (out-of-date)
                builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
     TU imports A'
        imports B'
        imports C'
        imports D'

After this commit, we'll immediateley invalidate A, B, C, and D when we
first observe that D is out-of-date, giving this build:

    TU imports A
       imports B
       imports C
       imports D (out-of-date)
    TU builds A' // The same graph as an empty cache.
       A' builds B'
          B' builds C'
             C' builds D'
                imports D'
          B' imports C'
             imports D'
       A' imports B'
          imports C'
          imports D'
    TU imports A'
       imports B'
       imports C'
       imports D'

The new build matches what we'd naively expect, pretty closely matching
the original build with the empty cache.

rdar://problem/48545366

llvm-svn: 355778

5 years agoModules: Rename MemoryBufferCache to InMemoryModuleCache
Duncan P. N. Exon Smith [Sat, 9 Mar 2019 17:33:56 +0000 (17:33 +0000)]
Modules: Rename MemoryBufferCache to InMemoryModuleCache

Change MemoryBufferCache to InMemoryModuleCache, moving it from Basic to
Serialization.  Another patch will start using it to manage module build
more explicitly, but this is split out because it's mostly mechanical.

Because of the move to Serialization we can no longer abuse the
Preprocessor to forward it to the ASTReader.  Besides the rename and
file move, that means Preprocessor::Preprocessor has one fewer parameter
and ASTReader::ASTReader has one more.

llvm-svn: 355777

5 years ago[ARM] Use non-constant operand in umulo-32.ll; NFC
Nikita Popov [Sat, 9 Mar 2019 13:43:21 +0000 (13:43 +0000)]
[ARM] Use non-constant operand in umulo-32.ll; NFC

Currently the store+load is folded and both operands of the umulo
end up being constants. To avoid this getting folded away entirely,
make sure at least one operand is non-constant.

Also remove some allocas which don't seem relevant to the test.

llvm-svn: 355776

5 years ago[ARM] Generate test checks for umulo-32.ll; NFC
Nikita Popov [Sat, 9 Mar 2019 13:21:15 +0000 (13:21 +0000)]
[ARM] Generate test checks for umulo-32.ll; NFC

The second test case is going to be changed by D59041, so generate
full baseline checks.

llvm-svn: 355775

5 years ago[lldb] [test] Adjust XFAIL list to match buildbot results
Michal Gorny [Sat, 9 Mar 2019 12:47:38 +0000 (12:47 +0000)]
[lldb] [test] Adjust XFAIL list to match buildbot results

Adjust the XFAIL-ing tests to match consistent results from buildbot.
I'm going to work on differences between them and my local results
following this.

llvm-svn: 355774

5 years ago[RISCV][NFC] Minor refactoring of CC_RISCV
Alex Bradbury [Sat, 9 Mar 2019 11:16:27 +0000 (11:16 +0000)]
[RISCV][NFC] Minor refactoring of CC_RISCV

Immediately check if we need to early-exit as we have a return value that
can't be returned directly. Also tweak following if/else.

llvm-svn: 355773

5 years ago[RISCV][NFC] Split out emitSelectPseudo from EmitInstrWithCustomInserter
Alex Bradbury [Sat, 9 Mar 2019 09:30:14 +0000 (09:30 +0000)]
[RISCV][NFC] Split out emitSelectPseudo from EmitInstrWithCustomInserter

It's cleaner and more consistent to have a separate helper function here.

llvm-svn: 355772

5 years ago[RISCV] Support -target-abi at the MC layer and for codegen
Alex Bradbury [Sat, 9 Mar 2019 09:28:06 +0000 (09:28 +0000)]
[RISCV] Support -target-abi at the MC layer and for codegen

This patch adds proper handling of -target-abi, as accepted by llvm-mc and
llc. Lowering (codegen) for the hard-float ABIs will follow in a subsequent
patch. However, this patch does add MC layer support for the hard float and
RVE ABIs (emission of the appropriate ELF flags
https://github.com/riscv/riscv-elf-psabi-doc/blob/master/riscv-elf.md#-file-header).

ABI parsing must be shared between codegen and the MC layer, so we add
computeTargetABI to RISCVUtils. A warning will be printed if an invalid or
unrecognized ABI is given.

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

llvm-svn: 355771

5 years ago[WebAssembly] Use named operands to identify loads and stores
Thomas Lively [Sat, 9 Mar 2019 04:31:37 +0000 (04:31 +0000)]
[WebAssembly] Use named operands to identify loads and stores

Summary:
Uses the named operands tablegen feature to look up the indices of
offset, address, and p2align operands for all load and store
instructions. This replaces brittle, incorrect logic for identifying
loads and store when eliminating frame indices, which previously
crashed on bulk-memory ops. It also cleans up the SetP2Alignment pass.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, jfb, llvm-commits

Tags: #llvm

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

llvm-svn: 355770

5 years agoRefactor isBooleanFlip into extractBooleanFlip so that users do not depend on the...
Amaury Sechet [Sat, 9 Mar 2019 02:51:52 +0000 (02:51 +0000)]
Refactor isBooleanFlip into extractBooleanFlip so that users do not depend on the patern matched. NFC

llvm-svn: 355769

5 years ago[x86] add tests for extract of FP select; NFC
Sanjay Patel [Sat, 9 Mar 2019 02:11:05 +0000 (02:11 +0000)]
[x86] add tests for extract of FP select; NFC

llvm-svn: 355768

5 years ago[ScalarizeMaskedMemIntrin] Use IRBuilder functions that take uint32_t/uint64_t for...
Craig Topper [Sat, 9 Mar 2019 02:08:41 +0000 (02:08 +0000)]
[ScalarizeMaskedMemIntrin] Use IRBuilder functions that take uint32_t/uint64_t for getelementptr, extractelement, and insertelement.

This saves needing to call getInt32 ourselves. Making the code a little shorter.

The test changes are because insert/extract use getInt64 internally. Shouldn't be a functional issue.

This cleanup because I plan to write similar code for expandload/compressstore.

llvm-svn: 355767

5 years agoActually implement the TestQueues.py workaround
Frederic Riss [Sat, 9 Mar 2019 01:34:44 +0000 (01:34 +0000)]
Actually implement the TestQueues.py workaround

The code commited in r355764 didn't do what I want as I typed GetThreadID
instead of GetQueueID. This commit contains a (hopefully) better version
of the workaround.

llvm-svn: 355766

5 years ago[CMake] Support stripping and linking output to .build-id directory
Petr Hosek [Sat, 9 Mar 2019 01:26:55 +0000 (01:26 +0000)]
[CMake] Support stripping and linking output to .build-id directory

When installing runtimes with install-runtimes-stripped, we don't want
to just strip them, we also want to preserve the debugging information
for potential debugging. To make it possible to later find the stripped
debugging information, we want to use the .build-id layout:

https://fedoraproject.org/wiki/RolandMcGrath/BuildID#Find_files_by_build_ID

That is, for libfoo.so with build ID abcdef1234, the debugging information
will be installed into lib/debug/.build-id/ab/cdef1234. llvm-objcopy
already has support for stripping files and linking the debugging
stripped output into the right location. However, CMake doesn't support
customizing strip invocation for the *-stripped targets. So instead, we
replace CMAKE_STRIP with a custom script that invokes llvm-objcopy with
the right command line flags.

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

llvm-svn: 355765

5 years agoTry to workaround the TestQueues.py flakyness
Frederic Riss [Sat, 9 Mar 2019 01:23:47 +0000 (01:23 +0000)]
Try to workaround the TestQueues.py flakyness

This is not a fix, but if I understand enough of the issue, it should
bail out early of the test when in a situation that would result in
a failure down the road.

llvm-svn: 355764

5 years agoLWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"
Eric Fiselier [Sat, 9 Mar 2019 00:38:19 +0000 (00:38 +0000)]
LWG 2843 "Unclear behavior of std::pmr::memory_resource::do_allocate()"

Patch by Arthur O'Dwyer.
Reviewed as https://reviews.llvm.org/D47344

new_delete_resource().allocate(n, a) has basically two permissible results:

* Return an appropriately sized and aligned block.
* Throw bad_alloc.

Before this patch, libc++'s new_delete_resource would do a third and impermissible thing, which was
to return an appropriately sized but inappropriately under-aligned block. This is now fixed.

(This came up while I was stress-testing unsynchronized_pool_resource on my MacBook. If we can't
trust the default resource to return appropriately aligned blocks, pretty much everything breaks.
For similar reasons, I would strongly support just patching __libcpp_allocate directly, but I don't
care to die on that hill, so I made this patch as a <memory_resource>-specific workaround.)

llvm-svn: 355763

5 years agoBreak cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands
Jonas Devlieghere [Sat, 9 Mar 2019 00:10:52 +0000 (00:10 +0000)]
Break cycle lldb/Commands [3->] lldb/Expression [1->] lldb/Commands

Inspired by Zachary's mail on lldb-dev, this seemed like low hanging
fruit. This patch breaks the circular dependency between commands and
expression.

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

llvm-svn: 355762

5 years agoAdd parens to force the order of operations in an expression trying
Jason Molenda [Sat, 9 Mar 2019 00:04:24 +0000 (00:04 +0000)]
Add parens to force the order of operations in an expression trying
to do "databuffer + offset" so that we don't overflow the uint64_t's
we're using for addresses when working with high addresses.

Found with clang's ubsan while doing darwin kernel debugging.

<rdar://problem/48728940>

llvm-svn: 355761