platform/upstream/llvm.git
5 years ago[Tests] Autogen a few more lftr tests for readability
Philip Reames [Thu, 16 May 2019 20:19:02 +0000 (20:19 +0000)]
[Tests] Autogen a few more lftr tests for readability

llvm-svn: 360932

5 years ago[Tests] Autogen a few lftr test in preparation for merging
Philip Reames [Thu, 16 May 2019 20:15:25 +0000 (20:15 +0000)]
[Tests] Autogen a few lftr test in preparation for merging

llvm-svn: 360931

5 years agoFactor out switch statement into a helper function (NFC)
Adrian Prantl [Thu, 16 May 2019 20:03:05 +0000 (20:03 +0000)]
Factor out switch statement into a helper function (NFC)

This addresses post-commit review feedback for https://reviews.llvm.org/D62015.

llvm-svn: 360930

5 years agoMake sure GetObjectDescription falls back to the Objective-C runtime.
Adrian Prantl [Thu, 16 May 2019 19:21:31 +0000 (19:21 +0000)]
Make sure GetObjectDescription falls back to the Objective-C runtime.

This fixes an unintended regression introduced by
https://reviews.llvm.org/D61451 by making sure the Objective-C runtime
is also tried when the "correct" language runtime failed to return an
object description.

rdar://problem/50791055

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

llvm-svn: 360929

5 years ago[NFC][InstSimplify] Update fast-math.ll tests I botched in r360808.
Cameron McInally [Thu, 16 May 2019 19:00:57 +0000 (19:00 +0000)]
[NFC][InstSimplify] Update fast-math.ll tests I botched in r360808.

These were new tests I added in r360808. I made a mistake while converting the exisiting binary FNeg test into the new unary FNeg tests. Correct that.

llvm-svn: 360928

5 years ago[TSan][libdispatch] Use FileCheck's --implicit-check-not=...
Julian Lettner [Thu, 16 May 2019 18:57:36 +0000 (18:57 +0000)]
[TSan][libdispatch] Use FileCheck's --implicit-check-not=...

Use FileCheck's --implicit-check-not='ThreadSanitizer' which increases
the strictness of our tests a bit. NFC.

```
CHECK: start
CHECK-NOT: ThreadSanitizer
CHECK: done
```

With --implicit-check-not, the above is turned into:

```
CHECK-NOT: ThreadSanitizer
CHECK: start
CHECK-NOT: ThreadSanitizer
CHECK: done
CHECK-NOT: ThreadSanitizer
```

llvm-svn: 360927

5 years ago[ORC] Change handling for SymbolStringPtr tombstones and empty keys.
Lang Hames [Thu, 16 May 2019 18:29:34 +0000 (18:29 +0000)]
[ORC] Change handling for SymbolStringPtr tombstones and empty keys.

SymbolStringPtr used to use nullptr as its empty value and (since it performed
ref-count operations on any non-nullptr) a pointer to a special pool-entry
instance as its tombstone.

This commit changes the scheme to use two invalid pointer values as the empty
and tombstone values, and broadens the ref-count guard to prevent ref-counting
operations from being performed on these pointers. This should improve the
performance of SymbolStringPtrs used in DenseMaps/DenseSets, as ref counting
operations will no longer be performed on the tombstone.

llvm-svn: 360925

5 years ago[X86] Stop implicitly enabling avx512vl when avx512bf16 is enabled.
Craig Topper [Thu, 16 May 2019 18:28:17 +0000 (18:28 +0000)]
[X86] Stop implicitly enabling avx512vl when avx512bf16 is enabled.

Previously we were doing this so that the 256 bit selectw builtin could be used in the implementation of the 512->256 bit conversion intrinsic.

After this commit we now use a masked convert builtin that will emit the intrinsic call and the 256-bit select from custom code in CGBuiltin. Then the header only needs to call that one intrinsic.

llvm-svn: 360924

5 years ago[InstCombine] add tests for shuffle of insert subvectors; NFC
Sanjay Patel [Thu, 16 May 2019 18:09:47 +0000 (18:09 +0000)]
[InstCombine] add tests for shuffle of insert subvectors; NFC

llvm-svn: 360923

5 years agoUpdate comments on enums
Stephen Kelly [Thu, 16 May 2019 18:02:36 +0000 (18:02 +0000)]
Update comments on enums

llvm-svn: 360922

5 years agoFix typos in comment.
Joerg Sonnenberger [Thu, 16 May 2019 18:01:57 +0000 (18:01 +0000)]
Fix typos in comment.

llvm-svn: 360921

5 years agoMove TraversalKind enum to ast_type_traits
Stephen Kelly [Thu, 16 May 2019 17:57:38 +0000 (17:57 +0000)]
Move TraversalKind enum to ast_type_traits

Summary:
Make it usable outside of ASTMatchFinder.  This will make it possible to
use this enum to control whether certain implicit nodes are skipped
while AST dumping for example.

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 360920

5 years agoFixed second issue reported in https://bugs.llvm.org/show_bug.cgi?id=41584.
Andrey Churbanov [Thu, 16 May 2019 17:52:53 +0000 (17:52 +0000)]
Fixed second issue reported in https://bugs.llvm.org/show_bug.cgi?id=41584.

Added synchronization for possible concurrent initialization of mutexes
by multiple threads. The need of synchronization caused by commit r357927
which added the use of mutexes at threads movement to/from common pool
(earlier the mutexes were used only at suspend/resume).

Patch by Johnny Peyton.

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

llvm-svn: 360919

5 years ago[X86] Update doxygen comments for AVX512BF16 to not refer to masks as 'immediates...
Craig Topper [Thu, 16 May 2019 17:34:35 +0000 (17:34 +0000)]
[X86] Update doxygen comments for AVX512BF16 to not refer to masks as 'immediates'. Refer to parameter names instead of 'src', 'src1', 'src2'. NFC

llvm-svn: 360918

5 years ago[ORC] Use inline friend definitions for SymbolStringPtr operators.
Lang Hames [Thu, 16 May 2019 17:20:17 +0000 (17:20 +0000)]
[ORC] Use inline friend definitions for SymbolStringPtr operators.

llvm-svn: 360917

5 years ago[IRExecutionUnit] Remove static_assert
Jonas Devlieghere [Thu, 16 May 2019 16:54:41 +0000 (16:54 +0000)]
[IRExecutionUnit] Remove static_assert

This doesn't make sense on platforms other than 64 bit.

llvm-svn: 360916

5 years ago[X86] Use 0x9 instead of 0x1 as the immediate in some masked floor pattern. Similarly...
Craig Topper [Thu, 16 May 2019 16:53:50 +0000 (16:53 +0000)]
[X86] Use 0x9 instead of 0x1 as the immediate in some masked floor pattern. Similarly change 0x2 to 0xA for ceil.

This suppresses exceptions which is what we should be doing for ceil and floor. We already use the correct immediate
in patterns without masking.

llvm-svn: 360915

5 years ago[libFuzzer] Disable merge-sigusr.test on linux.
Matt Morehouse [Thu, 16 May 2019 16:42:45 +0000 (16:42 +0000)]
[libFuzzer] Disable merge-sigusr.test on linux.

Make buildbot green while I rethink the test.

llvm-svn: 360914

5 years ago[CommandLine] Don't allow duplicate categories.
Don Hinton [Thu, 16 May 2019 16:25:13 +0000 (16:25 +0000)]
[CommandLine] Don't allow duplicate categories.

Summary:
This is a fix to D61574, r360179, that allowed duplicate
OptionCategory's.  This change adds a check to make sure a category can
only be added once even if the user passes it twice.

Reviewed By: MaskRay

Tags: #llvm

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

llvm-svn: 360913

5 years ago[CodeComplete] Complete enumerators when preferred type is an enum
Ilya Biryukov [Thu, 16 May 2019 16:06:57 +0000 (16:06 +0000)]
[CodeComplete] Complete enumerators when preferred type is an enum

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 360912

5 years agoImprove the test coverage for std::is_base_of
Marshall Clow [Thu, 16 May 2019 15:56:26 +0000 (15:56 +0000)]
Improve the test coverage for std::is_base_of

llvm-svn: 360911

5 years ago[analyzer] Add a test plugin for checker option handling
Kristof Umann [Thu, 16 May 2019 15:55:07 +0000 (15:55 +0000)]
[analyzer] Add a test plugin for checker option handling

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

llvm-svn: 360910

5 years ago[llvm-objdump]Move test code missed in r360904
James Henderson [Thu, 16 May 2019 15:20:08 +0000 (15:20 +0000)]
[llvm-objdump]Move test code missed in r360904

llvm-svn: 360909

5 years agoMinidump: Add support for the MemoryList stream
Pavel Labath [Thu, 16 May 2019 15:17:30 +0000 (15:17 +0000)]
Minidump: Add support for the MemoryList stream

Summary:
the stream format is exactly the same as for ThreadList and ModuleList
streams, only the entry types are slightly different, so the changes in
this patch are just straight-forward applications of established
patterns.

Reviewers: amccarth, jhenderson, clayborg

Subscribers: markmentovai, lldb-commits, llvm-commits

Tags: #llvm

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

llvm-svn: 360908

5 years agoftime-trace as a CoreOption
Alexandre Ganea [Thu, 16 May 2019 15:14:01 +0000 (15:14 +0000)]
ftime-trace as a CoreOption

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

llvm-svn: 360907

5 years agoAMDGPU: Introduce TokenFactor for ABI register copies in call sequence
Matt Arsenault [Thu, 16 May 2019 15:10:27 +0000 (15:10 +0000)]
AMDGPU: Introduce TokenFactor for ABI register copies in call sequence

The call was missing chain dependencies on the pre-call copies. I
don't think this was causing any real issues however.

llvm-svn: 360906

5 years ago[InstSimplify] add tests for fcmp of maxnum with constants; NFC
Sanjay Patel [Thu, 16 May 2019 15:00:11 +0000 (15:00 +0000)]
[InstSimplify] add tests for fcmp of maxnum with constants; NFC

Sibling tests for rL360899 (D61691).

llvm-svn: 360905

5 years ago[llvm-objdump]Split section-filter.test in two to remove X86 dependency
James Henderson [Thu, 16 May 2019 14:49:10 +0000 (14:49 +0000)]
[llvm-objdump]Split section-filter.test in two to remove X86 dependency

This allows the generic parts of section-filter.test to be tested on all
targets. The X86-specific parts have been moved to another test.

llvm-svn: 360904

5 years agoAMDGPU: Assume xnack is enabled by default
Matt Arsenault [Thu, 16 May 2019 14:48:34 +0000 (14:48 +0000)]
AMDGPU: Assume xnack is enabled by default

This is the conservatively correct default. It is always safe to
assume xnack is enabled, but not the converse.

Introduce a feature to blacklist targets where xnack can never be
meaningfully enabled. I'm not sure the targets this is applied to is
100% correct.

llvm-svn: 360903

5 years agoResubmit: [Salvage] Change salvage debug info implementation to use DW_OP_LLVM_conver...
Stephen Tozer [Thu, 16 May 2019 14:41:01 +0000 (14:41 +0000)]
Resubmit: [Salvage] Change salvage debug info implementation to use DW_OP_LLVM_convert where needed

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

Previously, LLVM had no functional way of performing casts inside of a
DIExpression(), which made salvaging cast instructions other than Noop casts
impossible. With the recent addition of DW_OP_LLVM_convert this salvaging is
now possible, and so can be used to fix the attached bug as well as any cases
where SExt instruction results are lost in the debugging metadata. This patch
introduces this fix by expanding the salvage debug info method to cover these
cases using the new operator.

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

llvm-svn: 360902

5 years ago[llvm-objdump] Add "REQUIES: x86-registered-target" to section-filter.test after...
Fangrui Song [Thu, 16 May 2019 14:40:31 +0000 (14:40 +0000)]
[llvm-objdump] Add "REQUIES: x86-registered-target" to section-filter.test after rL360893

Appease the hexagon buildbot that doesn't build X86. Disassemblers
require Target/X86 support.

llvm-svn: 360901

5 years agoAdd AIX Version Macros
Xing Xue [Thu, 16 May 2019 14:22:37 +0000 (14:22 +0000)]
Add AIX Version Macros

Summary:
- This patch checks the AIX version and defines the appropriate macros.
- Follow up to a comment on D59048.

Author: andusy

Reviewers: hubert.reinterpretcast, jasonliu, sfertile, xingxue

Reviewed By: sfertile

Subscribers: jsji, cfe-commits

Tags: #clang

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

llvm-svn: 360900

5 years ago[InstSimplify] fold fcmp (minnum, X, C1), C2
Sanjay Patel [Thu, 16 May 2019 14:03:10 +0000 (14:03 +0000)]
[InstSimplify] fold fcmp (minnum, X, C1), C2
   minnum(X, LesserC) == C --> false
   minnum(X, LesserC) >= C --> false
   minnum(X, LesserC) >  C --> false
   minnum(X, LesserC) != C --> true
   minnum(X, LesserC) <= C --> true
   minnum(X, LesserC) <  C --> true

maxnum siblings will follow if there are no problems here.

We should be able to perform some other combines when the constants
are equal or greater-than too, but that would go in instcombine.

We might also generalize this by creating an FP ConstantRange
(similar to what we do for integers).

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

llvm-svn: 360899

5 years agoFixes for builds that require strict X/Open and POSIX compatiblity
Xing Xue [Thu, 16 May 2019 14:02:13 +0000 (14:02 +0000)]
Fixes for builds that require strict X/Open and POSIX compatiblity

Summary:
- Use alternative to MAP_ANONYMOUS for allocating mapped memory if it isn't available
- Use strtok_r instead of strsep as part of getting program path
- Don't try to find the width of a terminal using "struct winsize" and TIOCGWINSZ on POSIX builds. These aren't defined under POSIX (even though some platforms make them available when they shouldn't), so just check if we are doing a X/Open or POSIX compliant build first.

Author: daltenty

Reviewers: hubert.reinterpretcast, xingxue, andusy

Reviewed By: hubert.reinterpretcast

Subscribers: MaskRay, jsji, hiraditya, kristina, llvm-commits

Tags: #llvm

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

llvm-svn: 360898

5 years ago[RISCV][NFC] Add nounwind attribute to functions missing it in test/CodeGen/RISCV
Alex Bradbury [Thu, 16 May 2019 13:56:23 +0000 (13:56 +0000)]
[RISCV][NFC] Add nounwind attribute to functions missing it in test/CodeGen/RISCV

This is in preparation for emitting CFI directives.

llvm-svn: 360897

5 years ago[clang] Handle lround/llround builtins
Adhemerval Zanella [Thu, 16 May 2019 13:43:25 +0000 (13:43 +0000)]
[clang] Handle lround/llround builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lround
and llround.  It currently only optimize for AArch64 backend.

Reviewed By: efriedma

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

llvm-svn: 360896

5 years ago[tests][go]Add -stdlib=libc++ to build GO test if LLVM is built with libc++
Xing Xue [Thu, 16 May 2019 13:32:55 +0000 (13:32 +0000)]
[tests][go]Add -stdlib=libc++ to build GO test if LLVM is built with libc++

When libc++ is used to build LLVM libraries, these libraries have dependencies on libc++ and C++ STL signatures in these libraries are corresponding to libc++ implementation. Therefore, -stdlib=libc++ is required on the C++ compiler command for building GO tests that link with these LLVM libraries.

Reviewers: hubert.reinterpretcast, sfertile, amyk, EricWF

Reviewed By: sfertile, hubert.reinterpretcast

Subscribers: jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 360895

5 years ago[AArch64] Handle ISD::LROUND and ISD::LLROUND
Adhemerval Zanella [Thu, 16 May 2019 13:30:18 +0000 (13:30 +0000)]
[AArch64] Handle ISD::LROUND and ISD::LLROUND

This patch optimizes ISD::LROUND and ISD::LLROUND to fcvtas
instruction. It currently only handles the scalar version.

llvm-svn: 360894

5 years ago[llvm-objdump]Improve testing of some switches #1
James Henderson [Thu, 16 May 2019 13:28:36 +0000 (13:28 +0000)]
[llvm-objdump]Improve testing of some switches #1

This is the first in a set of patches I have to improve testing of
llvm-objdump. This patch targets --all-headers, --section, and
--full-contents. In the --section case, it deletes a pre-canned binary
which is only used by the one test and replaces it with yaml.

Reviewed by: grimar, MaskRay

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

llvm-svn: 360893

5 years agoRecommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>
Fangrui Song [Thu, 16 May 2019 13:24:04 +0000 (13:24 +0000)]
Recommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>

r360876 didn't fix 2 call sites in clang.

Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.

Follow-up of D61781.

llvm-svn: 360892

5 years agoReland "[analyzer] Add an example plugin for checker dependency handling"
Kristof Umann [Thu, 16 May 2019 13:22:04 +0000 (13:22 +0000)]
Reland "[analyzer] Add an example plugin for checker dependency handling"

Buildbots complained that they couldn't find the newly added plugins.

The solution was to move the check-clang cmake target closer to the bottom of
the file, after the new dependencies are added.

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

llvm-svn: 360891

5 years agoFix hwloc topology traversal code unable to handle situation where L2 cache is common...
Paul Osmialowski [Thu, 16 May 2019 13:16:24 +0000 (13:16 +0000)]
Fix hwloc topology traversal code unable to handle situation where L2 cache is common for the packages

Currently cores within package that share the same L2 cache are grouped together.
The current logic behind this assumes that the L2 cache is always at deeper
(or the same) level than the package itself. In case when L2 cache is common
for all packages (and the packages are at deeper level than L2 cache) the whole of
the further topology discovery fails to find any computational units resulting in
following assertion:

Assertion failure at kmp_affinity.cpp(715): nActiveThreads == __kmp_avail_proc.
OMP: Error #13: Assertion failure at kmp_affinity.cpp(715).

This patch adds a bit of a logic that prevents such situation from occurring.

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

llvm-svn: 360890

5 years ago[CodeGen] Add lround/llround builtins
Adhemerval Zanella [Thu, 16 May 2019 13:15:27 +0000 (13:15 +0000)]
[CodeGen] Add lround/llround builtins

This patch add the ISD::LROUND and ISD::LLROUND along with new
intrinsics.  The changes are straightforward as for other
floating-point rounding functions, with just some adjustments
required to handle the return value being an interger.

The idea is to optimize lround/llround generation for AArch64
in a subsequent patch.  Current semantic is just route it to libm
symbol.

llvm-svn: 360889

5 years agoGlobalISel: Add buildFMA to MachineIRBuilder
Matt Arsenault [Thu, 16 May 2019 13:04:20 +0000 (13:04 +0000)]
GlobalISel: Add buildFMA to MachineIRBuilder

llvm-svn: 360888

5 years agoRegAllocFast: Improve hinting heuristic
Matt Arsenault [Thu, 16 May 2019 12:50:39 +0000 (12:50 +0000)]
RegAllocFast: Improve hinting heuristic

Trace through multiple COPYs when looking for a physreg source. Add
hinting for vregs that will be copied into physregs (we only hinted
for vregs getting copied to a physreg previously).  Give hinted a
register a bonus when deciding which value to spill.  This is part of
my rewrite regallocfast series. In fact this one doesn't even have an
effect unless you also flip the allocation to happen from back to
front of a basic block. Nonetheless it helps to split this up to ease
review of D52010

Patch by Matthias Braun

llvm-svn: 360887

5 years ago[DominatorTree] Print roots unconditionally in `print()`.
Clement Courbet [Thu, 16 May 2019 12:48:56 +0000 (12:48 +0000)]
[DominatorTree] Print roots unconditionally in `print()`.

Summary:
This came up in a debugging session. I was failing to update the root of
the tree, and got during verification:

```
DominatorTree is different than a freshly computed one!
        Current:
=============================--------------------------------
Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
  [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
    [2] %opeq1.exit {4294967295,4294967295} [1]

        Freshly computed tree:
=============================--------------------------------
Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
  [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
    [2] %opeq1.exit {4294967295,4294967295} [1]
```

We now print:

```
DominatorTree is different than a freshly computed one!
        Current:
=============================--------------------------------
Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
  [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
    [2] %opeq1.exit {4294967295,4294967295} [1]
Roots: <badref>

        Freshly computed tree:
=============================--------------------------------
Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.
  [1] %"entry+land.rhs.i" {4294967295,4294967295} [0]
    [2] %opeq1.exit {4294967295,4294967295} [1]
Roots: %"entry+land.rhs.i"
```

Reviewers: kuhar, asbirlea

Subscribers: llvm-commits

Tags: #llvm

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

llvm-svn: 360886

5 years agoFix isInSystemMacro in presence of macro and pasted token
Serge Guelton [Thu, 16 May 2019 12:40:00 +0000 (12:40 +0000)]
Fix isInSystemMacro in presence of macro and pasted token

When a warning is raised from the expansion of a system macro that
involves pasted token, there was still situations were they were not
skipped, as showcased by this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1472437

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

llvm-svn: 360885

5 years ago[NFC] Fixup FileCheck option name in tests added in rL360881
Roman Lebedev [Thu, 16 May 2019 12:39:34 +0000 (12:39 +0000)]
[NFC] Fixup FileCheck option name in tests added in rL360881

llvm-svn: 360884

5 years ago[clang-tidy] Removed superfluous and slightly annoying newlines in run-clang-tidy...
Jonas Toth [Thu, 16 May 2019 12:39:22 +0000 (12:39 +0000)]
[clang-tidy] Removed superfluous and slightly annoying newlines in run-clang-tidy's output.

Summary: The output of clang-tidy itself already has enough newlines, so the resulting output is more in line with the usual compiler output.

Patch by svenpanne.

Reviewers: alexfh, JonasToth

Reviewed By: JonasToth

Subscribers: JonasToth, cfe-commits

Tags: #clang

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

llvm-svn: 360883

5 years ago[clang-tidy] Handle member variables in readability-simplify-boolean-expr
Jonas Toth [Thu, 16 May 2019 12:35:00 +0000 (12:35 +0000)]
[clang-tidy] Handle member variables in readability-simplify-boolean-expr

- Add readability-simplify-boolean-expr test cases for member variables
Fixes PR40179

Patch by LegalizeAdulthood.

Reviewers: alexfh, hokein, aaron.ballman, JonasToth

Reviewed By: JonasToth

Subscribers: jdoerfert, xazax.hun, cfe-commits

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

llvm-svn: 360882

5 years ago[NFC][CodeGen] Add some more tests for pulling binops through shifts
Roman Lebedev [Thu, 16 May 2019 12:26:53 +0000 (12:26 +0000)]
[NFC][CodeGen] Add some more tests for pulling binops through shifts

The ashr variant may see relaxation in https://reviews.llvm.org/D61918

llvm-svn: 360881

5 years agoGlobalISel: Add buildXor/buildNot
Matt Arsenault [Thu, 16 May 2019 12:23:04 +0000 (12:23 +0000)]
GlobalISel: Add buildXor/buildNot

llvm-svn: 360880

5 years agoGlobalISel: Add DstOp version of buildIntrinsic
Matt Arsenault [Thu, 16 May 2019 12:22:56 +0000 (12:22 +0000)]
GlobalISel: Add DstOp version of buildIntrinsic

llvm-svn: 360879

5 years agoRevert r360876 "[Object] Change object::SectionRef::getContents() to return Expected...
Hans Wennborg [Thu, 16 May 2019 12:08:34 +0000 (12:08 +0000)]
Revert r360876 "[Object] Change object::SectionRef::getContents() to return Expected<StringRef>"

It broke the Clang build, see llvm-commits thread.

> Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.
>
> Follow-up of D61781.

llvm-svn: 360878

5 years agoAMDGPU/GlobalISel: Correct regbank for 1-bit and/or/xor
Matt Arsenault [Thu, 16 May 2019 12:06:41 +0000 (12:06 +0000)]
AMDGPU/GlobalISel: Correct regbank for 1-bit and/or/xor

Bool values should use the scc/vcc regbank since r350611.

llvm-svn: 360877

5 years ago[Object] Change object::SectionRef::getContents() to return Expected<StringRef>
Fangrui Song [Thu, 16 May 2019 11:33:48 +0000 (11:33 +0000)]
[Object] Change object::SectionRef::getContents() to return Expected<StringRef>

Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.

Follow-up of D61781.

llvm-svn: 360876

5 years ago[lld-link] Add missing "REQUIRES: x86" to COFF/lib-module-asm.ll test.
Yvan Roux [Thu, 16 May 2019 11:29:30 +0000 (11:29 +0000)]
[lld-link] Add missing "REQUIRES: x86" to COFF/lib-module-asm.ll test.

This should fix ARM bots.

llvm-svn: 360875

5 years agoDWARFContext: Return empty data extractors instead of null pointers
Pavel Labath [Thu, 16 May 2019 11:19:02 +0000 (11:19 +0000)]
DWARFContext: Return empty data extractors instead of null pointers

Summary:
There are several reasons for doing this:
- generally, there's no reason to differentiate between a section being
  absent and it being present, but empty
- it matches more closely what llvm DWARF parser is doing (which also
  doesn't differentiate the two cases)
- SymbolFileDWARF also doesn't differentiate the two cases, which makes
  porting the rest of sections easier
- it fixes a bug in how the return-null-if-empty logic was implemented
  (it returned nullptr only the second time we tried to get the
  debug_aranges section), which meant that we hit an assert when trying
  to parse an empty-but-present section

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: zturner, lldb-commits

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

llvm-svn: 360874

5 years ago[crt] Mark dso_handle test as xfailing on ARM.
Yvan Roux [Thu, 16 May 2019 11:13:49 +0000 (11:13 +0000)]
[crt] Mark dso_handle test as xfailing on ARM.

This is a temporary action to fix the bots.

llvm-svn: 360873

5 years agoDWARF: Add ability to reference debug info coming from multiple sections
Pavel Labath [Thu, 16 May 2019 11:07:58 +0000 (11:07 +0000)]
DWARF: Add ability to reference debug info coming from multiple sections

Summary:
This patch adds the ability to precisely address debug info in
situations when a single file can have more than one debug-info-bearing
sections (as is the case with type units in DWARF v4).

The changes here can be classified into roughly three categories:
- the code which addresses a debug info by offset gets an additional
  argument, which specifies the section one should look into.
- the DIERef class also gets an additional member variable specifying
  the section. This way, code dealing with DIERefs can know which
  section is the object referring to.
- the user_id_t encoding steals one bit from the dwarf_id field to store
  the section. This means the total number of separate object files
  (apple .o, or normal .dwo) is limited to 2 billion, but that is fine
  as it's not possible to hit that number without switching to DWARF64
  anyway.

This patch is functionally equivalent to (and inspired by) the two
patches (D61503 and D61504) by Jan Kratochvil, but there are differences
in the implementation:
- it uses an enum instead of a bool flag to differentiate the sections
- it increases the size of DIERef struct instead of reducing the amount
  of addressable debug info
- it sets up DWARFDebugInfo to store the units in a single vector
  instead of two. This sets us up for the future in which type units can
  also live in the debug_info section, and I believe it's cleaner
  because there's no need for unit index remapping

There are no tests with this patch as this is essentially NFC until
we start parsing type units from the debug_types section.

Reviewers: JDevlieghere, clayborg, aprantl

Subscribers: arphaman, jankratochvil, lldb-commits

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

llvm-svn: 360872

5 years ago[AArch64][SVE2] Asm: implement CMLA/SQRDCMLAH instructions
Cullen Rhodes [Thu, 16 May 2019 09:42:22 +0000 (09:42 +0000)]
[AArch64][SVE2] Asm: implement CMLA/SQRDCMLAH instructions

Summary:
This patch adds support for the indexed and unpredicated vectors forms
of the CMLA and SQRDCMLAH instructions.

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer

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

llvm-svn: 360871

5 years ago[AArch64][SVE2] Asm: implement CDOT instruction
Cullen Rhodes [Thu, 16 May 2019 09:33:44 +0000 (09:33 +0000)]
[AArch64][SVE2] Asm: implement CDOT instruction

Summary:
The complex DOT instructions perform a dot-product on quadtuplets from
two source vectors and the resuling wide real or wide imaginary is
accumulated into the destination register. The instructions come in two
forms:

Vector form, e.g.
  cdot z0.s, z1.b, z2.b, #90    - complex dot product on four 8-bit quad-tuplets,
                                  accumulating results in 32-bit elements. The
                                  complex numbers in the second source vector are
                                  rotated by 90 degrees.

  cdot z0.d, z1.h, z2.h, #180   - complex dot product on four 16-bit quad-tuplets,
                                  accumulating results in 64-bit elements.
                                  The complex numbers in the second source
                                  vector are rotated by 180 degrees.

Indexed form, e.g.
  cdot z0.s, z1.b, z2.b[3], #0  - complex dot product on four 8-bit quad-tuplets,
                                  with specified quadtuplet from second source vector,
                                  accumulating results in 32-bit elements.
  cdot z0.d, z1.h, z2.h[1], #0  - complex dot product on four 16-bit quad-tuplets,
                                  with specified quadtuplet from second source vector,
                                  accumulating results in 64-bit elements.

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer, rovka

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

llvm-svn: 360870

5 years ago[clang-tidy] Do not list enabled checks when -quiet is given to run-clang-tidy.
Jonas Toth [Thu, 16 May 2019 09:22:39 +0000 (09:22 +0000)]
[clang-tidy] Do not list enabled checks when -quiet is given to run-clang-tidy.

Summary: When run-clang-tidy is given the -quiet flag, do not output the potentially hundreds of enabled check names at the beginning.

Patch by svenpanne.

Reviewers: alexfh, JonasToth

Reviewed By: JonasToth

Subscribers: JonasToth, cfe-commits

Tags: #clang

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

llvm-svn: 360869

5 years agoSimplify Triple::ppc64{,le} checks with Triple::isPPC64()
Fangrui Song [Thu, 16 May 2019 09:07:33 +0000 (09:07 +0000)]
Simplify Triple::ppc64{,le} checks with Triple::isPPC64()

While here, update some ppc64le specific check to isPPC64(), if it
applies to big-endian as well, in the hope that it will ease the support
of big-endian if people are interested in this area. The big-endian
variant is used by at least FreeBSD, Gentoo Linux, Adélie Linux, and
Void Linux.

llvm-svn: 360868

5 years ago[AArch64][SVE2] Asm: add unpredicated integer multiply instructions
Cullen Rhodes [Thu, 16 May 2019 09:07:26 +0000 (09:07 +0000)]
[AArch64][SVE2] Asm: add unpredicated integer multiply instructions

Summary:
Add support for the following instructions:

  * MUL (indexed and unpredicated vectors forms)
  * SQDMULH (indexed and unpredicated vectors forms)
  * SQRDMULH (indexed and unpredicated vectors forms)
  * SMULH (unpredicated, predicated form added in SVE)
  * UMULH (unpredicated, predicated form added in SVE)
  * PMUL (unpredicated)

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: SjoerdMeijer, rovka

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

llvm-svn: 360867

5 years agoAdd missing "REQUIRES: x86" to the lto/irmover-warning.ll test.
Igor Kudrin [Thu, 16 May 2019 09:04:52 +0000 (09:04 +0000)]
Add missing "REQUIRES: x86" to the lto/irmover-warning.ll test.

llvm-svn: 360866

5 years agoSimplify ArchSpec::IsMIPS()
Fangrui Song [Thu, 16 May 2019 08:37:32 +0000 (08:37 +0000)]
Simplify ArchSpec::IsMIPS()

llvm-svn: 360865

5 years agoAdd Triple::isPPC64()
Fangrui Song [Thu, 16 May 2019 08:31:22 +0000 (08:31 +0000)]
Add Triple::isPPC64()

llvm-svn: 360864

5 years ago[builtin] Fixed definitions of builtins that rely on the int/long long type is 32...
Karl-Johan Karlsson [Thu, 16 May 2019 07:18:02 +0000 (07:18 +0000)]
[builtin] Fixed definitions of builtins that rely on the int/long long type is 32/64 bits

Summary:
The definition of the builtins __builtin_bswap32, __builtin_bitreverse32, __builtin_rotateleft32 and __builtin_rotateright32 rely on that the int type is 32 bits wide on the target.
The defintions of the builtins __builtin_bswap64, __builtin_bitreverse64, __builtin_rotateleft64, and __builtin_rotateright64 rely on that the long long type is 64 bits wide.

On targets where this is not the case (e.g. AVR) clang will generate faulty code (wrong llvm assembler intrinsics).

This patch add support for using 'Z' (the int32_t type) in Bultins.def. The builtins above are changed to be based on the int32_t type instead of the int type, and the int64_t type instead of the long long type.

The AVR backend (experimental) have a native int type that is only 16 bits wide. The supplied testcase will therefore fail if running the testcase on trunk as clang will convert e.g. __builtin_bitreverse32 into llvm.bitreverse.i16 on AVR.

Reviewers: dylanmckay, spatel, rsmith, efriedma

Reviewed By: efriedma

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

llvm-svn: 360863

5 years ago[PPC] Fix 32-bit build of libunwind
Martin Storsjo [Thu, 16 May 2019 06:49:20 +0000 (06:49 +0000)]
[PPC] Fix 32-bit build of libunwind

Clang integrated assembler was unable to build libunwind PPC32 assembly code,
present in functions used to save/restore register context.

This change consists in replacing the assembly style used in libunwind source,
to one that is compatible with both Clang integrated assembler as well as
GNU assembler.

Patch by Leandro Lupori!

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

llvm-svn: 360862

5 years ago[PPC64][libunwind] Fix r2 not properly restored
Martin Storsjo [Thu, 16 May 2019 06:49:13 +0000 (06:49 +0000)]
[PPC64][libunwind] Fix r2 not properly restored

This change makes each unwind step inspect the instruction at the
return address and, if needed, read r2 from its saved location and
modify the context appropriately.

The unwind logic is able to handle both ELFv1 and ELFv2 stacks.

Reported by Bug 41050

Patch by Leandro Lupori!

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

llvm-svn: 360861

5 years ago[llvm-readobj] - Revert r360676 partially. NFC.
George Rimar [Thu, 16 May 2019 06:22:51 +0000 (06:22 +0000)]
[llvm-readobj] - Revert r360676 partially. NFC.

In the r360676 "Apply clang format. NFC" I applied clang-format
for whole ELFDumper.cpp. It caused a little discussion,
one of the points mentioned was that previously nicely lined up
tables are not so nice now.

This patch reverts them.

llvm-svn: 360860

5 years agoReland r360771 "[MergeICmps] Simplify the code."
Clement Courbet [Thu, 16 May 2019 06:18:02 +0000 (06:18 +0000)]
Reland r360771 "[MergeICmps] Simplify the code."

This revision does not seem to be the culprit.

llvm-svn: 360859

5 years ago[LTO] Improve readability of module IDs
Igor Kudrin [Thu, 16 May 2019 05:23:25 +0000 (05:23 +0000)]
[LTO] Improve readability of module IDs

Module IDs can appear in diagnostic messages.
This patch adds some auxiliary symbols to improve their readability.

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

llvm-svn: 360858

5 years ago[IRMover] Improve diagnostic messages for conflicting metadata
Igor Kudrin [Thu, 16 May 2019 05:23:13 +0000 (05:23 +0000)]
[IRMover] Improve diagnostic messages for conflicting metadata

This does the similar for error messages as rL344011 has done for warnings.

With llvm::lto::LTO, the error might appear when LTO::run() is executed.
In that case, the calling code cannot know which module causes the error
and, subsequently, cannot hint the user.

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

llvm-svn: 360857

5 years agoGlobalISel: Add buildFConstant for APFloat
Matt Arsenault [Thu, 16 May 2019 04:09:06 +0000 (04:09 +0000)]
GlobalISel: Add buildFConstant for APFloat

llvm-svn: 360853

5 years agoGlobalISel: Add some FP instructions to MachineIRBuilder
Matt Arsenault [Thu, 16 May 2019 04:08:55 +0000 (04:08 +0000)]
GlobalISel: Add some FP instructions to MachineIRBuilder

This makes FP legalization code more convenient.

llvm-svn: 360852

5 years agoGlobalISel: Fix indentation
Matt Arsenault [Thu, 16 May 2019 04:08:46 +0000 (04:08 +0000)]
GlobalISel: Fix indentation

llvm-svn: 360851

5 years agoGlobalISel: Add G_FCOPYSIGN
Matt Arsenault [Thu, 16 May 2019 04:08:39 +0000 (04:08 +0000)]
GlobalISel: Add G_FCOPYSIGN

llvm-svn: 360850

5 years agoFix missing const
Matt Arsenault [Thu, 16 May 2019 04:08:25 +0000 (04:08 +0000)]
Fix missing const

llvm-svn: 360849

5 years ago[libFuzzer] Increase merge-sigusr sleep after sending signal.
Matt Morehouse [Thu, 16 May 2019 04:00:41 +0000 (04:00 +0000)]
[libFuzzer] Increase merge-sigusr sleep after sending signal.

Test is flaky on buildbot at least partially due to the fuzz target not
exiting before we read its output.

llvm-svn: 360848

5 years agoPemove SymbolTable::addBitcode as it is redundant.
Rui Ueyama [Thu, 16 May 2019 03:54:50 +0000 (03:54 +0000)]
Pemove SymbolTable::addBitcode as it is redundant.

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

llvm-svn: 360846

5 years agoConsistently return `Symbol *` from SymbolTable's add-family functions.
Rui Ueyama [Thu, 16 May 2019 03:54:41 +0000 (03:54 +0000)]
Consistently return `Symbol *` from SymbolTable's add-family functions.

llvm-svn: 360845

5 years agoDe-template parseFile() and SymbolTable's add-family functions.
Rui Ueyama [Thu, 16 May 2019 03:45:13 +0000 (03:45 +0000)]
De-template parseFile() and SymbolTable's add-family functions.

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

llvm-svn: 360844

5 years agoFix prof branch_weights in entry_counts_missing_dbginfo.ll test
Yevgeny Rouban [Thu, 16 May 2019 03:39:09 +0000 (03:39 +0000)]
Fix prof branch_weights in entry_counts_missing_dbginfo.ll test

Removed extra parameter from !prof branch_weights metadata of
a call instruction according to the spec.

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

llvm-svn: 360843

5 years agoRevert r360833 until I can work out the issue with Win32 bots
Kristina Brooks [Thu, 16 May 2019 03:30:08 +0000 (03:30 +0000)]
Revert r360833 until I can work out the issue with Win32 bots

This reverts "r360833: [Clang][PP] Add the __FILE_NAME__ builtin macro."

The tests are failing on Windows bots, reverting the patchset until I can
work out why.

llvm-svn: 360842

5 years agoIntroduce CommonSymbol.
Rui Ueyama [Thu, 16 May 2019 03:29:03 +0000 (03:29 +0000)]
Introduce CommonSymbol.

Previously, we handled common symbols as a kind of Defined symbol,
but what we were doing for common symbols is pretty different from
regular defined symbols.

Common symbol and defined symbol are probably as different as shared
symbol and defined symbols are different.

This patch introduces CommonSymbol to represent common symbols.
After symbols are resolved, they are converted to Defined symbols
residing in a .bss section.

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

llvm-svn: 360841

5 years ago[libFuzzer] Also kill parent process in merge-siguser.test.
Matt Morehouse [Thu, 16 May 2019 03:04:44 +0000 (03:04 +0000)]
[libFuzzer] Also kill parent process in merge-siguser.test.

llvm-svn: 360840

5 years agoFix assumption about Win32 paths in r360833
Kristina Brooks [Thu, 16 May 2019 02:46:12 +0000 (02:46 +0000)]
Fix assumption about Win32 paths in r360833

Attempt to fix Windows buildbots due to differences in
path handling (caused by r360833).

llvm-svn: 360839

5 years agoSimplify SymbolTable::add{Defined,Undefined,...} functions.
Rui Ueyama [Thu, 16 May 2019 02:14:00 +0000 (02:14 +0000)]
Simplify SymbolTable::add{Defined,Undefined,...} functions.

SymbolTable's add-family functions have lots of parameters because
when they have to create a new symbol, they forward given arguments
to Symbol's constructors. Therefore, the functions take at least as
many arguments as their corresponding constructors.

This patch simplifies the add-family functions. Now, the functions
take a symbol instead of arguments to construct a symbol. If there's
no existing symbol, a given symbol is memcpy'ed to the symbol table.
Otherwise, the functions attempt to merge the existing and a given
new symbol.

I also eliminated `CanOmitFromDynSym` parameter, so that the functions
take really one argument.

Symbol classes are trivially constructible, so looks like constructing
them to pass to add-family functions is as cheap as passing a lot of
arguments to the functions. A quick benchmark showed that this patch
seems performance-neutral.

This is a preparation for
http://lists.llvm.org/pipermail/llvm-dev/2019-April/131902.html

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

llvm-svn: 360838

5 years agoFix regression in r360311 caused by reversed bool arguments.
Richard Smith [Thu, 16 May 2019 02:06:16 +0000 (02:06 +0000)]
Fix regression in r360311 caused by reversed bool arguments.

llvm-svn: 360837

5 years ago[libFuzzer] Fix typo in merge-sigusr.test.
Matt Morehouse [Thu, 16 May 2019 01:56:11 +0000 (01:56 +0000)]
[libFuzzer] Fix typo in merge-sigusr.test.

llvm-svn: 360836

5 years ago[libFuzzer] Use PID to send signals rather than process name.
Matt Morehouse [Thu, 16 May 2019 01:32:39 +0000 (01:32 +0000)]
[libFuzzer] Use PID to send signals rather than process name.

pkill reads the process name as a pattern, not a raw name.  This means
that if the process name contains + or other regex characters, pkill
fails.

llvm-svn: 360835

5 years agoFix typo in comment of CSAction -> Action.
Eric Christopher [Thu, 16 May 2019 01:07:54 +0000 (01:07 +0000)]
Fix typo in comment of CSAction -> Action.

llvm-svn: 360834

5 years ago[Clang][PP] Add the __FILE_NAME__ builtin macro.
Kristina Brooks [Thu, 16 May 2019 00:52:41 +0000 (00:52 +0000)]
[Clang][PP] Add the __FILE_NAME__ builtin macro.

This patch adds the `__FILE_NAME__` macro that expands to the
last component of the path, similar to `__FILE__` except with
a guarantee that only the last path component (without the
separator) will be rendered.

I intend to follow through with discussion of this with WG14
as a potential inclusion in the C standard or failing that,
try to discuss this with GCC developers since this extension
is desired by GCC and Clang users/developers alike.

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

llvm-svn: 360833

5 years ago[ELF] Fix typo in header guard. NFC.
Sam Clegg [Thu, 16 May 2019 00:45:50 +0000 (00:45 +0000)]
[ELF] Fix typo in header guard. NFC.

llvm-svn: 360832

5 years ago[ORC] Modify DenseMap hashing for SymbolStringPtrs.
Lang Hames [Thu, 16 May 2019 00:21:10 +0000 (00:21 +0000)]
[ORC] Modify DenseMap hashing for SymbolStringPtrs.

Modifies the DenseMapInfo<SymbolStringPtr>::getHashValue method to take its
argument by const-ref rather than by value (to avoid unnecessary ref-counting
operations) and to defer to DenseMapInfo<void*> for the hash value computation
(since SymbolStringPtrs are just pointers under the hood).

llvm-svn: 360831

5 years ago[JITLink][MachO] Use getSymbol64TableEntry for 64-bit MachO files.
Lang Hames [Thu, 16 May 2019 00:21:07 +0000 (00:21 +0000)]
[JITLink][MachO] Use getSymbol64TableEntry for 64-bit MachO files.

Fixes a think-o. No test case: The nlist and nlist64 data structures happen to
line up for this field, so there's no way to construct a failing test case.

llvm-svn: 360830

5 years agoFix GN build
Vitaly Buka [Thu, 16 May 2019 00:19:37 +0000 (00:19 +0000)]
Fix GN build

llvm-svn: 360829

5 years agoMake tentative parsing to detect template-argument-lists less aggressive
Richard Smith [Wed, 15 May 2019 23:36:14 +0000 (23:36 +0000)]
Make tentative parsing to detect template-argument-lists less aggressive
(and less wrong).

It's not correct to assume that X<something, Type> is always a
template-id; there are a few cases where the comma takes us into a
non-expression syntactic context in which 'Type' might be permissible.
Stop doing that.

This slightly regresses our error recovery on the cases where the
construct is intended to be a template-id. We typically do still manage
to diagnose a missing 'template' keyword, but we realize this too late
to properly recover from the error.

This fixes a regression introduced by r360308.

llvm-svn: 360827