platform/upstream/llvm.git
4 years ago[X86] Use 128-bit vector instructions for f32/f64->i64 conversions on 32-bit targets...
Craig Topper [Tue, 24 Dec 2019 19:08:06 +0000 (11:08 -0800)]
[X86] Use 128-bit vector instructions for f32/f64->i64 conversions on 32-bit targets with avx512dq and avx512vl instructions.

On 32-bit targets we can't use the scalar instruction so we
insert the scalar into a vector and use packed conversions.
Previously we used either v4f32->v4i64 or v4f64->v4i64 to avoid
some complexity creating target specific ISD opcodes for
v4f32->v2i64. But this causes extra vzeroupper instructions and
possibly frequency throttling on Intel CPUs.

This patch changes this to create a 128-bit vector and uses a
target specific ISD opcode if needed.

4 years ago[mlir] Fix -Wunneeded-internal-declaration
Fangrui Song [Tue, 24 Dec 2019 18:29:49 +0000 (10:29 -0800)]
[mlir] Fix -Wunneeded-internal-declaration

4 years agotest: ensure that we dead-strip in the linker
Saleem Abdulrasool [Tue, 24 Dec 2019 18:18:13 +0000 (10:18 -0800)]
test: ensure that we dead-strip in the linker

`/OPT:REF` is needed for link to dead strip functions, `/Gy` by itself
is not sufficient.

4 years ago[X86] Add STRICT versions of CVTTP2SI, CVTTP2UI, CMPM, and CMPP.
Craig Topper [Tue, 24 Dec 2019 18:07:04 +0000 (10:07 -0800)]
[X86] Add STRICT versions of CVTTP2SI, CVTTP2UI, CMPM, and CMPP.

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

4 years ago[OPENMP][DOCS]Update status of OpenMP 5.0 features, NFC.
Alexey Bataev [Tue, 24 Dec 2019 17:39:59 +0000 (12:39 -0500)]
[OPENMP][DOCS]Update status of OpenMP 5.0 features, NFC.

4 years ago[OPENMP50]Basic support for conditional lastprivate.
Alexey Bataev [Fri, 20 Dec 2019 16:04:57 +0000 (11:04 -0500)]
[OPENMP50]Basic support for conditional lastprivate.

Added parsing/sema checks for conditional lastprivates.

4 years agoGlobalISel: Update syntax in debug printing
Matt Arsenault [Sat, 21 Dec 2019 20:20:46 +0000 (15:20 -0500)]
GlobalISel: Update syntax in debug printing

Physical register names now start with $, not %

4 years agoGlobalISel: Define equivalent node for G_INTRINSIC_ROUND
Matt Arsenault [Tue, 24 Dec 2019 00:57:28 +0000 (19:57 -0500)]
GlobalISel: Define equivalent node for G_INTRINSIC_ROUND

4 years agoGlobalISel: Fix naming variables "brank" instead of "bank"
Matt Arsenault [Sun, 22 Dec 2019 18:46:40 +0000 (13:46 -0500)]
GlobalISel: Fix naming variables "brank" instead of "bank"

4 years ago[lldb][NFC] Move ClangASTContext::m_scratch_ast_source_up to the appropriate class
Raphael Isemann [Tue, 24 Dec 2019 08:31:45 +0000 (09:31 +0100)]
[lldb][NFC] Move ClangASTContext::m_scratch_ast_source_up to the appropriate class

m_scratch_ast_source_up is only used by ClangASTContextForExpressions so it
should also be declared only in that class. Also make all other members of
ClangASTContext private and move the initialization code for ClangASTContextForExpressions
into the constructor.

4 years agoFix readability-const-return-type identifying the wrong `const` token
Ilya Mirsky [Tue, 24 Dec 2019 15:10:01 +0000 (10:10 -0500)]
Fix readability-const-return-type identifying the wrong `const` token

Replace tidy::utils::lexer::getConstQualifyingToken with a corrected and also
generalized to other qualifiers variant - getQualifyingToken.

Fixes PR44326

4 years agoFix false positive in magic number checker.
Florin Iucha [Tue, 24 Dec 2019 15:03:00 +0000 (10:03 -0500)]
Fix false positive in magic number checker.

cppcoreguidelines-avoid-magic-numbers should not warn about enum class.
Fixes PR40640.

4 years agoAMDGPU/GlobalISel: Legalize some 16-bit round instructions
Matt Arsenault [Tue, 24 Dec 2019 00:42:53 +0000 (19:42 -0500)]
AMDGPU/GlobalISel: Legalize some 16-bit round instructions

4 years agoGlobalISel: Define equivalent node for G_INTRINSIC_TRUNC
Matt Arsenault [Tue, 24 Dec 2019 00:30:53 +0000 (19:30 -0500)]
GlobalISel: Define equivalent node for G_INTRINSIC_TRUNC

4 years agoAMDGPU/GlobalISel: Lower llvm.amdgcn.else
Matt Arsenault [Fri, 20 Dec 2019 18:35:18 +0000 (00:05 +0530)]
AMDGPU/GlobalISel: Lower llvm.amdgcn.else

4 years ago[NFC] Remove some dead code from CGBuiltin.cpp.
Kevin P. Neal [Tue, 24 Dec 2019 14:38:34 +0000 (09:38 -0500)]
[NFC] Remove some dead code from CGBuiltin.cpp.

4 years agoVariableName doc: fix the link to the mozilla doc
Sylvestre Ledru [Tue, 24 Dec 2019 12:38:59 +0000 (13:38 +0100)]
VariableName doc: fix the link to the mozilla doc

4 years agomlir README.md: Fix the syntax
Sylvestre Ledru [Tue, 24 Dec 2019 12:31:07 +0000 (13:31 +0100)]
mlir README.md: Fix the syntax

4 years ago[lldb][NFC] Remove ClangExternalASTSourceCommon
Raphael Isemann [Mon, 23 Dec 2019 19:42:25 +0000 (20:42 +0100)]
[lldb][NFC] Remove ClangExternalASTSourceCommon

ClangExternalASTSourceCommon's purpose is to store a map from
Decl*/Type* to ClangASTMetadata. Usually this data is accessed
via the ClangASTContext interface which then grabs the
current ExternalASTSource of its ASTContext, tries to cast it
to ClangExternalASTSourceCommon and then accesses the metadata
map. If the casting fails the setter does nothing and the getter
returns a nullptr as if there was no known metadata for a type/decl.

This system breaks as soon as any non-LLDB ExternalASTSource is added via
a multiplexer to our existing ExternalASTSource (in which case we suddenly
loose all out metadata as the casting always fails with an ExternalASTSource
that is not inheriting from ClangExternalASTSourceCommon).

This patch moves the metadata map to the ClangASTContext. This gets
rid of all the fragile casting, the requirement that every ExternalASTSource in
LLDB has to inherit from ClangExternalASTSourceCommon and simplifies
the metadata implementation to a simple map lookup. As ClangExternalASTSourceCommon
had no other purpose than storing metadata, this patch deletes this class
and replaces all uses with clang::ExternalASTSource.

No other code changes in this commit beside the AppleObjCDeclVendor which
was the only code that did not use the ClangASTContext interface but directly
accessed the ClangExternalASTSourceCommon.

4 years agodoc: Document that extra-arg/extra-arg-before can be used several times
Sylvestre Ledru [Tue, 24 Dec 2019 12:06:24 +0000 (13:06 +0100)]
doc: Document that extra-arg/extra-arg-before can be used several times

Hopefully, it will help other people

4 years agoclang-doc remove trailing whitespaces
Sylvestre Ledru [Tue, 24 Dec 2019 12:03:45 +0000 (13:03 +0100)]
clang-doc remove trailing whitespaces

4 years agoRevert "[Support] Extend TimeProfiler to support multiple threads"
Russell Gallop [Tue, 24 Dec 2019 11:31:48 +0000 (11:31 +0000)]
Revert "[Support] Extend TimeProfiler to support multiple threads"

and "[Support] Try to fix bot failure after 8ddcd1dc26"

This reverts commits f70f180148 and 8ddcd1dc26 as this was breaking the
MacOS build, which doesn't support thread_local.

4 years ago[clang] [ast] CXXRecordDecl::getVisibleConversionFunctions() could be const
Whisperity [Tue, 24 Dec 2019 10:09:24 +0000 (11:09 +0100)]
[clang] [ast] CXXRecordDecl::getVisibleConversionFunctions() could be const

The function and its called static helpers don't modify the received
CXXRecordDecl arguments at all as the method's result is put into an
output parameter. Thus they can be const which allows for neatly
grabbing the conversion methods in a context where we only have a const
ASTUnit at hand.

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

4 years ago[TypePromotion] Make TypeSize a class member
Sam Parker [Tue, 24 Dec 2019 09:44:41 +0000 (04:44 -0500)]
[TypePromotion] Make TypeSize a class member

Having TypeSize as a static class variable was causing problems
with multi-threading. Several static functions have now been
converted into methods of TypePromotion and a few other members
of TypePromotion and IRPromoter have been added or removed.

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

4 years agoDebugInfo: Correct the form of DW_AT_macro_info in .dwo files (sec_offset, rather...
David Blaikie [Tue, 24 Dec 2019 09:23:21 +0000 (01:23 -0800)]
DebugInfo: Correct the form of DW_AT_macro_info in .dwo files (sec_offset, rather than data4)

4 years agoDebugInfo: Add {} to address -Wdangling-else warning.
David Blaikie [Tue, 24 Dec 2019 09:14:15 +0000 (01:14 -0800)]
DebugInfo: Add {} to address -Wdangling-else warning.

4 years agoAdd the Apache2 with LLVM exceptions license to MLIR
Mehdi Amini [Tue, 24 Dec 2019 08:57:16 +0000 (00:57 -0800)]
Add the Apache2 with LLVM exceptions license to MLIR

It seems that every subproject has a license file instead of having a top-level one.

4 years ago[llvm-readobj] - Remove an excessive helper for printing dynamic tags.
Georgii Rymar [Mon, 23 Dec 2019 11:54:36 +0000 (14:54 +0300)]
[llvm-readobj] - Remove an excessive helper for printing dynamic tags.

This removes the `getTypeString` from readeobj source because it
almost duplicates the existent method: `ELFFile<ELFT>::getDynamicTagAsString`.

Side effect: now it prints "<unknown:>0xHEXVALUE" instead of "(unknown)" for unknown values.
llvm-readelf before this patch printed:

```
0x0000000012345678 (unknown) 0x8765432187654321
0x000000006abcdef0 (unknown) 0x9988776655443322
0x0000000076543210 (unknown) 0x5555666677778888
```

and now it prints:

```
0x0000000012345678 (<unknown:>0x12345678) 0x8765432187654321
0x000000006abcdef0 (<unknown:>0x6abcdef0) 0x9988776655443322
0x0000000076543210 (<unknown:>0x76543210) 0x5555666677778888
```

GNU reaedlf prints different thing:

```
0x0000000012345678 (<unknown>: 12345678) 0x8765432187654321
0x000000006abcdef0 (Operating System specific: 6abcdef0) 0x9988776655443322
0x0000000076543210 (Processor Specific: 76543210) 0x5555666677778888
```

I am not sure we want to follow GNU here. Even if we do, it should be separate
patch probably. The new output looks better and closer to GNU anyways,
and the code is a bit simpler.

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

4 years agoRemove static MLIR doc ; they are already on the website
Mehdi Amini [Tue, 24 Dec 2019 08:53:10 +0000 (00:53 -0800)]
Remove static MLIR doc ; they are already on the website

4 years ago[docs] fix typo in Lexicon.rst
Alex Zinenko [Mon, 23 Dec 2019 17:20:25 +0000 (18:20 +0100)]
[docs] fix typo in Lexicon.rst

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

4 years agoAdd `mlir` to -DLLVM_ALL_PROJECTS CMake option
Mehdi Amini [Tue, 24 Dec 2019 07:23:51 +0000 (07:23 +0000)]
Add `mlir` to -DLLVM_ALL_PROJECTS CMake option

4 years ago[DebugInfo] Fix v4 macinfo for dwo files.
Sourabh Singh Tomar [Tue, 24 Dec 2019 06:08:38 +0000 (11:38 +0530)]
[DebugInfo] Fix v4 macinfo for dwo files.

Dwo files must contain have DW_AT_macro_info attribute, when macro information is emitted. Adjusted the test case
for the same.

4 years ago[SelectionDAG] Change SelectionDAGISel::{funcInfo,SDB} to use unique_ptr
Fangrui Song [Tue, 24 Dec 2019 06:20:29 +0000 (22:20 -0800)]
[SelectionDAG] Change SelectionDAGISel::{funcInfo,SDB} to use unique_ptr

CurDAG is referenced more than 2000 times and used in many gerated .cpp
files. Don't touch it for now.

4 years ago[SelectionDAG] Don't repeatedly add a node to the worklist in ComputeLiveOutVRegInfo...
Fangrui Song [Tue, 24 Dec 2019 05:42:41 +0000 (21:42 -0800)]
[SelectionDAG] Don't repeatedly add a node to the worklist in ComputeLiveOutVRegInfo. NFC

For sqlite3 amalgram, this decreases the number of Worklist.push_back calls (603084) by 10%.

4 years agotest: correct flags for Windows
Saleem Abdulrasool [Tue, 24 Dec 2019 04:20:20 +0000 (20:20 -0800)]
test: correct flags for Windows

Adjust the flags for the LLDB test on Windows.  This test was previously
not running, but after the fix to the python detection, we now run this.

4 years agoNFC: Rename printOptionValue to printValue to fix MSVC build.
River Riddle [Tue, 24 Dec 2019 03:34:25 +0000 (19:34 -0800)]
NFC: Rename printOptionValue to printValue to fix MSVC build.

MSVC has trouble resolving the static 'printOptionValue' from the method on llvm::cl::opt/list. This change renames the static method to avoid this conflict.

4 years agoDebugInfo: Support dumping any exprloc as an expression
David Blaikie [Sun, 22 Dec 2019 07:05:35 +0000 (23:05 -0800)]
DebugInfo: Support dumping any exprloc as an expression

Now that DWARFv5 provides a way to identify DWARF expressions based on
form, rather than only by attribute - use it to always provide pretty
printing for any exprloc attribute, not only the attributes known to
contain expressions.

4 years agoImport MLIR into the LLVM tree
Mehdi Amini [Tue, 24 Dec 2019 02:47:41 +0000 (02:47 +0000)]
Import MLIR into the LLVM tree

4 years ago[DWARF] Check that all fields of a Unit Header are read.
Igor Kudrin [Fri, 20 Dec 2019 10:36:52 +0000 (17:36 +0700)]
[DWARF] Check that all fields of a Unit Header are read.

Tests "dwarfdump-rnglists-dwarf64.s" and "dwarfdump-rnglists.s" were
malformed because they had missing required DWO ID fields in split
compilation unit headers. The patch fixes the tests and checks
the reading of a unit header more thoroughly.

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

4 years agoAdjust some MLIR paths and docs
Mehdi Amini [Tue, 24 Dec 2019 02:23:01 +0000 (02:23 +0000)]
Adjust some MLIR paths and docs

4 years agoRevert "[lldb] Don't process symlinks deep inside DWARFUnit"
Jonas Devlieghere [Tue, 24 Dec 2019 02:03:35 +0000 (18:03 -0800)]
Revert "[lldb] Don't process symlinks deep inside DWARFUnit"

This temporarily reverts commit 3cfb6677b2aa20f782d9bb0f7958e61f5a976c16
because it breaks TestCompDirSymLink.py on macOS.

4 years agoRemove pybind11-based bindings
Mehdi Amini [Tue, 24 Dec 2019 01:43:20 +0000 (17:43 -0800)]
Remove pybind11-based bindings

These bindings were added as an experiment, and never had a CMake configuration.
We will bring back python bindings after picking carefully our dependency and the kind
of layering we expect to expose for these bindings.

PiperOrigin-RevId: 286963717

4 years agoRefactor the way that pass options are specified.
River Riddle [Mon, 23 Dec 2019 23:54:55 +0000 (15:54 -0800)]
Refactor the way that pass options are specified.

This change refactors pass options to be more similar to how statistics are modeled. More specifically, the options are specified directly on the pass instead of in a separate options class. (Note that the behavior and specification for pass pipelines remains the same.) This brings about several benefits:
* The specification of options is much simpler
* The round-trip format of a pass can be generated automatically
* This gives a somewhat deeper integration with "configuring" a pass, which we could potentially expose to users in the future.

PiperOrigin-RevId: 286953824

4 years agoNFC: Replace ValuePtr with Value and remove it now that Value is value-typed.
River Riddle [Mon, 23 Dec 2019 22:45:01 +0000 (14:45 -0800)]
NFC: Replace ValuePtr with Value and remove it now that Value is value-typed.

ValuePtr was a temporary typedef during the transition to a value-typed Value.

PiperOrigin-RevId: 286945714

4 years ago[CFG] Fix an assertion failure with static initializers
Gabor Horvath [Mon, 23 Dec 2019 18:01:00 +0000 (10:01 -0800)]
[CFG] Fix an assertion failure with static initializers

The CFGBlock::getLastCondition was not prepared for static initializer
branches.

This patch also revamps CFG unit tests. Earlier the lifetime of the AST
was smaller than the CFG. So all the AST pointers within the CFG blocks
were dangling. This was OK, since none of the tests dereferenced those
pointers. This was, however, a timed bomb. There were patches in the
past that were reverted partially due to this problem.

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

4 years agoChange the `notifyRootUpdated` API to be transaction based.
River Riddle [Mon, 23 Dec 2019 21:05:38 +0000 (13:05 -0800)]
Change the `notifyRootUpdated` API to be transaction based.

This means that in-place, or root, updates need to use explicit calls to `startRootUpdate`, `finalizeRootUpdate`, and `cancelRootUpdate`. The major benefit of this change is that it enables in-place updates in DialectConversion, which simplifies the FuncOp pattern for example. The major downside to this is that the cases that *may* modify an operation in-place will need an explicit cancel on the failure branches(assuming that they started an update before attempting the transformation).

PiperOrigin-RevId: 286933674

4 years agoUpdate SPIR-V.md
Lei Zhang [Mon, 23 Dec 2019 21:04:34 +0000 (13:04 -0800)]
Update SPIR-V.md

This CL updates SPIR-V.md to reflect recent developments
in the SPIR-V dialect and its conversions.

Along the way, also updates the doc for define_inst.sh.

PiperOrigin-RevId: 286933546

4 years agoResubmit: ReImplement the Value classes as value-typed objects wrapping an internal...
River Riddle [Mon, 23 Dec 2019 20:36:20 +0000 (12:36 -0800)]
Resubmit: ReImplement the Value classes as value-typed objects wrapping an internal pointer storage.

This will enable future commits to reimplement the internal implementation of OpResult without needing to change all of the existing users. This is part of a chain of commits optimizing the size of operation results.

PiperOrigin-RevId: 286930047

4 years agoAutomated rollback of commit f603a50109107b447b835dac11f0eb541288393e
MLIR Team [Mon, 23 Dec 2019 19:49:50 +0000 (11:49 -0800)]
Automated rollback of commit f603a50109107b447b835dac11f0eb541288393e

PiperOrigin-RevId: 286924059

4 years agoReImplement the Value classes as value-typed objects wrapping an internal pointer...
River Riddle [Mon, 23 Dec 2019 19:18:53 +0000 (11:18 -0800)]
ReImplement the Value classes as value-typed objects wrapping an internal pointer storage.

This will enable future commits to reimplement the internal implementation of OpResult without needing to change all of the existing users. This is part of a chain of commits optimizing the size of operation results.

PiperOrigin-RevId: 286919966

4 years agoAdjust License.txt file to use the LLVM license
Mehdi Amini [Mon, 23 Dec 2019 17:35:36 +0000 (09:35 -0800)]
Adjust License.txt file to use the LLVM license

PiperOrigin-RevId: 286906740

4 years ago[InstCombine] add test for copysign; NFC
Sanjay Patel [Mon, 23 Dec 2019 22:54:31 +0000 (17:54 -0500)]
[InstCombine] add test for copysign; NFC

4 years ago[InstCombine] add tests for not(select ...); NFC
Sanjay Patel [Mon, 23 Dec 2019 22:14:02 +0000 (17:14 -0500)]
[InstCombine] add tests for not(select ...); NFC

4 years agoAdd implementations of POSIX mmap and munmap functions.
Siva Chandra Reddy [Thu, 5 Dec 2019 07:17:14 +0000 (23:17 -0800)]
Add implementations of POSIX mmap and munmap functions.

Summary:
A set of of linux x86_64 internal syscall helpers have also been added.

This change does not try to be perfect with respect to OS and machine
abstractions. A TODO note has been added at places where such abstractions
would help and make the arrangement scalable and cleaner. Addressing the
TODOs and building such abstractions is not in the scope of this change.
It is hoped that follow up changes cleaning up the problem areas and
addressing the TODOs will better illustrate the need for the changes.

This change also does not try to imitate mmap and munmap implementations
of other libcs. The idea here is to put in the bare minimum required to
obtain a working mmap and munmap, and then add the rest of the
functionality on an as needed basis.

Reviewers: abrachet, phosek, stanshebs, theraven

Subscribers: mgorny, MaskRay, jfb, libc-commits

Tags: #libc-project

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

4 years ago[lldb/CMake] Always set a value for find_package when finding optional dependencies
Alex Langford [Mon, 23 Dec 2019 21:37:56 +0000 (13:37 -0800)]
[lldb/CMake] Always set a value for find_package when finding optional dependencies

Because this is a macro, previous values of `find_package` persist
between calls. This means that if it is set to TRUE on any run, all
subsequent runs will have find_package set to TRUE regardles of whether
or not they should be.

4 years ago[Docs] Fix sphinx build errors.
Florian Hahn [Mon, 23 Dec 2019 20:52:39 +0000 (21:52 +0100)]
[Docs] Fix sphinx build errors.

4 years agoASTContext: fix declaration of ParsedTargetAttr [-Wmismatched-tags] after D68627
Fangrui Song [Mon, 23 Dec 2019 20:38:37 +0000 (12:38 -0800)]
ASTContext: fix declaration of ParsedTargetAttr [-Wmismatched-tags] after D68627

4 years ago[FPEnv][X86] More strict int <-> FP conversion fixes
Ulrich Weigand [Mon, 23 Dec 2019 20:11:45 +0000 (21:11 +0100)]
[FPEnv][X86] More strict int <-> FP conversion fixes

Fix several several additional problems with the int <-> FP conversion
logic both in common code and in the X86 target. In particular:

- The STRICT_FP_TO_UINT expansion emits a floating-point compare. This
  compare can raise exceptions and therefore needs to be a strict compare.
  I've made it signaling (even though quiet would also be correct) as
  signaling is the more usual default for an LT. This code exists both
  in common code and in the X86 target.

- The STRICT_UINT_TO_FP expansion algorithm was incorrect for strict mode:
  it emitted two STRICT_SINT_TO_FP nodes and then used a select to choose one
  of the results. This can cause spurious exceptions by the STRICT_SINT_TO_FP
  that ends up not chosen. I've fixed the algorithm to use only a single
  STRICT_SINT_TO_FP instead.

- The !isStrictFPEnabled logic in DoInstructionSelection would sometimes do
  the wrong thing because it calls getOperationAction using the result VT.
  But for some opcodes, incuding [SU]INT_TO_FP, getOperationAction needs to
  be called using the operand VT.

- Remove some (obsolete) code in X86DAGToDAGISel::Select that would mutate
  STRICT_FP_TO_[SU]INT to non-strict versions unnecessarily.

Reviewed by: craig.topper

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

4 years ago[msan] Check qsort input.
Evgenii Stepanov [Fri, 20 Dec 2019 20:07:04 +0000 (12:07 -0800)]
[msan] Check qsort input.

Summary:
Qsort interceptor suppresses all checks by unpoisoning the data in the
wrapper of a comparator function, and then unpoisoning the output array
as well.

This change adds an explicit run of the comparator on all elements of
the input array to catch any sanitizer bugs.

Reviewers: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[msan] Intercept qsort, qsort_r.
Evgenii Stepanov [Thu, 19 Dec 2019 21:38:59 +0000 (13:38 -0800)]
[msan] Intercept qsort, qsort_r.

Summary:
This fixes qsort-related false positives with glibc-2.27.
I'm not entirely sure why they did not show up with the earlier
versions; the code seems similar enough.

Reviewers: vitalybuka

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

4 years ago[Sema][X86] Consider target attribute into the checks in validateOutputSize and valid...
Craig Topper [Mon, 23 Dec 2019 18:38:38 +0000 (10:38 -0800)]
[Sema][X86] Consider target attribute into the checks in validateOutputSize and validateInputSize.

The validateOutputSize and validateInputSize need to check whether
AVX or AVX512 are enabled. But this can be affected by the
target attribute so we need to factor that in.

This patch moves some of the code from CodeGen to create an
appropriate feature map that we can pass to the function.

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

4 years agoMC: Ensure test only reads from the Inputs directory
David Blaikie [Mon, 23 Dec 2019 19:08:26 +0000 (11:08 -0800)]
MC: Ensure test only reads from the Inputs directory

4 years agoFix LLVM tool --version build mode printing for MSVC
Reid Kleckner [Sun, 22 Dec 2019 21:25:24 +0000 (13:25 -0800)]
Fix LLVM tool --version build mode printing for MSVC

LLVM tools such as llc print "DEBUG build" or "Optimized build" when
passed --version. Before this change, this was implemented by checking
for the __OPTIMIZE__ GCC macro. MSVC does not define this macro. For
MSVC, control this behavior with _DEBUG instead. It doesn't have
precisely the same meaning, but in most configurations, it will do the
right thing.

Fixes PR17752

Reviewed by: MaskRay

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

4 years ago[lldb/Test] Disable TestSynchronous.test on Windows.
Jonas Devlieghere [Mon, 23 Dec 2019 17:48:37 +0000 (09:48 -0800)]
[lldb/Test] Disable TestSynchronous.test on Windows.

The test was being skipped on the Windwos bot because it requires Python
which was silently disabled because of a configuration issue. Now that
the test runs, this fails as expected.

4 years agoMove from a long list of checkers to tables
Sylvestre Ledru [Mon, 23 Dec 2019 17:43:01 +0000 (18:43 +0100)]
Move from a long list of checkers to tables

Summary:
Currently, the list isn't very useful.
This change adds two tables.

* The checkers
* The aliases

For each checkers, we provide extract info:

* the severity. Taken from codechecker - https://github.com/Ericsson/codechecker/blob/master/config/checker_severity_map.json
* if the checker has an autofix or not

I used the cvs format for the table because:
* it is easy
* the data could be reused by other tools (we could move
that into a separated / generated file at some point)

Reviewers: alexfh, jdoerfert, jfb, lebedev.ri, Eugene.Zelenko

Subscribers: dexonsmith, wuzish, nemanjai, kbarton, arphaman, lebedev.ri, whisperity, Eugene.Zelenko, JonasToth, JDevlieghere, xazax.hun, cfe-commits, #clang-tools-extra

Tags: #clang

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

4 years ago[ELF] Don't suggest an alternative spelling for a symbol in a discarded section
Fangrui Song [Fri, 20 Dec 2019 00:04:45 +0000 (16:04 -0800)]
[ELF] Don't suggest an alternative spelling for a symbol in a discarded section

For undef-not-suggest.test, we currently make redundant alternative
spelling suggestions:

```
ld.lld: error: relocation refers to a discarded section: .text.foo
>>> defined in a.o
>>> section group signature: foo
>>> prevailing definition is in a.o
>>> referenced by a.o:(.rodata+0x0)
>>> did you mean:
>>> defined in: a.o

ld.lld: error: relocation refers to a symbol in a discarded section: foo
>>> defined in a.o
>>> section group signature: foo
>>> prevailing definition is in a.o
>>> referenced by a.o:(.rodata+0x8)
>>> did you mean: for
>>> defined in: a.o
```

Reviewed By: grimar, ruiu

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

4 years ago[AMDGPU] Don't create MachinePointerInfos with an UndefValue pointer
Jay Foad [Mon, 23 Dec 2019 13:42:12 +0000 (13:42 +0000)]
[AMDGPU] Don't create MachinePointerInfos with an UndefValue pointer

Summary:
The only useful information the UndefValue conveys is the address space,
which MachinePointerInfo can represent directly without referring to an
IR value.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years ago[RISCV][NFC] Fix use of missing attribute groups in tests
Luís Marques [Mon, 23 Dec 2019 15:32:52 +0000 (15:32 +0000)]
[RISCV][NFC] Fix use of missing attribute groups in tests

4 years ago[PowerPC] NFC - fix the testcase bug of folding rlwinm
czhengsz [Mon, 23 Dec 2019 15:26:41 +0000 (10:26 -0500)]
[PowerPC] NFC - fix the testcase bug of folding rlwinm

4 years ago[DAGCombine] visitEXTRACT_SUBVECTOR - 'little to big' extract_subvector(bitcast(...
Sanjay Patel [Mon, 23 Dec 2019 14:46:49 +0000 (09:46 -0500)]
[DAGCombine] visitEXTRACT_SUBVECTOR - 'little to big' extract_subvector(bitcast()) support

This moves the X86 specific transform from rL364407
into DAGCombiner to generically handle 'little to big' cases
(for example: extract_subvector(v2i64 bitcast(v16i8))). This
allows us to remove both the x86 implementation and the aarch64
bitcast(extract_subvector(bitcast())) combine.

Earlier patches that dealt with regressions initially exposed
by this patch:
rG5e5e99c041e4
rG0b38af89e2c0

Patch by: @RKSimon (Simon Pilgrim)

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

4 years ago[OPENMP50]Codegen for nontemporal clause.
Alexey Bataev [Thu, 19 Dec 2019 15:01:10 +0000 (10:01 -0500)]
[OPENMP50]Codegen for nontemporal clause.

Summary:
Basic codegen for the declarations marked as nontemporal. Also, if the
base declaration in the member expression is marked as nontemporal,
lvalue for member decl access inherits nonteporal flag from the base
lvalue.

Reviewers: rjmccall, hfinkel, jdoerfert

Subscribers: guansong, arphaman, caomhin, kkwli0, cfe-commits

Tags: #clang

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

4 years ago[lldb] Remove DWARFUnit::AppendDIEsWithTag
Pavel Labath [Mon, 23 Dec 2019 14:45:26 +0000 (15:45 +0100)]
[lldb] Remove DWARFUnit::AppendDIEsWithTag

This function is not very useful, as it's forcing a materialization of
the returned DIEs, and calling it is not substantially simpler than just
iterating over the DIEs manually. Delete it, and rewrite the single
caller.

4 years ago[gn build] Port eca40066ebb
LLVM GN Syncbot [Mon, 23 Dec 2019 13:55:08 +0000 (13:55 +0000)]
[gn build] Port eca40066ebb

4 years ago[lldb/DWARF] Fix hostname-stripping logic
Pavel Labath [Mon, 23 Dec 2019 13:33:00 +0000 (14:33 +0100)]
[lldb/DWARF] Fix hostname-stripping logic

This bit of code is trying to strip everything up to the first colon
from all debug info paths, as dwarf2 recommends this syntax for storing
the compilation host name. However, this code was too eager, and it
ended up stripping the entire compilation directory, if it did not
contain a forward slash (or a "x:\").

Normally this does not matter, as all absolute paths will contain one of
these patterns, but this does not have to be the case in case the debug
info is produced by "clang -fdebug-compilation-dir", which can end up
producing a relative compilation directory with no slashes (this is one
of the techniques for producing "relocatable" debug info).

4 years ago[Matrix] Use fmuladd for matrix.multiply if allowed.
Florian Hahn [Mon, 23 Dec 2019 13:28:56 +0000 (14:28 +0100)]
[Matrix] Use fmuladd  for matrix.multiply if allowed.

If the matrix.multiply calls have the contract fast math flag, we can
use fmuladd. This als adds a command line option to force fmuladd
generation. We can retire this option once there is a clang-level
option.

Reviewers: anemet, Gerolf, hfinkel, andrew.w.kaylor

Reviewed By: anemet

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

4 years ago[NFC] Move OptionUtils from Basic to Driver
Yaxun (Sam) Liu [Sun, 22 Dec 2019 05:34:14 +0000 (00:34 -0500)]
[NFC] Move OptionUtils from Basic to Driver

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

4 years ago[Matrix] Add forward shape propagation and first shape aware lowerings.
Florian Hahn [Mon, 23 Dec 2019 12:39:36 +0000 (13:39 +0100)]
[Matrix] Add forward shape propagation and first shape aware lowerings.

This patch adds infrastructure for forward shape propagation to
LowerMatrixIntrinsics. It also updates the pass to make use of
the shape information to break up larger vector operations and to
eliminate unnecessary conversion operations between columnwise matrixes
and flattened vectors: if shape information is available for an
instruction, lower the operation to a set of instructions operating on
columns. For example, a store of a matrix is broken down into separate
stores for each column. For users that do not have shape
information (e.g. because they do not yet support shape information
aware lowering), we pack the result columns into a flat vector and
update those users.

It also adds shape aware lowering for the first non-intrinsic
instruction: vector stores.

Example:

For
  %c  = call <4 x double> @llvm.matrix.transpose(<4 x double> %a, i32 2, i32 2)
  store <4 x double> %c, <4 x double>* %Ptr

We generate the code below without shape propagation. Note %9 which
combines the columns of the transposed matrix into a flat vector.

  %split = shufflevector <4 x double> %a, <4 x double> undef, <2 x i32> <i32 0, i32 1>
  %split1 = shufflevector <4 x double> %a, <4 x double> undef, <2 x i32> <i32 2, i32 3>
  %1 = extractelement <2 x double> %split, i64 0
  %2 = insertelement <2 x double> undef, double %1, i64 0
  %3 = extractelement <2 x double> %split1, i64 0
  %4 = insertelement <2 x double> %2, double %3, i64 1
  %5 = extractelement <2 x double> %split, i64 1
  %6 = insertelement <2 x double> undef, double %5, i64 0
  %7 = extractelement <2 x double> %split1, i64 1
  %8 = insertelement <2 x double> %6, double %7, i64 1
  %9 = shufflevector <2 x double> %4, <2 x double> %8, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  store <4 x double> %9, <4 x double>* %Ptr

With this patch, we propagate the 2x2 shape information from the
transpose to the store and we generate the code below. Note that we
store the columns directly and do not need an extra shuffle.

  %9 = bitcast <4 x double>* %Ptr to double*
  %10 = bitcast double* %9 to <2 x double>*
  store <2 x double> %4, <2 x double>* %10, align 8
  %11 = getelementptr double, double* %9, i32 2
  %12 = bitcast double* %11 to <2 x double>*
  store <2 x double> %8, <2 x double>* %12, align 8

Reviewers: anemet, Gerolf, reames, hfinkel, andrew.w.kaylor

Reviewed By: anemet

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

4 years ago[lldb][NFC] Remove unused callback functionality from ClangASTContext
Raphael Isemann [Mon, 23 Dec 2019 12:29:05 +0000 (13:29 +0100)]
[lldb][NFC] Remove unused callback functionality from ClangASTContext

4 years ago[OpenCL] Add atomic builtin functions
Sven van Haastregt [Mon, 23 Dec 2019 12:29:01 +0000 (12:29 +0000)]
[OpenCL] Add atomic builtin functions

Add atomic builtin functions from the OpenCL C specification.

Patch by Pierre Gondois and Sven van Haastregt.

4 years ago[lldb][NFC] Simplify ClangExternalASTSourceCallbacks
Raphael Isemann [Mon, 23 Dec 2019 12:08:22 +0000 (13:08 +0100)]
[lldb][NFC] Simplify ClangExternalASTSourceCallbacks

This class is only used by the ClangASTContext so we might as well
simplify this whole logic by just passing a ClangASTContext instead
of a list of callbacks and a void* pointer. If we ever need this
to support other classes then we can define some interface that
ClangASTContext implements but for now this isn't needed.

I also removed any code for m_callback_find_by_name as this was
always a nullptr in LLDB and removed all overriden implementations
that just redefined the default no-op implementation that the
ExternalASTSource provides.

Also removed the assert.h workarounds.

4 years ago[find_interesting_reviews.py] Add git blame output cache
Kristof Beyls [Mon, 23 Dec 2019 12:01:47 +0000 (12:01 +0000)]
[find_interesting_reviews.py] Add git blame output cache

The majority of the running time of this script tends to be spent in
running git blame on source files touched by patches under review.

By introducing a git blame output cache, some of the git blame commands
don't have to re-run, and the blame information can be retrieved from a
cache.

I've observed that in a typical run matching patches available for
review with potential reviewers, this speeds up the script's running
time by a factor of about 2.5x.

4 years ago[lldb][NFC] Remove unused 'type' parameter in ClangExpressionDeclMap::FindGlobalVariable
Raphael Isemann [Mon, 23 Dec 2019 11:18:49 +0000 (12:18 +0100)]
[lldb][NFC] Remove unused 'type' parameter in ClangExpressionDeclMap::FindGlobalVariable

We never pass something else than a nullptr as the 'type' so the related code in this function is never reached.

4 years ago[lldb][NFC] Remove wrong and unused ClangASTContext::CopyDecl method
Raphael Isemann [Mon, 23 Dec 2019 11:03:43 +0000 (12:03 +0100)]
[lldb][NFC] Remove wrong and unused ClangASTContext::CopyDecl method

4 years ago[lldb][NFC] Delete all 'else return ...' in CompilerDeclContext.cpp
Raphael Isemann [Mon, 23 Dec 2019 10:49:25 +0000 (11:49 +0100)]
[lldb][NFC] Delete all 'else return ...' in CompilerDeclContext.cpp

4 years ago[lldb] Add sanity check to CreateDeclContext and fixed illformed CompilerContext...
Raphael Isemann [Mon, 23 Dec 2019 09:55:21 +0000 (10:55 +0100)]
[lldb] Add sanity check to CreateDeclContext and fixed illformed CompilerContext in ClangExpressionDeclMap.

This adds a check that the ClangASTContext actually fits to the
DeclContext that we want to create a CompilerDeclContext for. If
the ClangASTContext (and its associated ASTContext) does not fit
to the DeclContext (that is, the DeclContext wasn't created by the
ASTContext), all computations using this malformed CompilerDeclContext
will yield unpredictable results.

Also fixes the only place that actually hits this assert which is the
construction of a CompilerDeclContext in ClangExpressionDeclMap
where we pass an unrelated ASTContext instead of the ASTContext
of the current expression.

I had to revert my previous change to DWARFASTParserClangTests.cpp
back to using the unsafe direct construction of CompilerDeclContext
as this assert won't work if the DeclContext we pass isn't a valid
DeclContext in the first place.

4 years ago[yaml2obj] - Allow using an arbitrary value for OSABI.
Georgii Rymar [Fri, 20 Dec 2019 14:02:43 +0000 (17:02 +0300)]
[yaml2obj] - Allow using an arbitrary value for OSABI.

There was no way to set an unsupported or unknown OS ABI.
With this patch it is possible to use any numeric value.

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

4 years ago[yaml2obj] - Add support for ELFOSABI_LINUX.
Georgii Rymar [Fri, 20 Dec 2019 12:51:10 +0000 (15:51 +0300)]
[yaml2obj] - Add support for ELFOSABI_LINUX.

ELFOSABI_LINUX is an alias for ELFOSABI_GNU.
It is not that obvious probably.

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

4 years ago[lldb] Don't process symlinks deep inside DWARFUnit
Pavel Labath [Fri, 20 Dec 2019 15:34:55 +0000 (16:34 +0100)]
[lldb] Don't process symlinks deep inside DWARFUnit

Summary:
This code is handling debug info paths starting with /proc/self/cwd,
which is one of the mechanisms people use to obtain "relocatable" debug
info (the idea being that one starts the debugger with an appropriate
cwd and things "just work").

Instead of resolving the symlinks inside DWARFUnit, we can do the same
thing more elegantly by hooking into the existing Module path remapping
code. Since llvm::DWARFUnit does not support any similar functionality,
doing things this way is also a step towards unifying llvm and lldb
dwarf parsers.

Reviewers: JDevlieghere, aprantl, clayborg, jdoerfert

Subscribers: lldb-commits

Tags: #lldb

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

4 years ago[yaml2obj] - Add testing for OSABI field.
Georgii Rymar [Fri, 20 Dec 2019 12:40:22 +0000 (15:40 +0300)]
[yaml2obj] - Add testing for OSABI field.

We have no such testing. This makes impossible
to add support for new ELFOSABI_* tags.

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

4 years ago[AArch64] [Windows] Use COFF stubs for calls to extern_weak functions
Martin Storsjö [Thu, 19 Dec 2019 12:00:44 +0000 (14:00 +0200)]
[AArch64] [Windows] Use COFF stubs for calls to extern_weak functions

As the extern_weak target might be missing, resolving to the absolute
address zero, we can't use the normal direct PC-relative branch
instructions (as that would result in relocations out of range).

Improve the classifyGlobalFunctionReference method to set
MO_DLLIMPORT/MO_COFFSTUB, and simplify the existing code in
AArch64TargetLowering::LowerCall to use the return value from
classifyGlobalFunctionReference for these cases.

Add code in both AArch64FastISel and GlobalISel/IRTranslator to
bail out for function calls to extern weak functions on windows,
to let SelectionDAG handle them.

This matches what was done for X86 in 6bf108d77a3c.

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

4 years ago[ARM] [Windows] Use COFF stubs for calls to extern_weak functions
Martin Storsjö [Thu, 19 Dec 2019 12:00:44 +0000 (14:00 +0200)]
[ARM] [Windows] Use COFF stubs for calls to extern_weak functions

As the extern_weak target might be missing, resolving to the absolute
address zero, we can't use the normal direct PC-relative branch
instructions (as that would result in relocations out of range).

Instead check the shouldAssumeDSOLocal method and load the address
from a COFF stub.

This matches what was done for X86 in 6bf108d77a3c.

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

4 years ago[ItaniumCXXABI] Don't mark an extern_weak init function as dso_local on windows
Martin Storsjö [Thu, 19 Dec 2019 11:57:47 +0000 (13:57 +0200)]
[ItaniumCXXABI] Don't mark an extern_weak init function as dso_local on windows

Since 6bf108d77a3c, we try to not mark extern_weak symbols as
dso_local, to allow using COFF stubs for references to those symbols
(as the symbol may be missing, resolving to an absolute address zero,
outside of the current DSO).

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

4 years ago[llvm-readobj][test] - Stop using Inputs/trivial.obj.elf-x86-64.
Georgii Rymar [Wed, 18 Dec 2019 14:49:37 +0000 (17:49 +0300)]
[llvm-readobj][test] - Stop using Inputs/trivial.obj.elf-x86-64.

This rewrites a few tests to stop using the
trivial.obj.elf-x86-64 precompiled object
and removes it.

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

4 years ago[lldb] Fix a -Wreturn-type gcc warning in ScriptInterpreter.cpp
Pavel Labath [Mon, 23 Dec 2019 10:06:50 +0000 (11:06 +0100)]
[lldb] Fix a -Wreturn-type gcc warning in ScriptInterpreter.cpp

4 years ago[lldb/lua] Fix bindings.test for lua-5.1
Pavel Labath [Mon, 23 Dec 2019 10:05:32 +0000 (11:05 +0100)]
[lldb/lua] Fix bindings.test for lua-5.1

string.format("%s", true) only works since lua-5.2. Make the print
statement more portable.

4 years ago[lldb][NFC] Simplify ClangASTContext::GetTranslationUnitDecl
Raphael Isemann [Mon, 23 Dec 2019 09:05:42 +0000 (10:05 +0100)]
[lldb][NFC] Simplify ClangASTContext::GetTranslationUnitDecl

These two functions are just calling their equivalent function
in ASTContext and implicitly convert the result to a
DeclContext* (a parent class of TranslationUnitDecl). This leads
to the absurd situation that we had to cast the result of
GetTranslationUnitDecl to a TranslationUnitDecl*. The only reason
we did this implicit conversion to the parent class
was that the void* conversion for the CompilerDeclContext constructor
was sound (which otherwise would receive a Decl* pointer when
called with a TranslationUnitDecl*).

Now that the CompilerDeclContext constructor is type safe we can
properly implement these functions by actually returning the
right type. Also deletes the static inconvenience method that was
not used anywhere.

4 years ago[lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in...
Raphael Isemann [Mon, 23 Dec 2019 09:38:12 +0000 (10:38 +0100)]
[lldb] Add a SubsystemRAII that takes care of calling Initialize and Terminate in the unit tests

Summary:
Many of our tests need to initialize certain subsystems/plugins of LLDB such as
`FileSystem` or `HostInfo` by calling their static `Initialize` functions before the
test starts and then calling `::Terminate` after the test is done (in reverse order).
This adds a lot of error-prone boilerplate code to our testing code.

This patch adds a RAII called SubsystemRAII that ensures that we always call
::Initialize and then call ::Terminate after the test is done (and that the Terminate
calls are always in the reverse order of the ::Initialize calls). It also gets rid of
all of the boilerplate that we had for these calls.

Per-fixture initialization is still not very nice with this approach as it would
require some kind of static unique_ptr that gets manually assigned/reseted
from the gtest SetUpTestCase/TearDownTestCase functions. Because of that
I changed all per-fixture setup to now do per-test setup which can be done
by just having the SubsystemRAII as a member of the test fixture. This change doesn't
influence our normal test runtime as LIT anyway runs each test case separately
(and the Initialize/Terminate calls are anyway not very expensive). It will however
make running all tests in a single executable slightly slower.

Reviewers: labath, JDevlieghere, martong, espindola, shafik

Reviewed By: labath

Subscribers: mgorny, rnkovacs, emaste, MaskRay, abidh, lldb-commits

Tags: #lldb

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

4 years ago[NFC] Style cleanups
Shengchen Kan [Mon, 23 Dec 2019 08:29:14 +0000 (16:29 +0800)]
[NFC] Style cleanups

1. Remove duplicate function for class name at the beginning of the
comment.
2. Use auto where the type is already obvious from the context.

4 years ago[lldb][NFC] Document CompilerDeclContext constructors
Raphael Isemann [Mon, 23 Dec 2019 08:59:58 +0000 (09:59 +0100)]
[lldb][NFC] Document CompilerDeclContext constructors

4 years ago[lldb][NFC] Make CompilerDeclContext construction type safe
Raphael Isemann [Mon, 23 Dec 2019 08:05:07 +0000 (09:05 +0100)]
[lldb][NFC] Make CompilerDeclContext construction type safe

The CompilerDeclContext constructor takes a void* pointer which
means that all callers of this constructor need to first explicitly
convert all pointers to clang::DeclContext*. This causes that we
for example can't just pass a TranslationUnitDecl* to the constructor without
first casting it to its parent class (as it inherits from both
Decl and DeclContext so the void* pointer is actually a Decl*).

This patch introduces a utility function in the ClangASTContext
which gets rid of the requirement to cast all pointers to
clang::DeclContext. Also moves all constructor calls to use this
function instead which is NFC (beside the change in
DWARFASTParserClangTests.cpp).