platform/upstream/llvm.git
4 years ago[libc] Enable llvmlibc clang-tidy checks
Paula Toth [Tue, 24 Mar 2020 03:33:56 +0000 (20:33 -0700)]
[libc] Enable llvmlibc clang-tidy checks

Summary:
Add  clang-tidy for llvm-libc source directory.

Example of check in action:
```
/workspace/llvm-project/libc/src/string/strcpy.cpp:10:1: error: system include stdio.h not allowed [llvmlibc-restrict-system-libc-headers,-warnings-as-errors]
#include <stdio.h>
^~~~~~~~~~~~~~~~~~
```

Reviewers: sivachandra, abrachet

Reviewed By: sivachandra, abrachet

Subscribers: aheejin, MaskRay, tschuett, libc-commits

Tags: #libc-project

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

4 years ago[NFC][RUIP] Small debug output refine
Jinsong Ji [Tue, 24 Mar 2020 02:55:30 +0000 (02:55 +0000)]
[NFC][RUIP] Small debug output refine

Add a new line, so that we always print MI in a new line,
before and after UpdateRegMask, for easier check..

4 years agoAdd an algorithm for performing "optimal" layout of a struct.
John McCall [Fri, 20 Mar 2020 20:45:39 +0000 (16:45 -0400)]
Add an algorithm for performing "optimal" layout of a struct.

The algorithm supports both assigning a fixed offset to a field prior to
layout and allowing fields to have sizes that aren't multiples of their
required alignments.  This means that the well-known algorithm of sorting
by decreasing alignment isn't always good enough.  Still, we start with
that, and only if that leaves padding around do we fall back on a greedy
padding-minimizing algorithm.

There is no known efficient algorithm for producing a guaranteed-minimal
layout in all cases.  In fact, allowing arbitrary fixed-offset fields means
there's a straightforward reduction from bin-packing, making this NP-hard.
But as usual with such problems, we can still efficiently produce adequate
solutions to the cases that matter most to us.

I intend to use this in coroutine frame layout, where the retcon lowerings
very badly want to minimize total space usage, and where the switch lowering
can indeed produce a header with interior padding if the promise field is
highly-aligned.  But it may be useful in a much wider variety of situations.

4 years ago[MLIR] move loopUnrollJamBy*Factor to loop transforms utils
Uday Bondhugula [Mon, 23 Mar 2020 18:26:00 +0000 (23:56 +0530)]
[MLIR] move loopUnrollJamBy*Factor to loop transforms utils

The declarations for these were already part of transforms utils, but
the definitions were left in affine transforms. Move definitions to loop
transforms utils.

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76633

4 years agoCreate basic SBEnvironment class
Walter Erquinigo [Sat, 21 Mar 2020 02:31:33 +0000 (19:31 -0700)]
Create basic SBEnvironment class

4 years ago[MLIR][NFC] loop tiling - improve comments / naming
Uday Bondhugula [Mon, 23 Mar 2020 15:02:58 +0000 (20:32 +0530)]
[MLIR][NFC] loop tiling - improve comments / naming

Improve comments, naming, and other cleanup

Signed-off-by: Uday Bondhugula <uday@polymagelabs.com>
Differential Revision: https://reviews.llvm.org/D76616

4 years ago[mlir] [VectorOps] A "reference" lowering of vector.transpose to LLVM IR
aartbik [Mon, 23 Mar 2020 22:31:51 +0000 (15:31 -0700)]
[mlir] [VectorOps] A "reference" lowering of vector.transpose to LLVM IR

Summary: Makes the vector.tranpose runnable on CPU.

Reviewers: nicolasvasilache, andydavis1, rriddle

Reviewed By: nicolasvasilache

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[VirtualFileSystem] Add unit test for vfs::YAMLVFSWriter
Jonas Devlieghere [Tue, 24 Mar 2020 00:47:18 +0000 (17:47 -0700)]
[VirtualFileSystem] Add unit test for vfs::YAMLVFSWriter

Add a unit test for vfs::YAMLVFSWriter.

This patch exposes an issue in the writer: when we call addFileMapping
with a directory, the VFS writer will emit it as a regular file, causing
any of the nested files or directories to not be found.

4 years agoscudo: Create a public include directory. NFCI.
Peter Collingbourne [Mon, 23 Mar 2020 23:08:18 +0000 (16:08 -0700)]
scudo: Create a public include directory. NFCI.

For MTE error reporting we will need to expose interfaces for crash handlers
to use to interpret scudo headers and metadata. The intent is that these
interfaces will live in scudo/interface.h.

Move the existing interface.h into an include/scudo directory and make it
independent of the internal headers, so that we will be able to add the
interfaces there.

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

4 years agoRevert "Create basic SBEnvironment class"
Walter Erquinigo [Tue, 24 Mar 2020 01:20:10 +0000 (18:20 -0700)]
Revert "Create basic SBEnvironment class"

This reverts commit fd868f517d2c5ca8c0f160dbec0857b14ecf74c1.

4 years agoCreate basic SBEnvironment class
Walter Erquinigo [Sat, 21 Mar 2020 02:31:33 +0000 (19:31 -0700)]
Create basic SBEnvironment class

4 years agoFix a bug in the .mlir lexer, where a \0 character in a file is treated as a colon...
Chris Lattner [Mon, 23 Mar 2020 22:39:32 +0000 (15:39 -0700)]
Fix a bug in the .mlir lexer, where a \0 character in a file is treated as a colon (due to an accidental fall through) instead of whitespace.

Summary:
While here, simplify the lexer a bit by eliminating the unneeded 'operator'
classification of certain sigils, they can just be treated as 'punctuation'.

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[OpenMPOpt] Initialize value to avoid use of uninitialized memory
Johannes Doerfert [Tue, 24 Mar 2020 00:14:34 +0000 (19:14 -0500)]
[OpenMPOpt] Initialize value to avoid use of uninitialized memory

This should fix the issue reported here:
  https://reviews.llvm.org/D76058#1937554

4 years ago[GlobalISel] Combine G_SELECTs of the form (cond ? x : x) into x
Jessica Paquette [Fri, 20 Mar 2020 01:12:18 +0000 (18:12 -0700)]
[GlobalISel] Combine G_SELECTs of the form (cond ? x : x) into x

When we find something like this:

```
%a:_(s32) = G_SOMETHING ...
...
%select:_(s32) = G_SELECT %cond(s1), %a, %a
```

We can remove the select and just replace it entirely with `%a` because it's
always going to result in `%a`.

Same if we have

```
%select:_(s32) = G_SELECT %cond(s1), %a, %b
```

where we can deduce that `%a == %b`.

This implements the following cases:

- `%select:_(s32) = G_SELECT %cond(s1), %a, %a` -> `%a`

- `%select:_(s32) = G_SELECT %cond(s1), %a, %some_copy_from_a` -> `%a`

- `%select:_(s32) = G_SELECT %cond(s1), %a, %b` -> `%a` when `%a` and `%b`
   are defined by identical instructions

This gives a few minor code size improvements on CTMark at -O3 for AArch64.

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

4 years ago[clangd] Rename theia-derived semantic highlighting protocol. NFC
Sam McCall [Mon, 23 Mar 2020 23:31:14 +0000 (00:31 +0100)]
[clangd] Rename theia-derived semantic highlighting protocol. NFC

This feature is being added to LSP with a different (request-response)
protocol in 3.16, so this should avoid some confusion.

4 years ago[compiler-rt] Add ConsumeRandomLengthString() version without arguments.
Max Moroz [Thu, 19 Mar 2020 19:42:23 +0000 (12:42 -0700)]
[compiler-rt] Add ConsumeRandomLengthString() version without arguments.

Reviewers: hctim, metzman

Subscribers: dberris, #sanitizers

Tags: #sanitizers

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

4 years agoUpdate documentation for __builtin_operator_new and
Richard Smith [Mon, 23 Mar 2020 23:30:46 +0000 (16:30 -0700)]
Update documentation for __builtin_operator_new and
__builtin_operator_delete to match r328134.

4 years ago[msan] Fix sigaltstack false positive.
Evgenii Stepanov [Mon, 23 Mar 2020 23:15:58 +0000 (16:15 -0700)]
[msan] Fix sigaltstack false positive.

struct stack_t on Linux x86_64 has internal padding which may be left
uninitialized. The check should be replaced with multiple checks for
individual fields of the struct. For now, remove the check altogether.

4 years ago[analyzer] Delete unneeded headers and using after D76509 for layering check
Fangrui Song [Mon, 23 Mar 2020 23:09:59 +0000 (16:09 -0700)]
[analyzer] Delete unneeded headers and using after D76509 for layering check

Otherwise it is incorrect to remove clangStaticAnalyzerFrontend's
dependency on clangRewrite and clangToolingCore.

4 years ago[PowerPC] Improve handling of some BUILD_VECTOR nodes
Nemanja Ivanovic [Mon, 23 Mar 2020 22:34:05 +0000 (17:34 -0500)]
[PowerPC] Improve handling of some BUILD_VECTOR nodes

An analysis of real world code turned up a number of patterns with BUILD_VECTOR
of nodes resulting from operations on extracted vector elements for which we
produce poor code. This addresses those cases. No attempt is made for
completeness as that would entail a large amount of work for something that
there is no evidence of in real code.

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

4 years ago[examples] Fixes for BUILD_SHARED_LIBS=on
Stephen Neuendorffer [Mon, 23 Mar 2020 22:20:54 +0000 (15:20 -0700)]
[examples] Fixes for BUILD_SHARED_LIBS=on

4 years ago[MLIR] Fixes for BUILD_SHARED_LIBS=on
Stephen Neuendorffer [Mon, 23 Mar 2020 22:20:14 +0000 (15:20 -0700)]
[MLIR] Fixes for BUILD_SHARED_LIBS=on

4 years ago[MLIR] Insert loop.yield to IfOp regions only if it's void.
Alexander Belyaev [Mon, 23 Mar 2020 21:33:33 +0000 (22:33 +0100)]
[MLIR] Insert loop.yield to IfOp regions only if it's void.

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

4 years ago[OPENMP50]Add 'default' modifier in reduction clauses.
Alexey Bataev [Mon, 23 Mar 2020 21:30:38 +0000 (17:30 -0400)]
[OPENMP50]Add 'default' modifier in reduction clauses.

Added full support for 'default' modifier in the reduction clauses.

4 years ago[PowerPC]: e500 target can't use lwsync, use msync instead
Justin Hibbits [Mon, 23 Mar 2020 14:44:39 +0000 (09:44 -0500)]
[PowerPC]: e500 target can't use lwsync, use msync instead

The e500 core has a silicon bug that triggers an illegal instruction
program trap on any sync other than msync.  Other cores will typically
ignore illegal sync types, and the documentation even implies that the
'illegal' bits are ignored.

Address this hardware deficiency by only using msync, like the PPC440.

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

4 years agoPR45142: 'template ~X<T>' is ill-formed; reject it rather than crashing.
Richard Smith [Mon, 23 Mar 2020 22:05:38 +0000 (15:05 -0700)]
PR45142: 'template ~X<T>' is ill-formed; reject it rather than crashing.

4 years agoImprove module.pcm lock file performance on machines with high core counts
Ladd Van Tol [Mon, 23 Mar 2020 21:16:55 +0000 (14:16 -0700)]
Improve module.pcm lock file performance on machines with high core counts

Summary:
When building a large Xcode project with multiple module dependencies, and mixed Objective-C & Swift, I observed a large number of clang processes stalling at zero CPU for 30+ seconds throughout the build. This was especially prevalent on my 18-core iMac Pro.

After some sampling, the major cause appears to be the lock file implementation for precompiled modules in the module cache. When the lock is heavily contended by multiple clang processes, the exponential backoff runs in lockstep, with some of the processes sleeping for 30+ seconds in order to acquire the file lock.

In the attached patch, I implemented a more aggressive polling mechanism that limits the sleep interval to a max of 500ms, and randomizes the wait time. I preserved a limited form of exponential backoff. I also updated the code to use cross-platform timing, thread sleep, and random number capabilities available in C++11.

On iMac Pro (2.3 GHz Intel Xeon W, 18 core):

Xcode 11.1 bundled clang:

502.2 seconds (average of 5 runs)

Custom clang build with LockFileManager patch applied:

276.6 seconds (average of 5 runs)

This is a 1.82x speedup for this use case.

On MacBook Pro (4 core 3.1GHz Intel i7):

Xcode 11.1 bundled clang:

539.4 seconds (average of 2 runs)

Custom clang build with LockFileManager patch applied:

509.5 seconds (average of 2 runs)

As expected, machines with fewer cores benefit less from this change.

```
Call graph:
    2992 Thread_393602   DispatchQueue_1: com.apple.main-thread  (serial)
      2992 start  (in libdyld.dylib) + 1  [0x7fff6a1683d5]
        2992 main  (in clang) + 297  [0x1097a1059]
          2992 driver_main(int, char const**)  (in clang) + 2803  [0x1097a5513]
            2992 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)  (in clang) + 1608  [0x1097a7cc8]
              2992 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)  (in clang) + 3299  [0x1097dace3]
                2992 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)  (in clang) + 509  [0x1097dcc1d]
                  2992 clang::FrontendAction::Execute()  (in clang) + 42  [0x109818b3a]
                    2992 clang::ParseAST(clang::Sema&, bool, bool)  (in clang) + 185  [0x10981b369]
                      2992 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)  (in clang) + 37  [0x10983e9b5]
                        2992 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)  (in clang) + 141  [0x10983ecfd]
                          2992 clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*)  (in clang) + 695  [0x10983f3b7]
                            2992 clang::Parser::ParseObjCAtDirectives(clang::Parser::ParsedAttributesWithRange&)  (in clang) + 637  [0x10a9be9bd]
                              2992 clang::Parser::ParseModuleImport(clang::SourceLocation)  (in clang) + 170  [0x10c4841ba]
                                2992 clang::Parser::ParseModuleName(clang::SourceLocation, llvm::SmallVectorImpl<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation> >&, bool)  (in clang) + 503  [0x10c485267]
                                  2992 clang::Preprocessor::Lex(clang::Token&)  (in clang) + 316  [0x1098285cc]
                                    2992 clang::Preprocessor::LexAfterModuleImport(clang::Token&)  (in clang) + 690  [0x10cc7af62]
                                      2992 clang::CompilerInstance::loadModule(clang::SourceLocation, llvm::ArrayRef<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation> >, clang::Module::NameVisibilityKind, bool)  (in clang) + 7989  [0x10bba6535]
                                        2992 compileAndLoadModule(clang::CompilerInstance&, clang::SourceLocation, clang::SourceLocation, clang::Module*, llvm::StringRef)  (in clang) + 296  [0x10bba8318]
                                          2992 llvm::LockFileManager::waitForUnlock()  (in clang) + 91  [0x10b6953ab]
                                            2992 nanosleep  (in libsystem_c.dylib) + 199  [0x7fff6a22c914]
                                              2992 __semwait_signal  (in libsystem_kernel.dylib) + 10  [0x7fff6a2a0f32]

```

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

4 years ago[lldb/PlatformDarwin] Always delete destination file first in PutFile
Fred Riss [Thu, 19 Mar 2020 15:43:41 +0000 (08:43 -0700)]
[lldb/PlatformDarwin] Always delete destination file first in PutFile

Summary:
The default behavior of Platform::PutFile is to open the file and
truncate it if it already exists. This works fine and is a sensible
default, but it interacts badly with code-signing on iOS, as doing so
invalidates the signature of the file (even if the new content has a
valid code signature).

We have a couple tests which on purpose reload a different binary with
the same name. Those tests are currently broken because of the above
interaction.

This patch simply makes the Darwin platform unconditionally delete the
destination file before sending the new one to work around this issue.

Reviewers: jasonmolenda

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lld] Enabling loading LLVM pass plugins
Eli Friedman [Mon, 23 Mar 2020 19:20:05 +0000 (12:20 -0700)]
[lld] Enabling loading LLVM pass plugins

Add the relevant magic bits to allow "-mllvm=-load=plugin.so" etc.

This is now using export_executable_symbols_for_plugins, so symbols are
only exported if plugins are enabled.

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

4 years ago[gn build] Port 7bf871c39f7
LLVM GN Syncbot [Mon, 23 Mar 2020 21:05:55 +0000 (21:05 +0000)]
[gn build] Port 7bf871c39f7

4 years ago[analyzer] ConstraintManager - use EXPENSIVE_CHECKS instead of (gcc specific) __OPTIM...
Simon Pilgrim [Mon, 23 Mar 2020 21:02:54 +0000 (21:02 +0000)]
[analyzer] ConstraintManager - use EXPENSIVE_CHECKS instead of (gcc specific) __OPTIMIZE__ guard

This was noticed on D71817, which removed another use of __OPTIMIZE__

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

4 years agoAMDGPU: Allow vectorization of round intrinsic
Matt Arsenault [Fri, 20 Mar 2020 21:16:46 +0000 (17:16 -0400)]
AMDGPU: Allow vectorization of round intrinsic

There seems to be a small benefit to the legalized sequence for v2f16
round with packed instructions, so allow vectorizing it by reducing
the cost.

An unintended side effect is vectorization of f32 round also
happens. The current FMA logic seems off to me, and isn't checking for
packed instructions.

4 years ago[Clang] Fix HIP tests when running on Windows with the LLVM toolchain is in the path
Alexandre Ganea [Mon, 23 Mar 2020 20:54:24 +0000 (16:54 -0400)]
[Clang] Fix HIP tests when running on Windows with the LLVM toolchain is in the path

On Windows, when the LLVM toolchain is in the current path (%PATH%), fusing the linker yields c:\{path}\lld.exe whereas the hip tests did not expect the .exe part.
This only happens if LLD is not present in the build folder, which consequently makes the code in Driver::GetProgramPath() to fall back to %PATH% and platform-specific search, which includes the .exe part (see https://github.com/llvm/llvm-project/blob/master/clang/lib/Driver/Driver.cpp#L4733).

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

4 years agoAMDGPU: Emit llvm.fshr for __builtin_amdgcn_alignbit
Matt Arsenault [Fri, 20 Mar 2020 01:40:58 +0000 (21:40 -0400)]
AMDGPU: Emit llvm.fshr for __builtin_amdgcn_alignbit

These are equivalent. The generic rotate builtins do not directly map
to the fshr intrinsic.

4 years agoGVNSink: Allow handling addrspacecast
Matt Arsenault [Mon, 23 Mar 2020 20:26:02 +0000 (16:26 -0400)]
GVNSink: Allow handling addrspacecast

4 years ago[analyzer][NFC] Move the text output type to its own file, move code to PathDiagnosti...
Kirstóf Umann [Thu, 19 Mar 2020 13:53:09 +0000 (14:53 +0100)]
[analyzer][NFC] Move the text output type to its own file, move code to PathDiagnosticConsumer creator functions

TableGen and .def files (which are meant to be used with the preprocessor) come
with obvious downsides. One of those issues is that generated switch-case
branches have to be identical. This pushes corner cases either to an outer code
block, or into the generated code.

Inspect the removed code in AnalysisConsumer::DigestAnalyzerOptions. You can see
how corner cases like a not existing output file, the analysis output type being
set to PD_NONE, or whether to complement the output with additional diagnostics
on stderr lay around the preprocessor generated code. This is a bit problematic,
as to how to deal with such errors is not in the hands of the users of this
interface (those implementing output types, like PlistDiagnostics etc).

This patch changes this by moving these corner cases into the generated code,
more specifically, into the called functions. In addition, I introduced a new
output type for convenience purposes, PD_TEXT_MINIMAL, which always existed
conceptually, but never in the actual Analyses.def file. This refactoring
allowed me to move TextDiagnostics (renamed from ClangDiagPathDiagConsumer) to
its own file, which it really deserved.

Also, those that had the misfortune to gaze upon Analyses.def will probably
enjoy the sight that a clang-format did on it.

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

4 years ago[llvm-objcopy] Improve tool selection logic to recognize llvm-strip-$major as strip
Fangrui Song [Sun, 22 Mar 2020 06:39:01 +0000 (23:39 -0700)]
[llvm-objcopy] Improve tool selection logic to recognize llvm-strip-$major as strip

Debian and some other distributions install llvm-strip as llvm-strip-$major (e.g. `/usr/bin/llvm-strip-9`)

D54193 made it work with llvm-strip-$major but did not add a test.
The behavior was regressed by D69146.

Fixes https://github.com/ClangBuiltLinux/linux/issues/940

Reviewed By: alexshap

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

4 years ago[Attributor][NFC] Refactorings and typos in doc
Stefanos Baziotis [Mon, 23 Mar 2020 20:44:10 +0000 (22:44 +0200)]
[Attributor][NFC] Refactorings and typos in doc

Reviewed By: sstefan1, uenoku

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

4 years agoInternal expressions shouldn't increment the result variable numbering.
Jim Ingham [Fri, 20 Mar 2020 21:59:54 +0000 (14:59 -0700)]
Internal expressions shouldn't increment the result variable numbering.

There an option: EvaluateExpressionOptions::SetResultIsInternal to indicate
whether the result number should be returned to the pool or not.  It
got broken when the PersistentExpressionState was refactored.

This fixes the issue and provides a test of the behavior.

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

4 years ago[compiler-rt] Intercept the uname() function
Ilya Leoshkevich [Mon, 23 Mar 2020 19:46:20 +0000 (12:46 -0700)]
[compiler-rt] Intercept the uname() function

Summary:
Move interceptor from msan to sanitizer_common_interceptors.inc, so that
other sanitizers could benefit.

Adjust FixedCVE_2016_2143() to deal with the intercepted uname().

Patch by Ilya Leoshkevich.

Reviewers: eugenis, vitalybuka, uweigand, jonpa

Reviewed By: eugenis, vitalybuka

Subscribers: dberris, krytarowski, #sanitizers, stefansf, Andreas-Krebbel

Tags: #sanitizers

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

4 years agoFix "previously declared as a struct" warning
Vitaly Buka [Mon, 23 Mar 2020 19:49:41 +0000 (12:49 -0700)]
Fix "previously declared as a struct" warning

4 years agoAllow replacing intrinsic operands with variables
Matt Arsenault [Wed, 13 Feb 2019 23:28:16 +0000 (18:28 -0500)]
Allow replacing intrinsic operands with variables

Since intrinsics can now specify when an argument is required to be
constant, it is now OK to replace arguments with variables if they
aren't. This means intrinsics must now be accurately marked with
immarg.

4 years ago[OpenMP][NFC] Minimize memory usage and copying of `OMPTraitInfo`s
Johannes Doerfert [Sat, 14 Mar 2020 04:42:05 +0000 (23:42 -0500)]
[OpenMP][NFC] Minimize memory usage and copying of `OMPTraitInfo`s

See rational here: https://reviews.llvm.org/D71830#1922656

Reviewed By: rnk

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

4 years ago[OpenMP][NFC] Reduce instantiation time with different data structure
Johannes Doerfert [Sat, 14 Mar 2020 00:39:09 +0000 (19:39 -0500)]
[OpenMP][NFC] Reduce instantiation time with different data structure

See rational here: https://reviews.llvm.org/D71847#1922648

Reviewed By: rnk

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

4 years agoDon't export symbols from clang/opt/llc if plugins are disabled.
Eli Friedman [Fri, 20 Mar 2020 21:00:19 +0000 (14:00 -0700)]
Don't export symbols from clang/opt/llc if plugins are disabled.

The only reason we export symbols from these tools is to support
plugins; if we don't have plugins, exporting symbols just bloats the
executable and makes LTO less effective.

See review of D75879 for the discussion that led to this patch.

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

4 years ago[gn build] Port 56abcfad70e
LLVM GN Syncbot [Mon, 23 Mar 2020 19:09:57 +0000 (19:09 +0000)]
[gn build] Port 56abcfad70e

4 years agoRevert "[analyzer][NFC] Tie CheckerRegistry to CheckerManager, allow CheckerManager...
Jonas Devlieghere [Mon, 23 Mar 2020 18:56:39 +0000 (11:56 -0700)]
Revert "[analyzer][NFC] Tie CheckerRegistry to CheckerManager, allow CheckerManager to be constructed for non-analysis purposes"

Temporarily reverting this patch because it breaks the modules build.

4 years agoAMDGPU/GlobalISel: Implement computeNumSignBitsForTargetInstr
Matt Arsenault [Sun, 22 Mar 2020 23:06:30 +0000 (19:06 -0400)]
AMDGPU/GlobalISel: Implement computeNumSignBitsForTargetInstr

4 years agoGlobalISel: Prepare to allow other target unit tests
Matt Arsenault [Sun, 22 Mar 2020 22:12:25 +0000 (18:12 -0400)]
GlobalISel: Prepare to allow other target unit tests

Currently all GlobalISel unittests use a hardcoded AArch64 target
machine. Factor this so I can write some for AMDGPU specific known
bits unittests.

4 years agoGlobalISel: Add computeKnownBitsForTargetInstr
Matt Arsenault [Wed, 22 Jan 2020 15:31:03 +0000 (10:31 -0500)]
GlobalISel: Add computeKnownBitsForTargetInstr

I think we can save the MRI argument from these since it's in
GISelKnownBits already, but currently not accessible.

Implementation deferred to avoid dependency on other patches.

4 years ago[Support] Fix clang warning in widenPath NFC
Andrew Ng [Sat, 21 Mar 2020 12:06:06 +0000 (12:06 +0000)]
[Support] Fix clang warning in widenPath NFC

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

4 years ago[mlir] Fix unsafe create operation in GreedyPatternRewriter
MaheshRavishankar [Thu, 19 Mar 2020 23:02:18 +0000 (16:02 -0700)]
[mlir] Fix unsafe create operation in GreedyPatternRewriter

When trying to fold an operation during operation creation check that
the operation folding succeeds before inserting the op.

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

4 years ago[DataFormatters] Add formatter for libc++ std::unique_ptr
shafik [Mon, 23 Mar 2020 18:42:41 +0000 (11:42 -0700)]
[DataFormatters] Add formatter for libc++ std::unique_ptr

This adds a formatter for libc++ std::unique_ptr.

I also refactored GetValueOfCompressedPair(...) out of LibCxxList.cpp since I need the same functionality and it made sense to share it.

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

4 years ago[CMake] Fix AMDGPUTests -DBUILD_SHARED_LIBS=on builds and trim dependencies of AMDGPU...
Fangrui Song [Mon, 23 Mar 2020 18:12:10 +0000 (11:12 -0700)]
[CMake] Fix AMDGPUTests -DBUILD_SHARED_LIBS=on builds and trim dependencies of AMDGPUTests and AMDDwarfTests after D76357/G24698e526f619271705fe72bcaa928be9bc82484

FAILED: unittests/Target/AMDGPU/AMDGPUTests
...
ld.lld: error: undefined symbol: llvm::MCRegisterInfo::getLLVMRegNum(unsigned int, bool) const
>>> referenced by DwarfRegMappings.cpp:60 (/usr/local/google/home/maskray/llvm/llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp:60)
>>>               unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/DwarfRegMappings.cpp.o:(AMDGPUDwarfRegMappingTests_TestWave64DwarfRegMapping_Test::TestBody())
>>> referenced by DwarfRegMappings.cpp:82 (/usr/local/google/home/maskray/llvm/llvm/unittests/Target/AMDGPU/DwarfRegMappings.cpp:82)
>>>               unittests/Target/AMDGPU/CMakeFiles/AMDGPUTests.dir/DwarfRegMappings.cpp.o:(AMDGPUDwarfRegMappingTests_TestWave32DwarfRegMapping_Test::TestBody())

A -DBUILD_SHARED_LIBS=off build is good because AMDGPUCodeGen pulls in MC.
A -DBUILD_SHARED_LIBS=on build requires all direct dependencies (MC) to be listed becuase llvm/cmake/modules/HandleLLVMOptions.cmake uses -Wl,-z,defs

4 years agoFix a warning building on my machine, NFC. warning: unused function 'compilePtxToCubi...
Chris Lattner [Mon, 23 Mar 2020 16:51:07 +0000 (09:51 -0700)]
Fix a warning building on my machine, NFC. warning: unused function 'compilePtxToCubinForTesting'

Summary: Also eliminate the redunant anon namespace around the already static function.

Reviewers: herhut

Subscribers: hiraditya, steven_wu, dexonsmith, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, csigg, arpith-jacob, mgester, lucyrfox, aartbik, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] remove one-use check for ctpop -> cttz
Sanjay Patel [Mon, 23 Mar 2020 17:56:07 +0000 (13:56 -0400)]
[InstCombine] remove one-use check for ctpop -> cttz

Two one-use checks were added with rGfdcb27105537,
but only the first one is necessary to limit an
increase in instruction count. The second transform
only creates one instruction, so it is always a
reasonable canonicalization/optimization.

4 years ago[ELF] Keep orphan section names (.rodata.foo .text.foo) unchanged if !hasSectionsCommand
Fangrui Song [Wed, 26 Feb 2020 02:00:13 +0000 (18:00 -0800)]
[ELF] Keep orphan section names (.rodata.foo .text.foo) unchanged if !hasSectionsCommand

This behavior matches GNU ld and seems reasonable.

```
// If a SECTIONS command is not specified
.text.* -> .text
.rodata.* -> .rodata
.init_array.* -> .init_array
```

A proposed Linux feature CONFIG_FG_KASLR may depend on the GNU ld behavior.

Reword a comment about -z keep-text-section-prefix and a comment about
CommonSection (deleted by rL286234).

Reviewed By: grimar

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

4 years ago[gn build] Port 57b8a407493
LLVM GN Syncbot [Mon, 23 Mar 2020 17:23:22 +0000 (17:23 +0000)]
[gn build] Port 57b8a407493

4 years ago[gn build] Port 24698e526f619271705fe72bcaa928be9bc82484. Fix AMDGPUTests
Fangrui Song [Mon, 23 Mar 2020 17:22:07 +0000 (10:22 -0700)]
[gn build] Port 24698e526f619271705fe72bcaa928be9bc82484. Fix AMDGPUTests

4 years ago[clang-format] No space inserted between commas in C#
Jonathan Coe [Mon, 23 Mar 2020 17:17:27 +0000 (17:17 +0000)]
[clang-format] No space inserted between commas in C#

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

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

4 years ago[OPENMP50]Bassic support for exclusive clause.
Alexey Bataev [Mon, 23 Mar 2020 14:41:08 +0000 (10:41 -0400)]
[OPENMP50]Bassic support for exclusive clause.

Added basic support (parsing/sema/serialization) for exclusive clause in
scan directives.

4 years ago[openmp][runtime] Fixed hang for explicit task inside a taskloop.
AndreyChurbanov [Mon, 23 Mar 2020 17:02:19 +0000 (20:02 +0300)]
[openmp][runtime] Fixed hang for explicit task inside a taskloop.

Added missed initialization of td_last_tied field for taskloop tasks.

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

4 years ago[gn build] Port 24698e526f619271705fe72bcaa928be9bc82484
Fangrui Song [Mon, 23 Mar 2020 16:55:39 +0000 (09:55 -0700)]
[gn build] Port 24698e526f619271705fe72bcaa928be9bc82484

4 years ago[lldb/Reproducers] Mark reproducer test directory as unsupported on Windows
Jonas Devlieghere [Mon, 23 Mar 2020 16:52:42 +0000 (09:52 -0700)]
[lldb/Reproducers] Mark reproducer test directory as unsupported on Windows

Reproducers are unsupported on Windows. Rather than having a UNSUPPORTED
line in every test, just skip the whole subdirectory.

4 years ago[OpenMPOpt] Validate declaration types against the expected types
Johannes Doerfert [Mon, 23 Mar 2020 15:47:06 +0000 (10:47 -0500)]
[OpenMPOpt] Validate declaration types against the expected types

Validation of the found runtime library functions declarations types
(return and argument types) with the expected types.

Reviewed By: jdoerfert

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

4 years ago[OpenMPOpt][FIX] Resolve OpenMP runtime call type mismatches
Johannes Doerfert [Mon, 23 Mar 2020 16:39:34 +0000 (11:39 -0500)]
[OpenMPOpt][FIX] Resolve OpenMP runtime call type mismatches

Exposed by D76058 and tested once that one lands.

4 years ago[Attributor] Fold single-use variable into assert
Benjamin Kramer [Mon, 23 Mar 2020 16:41:52 +0000 (17:41 +0100)]
[Attributor] Fold single-use variable into assert

Fixes unused variable warning in Release builds.

4 years ago[ELF][test] Clean text-section-prefix.s
Fangrui Song [Mon, 23 Mar 2020 16:27:49 +0000 (09:27 -0700)]
[ELF][test] Clean text-section-prefix.s

4 years ago[Analyzer] IteratorRangeChecker verify `std::advance()`, `std::prev()` and `std:...
Adam Balogh [Wed, 18 Mar 2020 19:15:20 +0000 (20:15 +0100)]
[Analyzer] IteratorRangeChecker verify `std::advance()`, `std::prev()` and `std::next()`

Upon calling one of the functions `std::advance()`, `std::prev()` and
`std::next()` iterators could get out of their valid range which leads
to undefined behavior. If all these funcions are inlined together with
the functions they call internally (e.g. `__advance()` called by
`std::advance()` in some implementations) the error is detected by
`IteratorRangeChecker` but the bug location is inside the STL
implementation. Even worse, if the budget runs out and one of the calls
is not inlined the bug remains undetected. This patch fixes this
behavior: all the bugs are detected at the point of the STL function
invocation.

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

4 years ago[Support] Silence warning in Path unittests when compiling with clang-cl
Alexandre Ganea [Mon, 23 Mar 2020 16:19:07 +0000 (12:19 -0400)]
[Support] Silence warning in Path unittests when compiling with clang-cl

warning: comparison of integers of different signs: 'const unsigned long long' and 'const int' [-Wsign-compare]

4 years ago[ARM] Extra VMOVN and VMULL tests. NFC
David Green [Mon, 23 Mar 2020 12:39:00 +0000 (12:39 +0000)]
[ARM] Extra VMOVN and VMULL tests. NFC

4 years ago[libc++] Bump Clang support for Clang 4
Louis Dionne [Mon, 23 Mar 2020 15:37:40 +0000 (11:37 -0400)]
[libc++] Bump Clang support for Clang 4

It's hard to imagine someone using a recent version of libc++ with a
roughly 3 years old Clang. Since we're not testing libc++ with Clang 3.5
anyway, claiming support for it is somewhat of a lie.

Note that we don't test Clang 4 either, however I have no reason to bump
the requirement beyond Clang 4 at the moment, whereas removing Clang 3.5
allows simplifying the test suite.

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

4 years ago[lldb/testsuite] Skip part of TestSettings.py on windows
Fred Riss [Mon, 23 Mar 2020 16:13:40 +0000 (09:13 -0700)]
[lldb/testsuite] Skip part of TestSettings.py on windows

The newly introduced tests for unsetting environment variables
is failing on Windows. Skip the test there to allow investigation.

It seems like setting inherit-env to false was never tested
before. Could it be that the Windows process launcher doesn't
honor this setting?

4 years agoAdd AMDGPU MC unittests only when AMDGPU target is being built
Ram Nalamothu [Mon, 23 Mar 2020 15:56:02 +0000 (21:26 +0530)]
Add AMDGPU MC unittests only when AMDGPU target is being built

Fixes the build failures introduced by 24698e526f619271705fe72bcaa928be9bc82484

4 years ago[analyzer][NFC] Tie CheckerRegistry to CheckerManager, allow CheckerManager to be...
Kristóf Umann [Fri, 28 Feb 2020 14:07:50 +0000 (15:07 +0100)]
[analyzer][NFC] Tie CheckerRegistry to CheckerManager, allow CheckerManager to be constructed for non-analysis purposes

Its been a while since my CheckerRegistry related patches landed, allow me to
refresh your memory:

During compilation, TblGen turns
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td into
(build directory)/tools/clang/include/clang/StaticAnalyzer/Checkers/Checkers.inc.
This is a file that contains the full name of the checkers, their options, etc.

The class that is responsible for parsing this file is CheckerRegistry. The job
of this class is to establish what checkers are available for the analyzer (even
from plugins and statically linked but non-tblgen generated files!), and
calculate which ones should be turned on according to the analyzer's invocation.

CheckerManager is the class that is responsible for the construction and storage
of checkers. This process works by first creating a CheckerRegistry object, and
passing itself to CheckerRegistry::initializeManager(CheckerManager&), which
will call the checker registry functions (for example registerMallocChecker) on
it.

The big problem here is that these two classes lie in two different libraries,
so their interaction is pretty awkward. This used to be far worse, but I
refactored much of it, which made things better but nowhere near perfect.

---

This patch changes how the above mentioned two classes interact. CheckerRegistry
is mainly used by CheckerManager, and they are so intertwined, it makes a lot of
sense to turn in into a field, instead of a one-time local variable. This has
additional benefits: much of the information that CheckerRegistry conveniently
holds is no longer thrown away right after the analyzer's initialization, and
opens the possibility to pass CheckerManager in the shouldRegister* function
rather then LangOptions (D75271).

There are a few problems with this. CheckerManager isn't the only user, when we
honor help flags like -analyzer-checker-help, we only have access to a
CompilerInstance class, that is before the point of parsing the AST.
CheckerManager makes little sense without ASTContext, so I made some changes and
added new constructors to make it constructible for the use of help flags.

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

4 years agorecommit 1b978ddba05c [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing...
Yaxun (Sam) Liu [Wed, 26 Feb 2020 15:57:39 +0000 (10:57 -0500)]
recommit 1b978ddba05c [CUDA][HIP][OpenMP] Emit deferred diagnostics by a post-parsing AST travese

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

4 years ago[libc++] [NFC] Test that correct value category is used in scoped_allocator_adaptor...
zoecarver [Mon, 23 Mar 2020 16:05:47 +0000 (09:05 -0700)]
[libc++] [NFC] Test that correct value category is used in scoped_allocator_adaptor::construct

This patch fixes 2586. Just tests. NFC.

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

4 years agoAdd support for custom op parser/printer hooks to know about result names.
Chris Lattner [Mon, 16 Mar 2020 00:13:59 +0000 (17:13 -0700)]
Add support for custom op parser/printer hooks to know about result names.

Summary:
This allows the custom parser/printer hooks to do interesting things with
the SSA names.  This patch:

 - Adds a new 'getResultName' method to OpAsmParser that allows a parser
   implementation to get information about its result names, along with
   a getNumResults() method that allows op parser impls to know how many
   results are expected.
 - Adds a OpAsmPrinter::printOperand overload that takes an explicit stream.
 - Adds a test.string_attr_pretty_name operation that uses these hooks to
   do fancy things with the result name.

Reviewers: rriddle!

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits

Tags: #llvm

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

4 years ago[Win64] Insert int3 into trailing empty BBs
Reid Kleckner [Fri, 20 Mar 2020 21:06:27 +0000 (14:06 -0700)]
[Win64] Insert int3 into trailing empty BBs

Otherwise, the Win64 unwinder considers direct branches to such empty
trailing BBs to be a branch out of the function. It treats such a branch
as a tail call, which can only be part of an epilogue. If the unwinder
misclassifies such a branch as part of the epilogue, it will fail to
unwind the stack further. This can lead to bad stack traces, or failure
to handle exceptions properly. This is described in
https://llvm.org/PR45064#c4, and by the comment at the top of the
X86AvoidTrailingCallPass.cpp file.

It should be safe to insert int3 for such blocks. An empty trailing BB
that reaches this pass is pretty much guaranteed to be unreachable.  If
a program executed such a block, it would fall off the end of the
function.

Most of the complexity in this patch comes from threading through the
"EHFuncletEntry" boolean on the MIRParser and registering the pass so we
can stop and start codegen around it. I used an MIR test because we
should teach LLVM to optimize away these branches as a follow-up.

Reviewed By: hans

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

4 years ago[Analysis] simplify code for scaleShuffleMask
Sanjay Patel [Mon, 23 Mar 2020 15:34:09 +0000 (11:34 -0400)]
[Analysis] simplify code for scaleShuffleMask

This is NFC-ish. The results should be identical, but perf is hopefully
better with the fast-path for no scaling. Added a unit test for that.

The code is adapted from what used to be the DAGCombiner equivalent
function before D76508 (rG0eeee83d7513).

4 years ago[Attributor][NFC] Copy llvm::function_ref, don't use references
Johannes Doerfert [Mon, 23 Mar 2020 07:02:09 +0000 (02:02 -0500)]
[Attributor][NFC] Copy llvm::function_ref, don't use references

On IRC this was called a "code smell" so we get rid of it.

4 years ago[Attributor] Handle calls in AAValueConstantRange properly
Johannes Doerfert [Fri, 20 Mar 2020 06:37:27 +0000 (01:37 -0500)]
[Attributor] Handle calls in AAValueConstantRange properly

We did handle calls that were operands of certain instructions but not
standalone calls we visit via indirection, e.g., selects.

4 years ago[Attributor] Unify handling of must-tail calls
Johannes Doerfert [Tue, 17 Mar 2020 01:23:27 +0000 (20:23 -0500)]
[Attributor] Unify handling of must-tail calls

We special cased must-tail calls all over the place because they cannot
be modified as other calls can be. However, we already centralized the
modification API so we can centralize the handling as well. This
simplifies the code and allows to remove must-tail calls completely.

4 years ago[Attributor][NFC] Predetermine the module before verification
Johannes Doerfert [Tue, 17 Mar 2020 01:18:07 +0000 (20:18 -0500)]
[Attributor][NFC] Predetermine the module before verification

It could happen that we delete the first function in the SCC in the
future so we should be careful accessing `Functions` after the manifest
stage.

4 years ago[Attributor][NFC] clang-format Attributor.{h,cpp}
Johannes Doerfert [Mon, 23 Mar 2020 07:03:23 +0000 (02:03 -0500)]
[Attributor][NFC] clang-format Attributor.{h,cpp}

4 years ago[Syntax] Build mapping from AST to syntax tree nodes
Marcel Hlopko [Mon, 23 Mar 2020 15:05:13 +0000 (16:05 +0100)]
[Syntax] Build mapping from AST to syntax tree nodes

Summary:
Copy of https://reviews.llvm.org/D72446, submitting with Ilya's permission.

Only used to assign roles to child nodes for now. This is more efficient
than doing range-based queries.

In the future, will be exposed in the public API of syntax trees.

Reviewers: gribozavr2

Reviewed By: gribozavr2

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[GlobalISel] Add generic opcodes for saturating add/subtract
Jay Foad [Mon, 24 Feb 2020 11:13:05 +0000 (11:13 +0000)]
[GlobalISel] Add generic opcodes for saturating add/subtract

Summary:
Add new generic MIR opcodes G_SADDSAT etc. Add support in IRTranslator
for translating the saturating add/subtract intrinsics to the new
opcodes.

Reviewers: aemerson, dsanders, paquette, arsenm

Subscribers: jvesely, wdng, nhaehnle, rovka, hiraditya, volkan, kerbowa, llvm-commits

Tags: #llvm

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

4 years agoAMDGPU/GlobalISel: Add some oversized G_IMPLICIT_DEF tests
Matt Arsenault [Mon, 23 Mar 2020 15:14:30 +0000 (11:14 -0400)]
AMDGPU/GlobalISel: Add some oversized G_IMPLICIT_DEF tests

Not all of these legalize correctly yet.

4 years agoRevert "Remove legacy CMake targets for libcxx and libcxxabi"
Louis Dionne [Mon, 23 Mar 2020 15:02:11 +0000 (11:02 -0400)]
Revert "Remove legacy CMake targets for libcxx and libcxxabi"

This reverts commit f383fb40b. It looks like several of our build bots
are still using the legacy target names, so we'll change those before
we commit this change again.

4 years ago[lldb/Target] Rework the way the inferior environment is created
Fred Riss [Fri, 20 Mar 2020 01:02:05 +0000 (18:02 -0700)]
[lldb/Target] Rework the way the inferior environment is created

Summary:
The interactions between the environment settings (`target.env-vars`,
`target.inherit-env`) and the inferior life-cycle are non-obvious
today. For example, if `target.inherit-env` is set, the `target.env-vars`
setting will be augmented with the contents of the host environment
the first time the launch environment is queried (usually at
launch). After that point, toggling `target.inherit-env` will have no
effect as there's no tracking of what comes from the host and what is
a user setting.

This patch computes the environment every time it is queried rather
than updating the contents of the `target.env-vars` property. This
means that toggling the `target.inherit-env` property later will now
have the intended effect.

This patch also adds a `target.unset-env-vars` settings that one can
use to remove variables from the launch environment. Using this, you
can inherit all but a few of the host environment.

The way the launch environment is constructed is:
  1/ if `target.inherit-env` is set, then read the host environment
  into the launch environment.
  2/ Remove for the environment the variables listed in
  `target.unset-env`.
  3/ Augment the launch environment with the contents of
  `target.env-vars`. This overrides any common values with the host
  environment.

The one functional difference here that could be seen as a regression
is that `target.env-vars` will not contain the inferior environment
after launch. The patch implements a better alternative in the
`target show-launch-environment` command which will return the
environment computed through the above rules.

Reviewers: labath, jingham

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[lldb/API] Make Launch(Simple) use args and env from target properties
Fred Riss [Thu, 12 Mar 2020 05:09:11 +0000 (22:09 -0700)]
[lldb/API] Make Launch(Simple) use args and env from target properties

Summary:
When no arguments or environment is provided to SBTarget::LaunchSimple,
make it use the values surrently set in the target properties. You can
get the current behavior back by passing an empty array instead.

It seems like using the target defaults is a much more intuitive
behavior for those APIs. It's unllikely that anyone passed NULL/None to
this API after having set properties in order to explicitely ignore them.

One direct application of this change is within the testsuite. We have
plenty of tests calling LaunchSimple and passing None as environment.
If you passed --inferior-env to dotest.py to, for example, set
(DY)LD_LIBRARY_PATH, it wouldn't be taken into account.

Reviewers: jingham, labath, #libc_abi!

Subscribers: libcxx-commits, lldb-commits

Tags: #lldb, #libc_abi

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

4 years ago[lldb/Target] Initialize new targets environment variables from target.env-vars
Fred Riss [Wed, 11 Mar 2020 17:26:03 +0000 (10:26 -0700)]
[lldb/Target] Initialize new targets environment variables from target.env-vars

Summary:
The TargetProperties constructor invokes a series of callbacks to
prime the properties from the default ones. The one callback in
charge of updating the inferior environment was commented out
because it crashed.

The reason for the crash is that TargetProperties is a parent class
of Target and the callbacks were invoked using a Target that was
not fully initialized. This patch moves the initial callback
invocations to a separate function that can be called at the end
the Target constructor, thus preventing the crash.

One existing test had to be modified, because the initialization of
the environment properties now take place at the time the target is
created, not at the first use of the environment (usually launch
time).

The added test checks that the LaunchInfo object returned by
the target has been primed with the values from the settings.

Reviewers: jingham, labath

Subscribers: lldb-commits

Tags: #lldb

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

4 years agoRemove legacy CMake targets for libcxx and libcxxabi
Louis Dionne [Wed, 11 Mar 2020 21:03:00 +0000 (17:03 -0400)]
Remove legacy CMake targets for libcxx and libcxxabi

We've been meaning to remove those targets for a while, and the fix is
simple enough cause they're all just aliases to other targets.

There's no doubt this commit will break some CI systems, however the
fix is trivial.

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

4 years ago[InstCombine] Limit CTPOP -> CTTZ simplifications to one use
Simon Pilgrim [Mon, 23 Mar 2020 14:24:05 +0000 (14:24 +0000)]
[InstCombine] Limit CTPOP -> CTTZ simplifications to one use

Tweak D76568 so we only combine if it will remove the bit-twiddling.

Suggested by @spatel

4 years ago[clang-format] Do not indent C# array initialisers as continuations
Jonathan Coe [Mon, 23 Mar 2020 14:23:52 +0000 (14:23 +0000)]
[clang-format] Do not indent C# array initialisers as continuations

Summary: Flag '= {' as a braced init list when parsing C# code.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, MyDeveloperDay

Tags: #clang-format, #clang

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

4 years ago[Analyzer] Iterator Modeling - Model `std::advance()`, `std::prev()` and `std::next()`
Adam Balogh [Wed, 19 Feb 2020 08:03:39 +0000 (09:03 +0100)]
[Analyzer] Iterator Modeling - Model `std::advance()`, `std::prev()` and `std::next()`

Whenever the analyzer budget runs out just at the point where
`std::advance()`, `std::prev()` or `std::next()` is invoked the function
are not inlined. This results in strange behavior such as
`std::prev(v.end())` equals `v.end()`. To prevent this model these
functions if they were not inlined. It may also happend that although
`std::advance()` is inlined but a function it calls inside (e.g.
`__advance()` in some implementations) is not. This case is also handled
in this patch.

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

4 years ago[lldb] Mark expressions that couldn't be parsed or executed as failed expressions
Raphael Isemann [Mon, 23 Mar 2020 14:25:51 +0000 (15:25 +0100)]
[lldb] Mark expressions that couldn't be parsed or executed as failed expressions

Summary:
LLDB keeps statistics of how many expression evaluations are 'successful' and 'failed'
which are updated after each expression evaluation (assuming statistics are enabled).
From what I understand the idea is that this could be used to define how well LLDB's
expression evaluator is working.

Currently all expressions are considered successful unless the user passes an explicit
positive element counting to the expression command (with the `-Z` flag) and then passes
an expression that successfully evaluates to a type that doesn't support element counting.
Expressions that fail to parse, execute or any other outcome are considered successful
at the moment which means we nearly always have a 100% expression evaluation
success rate.

This patch makes that expressions that fail to parse or execute to count as failed
expressions.

We can't know whether the expression failed because of an user error
of because LLDB couldn't correctly parse/compile it, but I would argue that this is
still an improvement. Assuming that the percentage of valid user expressions stays
mostly constant over time (which seems like a reasonable assumption), then this
way we can still see if we are doing relatively better/worse from release to release.

Reviewers: davide, aprantl, JDevlieghere

Reviewed By: aprantl

Subscribers: abidh

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

4 years agoImplement wave32 DWARF register mapping
Ram Nalamothu [Mon, 23 Mar 2020 10:56:51 +0000 (16:26 +0530)]
Implement wave32 DWARF register mapping

Implement the DWARF register mapping described in llvm/docs/AMDGPUUsage.rst.

This enables generating appropriate DWARF register numbers for wave64 and
wave32 modes.

4 years ago[SCCP] Precommit additional range propagation test.
Florian Hahn [Mon, 23 Mar 2020 14:15:19 +0000 (14:15 +0000)]
[SCCP] Precommit additional range propagation test.

4 years ago[VectorUtils] move x86's scaleShuffleMask to generic VectorUtils
Sanjay Patel [Mon, 23 Mar 2020 13:47:16 +0000 (09:47 -0400)]
[VectorUtils] move x86's scaleShuffleMask to generic VectorUtils

We have some long-standing missing shuffle optimizations that could
use this transform via VectorCombine now:
https://bugs.llvm.org/show_bug.cgi?id=35454
(and we still don't get that case in the backend either)

This function is apparently templated because there's existing code
in IR that treats mask values as unsigned and backend code that
treats masks values as signed.

The mask values are not endian-dependent (as shown by the existing
bitcast transform from DAGCombiner).

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