platform/upstream/llvm.git
5 years ago[clang-tidy] A new OpenMP module
Roman Lebedev [Fri, 22 Mar 2019 19:46:01 +0000 (19:46 +0000)]
[clang-tidy] A new OpenMP module

Summary:
Just the empty skeleton.
Previously reviewed as part of D57113.

Reviewers: JonasToth, aaron.ballman, alexfh, xazax.hun, hokein, gribozavr

Reviewed By: JonasToth, gribozavr

Subscribers: jdoerfert, mgorny, rnkovacs, guansong, arphaman, cfe-commits

Tags: #clang-tools-extra, #openmp, #clang

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

llvm-svn: 356800

5 years ago[NFC] ExceptionEscapeCheck: small refactoring
Roman Lebedev [Fri, 22 Mar 2019 19:45:51 +0000 (19:45 +0000)]
[NFC] ExceptionEscapeCheck: small refactoring

Summary:
D59466 wants to analyse the `Stmt`, and `ExceptionEscapeCheck` does not
have that as a possible entry point.
This simplifies addition of `Stmt` analysis entry point.

Reviewers: baloghadamsoftware, JonasToth, gribozavr

Reviewed By: gribozavr

Subscribers: rnkovacs, cfe-commits

Tags: #clang-tools-extra, #clang

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

llvm-svn: 356799

5 years ago[libc++] Re-export the sjlj ABI v2 for ARM architectures
Louis Dionne [Fri, 22 Mar 2019 19:38:53 +0000 (19:38 +0000)]
[libc++] Re-export the sjlj ABI v2 for ARM architectures

We were previously not exporting the right ABI version of libc++abi.

llvm-svn: 356798

5 years ago[KnownBits] Add const to some methods. NFC
Bjorn Pettersson [Fri, 22 Mar 2019 19:36:51 +0000 (19:36 +0000)]
[KnownBits] Add const to some methods. NFC

Add "const" to the trunc, zext, sext and zextOrTrunc
methods to make it clear that they aren't updating
the object itself.

llvm-svn: 356797

5 years ago[clang-tidy] Move all checks to the new registerPPCallbacks API
Alexander Kornienko [Fri, 22 Mar 2019 18:58:12 +0000 (18:58 +0000)]
[clang-tidy] Move all checks to the new registerPPCallbacks API

llvm-svn: 356796

5 years agoFix clang-move test.
Alexander Kornienko [Fri, 22 Mar 2019 18:52:10 +0000 (18:52 +0000)]
Fix clang-move test.

llvm-svn: 356795

5 years ago[clang] Add support for Exynos M5 (NFC)
Evandro Menezes [Fri, 22 Mar 2019 18:44:09 +0000 (18:44 +0000)]
[clang] Add support for Exynos M5 (NFC)

Add Exynos M5 test cases.

llvm-svn: 356794

5 years ago[AArch64, ARM] Add support for Exynos M5
Evandro Menezes [Fri, 22 Mar 2019 18:42:14 +0000 (18:42 +0000)]
[AArch64, ARM] Add support for Exynos M5

Add Exynos M5 support and test cases.

llvm-svn: 356793

5 years ago[clang-tidy] anyOf(hasName(..), hasName(..)) -> hasAnyName
Alexander Kornienko [Fri, 22 Mar 2019 18:37:45 +0000 (18:37 +0000)]
[clang-tidy] anyOf(hasName(..), hasName(..)) -> hasAnyName

+ a minor style fix

llvm-svn: 356792

5 years ago[ARM] [NFC] Use tGPR in patterns where appropriate.
Eli Friedman [Fri, 22 Mar 2019 18:37:26 +0000 (18:37 +0000)]
[ARM] [NFC] Use tGPR in patterns where appropriate.

This doesn't have any practical effect at the moment, as far as I know,
because high registers aren't allocatable in Thumb1 mode. But it might
matter in the future.

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

llvm-svn: 356791

5 years ago[SLP] fix variables names in test; NFC
Sanjay Patel [Fri, 22 Mar 2019 18:33:11 +0000 (18:33 +0000)]
[SLP] fix variables names in test; NFC

'tmpXXX' conflicts with the auto-generated script regex names.
That could cause mask a bug or fail if the output changes.

llvm-svn: 356790

5 years agoIR: Support parsing numeric block ids, and emit them in textual output.
James Y Knight [Fri, 22 Mar 2019 18:27:13 +0000 (18:27 +0000)]
IR: Support parsing numeric block ids, and emit them in textual output.

Just as as llvm IR supports explicitly specifying numeric value ids
for instructions, and emits them by default in textual output, now do
the same for blocks.

This is a slightly incompatible change in the textual IR format.

Previously, llvm would parse numeric labels as string names. E.g.
  define void @f() {
    br label %"55"
  55:
    ret void
  }
defined a label *named* "55", even without needing to be quoted, while
the reference required quoting. Now, if you intend a block label which
looks like a value number to be a name, you must quote it in the
definition too (e.g. `"55":`).

Previously, llvm would print nameless blocks only as a comment, and
would omit it if there was no predecessor. This could cause confusion
for readers of the IR, just as unnamed instructions did prior to the
addition of "%5 = " syntax, back in 2008 (PR2480).

Now, it will always print a label for an unnamed block, with the
exception of the entry block. (IMO it may be better to print it for
the entry-block as well. However, that requires updating many more
tests.)

Thus, the following is supported, and is the canonical printing:
  define i32 @f(i32, i32) {
    %3 = add i32 %0, %1
    br label %4

  4:
    ret i32 %3
  }

New test cases covering this behavior are added, and other tests
updated as required.

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

llvm-svn: 356789

5 years ago[clangd] Call the new ClangTidyCheck::registerPPCallbacks overload
Alexander Kornienko [Fri, 22 Mar 2019 18:16:51 +0000 (18:16 +0000)]
[clangd] Call the new ClangTidyCheck::registerPPCallbacks overload

llvm-svn: 356788

5 years ago[X86] Regenerate powi tests to include i686 x87/sse targets
Simon Pilgrim [Fri, 22 Mar 2019 18:04:28 +0000 (18:04 +0000)]
[X86] Regenerate powi tests to include i686 x87/sse targets

llvm-svn: 356787

5 years ago[X86] Add PR13897 test case (i128 mul on i686)
Simon Pilgrim [Fri, 22 Mar 2019 17:52:21 +0000 (17:52 +0000)]
[X86] Add PR13897 test case (i128 mul on i686)

llvm-svn: 356786

5 years ago[ValueTracking] Avoid redundant known bits calculation in computeOverflowForSignedAdd()
Nikita Popov [Fri, 22 Mar 2019 17:51:40 +0000 (17:51 +0000)]
[ValueTracking] Avoid redundant known bits calculation in computeOverflowForSignedAdd()

We're already computing the known bits of the operands here. If the
known bits of the operands can determine the sign bit of the result,
we'll already catch this in signedAddMayOverflow(). The only other
way (and as the comment already indicates) we'll get new information
from computing known bits on the whole add, is if there's an assumption
on it.

As such, we change the code to only compute known bits from assumptions,
instead of computing full known bits on the add (which would unnecessarily
recompute the known bits of the operands as well).

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

llvm-svn: 356785

5 years ago[X86] lowerShuffleAsBitMask - ensure float bit masks are the correct width (PR41203)
Simon Pilgrim [Fri, 22 Mar 2019 17:23:55 +0000 (17:23 +0000)]
[X86] lowerShuffleAsBitMask - ensure float bit masks are the correct width (PR41203)

llvm-svn: 356784

5 years ago[AliasAnalysis] Second prototype to cache BasicAA / anyAA state.
Alina Sbirlea [Fri, 22 Mar 2019 17:22:19 +0000 (17:22 +0000)]
[AliasAnalysis] Second prototype to cache BasicAA / anyAA state.

Summary:
Adding contained caching to AliasAnalysis. BasicAA is currently the only one using it.

AA changes:
- This patch is pulling the caches from BasicAAResults to AAResults, meaning the getModRefInfo call benefits from the IsCapturedCache as well when in "batch mode".
- All AAResultBase implementations add the QueryInfo member to all APIs. AAResults APIs maintain wrapper APIs such that all alias()/getModRefInfo call sites are unchanged.
- AA now provides a BatchAAResults type as a wrapper to AAResults. It keeps the AAResults instance and a QueryInfo instantiated to batch mode. It delegates all work to the AAResults instance with the batched QueryInfo. More API wrappers may be needed in BatchAAResults; only the minimum needed is currently added.

MemorySSA changes:
- All walkers are now templated on the AA used (AliasAnalysis=AAResults or BatchAAResults).
- At build time, we optimize uses; now we create a local walker (lives only as long as OptimizeUses does) using BatchAAResults.
- All Walkers have an internal AA and only use that now, never the AA in MemorySSA. The Walkers receive the AA they will use when built.

- The walker we use for queries after the build is instantiated on AliasAnalysis and is built after building MemorySSA and setting AA.
- All static methods doing walking are now templated on AliasAnalysisType if they are used both during build and after. If used only during build, the method now only takes a BatchAAResults. If used only after build, the method now takes an AliasAnalysis.

Subscribers: sanjoy, arsenm, jvesely, nhaehnle, jlebar, george.burgess.iv, llvm-commits

Tags: #llvm

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

llvm-svn: 356783

5 years ago[Tests] Add masked.gather tests for non-constant masks + speculation possibilities
Philip Reames [Fri, 22 Mar 2019 16:39:04 +0000 (16:39 +0000)]
[Tests] Add masked.gather tests for non-constant masks + speculation possibilities

llvm-svn: 356782

5 years ago[ConstantFolding] Fix GetConstantFoldFPValue to avoid cast overflow.
Bixia Zheng [Fri, 22 Mar 2019 16:37:37 +0000 (16:37 +0000)]
[ConstantFolding] Fix GetConstantFoldFPValue to avoid cast overflow.

Summary:
In C++, the behavior of casting a double value that is beyond the range
of a single precision floating-point to a float value is undefined. This
change replaces such a cast with APFloat::convert to convert the value,
which is consistent with how we convert a double value to a half value.

Reviewers: sanjoy

Subscribers: lebedev.ri, sanjoy, jlebar, llvm-commits

Tags: #llvm

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

llvm-svn: 356781

5 years agoMake clang-move use same file naming convention as other tools
Nico Weber [Fri, 22 Mar 2019 16:34:39 +0000 (16:34 +0000)]
Make clang-move use same file naming convention as other tools

In all the other clang-foo tools, the main library file is called
Foo.cpp and the file in the tool/ folder is called ClangFoo.cpp.
Do this for clang-move too.

No intended behavior change.

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

llvm-svn: 356780

5 years ago[tests] Add a generic masked.gather test to show sometimes we can't transform
Philip Reames [Fri, 22 Mar 2019 16:30:56 +0000 (16:30 +0000)]
[tests] Add a generic masked.gather test to show sometimes we can't transform

llvm-svn: 356779

5 years ago[tests] Add tests for converting masked.load to load speculatively
Philip Reames [Fri, 22 Mar 2019 16:26:57 +0000 (16:26 +0000)]
[tests] Add tests for converting masked.load to load speculatively

llvm-svn: 356778

5 years ago[llvm-readobj] Revert bad changes
Xing GUO [Fri, 22 Mar 2019 16:20:54 +0000 (16:20 +0000)]
[llvm-readobj] Revert bad changes

llvm-svn: 356777

5 years ago[ARM] Fix bug 39982 - pcs("aapcs-vfp") is not consistent
Carey Williams [Fri, 22 Mar 2019 16:20:45 +0000 (16:20 +0000)]
[ARM] Fix bug 39982 - pcs("aapcs-vfp") is not consistent

Correctly handle homogeneous aggregates when a
function's ABI is specified via the pcs attribute.

Bug: https://bugs.llvm.org/show_bug.cgi?id=39982
Differential Revision: https://reviews.llvm.org/D59094

llvm-svn: 356776

5 years ago[Tests] Use valid alignment in masked.gather tests
Philip Reames [Fri, 22 Mar 2019 16:20:24 +0000 (16:20 +0000)]
[Tests] Use valid alignment in masked.gather tests

llvm-svn: 356775

5 years agoRevert "[coroutines][PR40978] Emit error for co_yield within catch block"
Brian Gesiak [Fri, 22 Mar 2019 16:08:29 +0000 (16:08 +0000)]
Revert "[coroutines][PR40978] Emit error for co_yield within catch block"

The commit https://reviews.llvm.org/rC356296 is causing a regression in nested
catch scopes, https://bugs.llvm.org/show_bug.cgi?id=41171. Revert this change
for now in order to un-break that problem report.

llvm-svn: 356774

5 years agoRevert "Move the rest of the sections over to DWARFContext."
Pavel Labath [Fri, 22 Mar 2019 16:07:58 +0000 (16:07 +0000)]
Revert "Move the rest of the sections over to DWARFContext."

This reverts commit r356682 because it breaks the DWO flavours of some
tests:
    lldb-Suite :: lang/c/const_variables/TestConstVariables.py
    lldb-Suite :: lang/c/local_variables/TestLocalVariables.py
    lldb-Suite :: lang/c/vla/TestVLA.py

llvm-svn: 356773

5 years agogn build: Merge r356750
Nico Weber [Fri, 22 Mar 2019 16:00:16 +0000 (16:00 +0000)]
gn build: Merge r356750

llvm-svn: 356772

5 years agogn build: Merge r356570
Nico Weber [Fri, 22 Mar 2019 15:58:33 +0000 (15:58 +0000)]
gn build: Merge r356570

llvm-svn: 356771

5 years agogn build: Merge r356662
Nico Weber [Fri, 22 Mar 2019 15:56:33 +0000 (15:56 +0000)]
gn build: Merge r356662

llvm-svn: 356770

5 years agogn build: Merge r356692
Nico Weber [Fri, 22 Mar 2019 15:54:29 +0000 (15:54 +0000)]
gn build: Merge r356692

llvm-svn: 356769

5 years agoInstCombineSimplifyDemanded: Allow v3 results for AMDGCN buffer and image intrinsics
Tim Renouf [Fri, 22 Mar 2019 15:53:50 +0000 (15:53 +0000)]
InstCombineSimplifyDemanded: Allow v3 results for AMDGCN buffer and image intrinsics

This helps to avoid the situation where RA spots that only 3 of the
v4f32 result of a load are used, and immediately reallocates the 4th
register for something else, requiring a stall waiting for the load.

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

Change-Id: I947661edfd5715f62361a02b100f14aeeada29aa
llvm-svn: 356768

5 years agogn build: Merge r356753
Nico Weber [Fri, 22 Mar 2019 15:50:24 +0000 (15:50 +0000)]
gn build: Merge r356753

llvm-svn: 356767

5 years agogn build: Merge r356652 (and follow-up r56655)
Nico Weber [Fri, 22 Mar 2019 15:48:11 +0000 (15:48 +0000)]
gn build: Merge r356652 (and follow-up r56655)

llvm-svn: 356766

5 years agogn build: Merge r356729
Nico Weber [Fri, 22 Mar 2019 15:43:06 +0000 (15:43 +0000)]
gn build: Merge r356729

llvm-svn: 356765

5 years ago[llvm-readobj] Separate `Symbol Version` dumpers into `LLVM style` and `GNU style`
Xing GUO [Fri, 22 Mar 2019 15:42:13 +0000 (15:42 +0000)]
[llvm-readobj] Separate `Symbol Version` dumpers into `LLVM style` and `GNU style`

Summary:
Currently, llvm-readobj can dump symbol version sections only in LLVM style. In this patch, I would like to separate these dumpers into GNU style and
LLVM style for future implementation.

Reviewers: grimar, jhenderson, mattd, rupprecht

Reviewed By: rupprecht

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 356764

5 years ago[x86] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 22 Mar 2019 15:33:59 +0000 (15:33 +0000)]
[x86] auto-generate complete test checks; NFC

llvm-svn: 356763

5 years ago[x86] auto-generate complete test checks; NFC
Sanjay Patel [Fri, 22 Mar 2019 15:33:55 +0000 (15:33 +0000)]
[x86] auto-generate complete test checks; NFC

llvm-svn: 356762

5 years ago[x86] add 'nounwind' to tests to reduce noise; NFC
Sanjay Patel [Fri, 22 Mar 2019 15:33:51 +0000 (15:33 +0000)]
[x86] add 'nounwind' to tests to reduce noise; NFC

llvm-svn: 356761

5 years ago[x86] auto-generate complete checks for test; NFC
Sanjay Patel [Fri, 22 Mar 2019 15:33:47 +0000 (15:33 +0000)]
[x86] auto-generate complete checks for test; NFC

llvm-svn: 356760

5 years ago[OPENMP]Add missing comment, NFC.
Alexey Bataev [Fri, 22 Mar 2019 15:32:02 +0000 (15:32 +0000)]
[OPENMP]Add missing comment, NFC.

llvm-svn: 356759

5 years ago[OPENMP]Allow no allocator clause in target regions with requires
Alexey Bataev [Fri, 22 Mar 2019 15:25:12 +0000 (15:25 +0000)]
[OPENMP]Allow no allocator clause in target regions with requires
dynamic_allocators.

According to the OpenMP 5.0, 2.11.3 allocate Directive, Restrictions,
allocate directives that appear in a target region must specify an
allocator clause unless a requires directive with the dynamic_allocators
clause is present in the same compilation unit. Patch adds a check for a
presence of the requires directive with the dynamic_allocators clause.

llvm-svn: 356758

5 years ago[AMDGPU] Use three- and five-dword result type in image ops
Tim Renouf [Fri, 22 Mar 2019 15:21:11 +0000 (15:21 +0000)]
[AMDGPU] Use three- and five-dword result type in image ops

Some image ops return three or five dwords.  Previously, we modeled that
with a 4 or 8 dword register class.  The register allocator could
cleverly spot that some subregs were dead and allocate something else
there, but that caused the de-optimization that waitcnt insertion would
think that the result was used immediately.

This commit allows such an image op to have a result with a three or
five dword result, avoiding the above de-optimization.

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

Change-Id: I3651211bbd7ed22721ee7b9fefd7bcc60a809d8b
llvm-svn: 356757

5 years ago[clang-tidy] Fix a compiler warning.
Alexander Kornienko [Fri, 22 Mar 2019 15:07:18 +0000 (15:07 +0000)]
[clang-tidy] Fix a compiler warning.

Rename the Preprocessor field to fix the

  declaration of ‘std::unique_ptr<clang::Preprocessor> clang::tooling::ExpandModularHeadersPPCallbacks::Preprocessor’ changes the meaning of ‘Preprocessor’ from ‘class clang::Preprocessor’ [-fpermissive]

warning.

llvm-svn: 356756

5 years ago[AMDGPU] Implemented dwordx3 variants of buffer/tbuffer load/store intrinsics
Tim Renouf [Fri, 22 Mar 2019 14:58:02 +0000 (14:58 +0000)]
[AMDGPU] Implemented dwordx3 variants of buffer/tbuffer load/store intrinsics

Now we have vec3 MVTs, this commit implements dwordx3 variants of the
buffer intrinsics.

On gfx6, a dwordx3 buffer load intrinsic is implemented as a dwordx4
instruction, and a dwordx3 buffer store intrinsic is not supported.
We need to support the dwordx3 load intrinsic because it is generated by
subtarget-unaware code in InstCombine.

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

Change-Id: I016729d8557b98a52f529638ae97c340a5922a4e
llvm-svn: 356755

5 years ago[SLPVectorizer] Add test related to SLP Throttling support, NFCI.
Dinar Temirbulatov [Fri, 22 Mar 2019 14:50:53 +0000 (14:50 +0000)]
[SLPVectorizer] Add test related to SLP Throttling support, NFCI.

llvm-svn: 356754

5 years ago[ObjectYAML] Add basic minidump generation support
Pavel Labath [Fri, 22 Mar 2019 14:47:26 +0000 (14:47 +0000)]
[ObjectYAML] Add basic minidump generation support

Summary:
This patch adds the ability to read a yaml form of a minidump file and
write it out as binary. Apart from the minidump header and the stream
directory, only three basic stream kinds are supported:
- Text: This kind is used for streams which contain textual data. This
  is typically the contents of a /proc file on linux (e.g.
  /proc/PID/maps). In this case, we just put the raw stream contents
  into the yaml.
- SystemInfo: This stream contains various bits of information about the
  host system in binary form. We expose the data in a structured form.
- Raw: This kind is used as a fallback when we don't have any special
  knowledge about the stream. In this case, we just print the stream
  contents in hex.

For this code to be really useful, more stream kinds will need to be
added (particularly for things like lists of memory regions and loaded
modules). However, these can be added incrementally.

Reviewers: jhenderson, zturner, clayborg, aprantl

Subscribers: mgorny, lemo, llvm-commits, lldb-commits

Tags: #llvm

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

llvm-svn: 356753

5 years ago[OPENMP]Emit error message for allocate directive without allocator
Alexey Bataev [Fri, 22 Mar 2019 14:41:39 +0000 (14:41 +0000)]
[OPENMP]Emit error message for allocate directive without allocator
clause in target region.

According to the OpenMP 5.0, 2.11.3 allocate Directive, Restrictions,
allocate directives that appear in a target region must specify an
allocator clause unless a requires directive with the dynamic_allocators
clause is present in the same compilation unit.

llvm-svn: 356752

5 years agoExtend r356573 (minidump UUID handling) to cover elf build-ids too
Pavel Labath [Fri, 22 Mar 2019 14:03:59 +0000 (14:03 +0000)]
Extend r356573 (minidump UUID handling) to cover elf build-ids too

Breakpad (but not crashpad) will insert an empty (all-zero) build-id
record for modules which do not have a build-id. This tells lldb to
treat such records as empty/invalid uuids.

llvm-svn: 356751

5 years ago[clang-tidy] Expand modular headers for PPCallbacks
Alexander Kornienko [Fri, 22 Mar 2019 13:42:48 +0000 (13:42 +0000)]
[clang-tidy] Expand modular headers for PPCallbacks

Summary:
Add a way to expand modular headers for PPCallbacks. Checks can opt-in for this
expansion by overriding the new registerPPCallbacks virtual method and
registering their PPCallbacks in the preprocessor created for this specific
purpose.

Use module expansion in the readability-identifier-naming check

Reviewers: gribozavr, usaxena95, sammccall

Reviewed By: gribozavr

Subscribers: nemanjai, mgorny, xazax.hun, kbarton, jdoerfert, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 356750

5 years ago[AST] OMPStructuredBlockTest: avoid using multiline string literals in macros
Roman Lebedev [Fri, 22 Mar 2019 13:40:36 +0000 (13:40 +0000)]
[AST] OMPStructuredBlockTest: avoid using multiline string literals in macros

That is what i have been doing elsewhere in these tests, maybe that's it?

Maybe this helps with failing builds:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/17921
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-global-isel/builds/10248

llvm-svn: 356749

5 years ago[llvm-exegesis] Fix compilation before c++17.
Clement Courbet [Fri, 22 Mar 2019 13:37:39 +0000 (13:37 +0000)]
[llvm-exegesis] Fix compilation before c++17.

ClusteringTest.cpp:25:23: error: constexpr variable cannot have non-literal type 'const llvm::exegesis::(anonymous namespace)::(lambda at /home/buildslave/ps4-buildslave4/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/llvm.src/unittests/tools/llvm-exegesis/ClusteringTest.cpp:25:35)'
static constexpr auto HasPoints = [](const std::vector<int> &Indices) {

llvm-svn: 356748

5 years ago[llvm-exegesis] Add clustering test.
Clement Courbet [Fri, 22 Mar 2019 13:13:12 +0000 (13:13 +0000)]
[llvm-exegesis] Add clustering test.

Summary: To show that dbscan is insensitive to the order of the points.

Subscribers: tschuett, llvm-commits

Tags: #llvm

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

llvm-svn: 356747

5 years ago[llvm-objcopy]Add coverage for --split-dwo and --output-format
James Henderson [Fri, 22 Mar 2019 12:45:27 +0000 (12:45 +0000)]
[llvm-objcopy]Add coverage for --split-dwo and --output-format

Also fix up a couple of minor issues in the test being updated, where
FileCheck could match on incorrect output and fix the test case order to
match the struct order.

Reviewed by: grimar

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

llvm-svn: 356746

5 years agoRevert r356738 "[llvm-objcopy] - Implement replaceSectionReferences for GroupSection...
George Rimar [Fri, 22 Mar 2019 12:14:04 +0000 (12:14 +0000)]
Revert r356738 "[llvm-objcopy] - Implement replaceSectionReferences for GroupSection class."

Seems this broke ubsan bot:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-bootstrap-ubsan/builds/11760

llvm-svn: 356745

5 years ago[RISCV] Add basic RV32E definitions and MC layer support
Alex Bradbury [Fri, 22 Mar 2019 11:21:40 +0000 (11:21 +0000)]
[RISCV] Add basic RV32E definitions and MC layer support

The RISC-V ISA defines RV32E as an alternative "base" instruction set
encoding, that differs from RV32I by having only 16 rather than 32 registers.
This patch adds basic definitions for RV32E as well as MC layer support
(assembling, disassembling) and tests. The only supported ABI on RV32E is
ILP32E.

Add a new RISCVFeatures::validate() helper to RISCVUtils which can be called
from codegen or MC layer libraries to validate the combination of TargetTriple
and FeatureBitSet. Other targets have similar checks (e.g. erroring if SPE is
enabled on PPC64 or oddspreg + o32 ABI on Mips), but they either duplicate the
checks (Mips), or fail to check for both codegen and MC codepaths (PPC).

Codegen for the ILP32E ABI support and RV32E codegen are left for a future
patch/patches.

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

llvm-svn: 356744

5 years ago[Tooling] Avoid working-dir races in AllTUsToolExecutor
Ilya Biryukov [Fri, 22 Mar 2019 11:01:13 +0000 (11:01 +0000)]
[Tooling] Avoid working-dir races in AllTUsToolExecutor

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

llvm-svn: 356743

5 years ago[ARM] Add Cortex-M35P Support
Luke Cheeseman [Fri, 22 Mar 2019 10:58:15 +0000 (10:58 +0000)]
[ARM] Add Cortex-M35P Support

- Add clang frontend testing for Cortex-M35P

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

llvm-svn: 356742

5 years ago[RISCV] Optimize emission of SELECT sequences
Alex Bradbury [Fri, 22 Mar 2019 10:45:03 +0000 (10:45 +0000)]
[RISCV] Optimize emission of SELECT sequences

This patch optimizes the emission of a sequence of SELECTs with the same
condition, avoiding the insertion of unnecessary control flow. Such a sequence
often occurs when a SELECT of values wider than XLEN is legalized into two
SELECTs with legal types. We have identified several use cases where the
SELECTs could be interleaved with other instructions. Therefore, we extend the
sequence to include non-SELECT instructions if we are able to detect that the
non-SELECT instructions do not impact the optimization.

This patch supersedes https://reviews.llvm.org/D59096, which attempted to
address this issue by introducing a new SelectionDAG node. Hat tip to Eli
Friedman for his feedback on how to best handle this issue.

Differential Revision: https://reviews.llvm.org/D59355
Patch by Luís Marques.

llvm-svn: 356741

5 years ago[RISCV] Allow conversion of CC logic to bitwise logic
Alex Bradbury [Fri, 22 Mar 2019 10:39:22 +0000 (10:39 +0000)]
[RISCV] Allow conversion of CC logic to bitwise logic

Indicates in the TargetLowering interface that conversions from CC logic to
bitwise logic are allowed. Adds tests that show the benefit when optimization
opportunities are detected. Also adds tests that show that when the optimization
is not applied correct code is generated (but opportunities for other
optimizations remain).

Differential Revision: https://reviews.llvm.org/D59596
Patch by Luís Marques.

llvm-svn: 356740

5 years ago[llvm-objcopy] - Fix a st_name of the first symbol table entry.
George Rimar [Fri, 22 Mar 2019 10:28:56 +0000 (10:28 +0000)]
[llvm-objcopy] - Fix a st_name of the first symbol table entry.

Spec says about the first symbol table entry that index 0 both designates the first entry in the table
and serves as the undefined symbol index. It should have zero value.
Hence the first symbol table entry has no name. And so has to have a st_name == 0.
(http://refspecs.linuxbase.org/elf/gabi4+/ch4.symtab.html)

Currently, we do not emit zero value for the first symbol table entry.
That happens because we add empty strings to the string builder, which
for each such case adds a zero byte:
(https://github.com/llvm-mirror/llvm/blob/master/lib/MC/StringTableBuilder.cpp#L185)
After the string optimization performed it might return non zero indexes for the
empty string requested.

The patch fixes this issue for the case above and other sections with no names.

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

llvm-svn: 356739

5 years ago[llvm-objcopy] - Implement replaceSectionReferences for GroupSection class.
George Rimar [Fri, 22 Mar 2019 10:24:37 +0000 (10:24 +0000)]
[llvm-objcopy] - Implement replaceSectionReferences for GroupSection class.

Currently, llvm-objcopy incorrectly handles compression and decompression of the
sections from COMDAT groups, because we do not implement the
replaceSectionReferences for this type of the sections.

The patch does that.

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

llvm-svn: 356738

5 years ago[llvm-objcopy]Add support for *-freebsd output formats
James Henderson [Fri, 22 Mar 2019 10:21:09 +0000 (10:21 +0000)]
[llvm-objcopy]Add support for *-freebsd output formats

GNU objcopy can support output formats like elf32-i386-freebsd and
elf64-x86-64-freebsd. The only difference from their regular non-freebsd
counterparts that I have observed is that the freebsd versions set the
OS/ABI field to ELFOSABI_FREEBSD. This patch sets the OS/ABI field
according based on the format whenever --output-format is specified.

Reviewed by: rupprecht, grimar

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

llvm-svn: 356737

5 years ago[RISCV][NFC] Add test case to MC/RISCV/linker-relaxation.s showing incorrect relocati...
Alex Bradbury [Fri, 22 Mar 2019 10:20:21 +0000 (10:20 +0000)]
[RISCV][NFC] Add test case to MC/RISCV/linker-relaxation.s showing incorrect relocations being emitted

A follow-up patch will fix this case.

llvm-svn: 356736

5 years ago[AMDGPU] Added v5i32 and v5f32 register classes
Tim Renouf [Fri, 22 Mar 2019 10:11:21 +0000 (10:11 +0000)]
[AMDGPU] Added v5i32 and v5f32 register classes

They are not used by anything yet, but a subsequent commit will start
using them for image ops that return 5 dwords.

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

Change-Id: I63e1904081e39a6d66e4eb96d51df25ad399d271
llvm-svn: 356735

5 years ago[RISCV][NFC] Expand test/MC/RISCV/linker-relaxation.s tests
Alex Bradbury [Fri, 22 Mar 2019 06:05:52 +0000 (06:05 +0000)]
[RISCV][NFC] Expand test/MC/RISCV/linker-relaxation.s tests

Add more complete CHECK lines for the relocations generated when relaxation is
enabled, and add cases where a locally defined symbol is referenced.

Two instances of pcrel_lo(defined_symbol) are commented out, as they will
produce an error. A follow-up patch will fix this.

llvm-svn: 356734

5 years ago[X86] Add 32-bit command lines with and without SSE2 to atomic-non-integer.ll. NFC
Craig Topper [Fri, 22 Mar 2019 04:28:40 +0000 (04:28 +0000)]
[X86] Add 32-bit command lines with and without SSE2 to atomic-non-integer.ll. NFC

llvm-svn: 356733

5 years ago[BPF] fix flaky btf unit test static-var-derived-type.ll
Yonghong Song [Fri, 22 Mar 2019 02:54:47 +0000 (02:54 +0000)]
[BPF] fix flaky btf unit test static-var-derived-type.ll

The DataSecEentries is defined as an unordered_map since
order does not really matter.
  std::unordered_map<std::string, std::unique_ptr<BTFKindDataSec>>
      DataSecEntries;
This seems causing the test static-var-derived-type.ll flaky
as two sections ".bss" and ".readonly" have undeterministic
ordering when performing map iterating, which decides the
output assembly code sequence of BTF_KIND_DATASEC entries.

Fix the test to have only one data section to remove
flakiness.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 356731

5 years ago[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries
Fangrui Song [Fri, 22 Mar 2019 02:43:17 +0000 (02:43 +0000)]
[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries

Summary: This is the lld-side change of D57939

Reviewers: echristo, dblaikie, ruiu, espindola

Reviewed By: echristo, ruiu

Subscribers: jdoerfert, emaste, arichardson, llvm-commits

Tags: #llvm

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

llvm-svn: 356730

5 years ago[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries
Fangrui Song [Fri, 22 Mar 2019 02:43:11 +0000 (02:43 +0000)]
[DWARF] Refactor RelocVisitor and fix computation of SHT_RELA-typed relocation entries

Summary:
getRelocatedValue may compute incorrect value for SHT_RELA-typed relocation entries.

// DWARFDataExtractor.cpp
uint64_t DWARFDataExtractor::getRelocatedValue(uint32_t Size, uint32_t *Off,
...
  // This formula is correct for REL, but may be incorrect for RELA if the value
  // stored in the location (getUnsigned(Off, Size)) is not zero.
  return getUnsigned(Off, Size) + Rel->Value;

In this patch, we

* refactor these visit* functions to include a new parameter `uint64_t A`.
  Since these visit* functions are no longer used as visitors, rename them to resolve*.
  + REL: A is used as the addend. A is the value stored in the location where the
    relocation applies: getUnsigned(Off, Size)
  + RELA: The addend encoded in RelocationRef is used, e.g. getELFAddend(R)
* and add another set of supports* functions to check if a given relocation type is handled.
  DWARFObjInMemory uses them to fail early.

Reviewers: echristo, dblaikie

Reviewed By: echristo

Subscribers: mgorny, aprantl, aheejin, fedor.sergeev, llvm-commits

Tags: #llvm

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

llvm-svn: 356729

5 years ago[NFC][TSan][libdispatch] Don't use ignore_noninstrumented_modules on Linux
Julian Lettner [Fri, 22 Mar 2019 01:43:43 +0000 (01:43 +0000)]
[NFC][TSan][libdispatch] Don't use ignore_noninstrumented_modules on Linux

llvm-svn: 356728

5 years ago[BPF] handle derived type properly for computing type id
Yonghong Song [Fri, 22 Mar 2019 01:30:50 +0000 (01:30 +0000)]
[BPF] handle derived type properly for computing type id

Currently, the type id for a derived type is computed incorrectly.
For example,
  type #1: int
  type #2: ptr to #1

For a global variable "int *a", type #1 will be attributed to variable "a".
This is due to a bug which assigns the type id of the basetype of
that derived type as the derived type's type id. This happens
to "const", "volatile", "restrict", "typedef" and "pointer" types.

This patch fixed this bug, fixed existing test cases and added
a new one focusing on pointers plus other derived types.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 356727

5 years agoFix a vector test to not use a local type as a template parameter. This causes a...
Marshall Clow [Fri, 22 Mar 2019 00:49:41 +0000 (00:49 +0000)]
Fix a vector test to not use a local type as a template parameter. This causes a warning on C++03. NFC

llvm-svn: 356726

5 years ago[Reproducers] Fix log statements
Jonas Devlieghere [Thu, 21 Mar 2019 23:58:51 +0000 (23:58 +0000)]
[Reproducers] Fix log statements

This isn't python where you can omit the index inside `{}`.

llvm-svn: 356725

5 years agoThis test assumes that -rtlib defaults to libgcc. But that isn't true in the face...
Sterling Augustine [Thu, 21 Mar 2019 23:30:50 +0000 (23:30 +0000)]
This test assumes that -rtlib defaults to libgcc. But that isn't true in the face of -DCLANG_DEFAULT_RTLIB=compiler-rt.

Subscribers: dberris, jdoerfert, llvm-commits

Tags: #llvm

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

llvm-svn: 356724

5 years ago[X86] Autogenerate complete checks. NFC
Craig Topper [Thu, 21 Mar 2019 23:09:56 +0000 (23:09 +0000)]
[X86] Autogenerate complete checks. NFC

llvm-svn: 356723

5 years ago[AArch64] Split the neon.addp intrinsic into integer and fp variants.
Amara Emerson [Thu, 21 Mar 2019 22:31:37 +0000 (22:31 +0000)]
[AArch64] Split the neon.addp intrinsic into integer and fp variants.

This is the result of discussions on the list about how to deal with intrinsics
which require codegen to disambiguate them via only the integer/fp overloads.
It causes problems for GlobalISel as some of that information is lost during
translation, while with other operations like IR instructions the information is
encoded into the instruction opcode.

This patch changes clang to emit the new faddp intrinsic if the vector operands
to the builtin have FP element types. LLVM IR AutoUpgrade has been taught to
upgrade existing calls to aarch64.neon.addp with fp vector arguments, and
we remove the workarounds introduced for GlobalISel in r355865.

This is a more permanent solution to PR40968.

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

llvm-svn: 356722

5 years ago[X86] Use LoadInst->getType() instead of LoadInst->getPointerOperandType()->getElemen...
Craig Topper [Thu, 21 Mar 2019 21:37:18 +0000 (21:37 +0000)]
[X86] Use LoadInst->getType() instead of LoadInst->getPointerOperandType()->getElementType(). NFCI

For the future day when the pointer's don't have element types, we shoudl just use the type of the load result instead.

llvm-svn: 356721

5 years ago[InstSimplify] Add tests for signed icmp of and/or; NFC
Nikita Popov [Thu, 21 Mar 2019 21:13:08 +0000 (21:13 +0000)]
[InstSimplify] Add tests for signed icmp of and/or; NFC

Even if a signed predicate is used, the ranges computed for and/or
are unsigned, resulting in missed simplifications.

llvm-svn: 356720

5 years ago[libc++] Remove too-stringent XFAILs for file_clock tests
Louis Dionne [Thu, 21 Mar 2019 21:07:33 +0000 (21:07 +0000)]
[libc++] Remove too-stringent XFAILs for file_clock tests

Those tests actually pass because we don't use anything that's marked
as unavailable.

llvm-svn: 356719

5 years ago[Object] Fix reading objects created with -fembed-bitcode-marker
Steven Wu [Thu, 21 Mar 2019 21:01:31 +0000 (21:01 +0000)]
[Object] Fix reading objects created with -fembed-bitcode-marker

Currently, this fails with many tools, e.g.

$ clang -fembed-bitcode-marker -c -o test.o test.c
$ nm test.o
nm: test.o The file was not recognized as a valid object file

-fembed-bitcode-marker creates a LLVM,bitcode section consisting of a single
byte. When reading the object file, IRObjectFile::findBitcodeInObject succeeds,
causing SymbolicFile::createSymbolicFile to try to read the "bitcode" rather
than using the outer Mach-O data - when then fails.

Fix this by making findBitcodeInObject return an error if the section size <= 1.

Patched by: Nicholas Allegra

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

llvm-svn: 356718

5 years agoMips: Fix typo in assert message
Matt Arsenault [Thu, 21 Mar 2019 20:56:06 +0000 (20:56 +0000)]
Mips: Fix typo in assert message

llvm-svn: 356717

5 years agoMips: Don't create copy of nothing
Matt Arsenault [Thu, 21 Mar 2019 20:56:05 +0000 (20:56 +0000)]
Mips: Don't create copy of nothing

This was creating a copy of the register the pseudo itself was
def'ing, leaving a copy of an undefined register. I'm not sure how
the verifier is not catching this, but this avoids asserting in a
future change to RegAllocFast

llvm-svn: 356716

5 years ago[OPENMP]Fix a warning about unused variable, NFC.
Alexey Bataev [Thu, 21 Mar 2019 20:52:04 +0000 (20:52 +0000)]
[OPENMP]Fix a warning about unused variable, NFC.

llvm-svn: 356715

5 years agoGlobalISel: Fix RegBankSelect for REG_SEQUENCE
Matt Arsenault [Thu, 21 Mar 2019 20:45:36 +0000 (20:45 +0000)]
GlobalISel: Fix RegBankSelect for REG_SEQUENCE

The AArch64 test was broken since the result register already had a
set register class, so this test was a no-op. The mapping verify call
would fail because the result size is not the same as the inputs like
in a copy or phi.

The AMDGPU testcases are half broken and introduce illegal VGPR->SGPR
copies which need much more work to handle correctly (same for phis),
but add them as a baseline.

llvm-svn: 356713

5 years agoImprove the diagnostic for #include_next occurring in a file not found
Richard Smith [Thu, 21 Mar 2019 20:42:13 +0000 (20:42 +0000)]
Improve the diagnostic for #include_next occurring in a file not found
in the include path.

Instead of making the incorrect claim that the included file has an
absolute path, describe the actual problem: the including file was found
either by absolute path, or relative to such a file, or relative to the
primary source file.

llvm-svn: 356712

5 years agoMakefile.rules: Normalize use of trailing slashes in path variables.
Adrian Prantl [Thu, 21 Mar 2019 20:36:23 +0000 (20:36 +0000)]
Makefile.rules: Normalize use of trailing slashes in path variables.

llvm-svn: 356711

5 years ago[OPENMP] Simplify codegen for allocate directive on local variables.
Alexey Bataev [Thu, 21 Mar 2019 20:36:16 +0000 (20:36 +0000)]
[OPENMP] Simplify codegen for allocate directive on local variables.

Simplified codegen for the allocate directive for local variables,
initial implementation of the codegen for NVPTX target.

llvm-svn: 356710

5 years ago[X86] Correct the value of MaxAtomicInlineWidth for pre-586 cpus
Craig Topper [Thu, 21 Mar 2019 20:36:08 +0000 (20:36 +0000)]
[X86] Correct the value of MaxAtomicInlineWidth for pre-586 cpus

Use the new cx8 feature flag that was added to the backend to represent support for cmpxchg8b. Use this flag to set the MaxAtomicInlineWidth.

This also assumes all the cmpxchg instructions are enabled for CK_Generic which is what cc1 defaults to when nothing is specified.

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

llvm-svn: 356709

5 years agoDon't add a tail keyword to calls to ObjC runtime functions if the calls
Akira Hatanaka [Thu, 21 Mar 2019 20:16:09 +0000 (20:16 +0000)]
Don't add a tail keyword to calls to ObjC runtime functions if the calls
are annotated with notail.

r356705 annotated calls to objc_retainAutoreleasedReturnValue with
notail on x86-64. This commit teaches ARC optimizer to check the notail
marker on the call before turning it into a tail call.

rdar://problem/38675807

llvm-svn: 356707

5 years ago[Driver] Pass -malign-double from the driver to the cc1 command line
Craig Topper [Thu, 21 Mar 2019 20:07:24 +0000 (20:07 +0000)]
[Driver] Pass -malign-double from the driver to the cc1 command line

-malign-double is currently only implemented in the -cc1 interface. But its declared in Options.td so it is a driver option too. But you try to use it with the driver you'll get a message about the option being unused.

This patch teaches the driver to pass the option through to cc1 so it won't be unused. The Options.td says the option is x86 only but I didn't see any x86 specific code in its impementation in cc1 so not sure if the documentation is wrong or if I should only pass this option through the driver on x86 targets.

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

llvm-svn: 356706

5 years ago[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue
Akira Hatanaka [Thu, 21 Mar 2019 19:59:49 +0000 (19:59 +0000)]
[CodeGen][ObjC] Annotate calls to objc_retainAutoreleasedReturnValue
with notail on x86-64.

On x86-64, the epilogue code inserted before the tail jump blocks the
autoreleased return optimization.

rdar://problem/38675807

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

llvm-svn: 356705

5 years agoRefactor handling of #include directives to cleanly separate the
Richard Smith [Thu, 21 Mar 2019 19:44:17 +0000 (19:44 +0000)]
Refactor handling of #include directives to cleanly separate the
"skipped header because it should be imported as a module" cases from
the "skipped header because of some other reason" cases.

llvm-svn: 356704

5 years ago[lldb] Add missing EINTR handling
Michal Gorny [Thu, 21 Mar 2019 19:35:55 +0000 (19:35 +0000)]
[lldb] Add missing EINTR handling

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

llvm-svn: 356703

5 years ago[OPENMP]Codegen support for allocate directive on global variables.
Alexey Bataev [Thu, 21 Mar 2019 19:35:27 +0000 (19:35 +0000)]
[OPENMP]Codegen support for allocate directive on global variables.

For the global variables the allocate directive must specify only the
predefined allocator. This allocator must be translated into the correct
form of the address space for the targets that support different address
spaces.

llvm-svn: 356702

5 years agoEnable `asan/TestCases/Posix/start-deactivated.cc` test for iOS.
Dan Liew [Thu, 21 Mar 2019 19:20:44 +0000 (19:20 +0000)]
Enable `asan/TestCases/Posix/start-deactivated.cc` test for iOS.

Summary:
To make this test pass it was necesary to change `iossim_run.py` to
propagate the `ASAN_ACTIVATION_OPTIONS` environment variable into the
testing environment.

rdar://problem/49114807

Reviewers: kubamracek, yln, serge-sans-paille

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers, #llvm

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

llvm-svn: 356701

5 years ago[clang][OpenMP] Fix another test when using libgomp.
Jordan Rupprecht [Thu, 21 Mar 2019 19:13:22 +0000 (19:13 +0000)]
[clang][OpenMP] Fix another test when using libgomp.

Similarly to r356614, -fopenmp=libomp needs to be used for some omp-related AST matching.

llvm-svn: 356700

5 years ago[OPENMP]Simplify the check for the predefined allocators, NFC.
Alexey Bataev [Thu, 21 Mar 2019 19:05:07 +0000 (19:05 +0000)]
[OPENMP]Simplify the check for the predefined allocators, NFC.

Previously implemented check required the reevaluation of the already
evaluated predefined allocator kind for the global variables. Patch
simplifies this evaluation and removes extra code.

llvm-svn: 356699

5 years ago[AArch64] Update for Exynos
Evandro Menezes [Thu, 21 Mar 2019 18:54:58 +0000 (18:54 +0000)]
[AArch64] Update for Exynos

Fix the feature set for Exynos M4 by removing support for `+fp16fml` and fix test case.

llvm-svn: 356698