platform/upstream/llvm.git
4 years agoSBFile: add a bunch of tests that should eventually work.
Lawrence D'Anna [Wed, 9 Oct 2019 21:50:46 +0000 (21:50 +0000)]
SBFile: add a bunch of tests that should eventually work.

Summary:
It's really annoying and confusing to have to keep referring
back to earlier versions of this SBFile work to find the
tests that need to be added for each patch, and not duplicate
them with new tests.

This patch just imports all my tests.   A bunch of them don't
work yet, so they are marked to be skipped.   They'll be
unmarked as I fix them.

One of these tests will actually trip an assert in the SWIG
code now instead of just failing, so I'm fixing that here too.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374237

4 years ago[Reproducer] Add convenience methods IsCapturing and IsReplaying.
Jonas Devlieghere [Wed, 9 Oct 2019 21:47:49 +0000 (21:47 +0000)]
[Reproducer] Add convenience methods IsCapturing and IsReplaying.

Add convenience methods to the Reproducer class for when you don't need
access to the generator and the loader.

llvm-svn: 374236

4 years ago[WebAssembly] Make returns variadic
Thomas Lively [Wed, 9 Oct 2019 21:42:08 +0000 (21:42 +0000)]
[WebAssembly] Make returns variadic

Summary:
This is necessary and sufficient to get simple cases of multiple
return working with multivalue enabled. More complex cases will
require block and loop signatures to be generalized to potentially be
type indices as well.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

llvm-svn: 374235

4 years agoTestHelloWorld: Make compatible with remote testing
Frederic Riss [Wed, 9 Oct 2019 21:41:02 +0000 (21:41 +0000)]
TestHelloWorld: Make compatible with remote testing

The synchronization token handling was not remote-friendly.

llvm-svn: 374234

4 years ago[SampleFDO] Add indexing for function profiles so they can be loaded on demand
Wei Mi [Wed, 9 Oct 2019 21:36:03 +0000 (21:36 +0000)]
[SampleFDO] Add indexing for function profiles so they can be loaded on demand
in ExtBinary format

Currently for Text, Binary and ExtBinary format profiles, when we compile a
module with samplefdo, even if there is no function showing up in the profile,
we have to load all the function profiles from the profile input. That is a
waste of compile time.

CompactBinary format profile has already had the support of loading function
profiles on demand. In this patch, we add the support to load profile on
demand for ExtBinary format. It will work no matter the sections in ExtBinary
format profile are compressed or not. Experiment shows it reduces the time to
compile a server benchmark by 30%.

When profile remapping and loading function profiles on demand are both used,
extra work needs to be done so that the loading on demand process will take
the name remapping into consideration. It will be addressed in a follow-up
patch.

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

llvm-svn: 374233

4 years agollvm-dwarfdump: Support multiple debug_loclists contributions
David Blaikie [Wed, 9 Oct 2019 21:25:28 +0000 (21:25 +0000)]
llvm-dwarfdump: Support multiple debug_loclists contributions

Also fixing the incorrect "offset" field being computed/printed for each
location list.

llvm-svn: 374232

4 years ago[LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduce...
Cameron Desrochers [Wed, 9 Oct 2019 21:15:48 +0000 (21:15 +0000)]
[LLDB] Fix for regression of test 'TestDataFormatterInvalidStdUniquePtr.py' introduced in r374195

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

llvm-svn: 374231

4 years ago[Docs] Adds section for Additional Topics on Reference page
DeForest Richards [Wed, 9 Oct 2019 21:09:09 +0000 (21:09 +0000)]
[Docs] Adds section for Additional Topics on Reference page

Adds a new section for Additional Topics on the Reference documentation page. Also moves Support Library topic to User Guides page.

llvm-svn: 374230

4 years ago[LLDB] Remove standalone build dep on llvm-strip
Jonas Devlieghere [Wed, 9 Oct 2019 21:06:03 +0000 (21:06 +0000)]
[LLDB] Remove standalone build dep on llvm-strip

When building standalone, since llvm-strip is a symlink, it is created
using add_custom_command/add_custom_target which cannot be exported, and
thus cannot be depended on by lldb.

Patch by: Gwen Mittertreiner

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

llvm-svn: 374229

4 years ago[libFuzzer] Fix Alarm callback in fuchsia.
Jake Ehrlich [Wed, 9 Oct 2019 21:01:50 +0000 (21:01 +0000)]
[libFuzzer] Fix Alarm callback in fuchsia.

This patch adds an #if macro to skip the InFuzzingThread() comparison
for fuchsia, similar to what it is done for Windows and NetBSD.

In fuchsia, the alarm callback runs in a separate thread[0], making it fail
the comparison InFuzzingThread(), breaking the -timeout flag.

[0]:
https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/fuzzer/FuzzerUtilFuchsia.cpp#L323

Author: charco (aka Marco  Vanotti)
Differential Revision: https://reviews.llvm.org/D68166

llvm-svn: 374228

4 years agoRevert "[lldb] Calculate relative path for symbol links"
Jim Ingham [Wed, 9 Oct 2019 20:56:43 +0000 (20:56 +0000)]
Revert "[lldb] Calculate relative path for symbol links"

This reverts commit 958091c209d0a92e38b9cb27fb77a0ff7da11853.

This commit incorrectly sets the _lldb.so symlink (at least it does when
building in Stefans' two build directory mode, where you build llvm with
cmake/ninja and lldb with cmake/Xcode, using a cmake generated project.

The _lldb.so link is SUPPOSED to point to:

bin/LLDB.framework/Versions/A/LLDB

but instead it points to

bin/LLDB

which is where LLDB was staged to before constructing the framework.  This
causes all sorts of problems when we then build the lldb driver into bin -
remember that MacOS is a case-preserving but case insensitive filesystem -
so when we later go to dlopen _lldb.so, we dlopen the main executable instead.

llvm-svn: 374226

4 years agoallow arbitrary python streams to be converted to SBFile
Lawrence D'Anna [Wed, 9 Oct 2019 20:56:17 +0000 (20:56 +0000)]
allow arbitrary python streams to be converted to SBFile

Summary:
This patch adds SWIG typemaps that can convert arbitrary python
file objects into lldb_private::File.

A SBFile may be initialized from a python file using the
constructor.   There are also alternate, tagged constructors
that allow python files to be borrowed, and for the caller
to control whether or not the python I/O methods will be
called even when a file descriptor is available.I

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: labath

Subscribers: zturner, amccarth, lldb-commits

Tags: #lldb

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

llvm-svn: 374225

4 years ago[OPENMP50]Fix scoring of contexts with and without user provided scores.
Alexey Bataev [Wed, 9 Oct 2019 20:54:06 +0000 (20:54 +0000)]
[OPENMP50]Fix scoring of contexts with and without user provided scores.

The context selector with user provided score must have higher score
than the context selector without user provided score.

llvm-svn: 374224

4 years ago[sanitizer, NFC] Fix grammar in comment
Vitaly Buka [Wed, 9 Oct 2019 20:52:39 +0000 (20:52 +0000)]
[sanitizer, NFC] Fix grammar in comment

llvm-svn: 374223

4 years ago[System Model] [TTI] Define AMDGPUTTIImpl::getST and AMDGPUTTIImpl::getTLI
Vitaly Buka [Wed, 9 Oct 2019 20:48:54 +0000 (20:48 +0000)]
[System Model] [TTI] Define AMDGPUTTIImpl::getST and AMDGPUTTIImpl::getTLI

To fix "infinite recursion" warning.

llvm-svn: 374222

4 years ago[System Model] [TTI] Fix virtual destructor warning
Vitaly Buka [Wed, 9 Oct 2019 20:48:52 +0000 (20:48 +0000)]
[System Model] [TTI] Fix virtual destructor warning

llvm-svn: 374221

4 years ago[sanitizer] Disable signal_trap_handler on s390
Vitaly Buka [Wed, 9 Oct 2019 20:48:50 +0000 (20:48 +0000)]
[sanitizer] Disable signal_trap_handler on s390

llvm-svn: 374220

4 years ago[Clang][OpenMP Offload] Add new tool for wrapping offload device binaries
Sergey Dmitriev [Wed, 9 Oct 2019 20:42:58 +0000 (20:42 +0000)]
[Clang][OpenMP Offload] Add new tool for wrapping offload device binaries

This patch removes the remaining part of the OpenMP offload linker scripts which was used for inserting device binaries into the output linked binary. Device binaries are now inserted into the host binary with a help of the wrapper bit-code file which contains device binaries as data. Wrapper bit-code file is dynamically created by the clang driver with a help of new tool clang-offload-wrapper which takes device binaries as input and produces bit-code file with required contents. Wrapper bit-code is then compiled to an object and resulting object is appended to the host linking by the clang driver.

This is the second part of the patch for eliminating OpenMP linker script (please see https://reviews.llvm.org/D64943).

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

llvm-svn: 374219

4 years agoSkip Apple simulator test for all remote testing scenarios.
Frederic Riss [Wed, 9 Oct 2019 20:39:04 +0000 (20:39 +0000)]
Skip Apple simulator test for all remote testing scenarios.

The test makes no sense to run remotely, period. The architecture of
the target is not the discriminant here.

llvm-svn: 374217

4 years ago[CMake] Fix add_lldb_test_dependency
Jonas Devlieghere [Wed, 9 Oct 2019 20:36:29 +0000 (20:36 +0000)]
[CMake] Fix add_lldb_test_dependency

This function would ignore all but the first argument. Now it correctly
adds every dependency by iterating over its arguments.

llvm-svn: 374216

4 years ago[utils] Update lldb-dotest for new test layout
Jonas Devlieghere [Wed, 9 Oct 2019 20:30:54 +0000 (20:30 +0000)]
[utils] Update lldb-dotest for new test layout

The path to dotest.py changed after the test directory reorganization.

llvm-svn: 374215

4 years ago[Docs] Adds Documentation links to sidebar
DeForest Richards [Wed, 9 Oct 2019 20:26:13 +0000 (20:26 +0000)]
[Docs] Adds Documentation links to sidebar

Adds links to Getting Started/Tutorials, User Guides, and Reference documentation pages to sidebar. Also adds a new section for LLVM IR on the Reference documentation page.

llvm-svn: 374214

4 years ago[sanitizer] Make signal_name a C test
Vitaly Buka [Wed, 9 Oct 2019 20:22:14 +0000 (20:22 +0000)]
[sanitizer] Make signal_name a C test

llvm-svn: 374213

4 years ago[test] Skip entry value test when clang < 10.0.0
Vedant Kumar [Wed, 9 Oct 2019 20:21:33 +0000 (20:21 +0000)]
[test] Skip entry value test when clang < 10.0.0

clang-9 emitted the wrong opcode for entry values on Darwin.

rdar://56119661

llvm-svn: 374212

4 years ago[sanitizer] Use raise() in test and cover more signals
Vitaly Buka [Wed, 9 Oct 2019 20:18:27 +0000 (20:18 +0000)]
[sanitizer] Use raise() in test and cover more signals

llvm-svn: 374211

4 years ago[ConstProp] add tests for extractelement with undef index; NFC
Sanjay Patel [Wed, 9 Oct 2019 20:14:17 +0000 (20:14 +0000)]
[ConstProp] add tests for extractelement with undef index; NFC

llvm-svn: 374210

4 years ago[AMDGPU] Use math constants defined in MathExtras (NFC)
Evandro Menezes [Wed, 9 Oct 2019 20:00:43 +0000 (20:00 +0000)]
[AMDGPU] Use math constants defined in MathExtras (NFC)

Use the the new math constants in `MathExtras.h`.

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

llvm-svn: 374208

4 years ago[Support] Add mathematical constants
Evandro Menezes [Wed, 9 Oct 2019 19:58:01 +0000 (19:58 +0000)]
[Support] Add mathematical constants

Add own version of the mathematical constants from the upcoming C++20 `std::numbers`.

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

llvm-svn: 374207

4 years ago[System Model] [TTI] Update cache and prefetch TTI interfaces
David Greene [Wed, 9 Oct 2019 19:51:48 +0000 (19:51 +0000)]
[System Model] [TTI] Update cache and prefetch TTI interfaces

Re-apply 9fdfb045ae8b/r365676 with fixes for PPC and Hexagon.  This involved
moving defaults from TargetTransformInfoImplBase to MCSubtargetInfo.

Rework the TTI cache and software prefetching APIs to prepare for the
introduction of a general system model.  Changes include:

- Marking existing interfaces const and/or override as appropriate
- Adding comments
- Adding BasicTTIImpl interfaces that delegate to a subtarget
  implementation
- Moving the default TargetTransformInfoImplBase implementation to a default
  MCSubtarget implementation

Only a handful of targets use these interfaces currently: AArch64, Hexagon, PPC
and SystemZ.  AArch64 already has a custom subtarget implementation, so its
custom TTI implementation is migrated to use the new facilities in BasicTTIImpl
to invoke its custom subtarget implementation.  The custom TTI implementations
continue to exist for the other targets with this change.  They are not moved
over to subtarget-based implementations.

The end goal is to have the default subtarget implementation defer to the system
model defined by the target.  With this change, the default MCSubtargetInfo
implementation essentially returns the defaults TargetTransformInfoImplBase used
to return.  Existing users of TTI defaults will hit the defaults now in
MCSubtargetInfo.  Targets that define their own custom TTI implementations won't
use the BasicTTIImpl implementations that route to the subtarget.

Once system models are in place for the targets that use these interfaces, their
custom TTI implementations can be removed.

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

llvm-svn: 374205

4 years ago[ObjC generics] Fix not inheriting type bounds in categories/extensions.
Volodymyr Sapsai [Wed, 9 Oct 2019 19:29:13 +0000 (19:29 +0000)]
[ObjC generics] Fix not inheriting type bounds in categories/extensions.

When a category/extension doesn't repeat a type bound, corresponding
type parameter is substituted with `id` when used as a type argument. As
a result, in the added test case it was causing errors like

> type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T'

We are already checking that type parameters should be consistent
everywhere (see `checkTypeParamListConsistency`) and update
`ObjCTypeParamDecl` to have correct underlying type. And when we use the
type parameter as a method return type or a method parameter type, it is
substituted to the bounded type. But when we use the type parameter as a
type argument, we check `ObjCTypeParamType` that ignores the updated
underlying type and remains `id`.

Fix by desugaring `ObjCTypeParamType` to the underlying type, the same
way we are doing with `TypedefType`.

rdar://problem/54329242

Reviewers: erik.pilkington, ahatanak

Reviewed By: erik.pilkington

Subscribers: jkorous, dexonsmith, ributzka, cfe-commits

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

llvm-svn: 374202

4 years agoRe-land "[test] Split LLDB tests into API, Shell & Unit"
Jonas Devlieghere [Wed, 9 Oct 2019 19:22:02 +0000 (19:22 +0000)]
Re-land "[test] Split LLDB tests into API, Shell & Unit"

The original patch got reverted because it broke `check-lldb` on a clean
build. This fixes that.

llvm-svn: 374201

4 years ago[mangle] Fix mangling where an extra mangle context is required.
Michael Liao [Wed, 9 Oct 2019 19:08:52 +0000 (19:08 +0000)]
[mangle] Fix mangling where an extra mangle context is required.

Summary:
- [Itanium C++ ABI][1], for certain contexts like default parameter and
  etc., mangling numbering will be local to the particular argument in
  which it appears.
- However, for these cases, the mangle numbering context is allocated per
  expression evaluation stack entry. That causes, for example, two
  lambdas defined/used understand the same default parameter are
  numbered as the same value and, in turn, one of them is not generated
  at all.
- In this patch, an extra mangle numbering context map is maintained in
  the AST context to map taht extra declaration context to its numbering
  context. So that, 2 different lambdas defined/used in the same default
  parameter are numbered differently.

[1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html

Reviewers: rsmith, eli.friedman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 374200

4 years ago[HIP] Fix -save-temps
Yaxun Liu [Wed, 9 Oct 2019 18:46:43 +0000 (18:46 +0000)]
[HIP] Fix -save-temps

Currently clang does not save some of the intermediate file generated during device compilation for HIP when -save-temps is specified.

This patch fixes that.

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

llvm-svn: 374198

4 years agoprotect libedit and LLDB gui from receiving null FILE* streams
Lawrence D'Anna [Wed, 9 Oct 2019 18:43:03 +0000 (18:43 +0000)]
protect libedit and LLDB gui from receiving null FILE* streams

Summary:
We now have valid files that will return NULL from GetStream().
libedit and the LLDB gui are the only places left that need FILE*
streams.  Both are doing curses-like user interaction that only
make sense with a real terminal anyway, so there is no need to convert
them off of their use of FILE*.   But we should check for null streams
before enabling these features.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere, labath

Subscribers: lldb-commits

Tags: #lldb

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

llvm-svn: 374197

4 years agoDebugInfo: Shot in the dark attempt to fix ubsan error from r374122
David Blaikie [Wed, 9 Oct 2019 18:37:13 +0000 (18:37 +0000)]
DebugInfo: Shot in the dark attempt to fix ubsan error from r374122

(specifying an underlying type for the enum might also be suitable - but
this seems better/as good, since there's a clear expectation this can
contain values other than the actual enumerators of this enum)

llvm-svn: 374196

4 years ago[LLDB] Fix for synthetic children memory leak
Cameron Desrochers [Wed, 9 Oct 2019 18:27:33 +0000 (18:27 +0000)]
[LLDB] Fix for synthetic children memory leak

The lifetime of a ValueObject and all its derivative ValueObjects (children, clones, etc.) is managed by a ClusterManager. These objects are only destroyed when every shared pointer to any of the managed objects in the cluster is destroyed. This means that no object in the cluster can store a shared pointer to another object in the cluster without creating a memory leak of the entire cluster. However, some of the synthetic children front-end implementations do exactly this; this patch fixes that.

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

llvm-svn: 374195

4 years ago[lit] Refactor ProgressDisplay
Julian Lettner [Wed, 9 Oct 2019 18:23:30 +0000 (18:23 +0000)]
[lit] Refactor ProgressDisplay

Move progress display to separate file.  Simplify some code paths.
Decouple from other components via progress callback.  Remove unused
`_Display` class.

Reviewed By: serge-sans-paille

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

llvm-svn: 374194

4 years agoUpdate breakpad lit test to be independent of the unnamed symbol number
Antonio Afonso [Wed, 9 Oct 2019 18:02:59 +0000 (18:02 +0000)]
Update breakpad lit test to be independent of the unnamed symbol number

llvm-svn: 374192

4 years ago[ARM] Fix arm_neon.h with -flax-vector-conversions=none
Eli Friedman [Wed, 9 Oct 2019 17:57:59 +0000 (17:57 +0000)]
[ARM] Fix arm_neon.h with -flax-vector-conversions=none

Really, we were already 99% of the way there; just needed a couple minor
fixes that affected 64-bit-only builtins.  Based on D61717.

Note that the change to builtin_str changes the type of a few
__builtin_neon_* intrinsics that had the "wrong" type.

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

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

llvm-svn: 374191

4 years ago[InstCombine] add another test for gep inbounds; NFC
Sanjay Patel [Wed, 9 Oct 2019 17:52:26 +0000 (17:52 +0000)]
[InstCombine] add another test for gep inbounds; NFC

llvm-svn: 374190

4 years ago[WebAssembly] Add builtin and intrinsic for v8x16.swizzle
Thomas Lively [Wed, 9 Oct 2019 17:45:47 +0000 (17:45 +0000)]
[WebAssembly] Add builtin and intrinsic for v8x16.swizzle

Summary:
This clang builtin and corresponding LLVM intrinsic are necessary to
expose the exact semantics of the underlying WebAssembly instruction
to users. LLVM produces a poison value if the dynamic swizzle indices
are greater than the vector size, but the WebAssembly instruction sets
the corresponding output lane to zero. Users who depend on this
behavior can safely use this builtin.

Depends on D68527.

Reviewers: aheejin, dschuff

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

Tags: #clang, #llvm

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

llvm-svn: 374189

4 years ago[WebAssembly] v8x16.swizzle and rewrite BUILD_VECTOR lowering
Thomas Lively [Wed, 9 Oct 2019 17:39:19 +0000 (17:39 +0000)]
[WebAssembly] v8x16.swizzle and rewrite BUILD_VECTOR lowering

Summary:
Adds the new v8x16.swizzle SIMD instruction as specified at
https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#swizzling-using-variable-indices.
In addition to adding swizzles as a candidate lowering in
LowerBUILD_VECTOR, also rewrites and simplifies the lowering to
minimize the number of replace_lanes necessary rather than trying to
minimize code size. This leads to more uses of v128.const instead of
splats, which is expected to increase performance.

The new code will be easier to tune once V8 implements all the vector
construction operations, and it will also be easier to add new
candidate instructions in the future if necessary.

Reviewers: aheejin, dschuff

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

Tags: #llvm

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

llvm-svn: 374188

4 years agoRevert [test] Split LLDB tests into API, Shell & Unit
Adrian Prantl [Wed, 9 Oct 2019 17:35:43 +0000 (17:35 +0000)]
Revert [test] Split LLDB tests into API, Shell & Unit
as it appears to have broken check-lldb.

This reverts r374184 (git commit 22314179f0660c172514b397060fd8f34b586e82)

llvm-svn: 374187

4 years ago[FPEnv][NFC] Change test to conform to strictfp attribute rules.
Kevin P. Neal [Wed, 9 Oct 2019 17:24:56 +0000 (17:24 +0000)]
[FPEnv][NFC] Change test to conform to strictfp attribute rules.

In particular, the function definition is not marked strictfp despite
containing a function marked strictfp. Also, if any function call is marked
strictfp then all function calls in that function must be marked.

This change to move the one strictfp call to a new properly marked function
meets all the new rules.

Tested with a stricter version of D68233.

Reviewed by: spatel
Approved by: spatel
Differential Revision: https://reviews.llvm.org/D68713

llvm-svn: 374186

4 years agoRemove obsolete parameter.
Adrian Prantl [Wed, 9 Oct 2019 16:55:27 +0000 (16:55 +0000)]
Remove obsolete parameter.

llvm-svn: 374185

4 years ago[test] Split LLDB tests into API, Shell & Unit
Jonas Devlieghere [Wed, 9 Oct 2019 16:38:47 +0000 (16:38 +0000)]
[test] Split LLDB tests into API, Shell & Unit

LLDB has three major testing strategies: unit tests, tests that exercise
the SB API though dotest.py and what we currently call lit tests. The
later is rather confusing as we're now using lit as the driver for all
three types of tests. As most of this grew organically, the directory
structure in the LLDB repository doesn't really make this clear.

The 'lit' tests are part of the root and among these tests there's a
Unit and Suite folder for the unit and dotest-tests. This layout makes
it impossible to run just the lit tests.

This patch changes the directory layout to match the 3 testing
strategies, each with their own directory and their own configuration
file. This means there are now 3 directories under lit with 3
corresponding targets:

 - API (check-lldb-api): Test exercising the SB API.
 - Shell (check-lldb-shell): Test exercising command line utilities.
 - Unit (check-lldb-unit): Unit tests.

Finally, there's still the `check-lldb` target that runs all three test
suites.

Finally, this also renames the lit folder to `test` to match the LLVM
repository layout.

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

llvm-svn: 374184

4 years ago[SLP] respect target register width for GEP vectorization (PR43578)
Sanjay Patel [Wed, 9 Oct 2019 16:32:49 +0000 (16:32 +0000)]
[SLP] respect target register width for GEP vectorization (PR43578)

We failed to account for the target register width (max vector factor)
when vectorizing starting from GEPs. This causes vectorization to
proceed to obviously illegal widths as in:
https://bugs.llvm.org/show_bug.cgi?id=43578

For x86, this also means that SLP can produce rogue AVX or AVX512
code even when the user specifies a narrower vector width.

The AArch64 test in ext-trunc.ll appears to be better using the
narrower width. I'm not exactly sure what getelementptr.ll is trying
to do, but it's testing with "-slp-threshold=-18", so I'm not worried
about those diffs. The x86 test is an over-reduction from SPEC h264;
this patch appears to restore the perf loss caused by SLP when using
-march=haswell.

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

llvm-svn: 374183

4 years ago[AArch64] Ensure no tagged memory is left in the unallocated portion of the
Momchil Velikov [Wed, 9 Oct 2019 16:31:50 +0000 (16:31 +0000)]
[AArch64] Ensure no tagged memory is left in the unallocated portion of the
stack

This patch makes sure that if we tag some memory, we untag that memory before
the function returns/throws via any exit, reachable from the tag operation. For
that we place the untag operation either at:

  a) the lifetime end call for the alloca, if that call post-dominates the
     lifetime start call (where the tag operation is placed), or it (the
     lifetime end call) dominates all reachable exits, otherwise
  b) at the reachable exits

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

llvm-svn: 374182

4 years ago[NFC] Remove files got accidentally upload in llvm-svn 374179
Jason Liu [Wed, 9 Oct 2019 16:24:25 +0000 (16:24 +0000)]
[NFC] Remove files got accidentally upload in llvm-svn 374179

llvm-svn: 374181

4 years agoRemove the is_mangled flag from Mangled and Symbol
Adrian Prantl [Wed, 9 Oct 2019 16:22:14 +0000 (16:22 +0000)]
Remove the is_mangled flag from Mangled and Symbol

Testing whether a name is mangled or not is extremely cheap and can be
done by looking at the first two characters. Mangled knows how to do
it. On the flip side, many call sites that currently pass in an
is_mangled determination do not know how to correctly do it (for
example, they leave out Swift mangling prefixes).

This patch removes this entry point and just forced Mangled to
determine the mangledness of a string itself.

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

llvm-svn: 374180

4 years ago[AIX][XCOFF][NFC] Change the SectionLen field name of CSect Auxiliary entry to Sectio...
Jason Liu [Wed, 9 Oct 2019 16:19:39 +0000 (16:19 +0000)]
[AIX][XCOFF][NFC] Change the SectionLen field name of CSect Auxiliary entry to SectionOrLength.

Summary:
According the the XCOFF document,
If
Then
XTY_SD
x_scnlen contains the csect length.
XTY_LD
x_scnlen contains the symbol table index of the containing csect.
XTY_CM
x_scnlen contains the csect length.
XTY_ER
x_scnlen contains 0.

Change the SectionLen member name to SectionOrLength is more reasonable.

Authored By: DiggerLin

Reviewed By: hubert.reinterpretcast

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

llvm-svn: 374179

4 years agoRe-land "[dsymutil] Fix handling of common symbols in multiple object files."
Jonas Devlieghere [Wed, 9 Oct 2019 16:19:13 +0000 (16:19 +0000)]
Re-land "[dsymutil] Fix handling of common symbols in multiple object files."

The original patch got reverted because it hit a long-standing legacy
issue on Windows that prevents files from being named `com`. Thanks
Kristina & Jeremy for pointing this out.

llvm-svn: 374178

4 years ago[MemorySSA] Make the use of moveAllAfterMergeBlocks consistent.
Alina Sbirlea [Wed, 9 Oct 2019 15:54:24 +0000 (15:54 +0000)]
[MemorySSA] Make the use of moveAllAfterMergeBlocks consistent.

Summary:
The rule for the moveAllAfterMergeBlocks API si for all instructions
from `From` to have been moved to `To`, while keeping the CFG edges (and
block terminators) unchanged.
Update all the callsites for moveAllAfterMergeBlocks to follow this.

Pending follow-up: since the same behavior is needed everytime, merge
all callsites into one. The common denominator may be the call to
`MergeBlockIntoPredecessor`.

Resolves PR43569.

Reviewers: george.burgess.iv

Subscribers: Prazek, sanjoy.google, llvm-commits

Tags: #llvm

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

llvm-svn: 374177

4 years ago[NFC] Reverting changes from test commit.
Mitchell Balan [Wed, 9 Oct 2019 15:12:22 +0000 (15:12 +0000)]
[NFC] Reverting changes from test commit.
llvm commit access test succeeded.

llvm-svn: 374175

4 years ago[NFC] Test commit.
Mitchell Balan [Wed, 9 Oct 2019 15:11:34 +0000 (15:11 +0000)]
[NFC] Test commit.
Testing llvm commit access only.

llvm-svn: 374174

4 years ago[scudo][standalone] Get statistics in a char buffer
Kostya Kortchinsky [Wed, 9 Oct 2019 15:09:28 +0000 (15:09 +0000)]
[scudo][standalone] Get statistics in a char buffer

Summary:
Following up on D68471, this CL introduces some `getStats` APIs to
gather statistics in char buffers (`ScopedString` really) instead of
printing them out right away. Ultimately `printStats` will just
output the buffer, but that allows us to potentially do some work
on the intermediate buffer, and can be used for a `mallocz` type
of functionality. This allows us to pretty much get rid of all the
`Printf` calls around, but I am keeping the function in for
debugging purposes.

This changes the existing tests to use the new APIs when required.

I will add new tests as suggested in D68471 in another CL.

Reviewers: morehouse, hctim, vitalybuka, eugenis, cferris

Reviewed By: morehouse

Subscribers: delcypher, #sanitizers, llvm-commits

Tags: #llvm, #sanitizers

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

llvm-svn: 374173

4 years ago[clang-format] Update noexcept reference qualifiers detection
Krasimir Georgiev [Wed, 9 Oct 2019 14:46:08 +0000 (14:46 +0000)]
[clang-format] Update noexcept reference qualifiers detection

Summary:
r373165 fixed an issue where a templated noexcept member function with a
reference qualifier would be indented more than expected:
```
// Formatting produced with LLVM style with AlwaysBreakTemplateDeclarations: Yes

// before r373165:
struct f {
  template <class T>
      void bar() && noexcept {}
};

// after:
struct f {
  template <class T>
  void bar() && noexcept {}
};

```
The way this is done is that in the AnnotatingParser in
`lib/FormatTokenAnnotator.cpp` the determination of the usage of a `&` or `&&`
(the line in determineTokenType

```
Current.Type = determineStarAmpUsage(...
```
is not performed in some cases anymore, combining with a few additional related
checks afterwards. The net effect of these checks results in the `&` or `&&`
token to start being classified as `TT_Unknown` in cases where before `r373165`
it would be classified as `TT_UnaryOperator` or `TT_PointerOrReference` by
`determineStarAmpUsage`.

This inadvertently caused 2 classes of regressions I'm aware of:

- The address-of `&` after a function assignment would be classified as
  `TT_Unknown`, causing spaces to surround it, disregarding style options:
```
// before r373165:
void (*fun_ptr)(void) = &fun;

// after:
void (*fun_ptr)(void) = & fun;
```

- In cases where there is a function declaration list -- looking macro between
  a template line and the start of the function declaration, an `&` as part of
  the return type would be classified as `TT_Unknown`, causing spaces to
  surround it:
```
// before r373165:
template <class T>
DEPRECATED("lala")
Type& foo();

// after:
template <class T>
DEPRECATED("lala")
Type & foo();
```

In these cases the problems are rooted in the skipping of the classification of
a `&` (and similarly `&&`) by determineStarAmpUsage which effects the formatting
decisions later in the pipeline.

I've looked into the goal of r373165 and noticed that replacing `noexcept` with
`const` in the given example produces no extra indentation with the old code:
```
// before r373165:
struct f {
  template <class T>
  int foo() & const {}
};

struct f {
  template <class T>
      int foo() & noexcept {}
};
```

I investigated how clang-format annotated these two examples differently to
determine the places where the processing of both diverges in the pipeline.
There were two places where the processing diverges, causing the extra indent in
the `noexcept` case:
1. The `const` is annotated as a `TT_TrailingAnnotation`, whereas `noexcept`
   is annotated as `TT_Unknown`. I've updated the `determineTokenType` function
   to account for this by adding a missing `tok:kw_noexcept` to the clause that
   marks a token as `TT_TrailingAnnotation`.
2. The `&` in the second example is wrongly identified as `TT_BinaryOperator`
   in `determineStarAmpUsage`. This is the reason for the extra indentation --
   clang-format gets confused and thinks this is an expression.
   I've updated `determineStarAmpUsage` to check for `tok:kw_noexcept`.

With these two updates in place, the additional parsing introduced by r373165
becomes unnecessary and all added tests pass (with updates, as now clang-format
respects the style configuration for spaces around the `&` in the test
examples).
I've removed these additions and added regression tests for the cases above.

Reviewers: AndWass, MyDeveloperDay

Reviewed By: MyDeveloperDay

Subscribers: cfe-commits

Tags: #clang, #clang-format

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

llvm-svn: 374172

4 years agoFix Wdocumentation unknown parameter warning. NFCI.
Simon Pilgrim [Wed, 9 Oct 2019 14:26:09 +0000 (14:26 +0000)]
Fix Wdocumentation unknown parameter warning. NFCI.

llvm-svn: 374171

4 years ago[llvm-exegesis] Ensure that ExecutableFunction are aligned.
Clement Courbet [Wed, 9 Oct 2019 14:25:08 +0000 (14:25 +0000)]
[llvm-exegesis] Ensure that ExecutableFunction are aligned.

Summary: Experiments show that this is the alignment we get (for ELF+Linux), but let's ensure that we have it.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 374170

4 years agoAdd and adjust saturating tests. NFC
David Green [Wed, 9 Oct 2019 14:17:38 +0000 (14:17 +0000)]
Add and adjust saturating tests. NFC

This adds some extra testing to the existing [su][add/sub]_sat X86 and AArch64
tests and adds equivalent tests for ARM.

llvm-svn: 374169

4 years ago[clangd] Make sure ReplyCallbacks are destroyed before RequestCancelersMutex
Kadir Cetinkaya [Wed, 9 Oct 2019 13:59:31 +0000 (13:59 +0000)]
[clangd] Make sure ReplyCallbacks are destroyed before RequestCancelersMutex

Summary:
After rL374163, replycallbacks might have a cancellable context, which
will try to access RequestCancellers on destruction. See
http://45.33.8.238/mac/1245/step_7.txt for a sample failure.

Reviewers: sammccall

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

Tags: #clang

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

llvm-svn: 374168

4 years ago[clang-offload-bundler] Support `.cui` and `.d`.
Michael Liao [Wed, 9 Oct 2019 13:53:37 +0000 (13:53 +0000)]
[clang-offload-bundler] Support `.cui` and `.d`.

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 374167

4 years ago[LV] Emitting SCEV checks with OptForSize
Sjoerd Meijer [Wed, 9 Oct 2019 13:19:41 +0000 (13:19 +0000)]
[LV] Emitting SCEV checks with OptForSize

When optimising for size and SCEV runtime checks need to be emitted to check
overflow behaviour, the loop vectorizer can run in this assert:

  LoopVectorize.cpp:2699: void llvm::InnerLoopVectorizer::emitSCEVChecks(
  llvm::Loop *, llvm::BasicBlock *): Assertion `!BB->getParent()->hasOptSize()
  && "Cannot SCEV check stride or overflow when opt

We should not generate predicates while optimising for size because
code will be generated for predicates such as these SCEV overflow runtime
checks.

This should fix PR43371.

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

llvm-svn: 374166

4 years ago[mips] Rename local variable. NFC
Simon Atanasyan [Wed, 9 Oct 2019 13:12:27 +0000 (13:12 +0000)]
[mips] Rename local variable. NFC

llvm-svn: 374165

4 years ago[mips] Split expandLoadImmReal into multiple methods. NFC
Simon Atanasyan [Wed, 9 Oct 2019 13:12:21 +0000 (13:12 +0000)]
[mips] Split expandLoadImmReal into multiple methods. NFC

The `expandLoadImmReal` handles four different and almost non-overlapping
cases: loading a "single" float immediate into a GPR, loading a "single"
float immediate into a FPR, and the same couple for a "double" float
immediate.

It's better to move each `else if` branch into separate methods.

llvm-svn: 374164

4 years ago[clangd] Propagate context into reply handlers
Kadir Cetinkaya [Wed, 9 Oct 2019 12:48:41 +0000 (12:48 +0000)]
[clangd] Propagate context into reply handlers

llvm-svn: 374163

4 years ago[llvm-exegesis] Fix r374158
Clement Courbet [Wed, 9 Oct 2019 12:37:56 +0000 (12:37 +0000)]
[llvm-exegesis] Fix r374158

Some bots complain about missing 'class':

LlvmState.h:70:40: error: declaration of ‘std::unique_ptr<const llvm::TargetMachine> llvm::exegesis::LLVMState::TargetMachine’ [-fpermissive]
   std::unique_ptr<const TargetMachine> TargetMachine;

llvm-svn: 374162

4 years ago[CostModel][X86] Add tests for insertelement to non-immediate vector element indices
Simon Pilgrim [Wed, 9 Oct 2019 12:36:34 +0000 (12:36 +0000)]
[CostModel][X86] Add tests for insertelement to non-immediate vector element indices

llvm-svn: 374161

4 years ago[CostModel][X86] Add tests for extractelement from non-immediate vector element indices
Simon Pilgrim [Wed, 9 Oct 2019 12:36:22 +0000 (12:36 +0000)]
[CostModel][X86] Add tests for extractelement from non-immediate vector element indices

llvm-svn: 374160

4 years ago[ARM] Add saturating arithmetic tests for MVE. NFC
David Green [Wed, 9 Oct 2019 12:29:51 +0000 (12:29 +0000)]
[ARM] Add saturating arithmetic tests for MVE. NFC

llvm-svn: 374159

4 years ago[llvm-exegesis][NFC] Remove extra `llvm::` qualifications.
Clement Courbet [Wed, 9 Oct 2019 11:58:42 +0000 (11:58 +0000)]
[llvm-exegesis][NFC] Remove extra `llvm::` qualifications.

Summary: Second patch: in the lib.

Reviewers: gchatelet

Subscribers: nemanjai, tschuett, MaskRay, mgrang, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 374158

4 years ago[llvm-exegesis][NFC] Remove extra `llvm::` qualifications.
Clement Courbet [Wed, 9 Oct 2019 11:29:21 +0000 (11:29 +0000)]
[llvm-exegesis][NFC] Remove extra `llvm::` qualifications.

Summary: First patch: in unit tests.

Subscribers: nemanjai, tschuett, MaskRay, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 374157

4 years ago[mips] Set default float ABI to "soft" on FreeBSD
Simon Atanasyan [Wed, 9 Oct 2019 10:38:03 +0000 (10:38 +0000)]
[mips] Set default float ABI to "soft" on FreeBSD

Initial patch by Kyle Evans.

Fix PR43596

llvm-svn: 374154

4 years ago[DebugInfo] Enable call site debug info for ARM and AArch64
Nikola Prica [Wed, 9 Oct 2019 10:14:15 +0000 (10:14 +0000)]
[DebugInfo] Enable call site debug info for ARM and AArch64

ARM and AArch64 SelectionDAG support for tacking parameter forwarding
register is implemented so we can allow clang invocations for those two
targets.
Beside that restrict debug entry value support to be emitted for
LimitedDebugInfo info and FullDebugInfo. Other types of debug info do
not have functions nor variables debug info.

Reviewers: aprantl, probinson, dstenb, vsk

Reviewed By: vsk

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

llvm-svn: 374153

4 years ago[Sema] Emit diagnostics for uncorrected delayed typos at the end of TU
Ilya Biryukov [Wed, 9 Oct 2019 10:00:05 +0000 (10:00 +0000)]
[Sema] Emit diagnostics for uncorrected delayed typos at the end of TU

Summary:
Instead of asserting all typos are corrected in the sema destructor.

The sema destructor is not run in the common case of running the compiler
with the -disable-free cc1 flag (which is the default in the driver).

Having this assertion led to crashes in libclang and clangd, which are not
reproducible when running the compiler.

Asserting at the end of the TU could be an option, but finding all
missing typo correction cases is hard and having worse diagnostics instead
of a failing assertion is a better trade-off.

For more discussion on this, see:
https://lists.llvm.org/pipermail/cfe-dev/2019-July/062872.html

Reviewers: sammccall, rsmith

Reviewed By: rsmith

Subscribers: usaxena95, dgoldman, jkorous, vsapsai, rnk, kadircet, cfe-commits

Tags: #clang

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

llvm-svn: 374152

4 years agoRevert r374006: Reland 'Add VFS support for sanitizers' blacklist'
Ilya Biryukov [Wed, 9 Oct 2019 09:40:22 +0000 (09:40 +0000)]
Revert r374006: Reland 'Add VFS support for sanitizers' blacklist'

Also revert follow-up changes to the test.
Reason: the patch breaks our internal clang-tidy integration.

It's also unclear why we should use getRealPath instead of plumbing the
VFS to SanitizerBlacklist, see original commit thread of cfe-commits for
a discussion.

llvm-svn: 374151

4 years ago[TableGen] Fix crash when using HwModes in CodeEmitterGen
James Molloy [Wed, 9 Oct 2019 09:15:34 +0000 (09:15 +0000)]
[TableGen] Fix crash when using HwModes in CodeEmitterGen

When an instruction has an encoding definition for only a subset of
the available HwModes, ensure we just avoid generating an encoding
rather than crash.

llvm-svn: 374150

4 years ago[llvm-exegesis] Add missing std::move in rL374146.
Clement Courbet [Wed, 9 Oct 2019 09:07:21 +0000 (09:07 +0000)]
[llvm-exegesis] Add missing std::move in rL374146.

This was breaking some bots:

/home/buildbots/ppc64le-clang-lnt-test/clang-ppc64le-lnt/llvm/include/llvm/Support/Error.h:483:5:   required from ‘llvm::Expected<T>::Expected(OtherT&&, typename std::enable_if<std::is_convertible<_Rep2, _Rep>::value>::type*) [with OtherT = std::vector<llvm::exegesis::CodeTemplate>&; T = std::vector<llvm::exegesis::CodeTemplate>; typename std::enable_if<std::is_convertible<_Rep2, _Rep>::value>::type = void]’
/home/buildbots/ppc64le-clang-lnt-test/clang-ppc64le-lnt/llvm/tools/llvm-exegesis/lib/X86/Target.cpp:238:20:   required from here
/usr/include/c++/6/bits/stl_construct.h:75:7: error: use of deleted function ‘llvm::exegesis::CodeTemplate::CodeTemplate(const llvm::exegesis::CodeTemplate&)’
     { ::new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

llvm-svn: 374149

4 years agoUnify the two CRC implementations
Hans Wennborg [Wed, 9 Oct 2019 09:06:30 +0000 (09:06 +0000)]
Unify the two CRC implementations

David added the JamCRC implementation in r246590. More recently, Eugene
added a CRC-32 implementation in r357901, which falls back to zlib's
crc32 function if present.

These checksums are essentially the same, so having multiple
implementations seems unnecessary. This replaces the CRC-32
implementation with the simpler one from JamCRC, and implements the
JamCRC interface in terms of CRC-32 since this means it can use zlib's
implementation when available, saving a few bytes and potentially making
it faster.

JamCRC took an ArrayRef<char> argument, and CRC-32 took a StringRef.
This patch changes it to ArrayRef<uint8_t> which I think is the best
choice, and simplifies a few of the callers nicely.

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

llvm-svn: 374148

4 years ago[llvm-exegesis][NFC] Fix rL374146.
Clement Courbet [Wed, 9 Oct 2019 09:03:42 +0000 (09:03 +0000)]
[llvm-exegesis][NFC] Fix rL374146.

Remove extra semicolon: Target.cpp:187:2: warning: extra ‘;’ [-Wpedantic]

llvm-svn: 374147

4 years ago[llvm-exegesis] Explore LEA addressing modes.
Clement Courbet [Wed, 9 Oct 2019 08:49:13 +0000 (08:49 +0000)]
[llvm-exegesis] Explore LEA addressing modes.

Summary:
This will help for PR32326.

This shows the well-known issue with `RBP` and `R13` as base registers.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits, RKSimon, andreadb

Tags: #llvm

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

llvm-svn: 374146

4 years ago[lldb] Don't crash when the ASTImporter produces diagnostics but instead log them.
Raphael Isemann [Wed, 9 Oct 2019 08:30:06 +0000 (08:30 +0000)]
[lldb] Don't crash when the ASTImporter produces diagnostics but instead log them.

When playing with the C++ module prototype I noticed I can get LLDB to crash
by making a result type that depends on __make_integer_seq (a BuiltinTemplate)
which is not supported by the ASTImporter yet. This causes the ASTImporter to emit
a diagnostic when copying the type to the ScratchASTContext. As deporting the result
type is done after we are done parsing and the Clang's diagnostic engine asserts that
it can only be used during parsing, it crashes LLDB while trying to render the diagnostic
in the HandleDiagnostic method of ClangDiagnosticManagerAdapter.

This patch just moves the HandleDiagnostic call to Clang behind our check that we still
have a DiagnosticManager (which we remove after parsing) which prevents the assert
from firing. We also shouldn't ignore such diagnostics, so I added a log statement for
them.

There doesn't seem to way to test this as these diagnostic only happen when we copy
a node that's not supported by the ASTImporter which should never happen once
we can copy everything with the ASTImporter, so every test case we add here will
eventually become invalid.

(Note that most of this diff is just whitespace changes as we now use an early exit
instead of a huge 'if' block).

llvm-svn: 374145

4 years agoRevert r374139, "[dsymutil] Fix handling of common symbols in multiple object files."
Jeremy Morse [Wed, 9 Oct 2019 08:27:48 +0000 (08:27 +0000)]
Revert r374139, "[dsymutil] Fix handling of common symbols in multiple object files."

The added test files ("com", "com1.o", "com2.o") are reserved names on
Windows, and makes 'git checkout' fail with a filesystem error.

llvm-svn: 374144

4 years ago[llvm-exegesis][NFC] Remove unecessary `using llvm::` directives.
Clement Courbet [Wed, 9 Oct 2019 07:52:07 +0000 (07:52 +0000)]
[llvm-exegesis][NFC] Remove unecessary `using llvm::` directives.

We've been in namespace llvm for at least a year.

llvm-svn: 374143

4 years agoUse lld-link instead of llvm-dlltool to create an implib
Rui Ueyama [Wed, 9 Oct 2019 07:04:38 +0000 (07:04 +0000)]
Use lld-link instead of llvm-dlltool to create an implib

Suggested by Martin Storsjö.

llvm-svn: 374142

4 years ago[lld] Don't create hints-section if Hint/Name Table is empty
Rui Ueyama [Wed, 9 Oct 2019 06:48:24 +0000 (06:48 +0000)]
[lld] Don't create hints-section if Hint/Name Table is empty

Fixes assert in addLinkerModuleCoffGroup() when using by-ordinal imports
only.

Patch by Stefan Schmidt.

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

llvm-svn: 374140

4 years ago[dsymutil] Fix handling of common symbols in multiple object files.
Jonas Devlieghere [Wed, 9 Oct 2019 04:16:18 +0000 (04:16 +0000)]
[dsymutil] Fix handling of common symbols in multiple object files.

For common symbols the linker emits only a single symbol entry in the
debug map. This caused dsymutil to not relocate common symbols when
linking DWARF coming form object files that did not have this entry.
This patch fixes that by keeping track of common symbols in the object
files and synthesizing a debug map entry for them using the address from
the main binary.

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

llvm-svn: 374139

4 years ago[TypeSize] Fix module builds (cassert)
Kristina Brooks [Wed, 9 Oct 2019 04:00:03 +0000 (04:00 +0000)]
[TypeSize] Fix module builds (cassert)

TypeSize.h uses `assert` statements without including
the <cassert> header first which leads to failures
in modular builds.

llvm-svn: 374138

4 years agoOptimize operator=(const basic_string&) for tail call.
Eric Fiselier [Wed, 9 Oct 2019 03:07:02 +0000 (03:07 +0000)]
Optimize operator=(const basic_string&) for tail call.

Patch by Martijn Vels (mvels@google.com)
Reviewed as https://reviews.llvm.org/D68276

This is a non trivial win for externally templated assignment operator.

x86 without tail call (current libc++)

0000000000000000 <std::string::operator=(std::string const&)>:
   0:   55                      push   %rbp
   1:   48 89 e5                mov    %rsp,%rbp
   4:   53                      push   %rbx
   5:   50                      push   %rax
   6:   48 89 fb                mov    %rdi,%rbx
   9:   48 39 f7                cmp    %rsi,%rdi
   c:   74 17                   je     25 <std::string::operator=(std::string const&)+0x25>
   e:   0f b6 56 17             movzbl 0x17(%rsi),%edx
  12:   84 d2                   test   %dl,%dl
  14:   79 07                   jns    1d <std::string::operator=(std::string const&)+0x1d>
  16:   48 8b 56 08             mov    0x8(%rsi),%rdx
  1a:   48 8b 36                mov    (%rsi),%rsi
  1d:   48 89 df                mov    %rbx,%rdi
  20:   e8 00 00 00 00          callq  25 <std::string::operator=(std::string const&)+0x25>
  25:   48 89 d8                mov    %rbx,%rax
  28:   48 83 c4 08             add    $0x8,%rsp
  2c:   5b                      pop    %rbx
  2d:   5d                      pop    %rbp
  2e:   c3                      retq

After:

0000000000000000 <std::string::operator=(std::string const&)>:
   0:   48 39 f7                cmp    %rsi,%rdi
   3:   74 14                   je     19 <std::string::operator=(std::string const&)+0x19>
   5:   0f b6 56 17             movzbl 0x17(%rsi),%edx
   9:   84 d2                   test   %dl,%dl
   b:   79 07                   jns    14 <std::string::operator=(std::string const&)+0x14>
   d:   48 8b 56 08             mov    0x8(%rsi),%rdx
  11:   48 8b 36                mov    (%rsi),%rsi
  14:   e9 00 00 00 00          jmpq   19 <std::string::operator=(std::string const&)+0x19>
  19:   48 89 f8                mov    %rdi,%rax
  1c:   c3                      retq

Benchmark (pending per https://reviews.llvm.org/D67667)

```
BM_StringAssignStr_Empty_Opaque                     6.23ns ± 0%             5.19ns ± 0%  -16.70%          (p=0.016 n=5+4)
BM_StringAssignStr_Empty_Transparent                5.86ns ± 0%             5.14ns ± 0%  -12.24%          (p=0.008 n=5+5)
BM_StringAssignStr_Small_Opaque                     8.79ns ± 1%             7.69ns ± 0%  -12.53%          (p=0.008 n=5+5)
BM_StringAssignStr_Small_Transparent                9.44ns ± 0%             8.00ns ± 0%  -15.26%          (p=0.008 n=5+5)
BM_StringAssignStr_Large_Opaque                     25.2ns ± 0%             24.3ns ± 0%   -3.50%          (p=0.008 n=5+5)
BM_StringAssignStr_Large_Transparent                23.6ns ± 0%             22.5ns ± 0%   -4.76%          (p=0.008 n=5+5)
BM_StringAssignStr_Huge_Opaque                       319ns ± 5%              317ns ± 5%     ~             (p=0.690 n=5+5)
BM_StringAssignStr_Huge_Transparent                  319ns ± 5%              317ns ± 5%     ~             (p=0.421 n=5+5)
BM_StringAssignAsciiz_Empty_Opaque                  7.41ns ± 0%             7.77ns ± 0%   +4.89%          (p=0.008 n=5+5)
BM_StringAssignAsciiz_Empty_Transparent             7.54ns ± 3%             7.30ns ± 0%   -3.24%          (p=0.008 n=5+5)
BM_StringAssignAsciiz_Small_Opaque                  9.87ns ± 0%            10.24ns ± 1%   +3.76%          (p=0.008 n=5+5)
BM_StringAssignAsciiz_Small_Transparent             10.4ns ± 1%              9.8ns ± 2%   -5.78%          (p=0.008 n=5+5)
BM_StringAssignAsciiz_Large_Opaque                  30.1ns ± 0%             30.1ns ± 0%     ~             (p=0.167 n=5+5)
BM_StringAssignAsciiz_Large_Transparent             27.1ns ± 0%             27.4ns ± 0%   +0.92%          (p=0.016 n=4+5)
BM_StringAssignAsciiz_Huge_Opaque                    383ns ± 4%              382ns ± 4%     ~             (p=0.548 n=5+5)
BM_StringAssignAsciiz_Huge_Transparent               375ns ± 0%              380ns ± 0%   +1.37%          (p=0.029 n=4+4)
BM_StringAssignAsciizMix_Opaque                     14.0ns ± 0%             14.0ns ± 0%     ~             (p=0.881 n=5+5)
BM_StringAssignAsciizMix_Transparent                13.7ns ± 1%             13.8ns ± 0%     ~             (p=0.056 n=5+5)
```

llvm-svn: 374137

4 years ago[c++20] P1152R4: warn on any simple-assignment to a volatile lvalue
Richard Smith [Wed, 9 Oct 2019 02:04:54 +0000 (02:04 +0000)]
[c++20] P1152R4: warn on any simple-assignment to a volatile lvalue
whose value is not ignored.

We don't warn on all the cases that are deprecated: specifically, we
choose to not warn for now if there are parentheses around the
assignment but its value is not actually used. This seems like a more
defensible rule, particularly for cases like sizeof(v = a), where the
parens are part of the operand rather than the sizeof syntax.

llvm-svn: 374135

4 years ago[c++20] Implement most of P1152R4.
Richard Smith [Wed, 9 Oct 2019 00:49:40 +0000 (00:49 +0000)]
[c++20] Implement most of P1152R4.

Diagnose some now-deprecated uses of volatile types:
 * as function parameter types and return types
 * as the type of a structured binding declaration
 * as the type of the lvalue operand of an increment / decrement /
   compound assignment operator

This does not implement a check for the deprecation of simple
assignments whose results are used; that check requires somewhat
more complexity and will be addressed separately.

llvm-svn: 374133

4 years agoExplicitly set entry point arch when it's thumb [Second Try]
Antonio Afonso [Tue, 8 Oct 2019 23:44:49 +0000 (23:44 +0000)]
Explicitly set entry point arch when it's thumb [Second Try]

Summary:
This is a redo of D68069 because I reverted it due to some concerns that were now addressed along with the new comments that @labath added.

I found a case where the main android binary (app_process32) had thumb code at its entry point but no entry in the symbol table indicating this. This made lldb set a 4 byte breakpoint at that address (we default to arm code) instead of a 2 byte one (like we should for thumb).
The big deal with this is that the expression evaluator uses the entry point as a way to know when a JITed expression has finished executing by putting a breakpoint there. Because of this, evaluating expressions on certain android devices (Google Pixel something) made the process crash.
This was fixed by checking this specific situation when we parse the symbol table and add an artificial symbol for this 2 byte range and indicating that it's arm thumb.

I created 2 unit tests for this, one to check that now we know that the entry point is arm thumb, and the other to make sure we didn't change the behaviour for arm code.

I also run the following on the command line with the `app_process32` where I found the issue:
**Before:**
```
(lldb) dis -s 0x1640 -e 0x1644
app_process32[0x1640]: .long  0xf0004668                ; unknown opcode
```
**After:**
```
(lldb) dis -s 0x1640 -e 0x1644
app_process32`:
app_process32[0x1640] <+0>: mov    r0, sp
app_process32[0x1642]:      andeq  r0, r0, r0
```

Reviewers: clayborg, labath, wallace, espindola

Reviewed By: labath

Subscribers: labath, lldb-commits, MaskRay, kristof.beyls, arichardson, emaste, srhines

Tags: #lldb

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

llvm-svn: 374132

4 years ago[cxx_status] Note that Clang has supported std::source_location since
Richard Smith [Tue, 8 Oct 2019 23:39:56 +0000 (23:39 +0000)]
[cxx_status] Note that Clang has supported std::source_location since
version 9.

llvm-svn: 374131

4 years agoFactor out some duplication. NFC.
Richard Smith [Tue, 8 Oct 2019 23:37:49 +0000 (23:37 +0000)]
Factor out some duplication. NFC.

llvm-svn: 374130

4 years agogn build: unbreak libcxx build after r374116 by restoring gen_link_script.py for gn
Nico Weber [Tue, 8 Oct 2019 23:08:18 +0000 (23:08 +0000)]
gn build: unbreak libcxx build after r374116 by restoring gen_link_script.py for gn

llvm-svn: 374129

4 years ago[Docs] Fixes broken sphinx build - undefined label
DeForest Richards [Tue, 8 Oct 2019 22:45:20 +0000 (22:45 +0000)]
[Docs] Fixes broken sphinx build - undefined label

Removes label ref pointing to non-existent subsystem docs page.

llvm-svn: 374128

4 years ago[clang-scan-deps] Improve string/character literal skipping
Alex Lorenz [Tue, 8 Oct 2019 22:42:44 +0000 (22:42 +0000)]
[clang-scan-deps] Improve string/character literal skipping

The existing string/character literal skipping code in the
dependency directives source minimizer has two issues:

- It doesn't stop the scanning when a newline is reached before the terminating character,
unlike the lexer which considers the token to be done (even if it's invalid) at the end of the line.

- It doesn't support whitespace between '\' and the newline when looking if the '\' is used as a line continuation character.

This commit fixes both issues.

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

llvm-svn: 374127

4 years ago[IRGen] Emit lifetime markers for temporary struct allocas
Francis Visoiu Mistrih [Tue, 8 Oct 2019 22:10:38 +0000 (22:10 +0000)]
[IRGen] Emit lifetime markers for temporary struct allocas

When passing arguments using temporary allocas, we need to add the
appropriate lifetime markers so that the stack coloring passes can
re-use the stack space.

This patch keeps track of all the lifetime.start calls emited before the
codegened call, and adds the corresponding lifetime.end calls after the
call.

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

llvm-svn: 374126

4 years ago[sanitizer] Fix crypt.cpp on Android again
Vitaly Buka [Tue, 8 Oct 2019 22:09:51 +0000 (22:09 +0000)]
[sanitizer] Fix crypt.cpp on Android again

llvm-svn: 374125

4 years ago[IA] Add tests for a few other edge cases
Bill Wendling [Tue, 8 Oct 2019 22:06:09 +0000 (22:06 +0000)]
[IA] Add tests for a few other edge cases

Test with the last eight bits within the range [7F, FF] and with
lower-case hex letters.

llvm-svn: 374124