platform/upstream/llvm.git
5 years agoRemove isAsCheapAsAMove from mem ops
Thomas Lively [Thu, 13 Sep 2018 02:50:57 +0000 (02:50 +0000)]
Remove isAsCheapAsAMove from mem ops

llvm-svn: 342105

5 years ago[WebAssembly] Add missing SIMD instruction attributes
Thomas Lively [Thu, 13 Sep 2018 02:50:56 +0000 (02:50 +0000)]
[WebAssembly] Add missing SIMD instruction attributes

Summary:
These attributes are copied from equivalent instructions in
WebAssemblyInstrInfo.td.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 342104

5 years agoMark LWG#3102 as complete. No code changes, but I updated a test or two
Marshall Clow [Thu, 13 Sep 2018 02:23:52 +0000 (02:23 +0000)]
Mark LWG#3102 as complete. No code changes, but I updated a test or two

llvm-svn: 342103

5 years agoSTLExtras: Add some more algorithm wrappers
David Blaikie [Thu, 13 Sep 2018 00:02:03 +0000 (00:02 +0000)]
STLExtras: Add some more algorithm wrappers

llvm-svn: 342102

5 years agoDebugInfo/PDB: Remove unused member
David Blaikie [Thu, 13 Sep 2018 00:02:02 +0000 (00:02 +0000)]
DebugInfo/PDB: Remove unused member

llvm-svn: 342101

5 years ago[AArch64] Support reserving x1-7 registers.
Tri Vo [Wed, 12 Sep 2018 23:45:04 +0000 (23:45 +0000)]
[AArch64] Support reserving x1-7 registers.

Summary: Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, efriedma, nickdesaulniers, srhines, phosek

Reviewed By: nickdesaulniers

Subscribers: manojgupta, jfb, cfe-commits, kristof.beyls

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

llvm-svn: 342100

5 years agodwarfdump: Improve performance on large DWP files
David Blaikie [Wed, 12 Sep 2018 23:39:51 +0000 (23:39 +0000)]
dwarfdump: Improve performance on large DWP files

llvm-svn: 342099

5 years agoRemove dead code made unnecessary by r342018.
Richard Smith [Wed, 12 Sep 2018 23:37:58 +0000 (23:37 +0000)]
Remove dead code made unnecessary by r342018.

llvm-svn: 342098

5 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 23:37:00 +0000 (23:37 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

This reinstates r342019, reverted in r342020. The regression previously
observed after this commit was fixed in r342096.

llvm-svn: 342097

5 years agoWhen we leave a module header, make that header visible in its
Richard Smith [Wed, 12 Sep 2018 23:09:23 +0000 (23:09 +0000)]
When we leave a module header, make that header visible in its
includer's context, even if its overall module is unavailable.

llvm-svn: 342096

5 years ago[DAGCombiner] improve formatting for select+setcc code; NFC
Sanjay Patel [Wed, 12 Sep 2018 23:03:50 +0000 (23:03 +0000)]
[DAGCombiner] improve formatting for select+setcc code; NFC

llvm-svn: 342095

5 years agofix 80-column violation with clang-format
Adrian Prantl [Wed, 12 Sep 2018 22:57:28 +0000 (22:57 +0000)]
fix 80-column violation with clang-format

llvm-svn: 342094

5 years ago[PDB] Remove all clone() methods.
Zachary Turner [Wed, 12 Sep 2018 22:57:03 +0000 (22:57 +0000)]
[PDB] Remove all clone() methods.

These are dead code and encourage poor usage patterns, so I'm
removing them.  They weren't called anywhere anyway.

llvm-svn: 342093

5 years ago[TSan] Update test values
Vlad Tsyrklevich [Wed, 12 Sep 2018 22:16:14 +0000 (22:16 +0000)]
[TSan] Update test values

Similarly to before, D51985 again reduced the number of registers
required for the read/write routines causing this test to fail on
sanitizer-x86_64-linux-autoconf.

llvm-svn: 342092

5 years ago[Hexagon] Use shuffles when lowering "gather" shufflevectors
Krzysztof Parzyszek [Wed, 12 Sep 2018 22:14:52 +0000 (22:14 +0000)]
[Hexagon] Use shuffles when lowering "gather" shufflevectors

Shufflevector instructions in LLVM IR that extract a subset of elements
of a longer input into a shorter vector can be done using VECTOR_SHUFFLEs.
This will avoid expanding them into constly extracts and inserts.

llvm-svn: 342091

5 years ago[Hexagon] Improve the selection algorithm in scalarizeShuffle
Krzysztof Parzyszek [Wed, 12 Sep 2018 22:10:58 +0000 (22:10 +0000)]
[Hexagon] Improve the selection algorithm in scalarizeShuffle

Use topological ordering for newly generated nodes.

llvm-svn: 342090

5 years ago[Support] sys::fs::directory_entry includes the file_type.
Kristina Brooks [Wed, 12 Sep 2018 22:08:10 +0000 (22:08 +0000)]
[Support] sys::fs::directory_entry includes the file_type.

This is available on most platforms (Linux/Mac/Win/BSD) with no extra syscalls.
On other platforms (e.g. Solaris) we stat() if this information is requested.

This will allow switching clang's VFS to efficiently expose (path, type) when
traversing a directory. Currently it exposes an entire Status, but does so by
calling fs::status() on all platforms.
Almost all callers only need the path, and all callers only need (path, type).

Patch by sammccall (Sam McCall)

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

llvm-svn: 342089

5 years ago[llvm-cov] Delete custom JSON serialization code (NFC)
Vedant Kumar [Wed, 12 Sep 2018 21:59:38 +0000 (21:59 +0000)]
[llvm-cov] Delete custom JSON serialization code (NFC)

Teach llvm-cov to use the new llvm JSON library, and remove some
redundant/brittle JSON serialization tests.

llvm-svn: 342088

5 years ago[ORC] Merge ExecutionSessionBase with ExecutionSession by moving a couple of
Lang Hames [Wed, 12 Sep 2018 21:49:02 +0000 (21:49 +0000)]
[ORC] Merge ExecutionSessionBase with ExecutionSession by moving a couple of
template methods in JITDylib out-of-line.

This also splits JITDylib::define into a pair of template methods, one taking an
lvalue reference and the other an rvalue reference. This simplifies the
templates at the cost of a small amount of code duplication.

llvm-svn: 342087

5 years ago[ORC] Add a special 'main' JITDylib that is created on ExecutionSession
Lang Hames [Wed, 12 Sep 2018 21:48:59 +0000 (21:48 +0000)]
[ORC] Add a special 'main' JITDylib that is created on ExecutionSession
construction, a new convenience lookup method, and add-to layer methods.

ExecutionSession now creates a special 'main' JITDylib upon construction. All
subsequently created JITDylibs are added to the main JITDylib's search order by
default (controlled by the AddToMainDylibSearchOrder parameter to
ExecutionSession::createDylib). The main JITDylib's search order will be used in
the future to properly handle cross-JITDylib weak symbols, with the first
definition in this search order selected.

This commit also adds a new ExecutionSession::lookup convenience method that
performs a blocking lookup using the main JITDylib's search order, as this will
be a very common operation for clients.

Finally, new convenience overloads of IRLayer and ObjectLayer's add methods are
introduced that add the given program representations to the main dylib, which
is likely to be the common case.

llvm-svn: 342086

5 years agoCommit my attempt to test the change to ProcessGDBRemote
Jason Molenda [Wed, 12 Sep 2018 21:35:02 +0000 (21:35 +0000)]
Commit my attempt to test the change to ProcessGDBRemote
in r336956.  This test doesn't actually test the change
that was submitted by Venkata, but it's a good one to
add.

llvm-svn: 342085

5 years ago[WebAssembly] Make tied inline asm operands work again
Heejin Ahn [Wed, 12 Sep 2018 21:34:39 +0000 (21:34 +0000)]
[WebAssembly] Make tied inline asm operands work again

Summary:
rL341389 broke code with tied register operands in inline assembly. For
example, `asm("" : "=r"(var) : "0"(var));`
The code above specifies the input operand to be in the same register
with the output operand, tying the two register. This patch makes this
kind of code work again.

Reviewers: dschuff

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

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

llvm-svn: 342084

5 years agorevert r341288 - [Reassociate] swap binop operands to increase factoring potential
Sanjay Patel [Wed, 12 Sep 2018 21:29:11 +0000 (21:29 +0000)]
revert r341288 - [Reassociate] swap binop operands to increase factoring potential

This causes or exposes indeterminism that is visible in the output of -reassociate.

llvm-svn: 342083

5 years ago[InstCombine] add tests for unsigned add overflow; NFC
Sanjay Patel [Wed, 12 Sep 2018 21:13:37 +0000 (21:13 +0000)]
[InstCombine] add tests for unsigned add overflow; NFC

llvm-svn: 342082

5 years agoGuard FMF context by excluding some FP operators from FPMathOperator
Michael Berg [Wed, 12 Sep 2018 21:09:59 +0000 (21:09 +0000)]
Guard FMF context by excluding some FP operators from FPMathOperator

Summary:
Some FPMathOperators succeed and the retrieve FMF context when they never have it, we should omit these cases to keep from removing FMF context.

For instance when we visit some FPMathOperator mapped Instructions which never have FMF flags and a Node was associated which does have FMF flags, that Node today will have all its flags cleared via the intersect operation.  With this change, we exclude associating Nodes that never have FPMathOperator status under FMF.

Reviewers: spatel, wristow, arsenm, hfinkel, aemerson

Reviewed By: spatel

Subscribers: llvm-commits, wdng

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

llvm-svn: 342081

5 years ago[PDB] Emit old fpo data to the PDB file.
Zachary Turner [Wed, 12 Sep 2018 21:02:01 +0000 (21:02 +0000)]
[PDB] Emit old fpo data to the PDB file.

r342003 added support for emitting FPO data from the
DEBUG_S_FRAMEDATA subsection of the .debug$S section to the PDB
file.  However, that is not the end of the story.  FPO can end
up in two different destinations in a PDB, each corresponding to
a different FPO data source.

The case handled by r342003 involves copying data from the
DEBUG_S_FRAMEDATA subsection of the .debug$S section to the
"New FPO" stream in the PDB, which is then referred to by the
DBI stream.  The case handled by this patch involves copying
records from the .debug$F section of an object file to the "FPO"
stream (or perhaps more aptly, the "Old FPO" stream) in the PDB
file, which is also referred to by the DBI stream.

The formats are largely similar, and the difference is mostly
only visible in masm generated object files, such as some of the
low-level CRT object files like memcpy.  MASM doesn't appear to
support writing the DEBUG_S_FRAMEDATA subsection, and instead
just writes these records to the .debug$F section.

Although clang-cl does not emit a .debug$F section ever, lld still
needs to support it so we have good debugging for CRT functions.

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

llvm-svn: 342080

5 years ago[Hexagon] Use legalized type for extracted elements in scalarizeShuffle
Krzysztof Parzyszek [Wed, 12 Sep 2018 20:58:48 +0000 (20:58 +0000)]
[Hexagon] Use legalized type for extracted elements in scalarizeShuffle

Scalarization of a shuffle will break up the source vectors into individual
elements, and use them to assemble the resulting vector. An element type of
a legal vector type may not necessarily be a legal scalar type, so make
sure that the extracted values are extended to a legal scalar type.

llvm-svn: 342079

5 years ago[Hexagon] Remove fp-contract=fast setting for at O3
Brendon Cahoon [Wed, 12 Sep 2018 20:35:56 +0000 (20:35 +0000)]
[Hexagon] Remove fp-contract=fast setting for at O3

Change Hexagon so that the setting for fp-contract is the default setting.
This makes Hexagon consistent with all other targets.

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

llvm-svn: 342078

5 years agoAMDGPU: Print all kernel descriptor directives (including the ones with default values)
Konstantin Zhuravlyov [Wed, 12 Sep 2018 20:25:39 +0000 (20:25 +0000)]
AMDGPU: Print all kernel descriptor directives (including the ones with default values)

Change by Tony Tye

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

llvm-svn: 342077

5 years ago[NFC][InstCombine] Drop newly-added interference-tests-for-high-bit-check.ll
Roman Lebedev [Wed, 12 Sep 2018 20:06:46 +0000 (20:06 +0000)]
[NFC][InstCombine] Drop newly-added interference-tests-for-high-bit-check.ll

Now that i have actually double-checked, no,
there is no such interference possible...

llvm-svn: 342076

5 years agoDo not create new terminals when launching process on Windows with --no-stdio
David Bolvansky [Wed, 12 Sep 2018 19:50:45 +0000 (19:50 +0000)]
Do not create new terminals when launching process on Windows with --no-stdio

Summary: Partially fixes PR38222

Reviewers: teemperor, zturner, stella.stamenova

Reviewed By: zturner, stella.stamenova

Subscribers: JDevlieghere, clayborg, labath, abidh, lldb-commits

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

llvm-svn: 342075

5 years ago[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.
Roman Lebedev [Wed, 12 Sep 2018 19:44:26 +0000 (19:44 +0000)]
[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.

More complicated, canonical pattern:
https://rise4fun.com/Alive/uhA
https://godbolt.org/z/o4RB8D

Also, we need to be careful not to skip some patters...

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

llvm-svn: 342074

5 years agoImplement the infrastructure for feature-test macros. Very few actual feature test...
Marshall Clow [Wed, 12 Sep 2018 19:41:40 +0000 (19:41 +0000)]
Implement the infrastructure for feature-test macros. Very few actual feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955

llvm-svn: 342073

5 years agoIf we fail to get an armv7em-- disassembler from llvm, skip the
Jason Molenda [Wed, 12 Sep 2018 19:30:03 +0000 (19:30 +0000)]
If we fail to get an armv7em-- disassembler from llvm, skip the
tests and don't mark this as a failure.  This happens when we've
linked against an llvm without the ARM target built in.  Davide
added some cmake conditionals to avoid building this test when the
target was absent from llvm's build, but we're still finding some
bots that manage to get in this situation.

<rdar://problem/44270082>

llvm-svn: 342072

5 years agoActually mark LWG#2953, don't just say you've done so in r342070
Marshall Clow [Wed, 12 Sep 2018 18:53:02 +0000 (18:53 +0000)]
Actually mark LWG#2953, don't just say you've done so in r342070

llvm-svn: 342071

5 years agomark LWG#2953 as complete. No code changes required, but added a couple of extra...
Marshall Clow [Wed, 12 Sep 2018 18:51:12 +0000 (18:51 +0000)]
mark LWG#2953 as complete. No code changes required, but added a couple of extra tests.

llvm-svn: 342070

5 years agoAMDGPU: Re-apply r341982 after fixing the layering issue
Konstantin Zhuravlyov [Wed, 12 Sep 2018 18:50:47 +0000 (18:50 +0000)]
AMDGPU: Re-apply r341982 after fixing the layering issue

Move isa version determination into TargetParser.

Also switch away from target features to CPU string when
determining isa version. This fixes an issue when we
output wrong isa version in the object code when features
of a particular CPU are altered (i.e. gfx902 w/o xnack
used to result in gfx900).

llvm-svn: 342069

5 years ago[Diagnostic] Fix a warning typo. NFC.
Matt Davis [Wed, 12 Sep 2018 18:27:21 +0000 (18:27 +0000)]
[Diagnostic] Fix a warning typo. NFC.

s/aligment/alignment/

llvm-svn: 342068

5 years ago[InstCombine] Inefficient pattern for high-bits checking (PR38708)
Roman Lebedev [Wed, 12 Sep 2018 18:19:43 +0000 (18:19 +0000)]
[InstCombine] Inefficient pattern for high-bits checking (PR38708)

Summary:
It is sometimes important to check that some newly-computed value
is non-negative and only `n` bits wide (where `n` is a variable.)
There are **many** ways to check that:
https://godbolt.org/z/o4RB8D
The last variant seems best?
(I'm sure there are some other variations i haven't thought of..)

Let's handle the second variant first, since it is much simpler.
https://rise4fun.com/Alive/LYjY

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

Reviewers: spatel, craig.topper, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 342067

5 years agoAdd compatibility version to liblldb in framework builds
Alex Langford [Wed, 12 Sep 2018 18:10:22 +0000 (18:10 +0000)]
Add compatibility version to liblldb in framework builds

Summary:
Building LLDB with xcodebuild sets the compatibility version of liblldb
in LLDB.framework. Building the framework with cmake does not set the
compatibility version, and so it defaults to 0.0.0. This is a discrepency in the
difference between the xcode build and the cmake build.

I tested this change by building without this patch. From the build tree I ran
`otool -L Library/Frameworks/LLDB.framework/Versions/A/LLDB` and got this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 0.0.0, current version 8.0.0)
```

Did the same with this patch and the output contained this:
```
@rpath/LLDB.framework/Versions/A/LLDB (compatibility version 1.0.0, current version 8.0.0)
```

Reviewers: clayborg, labath

Subscribers: mgorny, lldb-commits

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

llvm-svn: 342066

5 years ago[objcopy] make objcopy follow program header standards
Julie Hockett [Wed, 12 Sep 2018 17:56:31 +0000 (17:56 +0000)]
[objcopy] make objcopy follow program header standards

Submitted on behalf of Armando Montanez (amontanez@google.com).

Objects with unused program headers copied by objcopy would always have
nonzero values for program header offset and program header entry size.
While technically valid, this atypical behavior triggers warnings in some
tools. This change sets the two fields to zero when the program header is
unused, better fitting the general expectations for unused program header
data.

Section headers behaved somewhat similarly (though only with the entry size),
and are fixed in this revision as well.

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

llvm-svn: 342065

5 years ago[WebAssembly] SIMD comparisons
Thomas Lively [Wed, 12 Sep 2018 17:56:00 +0000 (17:56 +0000)]
[WebAssembly] SIMD comparisons

Summary:
Match the ordering semantics of non-vector comparisons. For
floating point comparisons that do not correspond to instructions, the
tests check that some vector comparison instruction was emitted but do
not care about the full implementation.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 342064

5 years agoUpdate the failure annotations for the uncaught_exceptions test. The underlying abi...
Marshall Clow [Wed, 12 Sep 2018 16:59:09 +0000 (16:59 +0000)]
Update the failure annotations for the uncaught_exceptions test. The underlying abi library on some Mac OS versions does not support the plural uncaught_exceptions, so libc++ emulates it from the singlar; this means it will only return 0 or 1.

llvm-svn: 342063

5 years ago[OPENMP] Fix PR38902: support ADL for declare reduction constructs.
Alexey Bataev [Wed, 12 Sep 2018 16:31:59 +0000 (16:31 +0000)]
[OPENMP] Fix PR38902: support ADL for declare reduction constructs.

Added support for argument-dependent lookup when trying to find the
required declare reduction decl.

llvm-svn: 342062

5 years ago[ARM] Tighten f64<->f16 conversion requirements
Diogo N. Sampaio [Wed, 12 Sep 2018 16:24:43 +0000 (16:24 +0000)]
[ARM] Tighten f64<->f16 conversion requirements

Fix missing Requires fields.

Patch by Bernard Ogden (bogden)

Reviewers: SjoerdMeijer, javed.absar, t.p.northover

Reviewed By: t.p.northover

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

llvm-svn: 342061

5 years ago[RISCV] Explicitly set an empty --sysroot in the test
Roger Ferrer Ibanez [Wed, 12 Sep 2018 15:55:14 +0000 (15:55 +0000)]
[RISCV] Explicitly set an empty --sysroot in the test

In rL341655 we added additional behaviour to the Driver for riscv32-unknown-elf
when the sysroot is empty.

The new tests that check the new behaviour expect that the absence of --sysroot
in the command-line implies that the sysroot empty. This doesn't hold if clang
is built with a non-empty DEFAULT_SYSROOT in cmake. When this is the case, this
test fails.

Since the new behaviour is triggered when the sysroot is empty, pass an empty
--sysroot to avoid using the default (if any).

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

llvm-svn: 342060

5 years ago[X86] Remove isel patterns for ADCX instruction
Craig Topper [Wed, 12 Sep 2018 15:47:34 +0000 (15:47 +0000)]
[X86] Remove isel patterns for ADCX instruction

There's no advantage to this instruction unless you need to avoid touching other flag bits. It's encoding is longer, it can't fold an immediate, it doesn't write all the flags.

I don't think gcc will generate this instruction either.

Fixes PR38852.

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

llvm-svn: 342059

5 years ago[PatternMatch] Use generic One,Two,ThreeOps_match classes (NFC).
Florian Hahn [Wed, 12 Sep 2018 14:52:38 +0000 (14:52 +0000)]
[PatternMatch] Use generic One,Two,ThreeOps_match classes (NFC).

Currently we have a few duplicated matcher classes, which all do pretty
much the same thing. This patch introduces generic
One,Tow,ThreeOps_match classes which take the opcode the match as
template argument.

Reviewers: SjoerdMeijer, dneilson, spatel, arsenm

Reviewed By: SjoerdMeijer

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

llvm-svn: 342058

5 years agoImplement LWG #3017. list splice functions should use addressof
Marshall Clow [Wed, 12 Sep 2018 14:46:17 +0000 (14:46 +0000)]
Implement LWG #3017. list splice functions should use addressof

llvm-svn: 342057

5 years agoReverting r342048, which caused UBSan failures in dsymutil.
Wolfgang Pieb [Wed, 12 Sep 2018 14:40:04 +0000 (14:40 +0000)]
Reverting r342048, which caused UBSan failures in dsymutil.

llvm-svn: 342056

5 years ago[GVNHoist] computeInsertionPoints() miscalculates IDF
Alexandros Lamprineas [Wed, 12 Sep 2018 14:28:23 +0000 (14:28 +0000)]
[GVNHoist] computeInsertionPoints() miscalculates IDF

Fix for https://bugs.llvm.org/show_bug.cgi?id=38912.

In GVNHoist::computeInsertionPoints() we iterate over the Value
Numbers and calculate the Iterated Dominance Frontiers without
clearing the IDFBlocks vector first. IDFBlocks ends up accumulating
an insane number of basic blocks, which bloats the compilation time
of SemaChecking.cpp with ubsan enabled.

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

llvm-svn: 342055

5 years ago[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.
Roman Lebedev [Wed, 12 Sep 2018 14:11:37 +0000 (14:11 +0000)]
[NFC][InstCombine] R38708 - inefficient pattern for high-bits checking.

The simplest pattern for now:
https://rise4fun.com/Alive/LYjY
https://godbolt.org/z/o4RB8D

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

llvm-svn: 342054

5 years ago[CodeGen] Align rtti and vtable data
David Green [Wed, 12 Sep 2018 14:09:06 +0000 (14:09 +0000)]
[CodeGen] Align rtti and vtable data

Previously the alignment on the newly created rtti/typeinfo data was largely
not set, meaning that DataLayout::getPreferredAlignment was free to overalign
it to 16 bytes. This causes unnecessary code bloat.

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

llvm-svn: 342053

5 years agoFix MSVC "not all control paths return a value" warnings. NFCI.
Simon Pilgrim [Wed, 12 Sep 2018 12:56:58 +0000 (12:56 +0000)]
Fix MSVC "not all control paths return a value" warnings. NFCI.

llvm-svn: 342052

5 years agoFix two issues in PDBASTParser
Pavel Labath [Wed, 12 Sep 2018 12:26:11 +0000 (12:26 +0000)]
Fix two issues in PDBASTParser

- gcc warning about using binary or for or-ing two comparisons (a == b | a == c)
- llvm style prefers static functions to functions in an anonymous namespace

llvm-svn: 342051

5 years agoMove SafeMachO from Utility to Host
Pavel Labath [Wed, 12 Sep 2018 12:26:05 +0000 (12:26 +0000)]
Move SafeMachO from Utility to Host

Summary:
One of the conclusions of the discussion on D49740 was that SafeMachO is better
off in the Host module (as that's the only place which should include
mach/machine.h, which is what this header is working around). Also, Utility,
which is the only module which cannot include Host, should not be doing
anything with object file formats.

This patch implements that move, and also removes any unneded includes of that
file.

I've verified that MacOS still compiles after this.

Reviewers: jingham, zturner, teemperor

Subscribers: fedor.sergeev, lldb-commits

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

llvm-svn: 342050

5 years ago[AArch64] Implement aarch64_vector_pcs codegen support.
Sander de Smalen [Wed, 12 Sep 2018 12:10:22 +0000 (12:10 +0000)]
[AArch64] Implement aarch64_vector_pcs codegen support.

This patch adds codegen support for the saving/restoring
V8-V23 for functions specified with the aarch64_vector_pcs
calling convention attribute, as added in patch D51477.

Reviewers: t.p.northover, gberry, thegameg, rengolin, javed.absar, MatzeB

Reviewed By: thegameg

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

llvm-svn: 342049

5 years ago[DWARF] Refactoring range list dumping to fold DWARF v4 functionality into v5 handling
Wolfgang Pieb [Wed, 12 Sep 2018 12:01:19 +0000 (12:01 +0000)]
[DWARF] Refactoring range list dumping to fold DWARF v4 functionality into v5 handling

Eliminating some duplication of rangelist dumping code at the expense of
some version-dependent code in dump and extract routines.

Reviewer: dblaikie, JDevlieghere, vleschuk

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

llvm-svn: 342048

5 years agoRemove another unused mislayered include.
Benjamin Kramer [Wed, 12 Sep 2018 11:31:18 +0000 (11:31 +0000)]
Remove another unused mislayered include.

llvm-svn: 342047

5 years agoRemove unused include that's also a layering violation.
Benjamin Kramer [Wed, 12 Sep 2018 11:27:10 +0000 (11:27 +0000)]
Remove unused include that's also a layering violation.

llvm-svn: 342046

5 years ago[ADT] Made numerous methods of ImmutableList const
Kristof Umann [Wed, 12 Sep 2018 11:20:15 +0000 (11:20 +0000)]
[ADT] Made numerous methods of ImmutableList const

Also added ImmutableList<T>::iterator::operator->.

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

llvm-svn: 342045

5 years agoRemove manual byte counting from internal Stream methods.
Raphael Isemann [Wed, 12 Sep 2018 10:20:41 +0000 (10:20 +0000)]
Remove manual byte counting from internal Stream methods.

Summary:
This patch removes the manual byte counting in all internal Stream methods.
This is now done by the automatic byte counting provided by calling `GetWrittenBytes()`
before and after writing the data (which is automatically done for us by the `ByteDelta`
utility class).

Reviewers: #lldb, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: JDevlieghere, labath, lldb-commits

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

llvm-svn: 342044

5 years ago[CGP] Ensure splitgep gives deterministic output
David Green [Wed, 12 Sep 2018 10:19:10 +0000 (10:19 +0000)]
[CGP] Ensure splitgep gives deterministic output

The output of splitLargeGEPOffsets does not appear to be deterministic because
of the way that we iterate over a DenseMap. I've changed it to a MapVector for
consistent output.

The test here isn't particularly great, only showing a consmetic difference in
output. The original reproducer is much larger but show a diffierence in
instruction ordering, leading to different codegen.

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

llvm-svn: 342043

5 years agoAdd a basic test for 'memory region'
Raphael Isemann [Wed, 12 Sep 2018 10:04:25 +0000 (10:04 +0000)]
Add a basic test for 'memory region'

Summary:
The 'memory region' command is at the moment not tested at all by our test suite.
This patch just adds a basic test that at least provides some basic testing.

Reviewers: #lldb, davide

Reviewed By: #lldb, davide

Subscribers: vsk, davide, lldb-commits

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

llvm-svn: 342042

5 years ago[clang-tidy] Abseil: Add more directories that are slated for future absl expansion.
Benjamin Kramer [Wed, 12 Sep 2018 10:04:16 +0000 (10:04 +0000)]
[clang-tidy] Abseil: Add more directories that are slated for future absl expansion.

llvm-svn: 342041

5 years ago[ARM] Follow-up to rL342033
Sam Parker [Wed, 12 Sep 2018 09:58:56 +0000 (09:58 +0000)]
[ARM] Follow-up to rL342033

Fixed typo which can cause segfault.

llvm-svn: 342040

5 years ago[SimplifyCFG] Put an alignment on generated switch tables
David Green [Wed, 12 Sep 2018 09:54:17 +0000 (09:54 +0000)]
[SimplifyCFG] Put an alignment on generated switch tables

Previously the alignment on the newly created switch table data was not set,
meaning that DataLayout::getPreferredAlignment was free to overalign it to 16
bytes. This causes unnecessary code bloat.

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

llvm-svn: 342039

5 years ago[AArch64] NFC: Refactoring to prepare for vector PCS.
Sander de Smalen [Wed, 12 Sep 2018 09:44:46 +0000 (09:44 +0000)]
[AArch64] NFC: Refactoring to prepare for vector PCS.

This patch refactors several parts of AArch64FrameLowering
so that it can be easily extended to support saving/restoring
of FPR128 (Q) registers.

Reviewers: t.p.northover, gberry, thegameg, rengolin, javed.absar

Reviewed By: thegameg

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

llvm-svn: 342038

5 years ago[clangd] Add missing clangBasic target_link_libraries
Heejin Ahn [Wed, 12 Sep 2018 09:40:13 +0000 (09:40 +0000)]
[clangd] Add missing clangBasic target_link_libraries

Without this, builds with `-DSHARED_LIB=ON` fail.

llvm-svn: 342037

5 years agoFix buildbots after r342027
Kirill Bobyrev [Wed, 12 Sep 2018 09:27:55 +0000 (09:27 +0000)]
Fix buildbots after r342027

llvm-svn: 342036

5 years ago[llvm-exegesis][NFC]Remove dead function parameter
Clement Courbet [Wed, 12 Sep 2018 09:26:32 +0000 (09:26 +0000)]
[llvm-exegesis][NFC]Remove dead function parameter

llvm-svn: 342035

5 years ago[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed
Mikhail Maltsev [Wed, 12 Sep 2018 09:19:19 +0000 (09:19 +0000)]
[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

Summary:
On targets that do not support FP16 natively LLVM currently legalizes
vectors of FP16 values by scalarizing them and promoting to FP32. This
causes problems for the following code:

  void foo(int, ...);

  typedef __attribute__((neon_vector_type(4))) __fp16 float16x4_t;
  void bar(float16x4_t x) {
    foo(42, x);
  }

According to the AAPCS (appendix A.2) float16x4_t is a containerized
vector fundamental type, so 'foo' expects that the 4 16-bit FP values
are packed into 2 32-bit registers, but instead bar promotes them to
4 single precision values.

Since we already handle scalar FP16 values in the frontend by
bitcasting them to/from integers, this patch adds similar handling for
vector types and homogeneous FP16 vector aggregates.

One existing test required some adjustments because we now generate
more bitcasts (so the patch changes the test to target a machine with
native FP16 support).

Reviewers: eli.friedman, olista01, SjoerdMeijer, javed.absar, efriedma

Reviewed By: javed.absar, efriedma

Subscribers: efriedma, kristof.beyls, cfe-commits, chrib

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

llvm-svn: 342034

5 years ago[ARM] Exchange MAC operands in ARMParallelDSP
Sam Parker [Wed, 12 Sep 2018 09:17:44 +0000 (09:17 +0000)]
[ARM] Exchange MAC operands in ARMParallelDSP

SMLAD and SMLALD instructions also come in the form of SMLADX and
SMLALDX which perform an exchange on their second operand. To support
this, more of the loads in the MAC candidates are compared for
sequential access and a boolean value has been added to BinOpChain.

AddMACCandiate has been refactored into a small pattern matching
state machine to reduce the amount of duplicated code, but also to
enable the matching to be more flexible. CreateParallelMACPairs now
iterates through all the candidates to find parallel ones.

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

llvm-svn: 342033

5 years ago[ARM] Allow bitcasts in ARMCodeGenPrepare
Sam Parker [Wed, 12 Sep 2018 09:11:48 +0000 (09:11 +0000)]
[ARM] Allow bitcasts in ARMCodeGenPrepare

Allow bitcasts in the use-def chains, treating them as sources.

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

llvm-svn: 342032

5 years agoFix Check test to avoid output string mismatch
Christian Bruel [Wed, 12 Sep 2018 08:59:17 +0000 (08:59 +0000)]
Fix Check test to avoid output string mismatch

Differential Revision: http://reviews.llvm.org/D51354

llvm-svn: 342031

5 years ago[AArch64] Add parsing of aarch64_vector_pcs attribute.
Sander de Smalen [Wed, 12 Sep 2018 08:54:06 +0000 (08:54 +0000)]
[AArch64] Add parsing of aarch64_vector_pcs attribute.

This patch adds parsing support for the 'aarch64_vector_pcs'
calling convention attribute to calls and function declarations.

More information describing the vector ABI and procedure call standard
can be found here:

  https://developer.arm.com/products/software-development-tools/\
                            hpc/arm-compiler-for-hpc/vector-function-abi

Reviewers: t.p.northover, rnk, rengolin, javed.absar, thegameg, SjoerdMeijer

Reviewed By: SjoerdMeijer

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

llvm-svn: 342030

5 years agoReduce alignment on struct XSAVE, fixing a gcc warning
Pavel Labath [Wed, 12 Sep 2018 08:50:08 +0000 (08:50 +0000)]
Reduce alignment on struct XSAVE, fixing a gcc warning

The warning is about heap-allocating a struct with bigger alignment
requirements than the standard heap allocator provides.

AFAICT, all uses of the XSAVE struct are already heap-allocated, so this
high alignment does not actually have any effect and removing it should
be NFC.

I have also done some digging in the commit history. This alignment
requirement was since the XSAVE struct was introduced in r180572 when
adding AVX register support for linux. It does not mention the alignment
specifically, so I am guessing this was just put there because the
corresponging XSAVE cpu instruction requires its buffer to be 64-byte
aligned. However, LLDB will not be normally reading this struct via the
XSAVE instruction directly. Instead we will ask the kernel to copy the
buffer saved when suspeding the inferior. This should not require such
strict alignment (in fact, linux kernel will happily do this for any
alignment).

llvm-svn: 342029

5 years ago[Tooling] Wait for all threads to finish before resetting CWD.
Eric Liu [Wed, 12 Sep 2018 08:29:47 +0000 (08:29 +0000)]
[Tooling] Wait for all threads to finish before resetting CWD.

llvm-svn: 342028

5 years ago[LV] Move InterleaveGroup and InterleavedAccessInfo to VectorUtils.h (NFC)
Florian Hahn [Wed, 12 Sep 2018 08:01:57 +0000 (08:01 +0000)]
[LV] Move InterleaveGroup and InterleavedAccessInfo to VectorUtils.h (NFC)

Move the 2 classes out of LoopVectorize.cpp to make it easier to re-use
them for VPlan outside LoopVectorize.cpp

Reviewers: Ayal, mssimpso, rengolin, dcaballe, mkuper, hsaito, hfinkel, xbolva00

Reviewed By: rengolin, xbolva00

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

llvm-svn: 342027

5 years ago[clangd] Add index benchmarks
Kirill Bobyrev [Wed, 12 Sep 2018 07:49:44 +0000 (07:49 +0000)]
[clangd] Add index benchmarks

This patch introduces index benchmarks on top of the proposed LLVM
benchmark pull.

Reviewed By: sammccall, lebedev.ri

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

llvm-svn: 342026

5 years ago[clangd] Implement a Proof-of-Concept tool for symbol index exploration
Kirill Bobyrev [Wed, 12 Sep 2018 07:32:54 +0000 (07:32 +0000)]
[clangd] Implement a Proof-of-Concept tool for symbol index exploration

Reviewed By: sammccall, ilya-biryukov

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

llvm-svn: 342025

5 years agoRemove unused include from IVDescriptors.cpp.
Ilya Biryukov [Wed, 12 Sep 2018 07:22:46 +0000 (07:22 +0000)]
Remove unused include from IVDescriptors.cpp.

This fixes a layering violation:

Analysis/IVDescrtors.cpp can't include Transforms/Utils/BasicBlockUtils.h,
since TransformUtils depends on Analysis.

llvm-svn: 342024

5 years agoRevert "AMDGPU: Move isa version and EF_AMDGPU_MACH_* determination into TargetParser."
Ilya Biryukov [Wed, 12 Sep 2018 07:05:30 +0000 (07:05 +0000)]
Revert "AMDGPU: Move isa version and EF_AMDGPU_MACH_* determination into TargetParser."

This reverts commit r341982.

The change introduced a layering violation. Reverting to unbreak
our integrate.

llvm-svn: 342023

5 years ago[SelectionDAG] Remove some code from PromoteIntOp_MGATHER that handles UpdateNodeOper...
Craig Topper [Wed, 12 Sep 2018 05:25:41 +0000 (05:25 +0000)]
[SelectionDAG] Remove some code from PromoteIntOp_MGATHER that handles UpdateNodeOperands returning an existing node instead of updating.

I suspect this became unecessary when the CSE of mgather was fixed in r338080. It may still be possible to hit this if we widen the element type of a gather outside of type legalization and the promote the mask of a separate gather node so they become the same. But that seems pretty unlikely.

llvm-svn: 342022

5 years ago[Driver] Search LibraryPaths when handling -print-file-name
Petr Hosek [Wed, 12 Sep 2018 03:26:10 +0000 (03:26 +0000)]
[Driver] Search LibraryPaths when handling -print-file-name

This is necessary to handle the multiarch runtime directories.

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

llvm-svn: 342021

5 years agoRevert r342019, "Track definition merging on the canonical declaration
Richard Smith [Wed, 12 Sep 2018 02:28:14 +0000 (02:28 +0000)]
Revert r342019, "Track definition merging on the canonical declaration
even when [...]"

Further testing has revealed that this causes build breaks during
explicit module compilations.

llvm-svn: 342020

5 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 02:13:48 +0000 (02:13 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

llvm-svn: 342019

5 years agoConsistently create a new declaration when merging a pre-existing but
Richard Smith [Wed, 12 Sep 2018 02:13:47 +0000 (02:13 +0000)]
Consistently create a new declaration when merging a pre-existing but
hidden definition with a would-be-parsed redefinition.

This permits a bunch of cleanups. In particular, we no longer need to
take merged definitions into account when checking declaration
visibility, only when checking definition visibility, which makes
certain visibility checks take linear instead of quadratic time.

We could also now remove the UPD_DECL_EXPORTED update record and track
on each declaration whether it was demoted from a definition (as we
already do for variables), but I'm not doing that in this patch to keep
the changes here simpler.

llvm-svn: 342018

5 years agoFix tracking of merged definitions when the merge target is also merged
Richard Smith [Wed, 12 Sep 2018 02:13:46 +0000 (02:13 +0000)]
Fix tracking of merged definitions when the merge target is also merged
into something else.

llvm-svn: 342017

5 years agoBreak LoopUtils into an Analysis file.
Vikram TV [Wed, 12 Sep 2018 01:59:43 +0000 (01:59 +0000)]
Break LoopUtils into an Analysis file.

Summary:
The InductionDescriptor and RecurrenceDescriptor classes basically analyze the IR to identify the respective IVs. So, it is better to have them in the "Analysis" directory instead of the "Transforms" directory.

The rationale for this is to make the Induction and Recurrence descriptor classes available for analysis passes. Currently including them in an analysis pass produces link error (http://lists.llvm.org/pipermail/llvm-dev/2018-July/124456.html).

Induction and Recurrence descriptors are moved from Transforms/Utils/LoopUtils.h|cpp to Analysis/IVDescriptors.h|cpp.

Reviewers: dmgreen, llvm-commits, hfinkel

Reviewed By: dmgreen

Subscribers: mgorny

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

llvm-svn: 342016

5 years ago[X86] Teach X86SelectionDAGInfo::EmitTargetCodeForMemcpy about GNUX32
Craig Topper [Wed, 12 Sep 2018 01:57:22 +0000 (01:57 +0000)]
[X86] Teach X86SelectionDAGInfo::EmitTargetCodeForMemcpy about GNUX32

Summary:
In GNUX23, is64BitMode returns true, but pointers are 32-bits. So we shouldn't copy pointer values into RSI/RDI since the widths don't match.

Fixes PR38865 despite what the title says. I think the llvm_unreachable in the copyPhysReg code tricked the optimizer and made the fatal error trigger.

Reviewers: rnk, efriedma, MatzeB, echristo

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 342015

5 years ago[hwasan] On every use-after-free print a developer note: the index of this heap objec...
Kostya Serebryany [Wed, 12 Sep 2018 00:58:15 +0000 (00:58 +0000)]
[hwasan] On every use-after-free print a developer note: the index of this heap object in the thread's deallocation ring buffer. Mostly useful to hwasan developers, will hopefully let us know the good size of the deallocation ring buffer

llvm-svn: 342014

5 years ago[ORC] Remove some unused typedefs.
Lang Hames [Wed, 12 Sep 2018 00:35:03 +0000 (00:35 +0000)]
[ORC] Remove some unused typedefs.

llvm-svn: 342013

5 years ago[NFC] Fix build breakage due to missing dep caused by D51950
Shuai Wang [Wed, 12 Sep 2018 00:32:13 +0000 (00:32 +0000)]
[NFC] Fix build breakage due to missing dep caused by D51950

llvm-svn: 342012

5 years ago[hwasan] tests for a buffer overflow with a large allocation
Kostya Serebryany [Wed, 12 Sep 2018 00:27:34 +0000 (00:27 +0000)]
[hwasan] tests for a buffer overflow with a large allocation

llvm-svn: 342011

5 years ago[ScopDetection] Use addUnknown for calls in the AliasSetTracker.
Eli Friedman [Tue, 11 Sep 2018 23:48:14 +0000 (23:48 +0000)]
[ScopDetection] Use addUnknown for calls in the AliasSetTracker.

The general-purpose add() now sometimes adds unexpected loop-variant
pointers to the AliasSetTracker, so certain loops would be rejected with
-polly-allow-modref-calls.  Use addUnknown() instead, which has the old
behavior.

I'm not completely convinced the resulting behavior is actually
correct: ScopDetection::isValidAccess seems to mostly ignore
"unknown" instructions in the AliasSetTracker.  But it's not any worse
than what was happening before.

Committing without pre-commit review to unbreak the buildbots; the
following tests were failing:

test/ScopInfo/mod_ref_access_pointee_arguments.ll
test/ScopInfo/mod_ref_read_pointee_arguments.ll
test/ScopInfo/multidim_2d_with_modref_call_2.ll

llvm-svn: 342010

5 years ago[MachineOutliner] Add codegen size remarks to the MachineOutliner
Jessica Paquette [Tue, 11 Sep 2018 23:05:34 +0000 (23:05 +0000)]
[MachineOutliner] Add codegen size remarks to the MachineOutliner

Since the outliner is a module pass, it doesn't get codegen size remarks like
the other codegen passes do. This adds size remarks *to* the outliner.

This is kind of a workaround, so it's peppered with FIXMEs; size remarks
really ought to not ever be handled by the pass itself. However, since the
outliner is the only "MachineModulePass", this works for now. Since the
entire purpose of the MachineOutliner is to produce code size savings, it
really ought to be included in codgen size remarks.

If we ever go ahead and make a MachineModulePass (say, something similar to
MachineFunctionPass), then all of this ought to be moved there.

llvm-svn: 342009

5 years ago[MIPS] Fix signed overflow in DADDIU emulation
Vedant Kumar [Tue, 11 Sep 2018 23:04:05 +0000 (23:04 +0000)]
[MIPS] Fix signed overflow in DADDIU emulation

This fixes a signed integer overflow diagnostic reported by ubsan.

rdar://44353380

llvm-svn: 342008

5 years ago[ELF] Revert "Also demote lazy symbols."
Chih-Hung Hsieh [Tue, 11 Sep 2018 23:00:36 +0000 (23:00 +0000)]
[ELF] Revert "Also demote lazy symbols."

This reverts commit https://reviews.llvm.org/rL330869
for a regression to link Android dex2oatds.

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

llvm-svn: 342007

5 years ago[clangtidy] Remove old copy of ExprMutationAnalyzer
Shuai Wang [Tue, 11 Sep 2018 22:59:46 +0000 (22:59 +0000)]
[clangtidy] Remove old copy of ExprMutationAnalyzer

Summary:
This is 2/2 of moving ExprMutationAnalyzer from clangtidy to clang/Analysis.
ExprMutationAnalyzer is moved to clang/Analysis in D51948.
This diff migrates existing usages within clangtidy to point to the new
location and remove the old copy of ExprMutationAnalyzer.

Reviewers: george.karpenkov, JonasToth

Reviewed By: george.karpenkov

Subscribers: mgorny, a.sidorin, Szelethus, cfe-commits

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

llvm-svn: 342006