platform/upstream/llvm.git
6 years ago[AArch64] Use MCAsmInfoMicrosoft and MCAsmInfoGNUCOFF as base classes
Martin Storsjo [Mon, 23 Jul 2018 22:15:14 +0000 (22:15 +0000)]
[AArch64] Use MCAsmInfoMicrosoft and MCAsmInfoGNUCOFF as base classes

This matches the structure used on X86 and ARM. This requires
a little bit of duplication of the parts that are equal in both
AArch64 COFF variants though.

Before SVN r335286, these classes didn't add anything that MCAsmInfoCOFF
didn't, but now they do.

This makes AArch64 match X86 in how comdat is used for float constants
for MinGW.

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

llvm-svn: 337755

6 years agoImplement a GCC compatible SEH unwinding personality, __gxx_personality_seh0
Martin Storsjo [Mon, 23 Jul 2018 22:09:23 +0000 (22:09 +0000)]
Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0

This allows handling SEH based exceptions, with unwind functions
provided by libgcc.

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

llvm-svn: 337754

6 years ago[utils] Fix the llvm::Optional data formatter
Vedant Kumar [Mon, 23 Jul 2018 21:59:06 +0000 (21:59 +0000)]
[utils] Fix the llvm::Optional data formatter

The llvm::Optional data formatter needs to look through the `Storage`
container if it's present.

Before:

   220    if (Op && Op->getOp() != dwarf::DW_OP_LLVM_fragment)
-> 221      HasComplexExpression = true;
   222
   223    // If the register can only be described by a complex expression (i.e.,
   224    // multiple subregisters) it doesn't safely compose with another complex
Target 0: (llc) stopped.
(lldb) p Op
(llvm::Optional<llvm::DIExpression::ExprOperand>) $0 = None

After:

(lldb) p Op
(llvm::Optional<llvm::DIExpression::ExprOperand>) $0 =
(llvm::DIExpression::ExprOperand) storage = {
  Op = 0x000000010603d460
}

llvm-svn: 337752

6 years ago[SelectionDAG] Reduce DanglingDebugInfo memory traffic, NFC
Vedant Kumar [Mon, 23 Jul 2018 21:59:04 +0000 (21:59 +0000)]
[SelectionDAG] Reduce DanglingDebugInfo memory traffic, NFC

This avoids approx. 2 x 10^5 DenseMap insertions in both non-debug and
debug -O2 builds of the sqlite3 amalgamation.

llvm-svn: 337751

6 years ago[ThinLTO] Ensure the TargetLibraryInfo is constructed early enough
Teresa Johnson [Mon, 23 Jul 2018 21:58:19 +0000 (21:58 +0000)]
[ThinLTO] Ensure the TargetLibraryInfo is constructed early enough

Summary:
Without this change, the WholeProgramDevirt pass, which requires the
TargetLibraryInfo, will construct one from the default triple.

Fixes PR38139.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 337750

6 years agoRevert "Use possibly cached directory entry values when performing recursive director...
Eric Fiselier [Mon, 23 Jul 2018 21:52:29 +0000 (21:52 +0000)]
Revert "Use possibly cached directory entry values when performing recursive directory iteration."

This reverts commit 04ce4aef00d3ee508327f6cf7bf1b1d200ab6238.

llvm-svn: 337749

6 years ago[DebugCounters] Keep track of total counts
George Burgess IV [Mon, 23 Jul 2018 21:49:36 +0000 (21:49 +0000)]
[DebugCounters] Keep track of total counts

This patch makes debug counters keep track of the total number of times
we've called `shouldExecute` for each counter, so it's easier to build
automated tooling on top of these.

A patch to print these counts is coming soon.

Patch by Zhizhou Yang!

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

llvm-svn: 337748

6 years ago[gdb] Fix SmallVector pretty printer after r337514
Fangrui Song [Mon, 23 Jul 2018 21:33:51 +0000 (21:33 +0000)]
[gdb] Fix SmallVector pretty printer after r337514

llvm-svn: 337747

6 years ago[clang-cl] Expose -fblocks and -fno-builtin as driver flags
Reid Kleckner [Mon, 23 Jul 2018 21:29:43 +0000 (21:29 +0000)]
[clang-cl] Expose -fblocks and -fno-builtin as driver flags

Users have requested them.

Helps with PR36427.

llvm-svn: 337746

6 years agoReapply "[XRay] Remove scheduling dependency in fork_basic_logging.cc"
Matthew Voss [Mon, 23 Jul 2018 21:22:02 +0000 (21:22 +0000)]
Reapply "[XRay] Remove scheduling dependency in fork_basic_logging.cc"

Summary:
Continuation of https://reviews.llvm.org/D49501

Second part of the test has an scheduling order when there shouldn't be.

Reviewers: dberris, ormris

Reviewed By: dberris, ormris

Subscribers: TWeaver

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

llvm-svn: 337745

6 years agoDo not try to perform lifetime-extension through conditional
Richard Smith [Mon, 23 Jul 2018 21:21:24 +0000 (21:21 +0000)]
Do not try to perform lifetime-extension through conditional
expressions.

CodeGen can't cope with that yet. Instead, produce a "not supported"
warning for now and don't extend lifetime.

llvm-svn: 337744

6 years agoFold -Wreturn-stack-address into general initialization lifetime
Richard Smith [Mon, 23 Jul 2018 21:21:22 +0000 (21:21 +0000)]
Fold -Wreturn-stack-address into general initialization lifetime
checking.

llvm-svn: 337743

6 years agoConstantFolding: Avoid a crash.
Manoj Gupta [Mon, 23 Jul 2018 21:20:00 +0000 (21:20 +0000)]
ConstantFolding: Avoid a crash.

Summary:
Check if the parent basic block and caller exists
before calling CS.getCaller when constant folding
strip.invariant.group instrinsic.

This avoids a crash when the function containing the intrinsic
is being inlined. The instruction is checked for any simplifiction
but has not yet been added to a basic block.

Reviewers: Prazek, rsmith, efriedma

Reviewed By: efriedma

Subscribers: eraman, llvm-commits

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

llvm-svn: 337742

6 years ago[cmake] Remove unused ${LLDB_PLUGINS} dependency from our Objective-C++ CMake config
Raphael Isemann [Mon, 23 Jul 2018 21:14:52 +0000 (21:14 +0000)]
[cmake] Remove unused ${LLDB_PLUGINS} dependency from our Objective-C++ CMake config

Summary:
LLDB_PLUGINS doesn't exist as a variable, so this line doesn't add any dependencies and is
just confusing. It seems this slipped in from the gdb-remote CMake I was using as a CMake template.

The gdb-remote CMake itself is using a local LLDB_PLUGINS variable, so that code is fine.

Reviewers: davide

Reviewed By: davide

Subscribers: davide, mgorny, lldb-commits

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

llvm-svn: 337741

6 years agoRe-land r335297 "[X86] Implement more of x86-64 large and medium PIC code models"
Reid Kleckner [Mon, 23 Jul 2018 21:14:35 +0000 (21:14 +0000)]
Re-land r335297 "[X86] Implement more of x86-64 large and medium PIC code models"

Don't try to generate large PIC code for non-ELF targets. Neither COFF
nor MachO have relocations for large position independent code, and
users have been using "large PIC" code models to JIT 64-bit code for a
while now. With this change, if they are generating ELF code, their
JITed code will truly be PIC, but if they target MachO or COFF, it will
contain 64-bit immediates that directly reference external symbols. For
a JIT, that's perfectly fine.

llvm-svn: 337740

6 years ago[llvm-mca][docs] Define IPC where it is first mentioned. NFC.
Matt Davis [Mon, 23 Jul 2018 21:10:50 +0000 (21:10 +0000)]
[llvm-mca][docs] Define IPC where it is first mentioned. NFC.

Expand the abbreviation where it is first used, and use IPC elsewhere.

llvm-svn: 337739

6 years agoUpdate to -r337585, allow scoped enum inits in -pedantic
Erich Keane [Mon, 23 Jul 2018 21:08:13 +0000 (21:08 +0000)]
Update to -r337585, allow scoped enum inits in -pedantic

llvm-svn: 337738

6 years ago[NFC] Minor code refactoring.
Raphael Isemann [Mon, 23 Jul 2018 20:56:49 +0000 (20:56 +0000)]
[NFC] Minor code refactoring.

Subscribers: lldb-commits

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

llvm-svn: 337737

6 years ago[CodeGen] Record if a C++ record is a trivial type
Aaron Smith [Mon, 23 Jul 2018 20:49:07 +0000 (20:49 +0000)]
[CodeGen] Record if a C++ record is a trivial type

Summary: This has a dependence on D45122

Reviewers: rnk, zturner, llvm-commits, aleksandr.urakov

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 337736

6 years agoFix RegScavenger::unprocess
David Greene [Mon, 23 Jul 2018 20:23:50 +0000 (20:23 +0000)]
Fix RegScavenger::unprocess

RegScavenger::unprocess walks backward, so it should undo the effects
of defs before undoing effects of kills. Previously it did things in
the opposite order, leaving a register apparently unused (dead) in the
case where an instruction both used (killed) and defined a register.

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

llvm-svn: 337735

6 years agoAdd inline asm aliasing test.
Nirav Dave [Mon, 23 Jul 2018 20:19:10 +0000 (20:19 +0000)]
Add inline asm aliasing test.

llvm-svn: 337734

6 years agoLanded XRay patch (D49559) in incorrect directory. Reverting changes.
Henry Zhu [Mon, 23 Jul 2018 20:07:18 +0000 (20:07 +0000)]
Landed XRay patch (D49559) in incorrect directory. Reverting changes.

llvm-svn: 337733

6 years ago[ms] Fix mangling of vector types in QMM_Result contexts.
Nico Weber [Mon, 23 Jul 2018 20:04:00 +0000 (20:04 +0000)]
[ms] Fix mangling of vector types in QMM_Result contexts.

If QMM_Result is set (which it is for return types, RTTI descriptors, and
exception type descriptors), tag types (structs, enums, classes, unions) get
their qualifiers mangled in.

__m64 and friends is a struct/union thingy in MSVC, but not in clang's headers.
To make mangling work, we call mangleArtificalTagType(TTK_Union/TTK_Struct for
the vector types to mangle them as tag types -- but the isa<TagType> check when
mangling in QMM_Result mode isn't true for these vector types. Add an
isArtificialTagType() function and check for that too. Fixes PR37276 and some
other issues.

I tried to audit all references to TagDecl and TagType in MicrosoftMangle.cpp
to find other places where we need to call mangleArtificalTagType(), but
couldn't find any.

I tried to audit all calls to mangleArtificalTagType() to see if
isArtificialTagType() needs to handle more than just the vector types, but as
far as I can tell all other types we use it for are types that MSVC can't
handle at all (Objective-C types etc).

https://reviews.llvm.org/D49597

llvm-svn: 337732

6 years agoRevert "[docs] Add support for Markdown documentation in Sphinx"
Michael J. Spencer [Mon, 23 Jul 2018 20:00:32 +0000 (20:00 +0000)]
Revert "[docs] Add support for Markdown documentation in Sphinx"

Looks like this bot hasn't been updated yet.

llvm-svn: 337731

6 years ago[docs] Add support for Markdown documentation in Sphinx
Michael J. Spencer [Mon, 23 Jul 2018 19:49:34 +0000 (19:49 +0000)]
[docs] Add support for Markdown documentation in Sphinx

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

llvm-svn: 337730

6 years agoRevert r337638, "ELF: Make sections with KeepUnique bit eligible for ICF."
Peter Collingbourne [Mon, 23 Jul 2018 19:36:55 +0000 (19:36 +0000)]
Revert r337638, "ELF: Make sections with KeepUnique bit eligible for ICF."

The gold behaviour with regard to --keep-unique is arguably a bug.
I also noticed a bug in my patch, which is that we mislink the
following program with --icf=safe by merging f3 and f4:

void f1() {}
void f2() {}

__attribute__((weak)) void* f3() { return f1; }
__attribute__((weak)) void* f4() { return f2; }

int main() {
  printf("%p %p\n", f3(), f4());
}

llvm-svn: 337729

6 years agoSeparate out the initialization kind for a statement expression result
Richard Smith [Mon, 23 Jul 2018 19:19:08 +0000 (19:19 +0000)]
Separate out the initialization kind for a statement expression result
from that for a return value.

No functionality change intended: I don't believe any of the diagnostics
affected by this patch are reachable when initializing the result of
statement expression.

llvm-svn: 337728

6 years ago[CMake] Fix the setting of LIBCXX_HEADER_DIR
Heejin Ahn [Mon, 23 Jul 2018 18:58:12 +0000 (18:58 +0000)]
[CMake] Fix the setting of LIBCXX_HEADER_DIR

Reviewers: phosek

Subscribers: mgorny, christof, ldionne, cfe-commits

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

llvm-svn: 337727

6 years agoFold dangling-field warning into general initialization lifetime checks.
Richard Smith [Mon, 23 Jul 2018 18:50:26 +0000 (18:50 +0000)]
Fold dangling-field warning into general initialization lifetime checks.

This reinstates r337627, reverted in r337671, with a fix to correctly
handle the lvalueness of array subscript expressions on pointers.

llvm-svn: 337726

6 years ago[yaml2obj] Add default sh_entsize for dynamic sections
Paul Semel [Mon, 23 Jul 2018 18:49:04 +0000 (18:49 +0000)]
[yaml2obj] Add default sh_entsize for dynamic sections

Dynamic section holds a table, so the sh_entsize might be set. As the
dynamic section entry size never changes, we can default it to the size
of a dynamic entry.

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

llvm-svn: 337725

6 years ago[XRay] Remove scheduling dependency in fork_basic_logging.cc
Henry Zhu [Mon, 23 Jul 2018 18:42:55 +0000 (18:42 +0000)]
[XRay] Remove scheduling dependency in fork_basic_logging.cc

Summary:
Continuation of https://reviews.llvm.org/D49501

Second part of the test has an scheduling order when there shouldn't be.

Reviewers: dberris, ormris

Reviewed By: dberris, ormris

Subscribers: TWeaver

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

llvm-svn: 337724

6 years ago[Hexagon] Handle unnamed globals in HexagonConstExpr
Krzysztof Parzyszek [Mon, 23 Jul 2018 18:30:17 +0000 (18:30 +0000)]
[Hexagon] Handle unnamed globals in HexagonConstExpr

Instead of comparing names, compare positions in the parent module.

llvm-svn: 337723

6 years agoRevert "[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used."
Jonas Hahnfeld [Mon, 23 Jul 2018 18:27:09 +0000 (18:27 +0000)]
Revert "[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used."

This reverts commit r336467: libatomic is not available on all Linux
systems and this commit completely breaks OpenMP on them, even if there
are no atomic operations or all of them can be lowered to hardware
instructions.

See http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180716/234816.html
for post-commit discussion.

llvm-svn: 337722

6 years ago[CStringSyntaxChecker] Improvements of strlcpy check
David Carlier [Mon, 23 Jul 2018 18:26:38 +0000 (18:26 +0000)]
[CStringSyntaxChecker] Improvements of strlcpy check

Adding an additional check whenwe offset fro the buffer base address.

Reviewers: george.karpenkov,NoQ

Reviewed By: george.karpenkov

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

llvm-svn: 337721

6 years ago[Demangle] Attempt to fix arena memory leak
Reid Kleckner [Mon, 23 Jul 2018 18:21:43 +0000 (18:21 +0000)]
[Demangle] Attempt to fix arena memory leak

llvm-svn: 337720

6 years agoFixing a typo; NFC.
Aaron Ballman [Mon, 23 Jul 2018 18:09:43 +0000 (18:09 +0000)]
Fixing a typo; NFC.

llvm-svn: 337719

6 years ago[lit] Move the shtest-xunit-output check lines into shtest-format
Justin Bogner [Mon, 23 Jul 2018 18:08:36 +0000 (18:08 +0000)]
[lit] Move the shtest-xunit-output check lines into shtest-format

These two tests are operating on the same test suite, which causes
them to be racy about writing temporary files and can cause spurious
failures. Merge them into one test to avoid the issue.

llvm-svn: 337718

6 years ago[DebugInfo] Error out when enabling -fdebug-types-section on non-ELF target.
Jonas Devlieghere [Mon, 23 Jul 2018 17:50:15 +0000 (17:50 +0000)]
[DebugInfo] Error out when enabling -fdebug-types-section on non-ELF target.

Currently, support for debug_types is only present for ELF and trying to
pass -fdebug-types-section for other targets results in a crash in the
backend. Until this is fixed, we should emit a diagnostic in the front
end when the option is passed for non-linux targets.

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

llvm-svn: 337717

6 years ago[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well
Jonas Toth [Mon, 23 Jul 2018 17:46:17 +0000 (17:46 +0000)]
[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well

Summary:
The cppcoreguidelines-pro-bounds-pointer-arithmetic warns on all occassion where
pointer arithmetic is used, but does not check values where the pointer types
is deduced via `auto`. This patch adjusts this behaviour and solved
PR36489.
I accidentally commited a wrong patch, this Differential is meant to have a
correct revision description and code attached to it.
Because the patch was accepted by aaron.ballman already, i will just commit
it.
See https://reviews.llvm.org/D48717 for the old differntial (contains wrong
code from the mixup)

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

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

llvm-svn: 337716

6 years ago[MS] Update _MSVC_LANG values for C++17 and C++2a
Reid Kleckner [Mon, 23 Jul 2018 17:44:00 +0000 (17:44 +0000)]
[MS] Update _MSVC_LANG values for C++17 and C++2a

Fixes PR38262

llvm-svn: 337715

6 years ago[ARM] Use unique_ptr to fix memory leak introduced in r337701
Fangrui Song [Mon, 23 Jul 2018 17:43:21 +0000 (17:43 +0000)]
[ARM] Use unique_ptr to fix memory leak introduced in r337701

llvm-svn: 337714

6 years agoOpChain has subclasses, so add a virtual destructor.
Jordan Rupprecht [Mon, 23 Jul 2018 17:38:05 +0000 (17:38 +0000)]
OpChain has subclasses, so add a virtual destructor.

Summary:
OpChain has subclasses, so add a virtual destructor.

This fixes an issue when deleting subclasses of OpChain (see MatchSMLAD() specifically) in r337701.

Reviewers: javed.absar

Subscribers: llvm-commits, SjoerdMeijer, samparker

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

llvm-svn: 337713

6 years agoRevert "[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well"
Jonas Toth [Mon, 23 Jul 2018 17:34:25 +0000 (17:34 +0000)]
Revert "[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well"

I applied the wrong patch.

llvm-svn: 337712

6 years ago[ARM] Follow-up to r337709.
Matt Morehouse [Mon, 23 Jul 2018 17:22:53 +0000 (17:22 +0000)]
[ARM] Follow-up to r337709.

Fix double-free.

llvm-svn: 337711

6 years ago[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well
Jonas Toth [Mon, 23 Jul 2018 17:13:06 +0000 (17:13 +0000)]
[clang-tidy] fix PR36489 - respect deduced pointer types from auto as well

Summary:
The cppcoreguidelines-pro-bounds-pointer-arithmetic warns on all occassion where
pointer arithmetic is used, but does not check values where the pointer types
is deduced via ``auto``. This patch adjusts this behaviour and solved
PR36489.

Reviewers: alexfh, aaron.ballman, hokein, ilya-biryukov

Reviewed By: alexfh, aaron.ballman

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

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

llvm-svn: 337710

6 years ago[ARM] Add doFinalization() to ARMCodeGenPrepare pass.
Matt Morehouse [Mon, 23 Jul 2018 17:00:45 +0000 (17:00 +0000)]
[ARM] Add doFinalization() to ARMCodeGenPrepare pass.

Attempt to fix the leak introduced in r337687 and make sanitizer
buildbots green again.

llvm-svn: 337709

6 years ago[Legalize] Elide MERGE_VALUES created by scalarizeVectorLoad.
Nirav Dave [Mon, 23 Jul 2018 16:43:42 +0000 (16:43 +0000)]
[Legalize] Elide MERGE_VALUES created by scalarizeVectorLoad.

scalarizeVectorLoad creates MERGE_VALUES nodes which are immediately
decomposed in expandLoad. Elide the node in these cases.

llvm-svn: 337708

6 years ago[clang-tidy] remove private decltypeType in TrailingReturnType
Jonas Toth [Mon, 23 Jul 2018 16:30:13 +0000 (16:30 +0000)]
[clang-tidy] remove private decltypeType in TrailingReturnType

Summary:
This patch removes a private matcher in fuchsia/TrailingReturnType check because
the matcher is now in ASTMatchers

Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: aaron.ballman

Subscribers: xazax.hun, cfe-commits

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

llvm-svn: 337707

6 years ago[Sema] Don't emit -Wmemset-transposed-args for memset(p,0,0)
Erik Pilkington [Mon, 23 Jul 2018 16:24:14 +0000 (16:24 +0000)]
[Sema] Don't emit -Wmemset-transposed-args for memset(p,0,0)

Thanks to Arthur O'Dwyer for the suggestion!

llvm-svn: 337706

6 years ago[mips] Add more checks to the tls.ll test case. NFC
Simon Atanasyan [Mon, 23 Jul 2018 16:05:44 +0000 (16:05 +0000)]
[mips] Add more checks to the tls.ll test case. NFC

llvm-svn: 337705

6 years ago[NEON] Define half-precision vmaxnm intrinsics only when available
Ivan A. Kosarev [Mon, 23 Jul 2018 16:01:35 +0000 (16:01 +0000)]
[NEON] Define half-precision vmaxnm intrinsics only when available

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

llvm-svn: 337704

6 years ago[ASTMatchers] add matcher for decltypeType and its underlyingType
Jonas Toth [Mon, 23 Jul 2018 15:59:27 +0000 (15:59 +0000)]
[ASTMatchers] add matcher for decltypeType and its underlyingType

Summary:
This patch introduces a new matcher for `DecltypeType` and its underlying type
in order to fix a bug in clang-tidy, see https://reviews.llvm.org/D48717 for more.

Reviewers: aaron.ballman, alexfh, NoQ, dcoughlin

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 337703

6 years ago[isl] Simplify iterator implementation by building on top of list accessors
Philip Pfaffe [Mon, 23 Jul 2018 15:28:50 +0000 (15:28 +0000)]
[isl] Simplify iterator implementation by building on top of list accessors

Summary:
With the new accessors, it's straightforward to use the templated
iterator instead of subclassing it for all the list types.

Depends on D49019

Reviewers: grosser, Meinersbur, bollu

Reviewed By: grosser

Subscribers: mehdi_amini, steven_wu, dexonsmith, pollydev, llvm-commits

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

llvm-svn: 337702

6 years ago[ARM][NFC] ParallelDSP reorganisation
Sam Parker [Mon, 23 Jul 2018 15:25:59 +0000 (15:25 +0000)]
[ARM][NFC] ParallelDSP reorganisation

In preparing to allow ARMParallelDSP pass to parallelise more than
smlads, I've restructed some elements:

- The ParallelMAC struct has been renamed to BinOpChain.
- The BinOpChain struct holds two value lists: LHS and RHS, as well
  as inheriting from the OpChain base class.
- The OpChain struct holds all the values of the represented chain
  and has had the memory locations functionality inserted into it.
- ParallelMACList becomes OpChainList and it now holds pointers
  instead of objects.

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

llvm-svn: 337701

6 years ago[SystemZ] Fix dumpSU() method in SystemZHazardRecognizer.
Jonas Paulsson [Mon, 23 Jul 2018 15:08:35 +0000 (15:08 +0000)]
[SystemZ]  Fix dumpSU() method in SystemZHazardRecognizer.

Two minor issues: The new MCD SchedWrite name does not contain "Unit" like
all the others, so a check is needed. Also, print "LSU" instead of "LS".

Review: Ulrich Weigand
llvm-svn: 337700

6 years ago[NEON] Define half-precision vrnd intrinsics only when available
Ivan A. Kosarev [Mon, 23 Jul 2018 14:53:44 +0000 (14:53 +0000)]
[NEON] Define half-precision vrnd intrinsics only when available

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

llvm-svn: 337699

6 years ago[FPEnv] Legalize double width StrictFP vector operations
Cameron McInally [Mon, 23 Jul 2018 14:40:17 +0000 (14:40 +0000)]
[FPEnv] Legalize double width StrictFP vector operations

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

llvm-svn: 337698

6 years ago[clangd] Fix category in clangd-vscode's package.json
Simon Marchi [Mon, 23 Jul 2018 14:32:12 +0000 (14:32 +0000)]
[clangd] Fix category in clangd-vscode's package.json

Summary:
When opening package.json, vscode shows:

  Use 'Programming  Languages' instead

Replacing "Languages" with this fixes it.

Reviewers: ilya-biryukov

Subscribers: arphaman, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 337697

6 years ago[libFuzzer] Handle unstable edges by using minimum hit counts
Max Moroz [Mon, 23 Jul 2018 14:20:52 +0000 (14:20 +0000)]
[libFuzzer] Handle unstable edges by using minimum hit counts

Summary:
Created unstable_handle flag that takes 1 or 2, depending on the handling type.
Modified RunOne to accommodate the following heuristic:
    Use the first CollectFeatures to count how many features there are.
    If no new features, CollectFeatures like before.
    If there is new feature, we run CB 2 more times,
        Check which edges are unstable per input and we store the least amount of hit counts for each edge.
        Apply these hit counts back to inline8bitcounters so that CollectFeatures can work as intended.
Modified UnstableCounters to 8int_t and created a bitset UnstableSet to tell which edges are unstable.

Patch by Kyungtak Woo (@kevinwkt).

Reviewers: Dor1s, metzman, morehouse

Reviewed By: Dor1s, morehouse

Subscribers: delcypher, #sanitizers, llvm-commits, kcc

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

llvm-svn: 337696

6 years ago[Docs] Fix LLVM_YAML_IS_DOCUMENT_LIST_VECTOR
Jonas Devlieghere [Mon, 23 Jul 2018 14:17:43 +0000 (14:17 +0000)]
[Docs] Fix LLVM_YAML_IS_DOCUMENT_LIST_VECTOR

The docs incorrectly said to repeat std::vector inside
LLVM_YAML_IS_DOCUMENT_LIST_VECTOR.

llvm-svn: 337695

6 years agoAdd support for parsing Breakpad minidump files that can have extra padding in the...
Greg Clayton [Mon, 23 Jul 2018 14:16:08 +0000 (14:16 +0000)]
Add support for parsing Breakpad minidump files that can have extra padding in the module, thread and memory lists.

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

llvm-svn: 337694

6 years ago[LLD] Add llvm-objcopy to test dependencies. NFC.
Andrew Ng [Mon, 23 Jul 2018 14:12:57 +0000 (14:12 +0000)]
[LLD] Add llvm-objcopy to test dependencies. NFC.

Dependency on llvm-objcopy was introduced by r337429.

Also sorted the list of dependencies.

llvm-svn: 337693

6 years agoFix windows build after r337689
Alexander Polyakov [Mon, 23 Jul 2018 14:10:30 +0000 (14:10 +0000)]
Fix windows build after r337689

Added missing header.

llvm-svn: 337692

6 years ago[OPNEMP, NVPTX] Fixed sychronization construct + code cleanup.
Alexey Bataev [Mon, 23 Jul 2018 13:52:12 +0000 (13:52 +0000)]
[OPNEMP, NVPTX] Fixed sychronization construct + code cleanup.

Summary:
1. Fixed internal problem in `__kmpc_barrier` function: SPMD mode
synchronization function should be called only in L1 parallel level.
2. Removed some extra code for synchronization inside of the code, used
`__kmpc_barrier` instead.
3. Some code cleanup.

Reviewers: gtbercea, grokos

Subscribers: openmp-commits

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

llvm-svn: 337691

6 years ago[NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsics
Ivan A. Kosarev [Mon, 23 Jul 2018 13:26:37 +0000 (13:26 +0000)]
[NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsics

This patch adds support for vrndi_f32() and vrndiq_f32()
intrinsics in AArch32 mode and for vrndns_f32() intrinsic in
AArch64 mode.

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

llvm-svn: 337690

6 years ago[lldb-mi] Re-implement data-info-line command.
Alexander Polyakov [Mon, 23 Jul 2018 13:02:41 +0000 (13:02 +0000)]
[lldb-mi] Re-implement data-info-line command.

Summary: Now data-info-line command uses SB API instead of HandleCommand.

Reviewers: aprantl, clayborg, jingham

Reviewed By: aprantl

Subscribers: ki.stfu, lldb-commits

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

llvm-svn: 337689

6 years ago[AST] Use llvm::TrailingObjects in CXXTryStmt
Benjamin Kramer [Mon, 23 Jul 2018 12:45:24 +0000 (12:45 +0000)]
[AST] Use llvm::TrailingObjects in CXXTryStmt

1. Use llvm::TrailingObjects in CXXTryStmt instead of manually doing the reinterpret_casts + pointer arithmetic. This is more consistent with other classes using this idiom and this make it clearer that this class has trailing objects.
2. Make the class CXXTryStmt final since it has trailing objects.
3. Move the friend declarations together.

No functional changes.

Patch by Bruno Ricci!

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

llvm-svn: 337688

6 years ago[ARM] ARMCodeGenPrepare backend pass
Sam Parker [Mon, 23 Jul 2018 12:27:47 +0000 (12:27 +0000)]
[ARM] ARMCodeGenPrepare backend pass

Arm specific codegen prepare is implemented to perform type promotion
on icmp operands, which can enable the removal of uxtb and uxth
(unsigned extend) instructions. This is possible because performing
type promotion before ISel alleviates this duty from the DAG builder
which has to perform legalisation, but has a limited view on data
ranges.

The pass visits any instruction operand of an icmp and creates a
worklist to traverse the use-def tree to determine whether the values
can simply be promoted. Our concern is values in the registers
overflowing the narrow (i8, i16) data range, so instructions marked
with nuw can be promoted easily. For add and sub instructions, we are
able to use the parallel dsp instructions to operate on scalar data
types and avoid overflowing bits. Underflowing adds and subs are also
permitted when the result is only used by an unsigned icmp.

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

llvm-svn: 337687

6 years ago[GVN] Don't use the eliminated load as an available value in phi construction
John Brawn [Mon, 23 Jul 2018 12:14:45 +0000 (12:14 +0000)]
[GVN] Don't use the eliminated load as an available value in phi construction

In ConstructSSAForLoadSet if an available value is actually the load that we're
doing SSA construction to eliminate, then we can omit it as SSAUpdate will add
in the value for the phi that will be replacing it anyway. This can result in
simpler IR which can allow further optimisation.

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

llvm-svn: 337686

6 years agoCleanup unnecessary conversions in filesystem.
Eric Fiselier [Mon, 23 Jul 2018 11:55:13 +0000 (11:55 +0000)]
Cleanup unnecessary conversions in filesystem.

llvm-svn: 337685

6 years agoCleanup name qualification in the filesystem internals.
Eric Fiselier [Mon, 23 Jul 2018 11:46:47 +0000 (11:46 +0000)]
Cleanup name qualification in the filesystem internals.

In most cases there is no reason why the filesystem internals
use the qualifier std:: or _VSTD::. This patch removes the unneeded
qualifiers, making the sources files more consistent

llvm-svn: 337684

6 years ago[ELF] Fix handling of FDE negative relative PC addr
Andrew Ng [Mon, 23 Jul 2018 11:29:46 +0000 (11:29 +0000)]
[ELF] Fix handling of FDE negative relative PC addr

Signed values for the FDE PC addr were not correctly handled in
readFdeAddr(). If the value is negative and the type of the value is
smaller than 64 bits, the FDE PC addr overflow error would be
incorrectly triggered.

Fixed readFdeAddr() to properly handle signed values by sign extending
where appropriate.

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

llvm-svn: 337683

6 years ago[Tooling] Use UniqueStringSaver. NFC
Sam McCall [Mon, 23 Jul 2018 11:25:25 +0000 (11:25 +0000)]
[Tooling] Use UniqueStringSaver. NFC

llvm-svn: 337682

6 years ago[clangd] Penalize non-instance members when accessed via class instances.
Eric Liu [Mon, 23 Jul 2018 10:56:37 +0000 (10:56 +0000)]
[clangd] Penalize non-instance members when accessed via class instances.

Summary:
The following are metrics for explicit member access completions. There is no
noticeable impact on other completion types.

Before:
EXPLICIT_MEMBER_ACCESS
  Total measurements: 24382
  All measurements: MRR: 62.27 Top10: 80.21% Top-100: 94.48%
  Full identifiers: MRR: 98.81 Top10: 99.89% Top-100: 99.95%
  0-5 filter len:
MRR:  13.25 46.31 62.47 67.77 70.40 81.91
Top-10:  29% 74% 84% 91% 91% 97%
Top-100:  67% 99% 99% 99% 99% 100%

After:
EXPLICIT_MEMBER_ACCESS
  Total measurements: 24382
  All measurements: MRR: 63.18 Top10: 80.58% Top-100: 95.07%
  Full identifiers: MRR: 98.79 Top10: 99.89% Top-100: 99.95%
  0-5 filter len:
MRR:  13.84 48.39 63.55 68.83 71.28 82.64
Top-10:  30% 75% 84% 91% 91% 97%
Top-100:  70% 99% 99% 99% 99% 100%

* Top-N: wanted result is found in the first N completion results.
* MRR: Mean reciprocal rank.

Remark: the change seems to have minor positive impact. Although the improvement
is relatively small, down-ranking non-instance members in instance member access
should reduce noise in the completion results.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

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

llvm-svn: 337681

6 years ago[MemorySSAUpdater] Update Phi operands after trivial Phi elimination
Alexandros Lamprineas [Mon, 23 Jul 2018 10:56:30 +0000 (10:56 +0000)]
[MemorySSAUpdater] Update Phi operands after trivial Phi elimination

Bug fix for PR37445. The underlying problem and its fix are similar to PR37808.
The bug lies in MemorySSAUpdater::getPreviousDefRecursive(), where PhiOps is
computed before the call to tryRemoveTrivialPhi() and it ends up being out of
date, pointing to stale data. We have now turned each of the PhiOps into a
TrackingVH<MemoryAccess>.

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

llvm-svn: 337680

6 years agoFix for last commit: adding new test file forgotten.
Adam Balogh [Mon, 23 Jul 2018 10:53:02 +0000 (10:53 +0000)]
Fix for last commit: adding new test file forgotten.

llvm-svn: 337679

6 years ago[Analyzer] Quick Fix for exponential execution time when simpilifying complex additiv...
Adam Balogh [Mon, 23 Jul 2018 10:50:20 +0000 (10:50 +0000)]
[Analyzer] Quick Fix for exponential execution time when simpilifying complex additive expressions

Patch https://reviews.llvm.org/rC329780 not only rearranges comparisons but
also binary expressions. This latter behavior is not protected by the analyzer
option. Hower, since no complexity threshold is enforced to the symbols this
may result in exponential execution time if the expressions are too complex:
https://bugs.llvm.org/show_bug.cgi?id=38208. For a quick fix we extended the
analyzer option to also cover the additive cases.

This is only a temporary fix, the final solution should be enforcing the
complexity threshold to the symbols.

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

llvm-svn: 337678

6 years ago[Support] Add a UniqueStringSaver: like StringSaver, but deduplicating.
Sam McCall [Mon, 23 Jul 2018 10:44:40 +0000 (10:44 +0000)]
[Support] Add a UniqueStringSaver: like StringSaver, but deduplicating.

Summary: Clarify contract of StringSaver (it null-terminates, callers rely on it).

Reviewers: hokein

Subscribers: llvm-commits

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

llvm-svn: 337677

6 years ago[NFC][MCA] ZnVer1: Update RegisterFile to identify false dependencies on partially...
Roman Lebedev [Mon, 23 Jul 2018 10:10:13 +0000 (10:10 +0000)]
[NFC][MCA] ZnVer1: Update RegisterFile to identify false dependencies on partially written registers.

Summary:
Pretty mechanical follow-up for D49196.

As microarchitecture.pdf notes, "20 AMD Ryzen pipeline",
"20.8 Register renaming and out-of-order schedulers":
  The integer register file has 168 physical registers of 64 bits each.
  The floating point register file has 160 registers of 128 bits each.
"20.14 Partial register access":
  The processor always keeps the different parts of an integer register together.
  ...
  An instruction that writes to part of a register will therefore have a false dependence
  on any previous write to the same register or any part of it.

Reviewers: andreadb, courbet, RKSimon, craig.topper, GGanesh

Reviewed By: GGanesh

Subscribers: gbedwell, llvm-commits

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

llvm-svn: 337676

6 years ago[NFC][MCA] ZnVer1: add partial-reg-update tests
Roman Lebedev [Mon, 23 Jul 2018 10:10:04 +0000 (10:10 +0000)]
[NFC][MCA] ZnVer1: add partial-reg-update tests

Reviewers: andreadb, courbet, RKSimon, craig.topper, GGanesh

Reviewed By: GGanesh

Subscribers: gbedwell, llvm-commits

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

llvm-svn: 337675

6 years ago[GVNHoist] safeToHoistLdSt allows illegal hoisting
Alexandros Lamprineas [Mon, 23 Jul 2018 09:42:35 +0000 (09:42 +0000)]
[GVNHoist] safeToHoistLdSt allows illegal hoisting

Bug fix for PR36787. When reasoning if it's safe to hoist a load we
want to make sure that the defining memory access dominates the new
insertion point of the hoisted instruction. safeToHoistLdSt calls
firstInBB(InsertionPoint,DefiningAccess) which returns false if
InsertionPoint == DefiningAccess, and therefore it falsely thinks
it's safe to hoist.

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

llvm-svn: 337674

6 years ago[x86/SLH] Fix a bug where we would harden tail calls twice -- once as
Chandler Carruth [Mon, 23 Jul 2018 07:56:15 +0000 (07:56 +0000)]
[x86/SLH] Fix a bug where we would harden tail calls twice -- once as
a call, and then again as a return.

Also added a comment to try and explain better why we would be doing
what we're doing when hardening the (non-call) returns.

llvm-svn: 337673

6 years ago[x86/SLH] Add a test covering indirect forms of control flow. NFC.
Chandler Carruth [Mon, 23 Jul 2018 07:51:51 +0000 (07:51 +0000)]
[x86/SLH] Add a test covering indirect forms of control flow. NFC.

This specifically covers different ways of making indirect calls and
jumps. There are some bugs in SLH that I will be fixing in subsequent
patches where the diff in the generated instructions makes the bug fix
much more clear, so just checking in a baseline of this test to start.

I'm also going to be adding direct mitigation for variant 1.2 which this
file very specifically tests in the various forms it can arise on x86.
Again, the diff to the generated instructions should make the change for
that much more clear, so having the test as a baseline seems useful.

llvm-svn: 337672

6 years agoRevert "Fold dangling-field warning into general initialization lifetime checks."
Ilya Biryukov [Mon, 23 Jul 2018 06:32:36 +0000 (06:32 +0000)]
Revert "Fold dangling-field warning into general initialization lifetime checks."

This reverts commit r337627.
After the change, clang started producing invalid warning on the following code:
    struct foo {
      foo(char *x) : x_(&x[10]) {}
    private:
      char *x_;
    };

1.cpp:2:21: warning: initializing pointer member 'x_' with the stack address of parameter 'x' [-Wdangling-field]

llvm-svn: 337671

6 years agoRevert "[CMake] Support statically linking dependencies only to shared or static...
Petr Hosek [Mon, 23 Jul 2018 05:07:44 +0000 (05:07 +0000)]
Revert "[CMake] Support statically linking dependencies only to shared or static library"

This reverts commit r337668: broke the cxxabi build when using Make.

llvm-svn: 337670

6 years agoUse possibly cached directory entry values when performing recursive directory iteration.
Eric Fiselier [Mon, 23 Jul 2018 04:55:57 +0000 (04:55 +0000)]
Use possibly cached directory entry values when performing recursive directory iteration.

llvm-svn: 337669

6 years ago[CMake] Support statically linking dependencies only to shared or static library
Petr Hosek [Mon, 23 Jul 2018 04:19:55 +0000 (04:19 +0000)]
[CMake] Support statically linking dependencies only to shared or static library

Currently it's possible to select whether to statically link unwinder
or the C++ ABI library, but this option applies to both the shared
and static library. However, in some scenarios it may be desirable to
only statically link unwinder and C++ ABI library into static C++
library since for shared C++ library we can rely on dynamic linking
and linker scripts. This change enables selectively enabling or
disabling statically linking only to shared or static library.

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

llvm-svn: 337668

6 years ago[x86/SLH] Rename and comment the main hardening function. NFC.
Chandler Carruth [Mon, 23 Jul 2018 04:01:34 +0000 (04:01 +0000)]
[x86/SLH] Rename and comment the main hardening function. NFC.

This provides an overview of the algorithm used to harden specific
loads. It also brings this our terminology further in line with
hardening rather than checking.

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

llvm-svn: 337667

6 years agoFix use of C++14 syntax in C++11 filesystem tests.
Eric Fiselier [Mon, 23 Jul 2018 03:41:46 +0000 (03:41 +0000)]
Fix use of C++14 syntax in C++11 filesystem tests.

llvm-svn: 337666

6 years agoWork around various GCC 4.9 build errors
Eric Fiselier [Mon, 23 Jul 2018 03:06:57 +0000 (03:06 +0000)]
Work around various GCC 4.9 build errors

llvm-svn: 337665

6 years agoImplement filesystem_error::what() and improve reporting.
Eric Fiselier [Mon, 23 Jul 2018 02:00:52 +0000 (02:00 +0000)]
Implement filesystem_error::what() and improve reporting.

This patch implements the `what()` for filesystem errors. The message
includes the 'what_arg', any paths that were specified, and the
error code message.

Additionally this patch refactors how errors are created, making it easier
to report them correctly.

llvm-svn: 337664

6 years agoFix the test
Brad Smith [Sun, 22 Jul 2018 22:04:28 +0000 (22:04 +0000)]
Fix the test

llvm-svn: 337663

6 years agoAdd GCC 9 to XFAILs list for test
Eric Fiselier [Sun, 22 Jul 2018 21:58:46 +0000 (21:58 +0000)]
Add GCC 9 to XFAILs list for test

llvm-svn: 337662

6 years agoWorkaround bug in GCC trunk.
Eric Fiselier [Sun, 22 Jul 2018 21:56:40 +0000 (21:56 +0000)]
Workaround bug in GCC trunk.

For some reason GCC ToT is failing to deduce the auto type for
a static data member from its initializer in some cases.

Though I'm sure the bug will be short lived, there is a trivial workaround for it.
So we might as well get the bot passing again.

llvm-svn: 337661

6 years agoOpenBSD/arm has switched to float ABI SoftFP.
Brad Smith [Sun, 22 Jul 2018 21:39:54 +0000 (21:39 +0000)]
OpenBSD/arm has switched to float ABI SoftFP.

llvm-svn: 337660

6 years agoHarden copy_file even more.
Eric Fiselier [Sun, 22 Jul 2018 21:15:15 +0000 (21:15 +0000)]
Harden copy_file even more.

This patch removes the O_CREAT open flag when we first
attempt to open the destination file but we expect it to
already exist.

This theoretically avoids the possibility that it was removed
between when we first stat'ed it, and when we attempt to open it.

llvm-svn: 337659

6 years agofix test failures with older clang versions
Eric Fiselier [Sun, 22 Jul 2018 20:50:16 +0000 (20:50 +0000)]
fix test failures with older clang versions

llvm-svn: 337658

6 years agoTest commit, fix a minor typo.
Jiading Gai [Sun, 22 Jul 2018 20:04:42 +0000 (20:04 +0000)]
Test commit, fix a minor typo.

llvm-svn: 337657

6 years ago[X86] Remove the max vector width restriction from combineLoopMAddPattern and rely...
Craig Topper [Sun, 22 Jul 2018 19:44:35 +0000 (19:44 +0000)]
[X86] Remove the max vector width restriction from combineLoopMAddPattern and rely splitOpsAndApply to handle splitting.

This seems to be a net improvement. There's still an issue under avx512f where we have a 512-bit vpaddd, but not vpmaddwd so we end up doing two 256-bit vpmaddwds and inserting the results before a 512-bit vpaddd. It might be better to do two 512-bits paddds with zeros in the upper half. Same number of instructions, but breaks a dependency.

llvm-svn: 337656

6 years ago[clangd] Unbreak fuzzer build.
Benjamin Kramer [Sun, 22 Jul 2018 15:55:57 +0000 (15:55 +0000)]
[clangd] Unbreak fuzzer build.

llvm-svn: 337655