platform/upstream/llvm.git
6 years agoUpdate to-do list with new work from WG21 meeting in San Diego
Marshall Clow [Mon, 12 Nov 2018 04:58:00 +0000 (04:58 +0000)]
Update to-do list with new work from WG21 meeting in San Diego

llvm-svn: 346634

6 years agoSupport Swift in platform availability attribute
Michael Wu [Mon, 12 Nov 2018 02:44:33 +0000 (02:44 +0000)]
Support Swift in platform availability attribute

Summary: This adds support for Swift platform availability attributes. It's largely a port of the changes made to https://github.com/apple/swift-clang/ for Swift availability attributes. Specifically, https://github.com/apple/swift-clang/commit/84b5a21c31cb5b0d7d958a478bc01964939b6952 and https://github.com/apple/swift-clang/commit/e5b87f265aede41c8381094bbf54e2715c8293b0 . The implementation of attribute_availability_swift is a little different and additional tests in test/Index/availability.c were added.

Reviewers: manmanren, friss, doug.gregor, arphaman, jfb, erik.pilkington, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: aaron.ballman, ColinKinloch, jrmuizel, cfe-commits

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

llvm-svn: 346633

6 years ago[GC] Remove unused configuration variable
Philip Reames [Mon, 12 Nov 2018 02:34:54 +0000 (02:34 +0000)]
[GC] Remove unused configuration variable

The custom root mechanism didn't actually do anything.  ShadowStackGC, the only one which used it, just removed the gcroots before they reached the normal lowering in SelectionDAG.  As a result, the state flag had no value.

llvm-svn: 346632

6 years ago[GC] Minor style modernization
Philip Reames [Mon, 12 Nov 2018 02:26:26 +0000 (02:26 +0000)]
[GC] Minor style modernization

llvm-svn: 346631

6 years ago[NFC] Reformat std::optional tests
Louis Dionne [Mon, 12 Nov 2018 01:38:30 +0000 (01:38 +0000)]
[NFC] Reformat std::optional tests

llvm-svn: 346630

6 years ago[NFC] Fix typo in <tuple>
Louis Dionne [Mon, 12 Nov 2018 01:28:07 +0000 (01:28 +0000)]
[NFC] Fix typo in <tuple>

llvm-svn: 346629

6 years ago[CodeGen][CXX]: Fix no_destroy CG bug under specific circumstances
Kristina Brooks [Mon, 12 Nov 2018 01:19:16 +0000 (01:19 +0000)]
[CodeGen][CXX]: Fix no_destroy CG bug under specific circumstances

Summary:

Class with no user-defined destructor that has an inherited member that has a
non-trivial destructor and a non-default constructor will attempt to emit a
destructor despite being marked as __attribute((no_destroy)) in which case it
would trigger an assertion due to an incorrect assumption.

In addition this adds missing test coverage for IR generation for no_destroy.

(Note that here use of no_destroy is synonymous with its global flag
counterpart `-fno-c++-static-destructors` being enabled)

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

llvm-svn: 346628

6 years ago[IPSCCP] Delete two forward declarations
Fangrui Song [Sun, 11 Nov 2018 23:17:46 +0000 (23:17 +0000)]
[IPSCCP] Delete two forward declarations

Summary: Use forward declaration as the reviewer is in favor of #include and delete a redundant declaration of Function.

Reviewers: fhahn

Reviewed By: fhahn

Subscribers: llvm-commits

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

llvm-svn: 346627

6 years agoRemove header grouping comments.
Jonas Devlieghere [Sun, 11 Nov 2018 23:17:06 +0000 (23:17 +0000)]
Remove header grouping comments.

This patch removes the comments grouping header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

llvm-svn: 346626

6 years agoRemove comments after header includes.
Jonas Devlieghere [Sun, 11 Nov 2018 23:16:43 +0000 (23:16 +0000)]
Remove comments after header includes.

This patch removes the comments following the header includes. They were
added after running IWYU over the LLDB codebase. However they add little
value, are often outdates and burdensome to maintain.

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

llvm-svn: 346625

6 years ago[llvm-nm] Use WithColor for error reporting
Jonas Devlieghere [Sun, 11 Nov 2018 22:12:21 +0000 (22:12 +0000)]
[llvm-nm] Use WithColor for error reporting

Use helpers from Support/WithError.h to print errors.

llvm-svn: 346624

6 years ago[llvm-objdump] Use WithColor for error reporting
Jonas Devlieghere [Sun, 11 Nov 2018 22:12:04 +0000 (22:12 +0000)]
[llvm-objdump] Use WithColor for error reporting

Use helpers from Support/WithError.h to print errors.

llvm-svn: 346623

6 years ago[llvm-undname] Use WithColor for error reporting
Jonas Devlieghere [Sun, 11 Nov 2018 22:11:47 +0000 (22:11 +0000)]
[llvm-undname] Use WithColor for error reporting

Use helpers from Support/WithError.h to print errors.

llvm-svn: 346622

6 years ago[GCRoot] Remove some unneccessary complexity
Philip Reames [Sun, 11 Nov 2018 21:13:09 +0000 (21:13 +0000)]
[GCRoot] Remove some unneccessary complexity

The GCStrategy provides three configuration options were are largely redundant.

1) Support for conditionally lowering gcread and gcwrite to loads and stores.  This is redundant since any GC which wished to use these abstractions would lower them out of existance before the built in lowering anyways.  As such, there's no need to have the lowering being conditional.
2) Conditional initialization for allocas marked via gcroot.  Semantically, roots have to be initialized before first potential use.  Arguably, the frontend really should have responsibility for that, but the old API allowed the frontend to ignore this detail.  Only one builtin GC used the non-initializing mode.  Since no one to my knowledge actually uses the ErlangGC strategy, I decide the slight pessimization was worth the simplicity.  If that turns out to be problematic, we can always improve the insertion algorithm to detect more existing initializing stores.

llvm-svn: 346621

6 years ago[IPSCCP] Use forward declaration.
Florian Hahn [Sun, 11 Nov 2018 20:57:04 +0000 (20:57 +0000)]
[IPSCCP] Use forward declaration.

llvm-svn: 346620

6 years ago[IPSCCP,PM] Add missing #include in rL346618
Fangrui Song [Sun, 11 Nov 2018 20:44:13 +0000 (20:44 +0000)]
[IPSCCP,PM] Add missing #include in rL346618

llvm-svn: 346619

6 years ago[IPSCCP,PM] Preserve PDT in the new pass manager.
Florian Hahn [Sun, 11 Nov 2018 20:22:45 +0000 (20:22 +0000)]
[IPSCCP,PM] Preserve PDT in the new pass manager.

Reviewers: kuhar, chandlerc, NutshellySima, brzycki

Reviewed By: NutshellySima, brzycki

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

llvm-svn: 346618

6 years ago[MC] Fix 3 objdump tests after rL346610
Fangrui Song [Sun, 11 Nov 2018 19:15:27 +0000 (19:15 +0000)]
[MC] Fix 3 objdump tests after rL346610

llvm-svn: 346617

6 years ago[ELF] Change GnuPub{Names,Types}Section from StringRef to LLDDWARFSection
Fangrui Song [Sun, 11 Nov 2018 18:57:35 +0000 (18:57 +0000)]
[ELF] Change GnuPub{Names,Types}Section from StringRef to LLDDWARFSection

Summary:
The debug_info_offset value may be relocated.

This is lld side change of D54375.

Reviewers: ruiu, dblaikie, grimar, espindola

Subscribers: emaste, arichardson, JDevlieghere, llvm-commits

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

llvm-svn: 346616

6 years ago[DWARF] Change pubnames to use DWARFSection instead of StringRef
Fangrui Song [Sun, 11 Nov 2018 18:57:28 +0000 (18:57 +0000)]
[DWARF] Change pubnames to use DWARFSection instead of StringRef

Summary: The debug_info_offset values in .debug_{,gnu_}pub{name,types} may be relocated. Change it to DWARFSection so that we can get relocated values.

Reviewers: ruiu, dblaikie, grimar, JDevlieghere

Reviewed By: JDevlieghere

Subscribers: aprantl, JDevlieghere, llvm-commits

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

llvm-svn: 346615

6 years ago[ELF] Fix relocation-common.s after rL346610
Fangrui Song [Sun, 11 Nov 2018 18:54:58 +0000 (18:54 +0000)]
[ELF] Fix relocation-common.s after rL346610

llvm-svn: 346614

6 years ago[ELF] Fix objdump tests after rL346610
Fangrui Song [Sun, 11 Nov 2018 18:49:05 +0000 (18:49 +0000)]
[ELF] Fix objdump tests after rL346610

llvm-svn: 346613

6 years ago[lld][test] Update tests using objdump
Kristina Brooks [Sun, 11 Nov 2018 18:42:59 +0000 (18:42 +0000)]
[lld][test] Update tests using objdump

Followup fix for LLD test for new format in rL346610.

llvm-svn: 346612

6 years ago[llvm][test] Update tests using objdump
Kristina Brooks [Sun, 11 Nov 2018 18:40:33 +0000 (18:40 +0000)]
[llvm][test] Update tests using objdump

Update tests using llvm-objdump since check strings don't
match anymore due to the extra `O` in place. This is a
followup for rL346610.

llvm-svn: 346611

6 years ago[llvm-objdump] Add symbol 'O' for object data
Kristina Brooks [Sun, 11 Nov 2018 17:47:13 +0000 (17:47 +0000)]
[llvm-objdump] Add symbol 'O' for object data

Improve compatibility with GNU objdump by showing `O` next to
global symbol names, instead of a blank space.

Patch by Higuoxing (Xing).

Reviewers: MaskRay

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

llvm-svn: 346610

6 years ago[x86] auto-generate complete checks; NFC
Sanjay Patel [Sun, 11 Nov 2018 14:57:26 +0000 (14:57 +0000)]
[x86] auto-generate complete checks; NFC

llvm-svn: 346609

6 years ago[clangd] Make ClangdFuzzer compile again.
Benjamin Kramer [Sun, 11 Nov 2018 11:09:58 +0000 (11:09 +0000)]
[clangd] Make ClangdFuzzer compile again.

llvm-svn: 346608

6 years agoPort LLVM r346606 to libcxxabi.
Nico Weber [Sun, 11 Nov 2018 10:09:06 +0000 (10:09 +0000)]
Port LLVM r346606 to libcxxabi.

llvm-svn: 346607

6 years agoMake initializeOutputStream() return false on error and true on success.
Nico Weber [Sun, 11 Nov 2018 10:04:00 +0000 (10:04 +0000)]
Make initializeOutputStream() return false on error and true on success.

As discussed in https://reviews.llvm.org/D52104

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

llvm-svn: 346606

6 years ago[X86] Use DAG.getConstant instead of getZeroVector.
Craig Topper [Sun, 11 Nov 2018 07:24:36 +0000 (07:24 +0000)]
[X86] Use DAG.getConstant instead of getZeroVector.

llvm-svn: 346605

6 years ago[Support] Make error banner optional in logAllUnhandledErrors
Jonas Devlieghere [Sun, 11 Nov 2018 01:46:03 +0000 (01:46 +0000)]
[Support] Make error banner optional in logAllUnhandledErrors

In a lot of places an empty string was passed as the ErrorBanner to
logAllUnhandledErrors. This patch makes that argument optional to
simplify the call sites.

llvm-svn: 346604

6 years ago[X86] Replace calls to getOnesVector/getZeroVector with getConstant.
Craig Topper [Sun, 11 Nov 2018 01:40:04 +0000 (01:40 +0000)]
[X86] Replace calls to getOnesVector/getZeroVector with getConstant.

getConstant will create a BUILD_VECTOR for us and use a legal type if necessary. So just create the simple node and let BUILD_VECTOR legalization do the canonicalization.

llvm-svn: 346603

6 years ago[llvm-cxxdump] Use error reporting helpers from support
Jonas Devlieghere [Sun, 11 Nov 2018 01:24:02 +0000 (01:24 +0000)]
[llvm-cxxdump] Use error reporting helpers from support

This patch makes llvm-cxxdump use the error reporting helpers from
Support/WithColor.h

llvm-svn: 346602

6 years agoPass the function type instead of the return type to FunctionDecl::Create
Jonas Devlieghere [Sun, 11 Nov 2018 00:56:15 +0000 (00:56 +0000)]
Pass the function type instead of the return type to FunctionDecl::Create

Fix places where the return type of a FunctionDecl was being used in
place of the function type

FunctionDecl::Create() takes as its T parameter the type of function
that should be created, not the return type. Passing in the return type
looks to have been copypasta'd around a bit, but the number of correct
usages outweighs the incorrect ones so I've opted for keeping what T is
the same and fixing up the call sites instead.

This fixes a crash in Clang when attempting to compile the following
snippet of code with -fblocks -fsanitize=function -x objective-c++ (my
original repro case):

  void g(void(^)());
  void f()
  {
      __block int a = 0;
        g(^(){ a++; });
  }

as well as the following which only requires -fsanitize=function -x c++:

  void f(char * buf)
  {
      __builtin_os_log_format(buf, "");
  }

Patch by: Ben (bobsayshilol)

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

llvm-svn: 346601

6 years ago[DAGCombiner] Make tryToFoldExtendOfConstant return an SDValue instead of an SDNode...
Craig Topper [Sat, 10 Nov 2018 23:46:03 +0000 (23:46 +0000)]
[DAGCombiner] Make tryToFoldExtendOfConstant return an SDValue instead of an SDNode*. NFC

Removes the need to call getNode internally and to recreate an SDValue after the call.

llvm-svn: 346600

6 years agoAdd missing include
Jonas Devlieghere [Sat, 10 Nov 2018 22:54:44 +0000 (22:54 +0000)]
Add missing include

llvm-svn: 346599

6 years agoExtract construction of DataBufferLLVM into FileSystem
Jonas Devlieghere [Sat, 10 Nov 2018 22:44:06 +0000 (22:44 +0000)]
Extract construction of DataBufferLLVM into FileSystem

This moves construction of data buffers into the FileSystem class. Like
some of the previous refactorings we don't translate the path yet
because the functionality hasn't been landed in LLVM yet.

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

llvm-svn: 346598

6 years agor600: Add datalayout to image builtin implementation
Jan Vesely [Sat, 10 Nov 2018 21:43:40 +0000 (21:43 +0000)]
r600: Add datalayout to image builtin implementation

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewer: Aaron Watry
llvm-svn: 346597

6 years ago[InstCombine] simplify code for merging stores; NFCI
Sanjay Patel [Sat, 10 Nov 2018 20:29:25 +0000 (20:29 +0000)]
[InstCombine] simplify code for merging stores; NFCI

llvm-svn: 346596

6 years ago[x86] allow vector load narrowing with multi-use values
Sanjay Patel [Sat, 10 Nov 2018 20:05:31 +0000 (20:05 +0000)]
[x86] allow vector load narrowing with multi-use values

This is a long-awaited follow-up suggested in D33578. Since then, we've picked up even more
opportunities for vector narrowing from changes like D53784, so there are a lot of test diffs.
Apart from 2-3 strange cases, these are all wins.

I've structured this to be no-functional-change-intended for any target except for x86
because I couldn't tell if AArch64, ARM, and AMDGPU would improve or not. All of those
targets have existing regression tests (4, 4, 10 files respectively) that would be
affected. Also, Hexagon overrides the shouldReduceLoadWidth() hook, but doesn't show
any regression test diffs. The trade-off is deciding if an extra vector load is better
than a single wide load + extract_subvector.

For x86, this is almost always better (on paper at least) because we often can fold
loads into subsequent ops and not increase the official instruction count. There's also
some unknown -- but potentially large -- benefit from using narrower vector ops if wide
ops are implemented with multiple uops and/or frequency throttling is avoided.

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

llvm-svn: 346595

6 years ago[InstCombine] auto-generate full checks; NFC
Sanjay Patel [Sat, 10 Nov 2018 18:51:10 +0000 (18:51 +0000)]
[InstCombine] auto-generate full checks; NFC

llvm-svn: 346594

6 years agoFix DragonFlyBSD linkage issue.
David Carlier [Sat, 10 Nov 2018 18:47:00 +0000 (18:47 +0000)]
Fix DragonFlyBSD linkage issue.

environ global failed on LTO linkage step.

llvm-svn: 346593

6 years ago[X86] Remove unused variable
Benjamin Kramer [Sat, 10 Nov 2018 18:11:11 +0000 (18:11 +0000)]
[X86] Remove unused variable

llvm-svn: 346592

6 years ago[cxx_status] Update for San Diego motions.
Richard Smith [Sat, 10 Nov 2018 18:02:40 +0000 (18:02 +0000)]
[cxx_status] Update for San Diego motions.

llvm-svn: 346591

6 years ago[X86] Remove apparently unneeded code from combineVSZext.
Craig Topper [Sat, 10 Nov 2018 17:44:28 +0000 (17:44 +0000)]
[X86] Remove apparently unneeded code from combineVSZext.

No lit tests fail with this code removed.

This is a pre-commit for D54346.

llvm-svn: 346590

6 years ago[CostModel][X86] SK_ExtractSubvector costs must only be tested for vector types ...
Simon Pilgrim [Sat, 10 Nov 2018 17:37:52 +0000 (17:37 +0000)]
[CostModel][X86] SK_ExtractSubvector costs must only be tested for vector types  (PR39615)

llvm-svn: 346589

6 years ago[GC] Rename a header for consistency
Philip Reames [Sat, 10 Nov 2018 16:08:10 +0000 (16:08 +0000)]
[GC] Rename a header for consistency

llvm-svn: 346588

6 years ago[X86][BdVer2] Fix loads/stores throughput for Piledriver (PR39465)
Roman Lebedev [Sat, 10 Nov 2018 14:31:43 +0000 (14:31 +0000)]
[X86][BdVer2] Fix loads/stores throughput for Piledriver (PR39465)

There are two AGU units, and per 1cy, there can be either two loads,
or a load and a store; but not two stores, or two loads and a store.

Additionally, loads shouldn't affect the store scheduler and vice versa.
(but *should* affect the PdEX scheduler.)

Required rL346545.
Fixes https://bugs.llvm.org/show_bug.cgi?id=39465

llvm-svn: 346587

6 years ago[python] Support PathLike filenames and directories
Michal Gorny [Sat, 10 Nov 2018 11:41:36 +0000 (11:41 +0000)]
[python] Support PathLike filenames and directories

Python 3.6 introduced a file system path protocol (PEP 519[1]).
The standard library APIs accepting file system paths now accept path
objects too. It could be useful to add this here as well
for convenience.

[1] https://www.python.org/dev/peps/pep-0519

Authored by: jstasiak (Jakub Stasiak)

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

llvm-svn: 346586

6 years ago[NFC][MCA][BdVer2] Add bdver2 runline into register-file-statistics.s test
Roman Lebedev [Sat, 10 Nov 2018 10:56:58 +0000 (10:56 +0000)]
[NFC][MCA][BdVer2] Add bdver2 runline into register-file-statistics.s test

Missed this one by accident when adding
the initial version in rL345463 / rL345462

llvm-svn: 346585

6 years ago[ThinLTO] Internalize readonly globals
Eugene Leviant [Sat, 10 Nov 2018 08:31:21 +0000 (08:31 +0000)]
[ThinLTO] Internalize readonly globals

This patch allows internalising globals if all accesses to them
(from live functions) are from non-volatile load instructions

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

llvm-svn: 346584

6 years ago[clang]: Fix misapplied patch in 346582.
Kristina Brooks [Sat, 10 Nov 2018 08:04:38 +0000 (08:04 +0000)]
[clang]: Fix misapplied patch in 346582.

llvm-svn: 346583

6 years agoCorrect naming conventions and 80 col rule violation in CGDeclCXX.cpp. NFC.
Kristina Brooks [Sat, 10 Nov 2018 07:53:47 +0000 (07:53 +0000)]
Correct naming conventions and 80 col rule violation in CGDeclCXX.cpp. NFC.

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

llvm-svn: 346582

6 years ago[X86] Use a MOVSX instruction instead of a MOVZX instruction in isel for an any_exten...
Craig Topper [Sat, 10 Nov 2018 06:04:33 +0000 (06:04 +0000)]
[X86] Use a MOVSX instruction instead of a MOVZX instruction in isel for an any_extend of the remainder from an 8-bit sdivrem.

The sdivrem will emit its own MOVSX to move %ah to the low byte of a register. By using a MOVSX for an any_extend this allows a post-isel peephole to merge them.

llvm-svn: 346581

6 years ago[X86] Add a test case to show scalarized vector srem to demonstrate unnecessary instr...
Craig Topper [Sat, 10 Nov 2018 06:04:09 +0000 (06:04 +0000)]
[X86] Add a test case to show scalarized vector srem to demonstrate unnecessary instructions. NFC

After the division %ah is being sign extended to move it to lower byte of a register while avoiding a partial register read. We then zero extend the low byte to the full 32 bit register. But we don't use any of the zero extended bits. In the DAG the zero extend was really an any_extend so the sign extend should have been enough.

llvm-svn: 346580

6 years agoCorrect atexit(3) support in MSan/NetBSD
Kamil Rytarowski [Sat, 10 Nov 2018 02:17:32 +0000 (02:17 +0000)]
Correct atexit(3) support in MSan/NetBSD

Summary:
The NetBSD specific implementation of cxa_atexit() does not
preserve the 2nd argument if dso is equal to NULL.

Changes:

 - Split paths of handling intercepted __cxa_atexit() and atexit(3).
   This affects all supported Operating Systems.
 - Add a local stack-like structure to hold the __cxa_atexit() context.
   atexit(3) is documented in the C standard as calling callback from the
   earliest to the oldest entry. This path also fixes potential ABI
   problem of passing an argument to a function from the atexit(3)
   callback mechanism.
 - Allow usage of global vars with ctors in interceptors.
   This allows to use Vector without automatic cleaning up the structures.

This code has been modeled after TSan implementation for the same functions.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dvyukov, eugenis, vitalybuka, kcc

Reviewed By: vitalybuka

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

Tags: #sanitizers

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

llvm-svn: 346579

6 years ago[PDB] Simplify some ghash code, NFC
Reid Kleckner [Sat, 10 Nov 2018 01:36:02 +0000 (01:36 +0000)]
[PDB] Simplify some ghash code, NFC

Instead of calling the same function twice with different parameters,
make the parameters depend on the condition.

llvm-svn: 346578

6 years agoFix DragonFlyBSD build
David Carlier [Sat, 10 Nov 2018 01:01:03 +0000 (01:01 +0000)]
Fix DragonFlyBSD build

Reviewers: rnk, thakis

Reviewed By: krytarowski

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

llvm-svn: 346577

6 years agoRegAllocFast: Further cleanups; NFC
Matthias Braun [Sat, 10 Nov 2018 00:36:27 +0000 (00:36 +0000)]
RegAllocFast: Further cleanups; NFC

llvm-svn: 346576

6 years agotest/CodeGen/X86: Relax test case
Matthias Braun [Sat, 10 Nov 2018 00:34:09 +0000 (00:34 +0000)]
test/CodeGen/X86: Relax test case

No need to hardcode register or expecting totally unnecessary spills
from the allocator.

llvm-svn: 346575

6 years ago[X86] In LowerHorizontalByteSum, emit vector_shuffle nodes instead of directly using...
Craig Topper [Sat, 10 Nov 2018 00:26:42 +0000 (00:26 +0000)]
[X86] In LowerHorizontalByteSum, emit vector_shuffle nodes instead of directly using X86ISD::UNPCKL/X86ISD::UNPCKH.

This gives shuffle lowering the freedom to use zero_extend_vector_inreg for the unpckl shuffle. Shuffle combining usually makes this swap later, but not when AVX512 is enabled it seems.

While there also use DAG.getConstant to create a 0 vector instead of using the helper the forces a specific BUILD_VECTOR. I don't think that helper is usually needed. We're basically free to create a constant build_vector anytime and it will be legalized on its own.

llvm-svn: 346574

6 years agoUnbreak the linux bot from the previous commit. Fred needed to use
Jason Molenda [Sat, 10 Nov 2018 00:25:45 +0000 (00:25 +0000)]
Unbreak the linux bot from the previous commit.  Fred needed to use
some of the macros from mach/exc_resource.h to decode EXC_RESOURCE,
but that header doesn't exist on non-apple platforms and
StopInfoMachException.cpp needs to build on those systems.
EXC_RESOURCE won't be decoded when lldb is built on non-darwin systems.

llvm-svn: 346573

6 years agoAdd extra diagnostics to test
Adrian Prantl [Sat, 10 Nov 2018 00:16:39 +0000 (00:16 +0000)]
Add extra diagnostics to test

llvm-svn: 346572

6 years agoEnable listening for EXC_RESOURCE events, and format mach
Jason Molenda [Sat, 10 Nov 2018 00:14:14 +0000 (00:14 +0000)]
Enable listening for EXC_RESOURCE events, and format mach
event as a thread stop reason if we receive one, using
some macros to decode the payload.

Patch originally written by Fred Riss, with a few small changes
by myself.

Writing a test for this is a little tricky because the
mach exception data interpretation relies on header macros
or function calls - it may change over time and writing
a gdb_remote_client test for this would break as older
encoding interpretation is changed.  I'll tak with Fred
about this more, but neither of us has been thrilled with
the kind of tests we could write for it.

<rdar://problem/13097323>, <rdar://problem/40144456>

llvm-svn: 346571

6 years ago[WebAssembly] Update bleeding-edge cpu features
Thomas Lively [Sat, 10 Nov 2018 00:11:14 +0000 (00:11 +0000)]
[WebAssembly] Update bleeding-edge cpu features

Reviewers: aheejin, dschuff

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

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

llvm-svn: 346570

6 years ago[GC] Simplify linking of GC builtin GC strategies
Philip Reames [Fri, 9 Nov 2018 23:56:21 +0000 (23:56 +0000)]
[GC] Simplify linking of GC builtin GC strategies

llvm-svn: 346569

6 years ago[ARM64] [Windows] Handle funclets
Eli Friedman [Fri, 9 Nov 2018 23:33:30 +0000 (23:33 +0000)]
[ARM64] [Windows] Handle funclets

This patch adds support for funclets in frame lowering and ISel
lowering. Together with D50288 and D50166, it enables C++ exception
handling.

Patch by Sanjin Sijaric, with some fixes by me.

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

llvm-svn: 346568

6 years ago[libcxx] Provide thread annotations for shared_mutex
Petr Hosek [Fri, 9 Nov 2018 23:32:25 +0000 (23:32 +0000)]
[libcxx] Provide thread annotations for shared_mutex

shared_mutex was introduced in C++17 but its implementation currently
doesn't use Clang's thread annotations like regular mutex. This change
adds those.

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

llvm-svn: 346567

6 years agoFix ClangFormat issue of recognizing ObjC subscript as C++ attributes when message...
Yan Zhang [Fri, 9 Nov 2018 23:19:14 +0000 (23:19 +0000)]
Fix ClangFormat issue of recognizing ObjC subscript as C++ attributes when message target is a result of a C-style method.

Summary:
The issue is that for array subscript like:

```
arr[[Foo() bar]];
```
ClangFormat will recognize it as C++11 attribute syntax and put a space between 'arr' and first '[', like:

```
arr [[Foo() bar]];
```

Now it is fixed. Tested with:
```
ninja FormatTests
```

Reviewers: benhamilton

Reviewed By: benhamilton

Subscribers: cfe-commits

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

llvm-svn: 346566

6 years ago[AVR] Reorder the CHECK lines in directmem.ll to match current trunk
Dylan McKay [Fri, 9 Nov 2018 23:17:59 +0000 (23:17 +0000)]
[AVR] Reorder the CHECK lines in directmem.ll to match current trunk

In r346432 ("[DAGCombine] Improve alias analysis for chain of independent stores"),
the order of ldi/sts blocks changed.

The new IR is equivalent to the old IR.

This patch updates the test to fix the test suite.

llvm-svn: 346565

6 years ago[SelectionDAG] Fix a -Wparentheses warning from gcc in an assert. NFC
Craig Topper [Fri, 9 Nov 2018 23:11:30 +0000 (23:11 +0000)]
[SelectionDAG] Fix a -Wparentheses warning from gcc in an assert. NFC

gcc wants parentheses around the logical OR since there is a logical AND for the string.

llvm-svn: 346564

6 years ago[ARM] Add MemOperand to LDRcp to enable DCE.
Eli Friedman [Fri, 9 Nov 2018 23:09:17 +0000 (23:09 +0000)]
[ARM] Add MemOperand to LDRcp to enable DCE.

LDRcp should be deleted when the dest register is dead in register
coalescing. Without MemOp, dead LDRcp will cause dead constant pool
value which references to non-existing label.

Patch by Yin Ma.

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

llvm-svn: 346563

6 years ago[JumpThreading] Fix exponential time algorithm computing known values.
Eli Friedman [Fri, 9 Nov 2018 22:35:26 +0000 (22:35 +0000)]
[JumpThreading] Fix exponential time algorithm computing known values.

ComputeValueKnownInPredecessors has a "visited" set to prevent infinite
loops, since a value can be visited more than once.  However, the
implementation didn't prevent the algorithm from taking exponential
time. Instead of removing elements from the RecursionSet one at a time,
we should keep around the whole set until
ComputeValueKnownInPredecessors finishes, then discard it.

The testcase is synthetic because I was having trouble effectively
reducing the original.  But it's basically the same idea.

Instead of failing, we could theoretically cache the result instead.
But I don't think it would help substantially in practice.

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

llvm-svn: 346562

6 years agoWork with a gdb-remote target that doesn't handle the
Jason Molenda [Fri, 9 Nov 2018 22:33:26 +0000 (22:33 +0000)]
Work with a gdb-remote target that doesn't handle the
qWatchpointSupportInfo packet correctly.

In GDBRemoteCommunicationClient::GetWatchpointSupportInfo,
if the response to qWatchpointSupportInfo does not
include the 'num' field, then we did not get an answer
we understood, mark this target as not supporting that
packet.

In Target.cpp, rename the very confusingly named
CheckIfWatchpointsExhausted to CheckIfWatchpointsSupported,
and check the error status returned by
Process::GetWatchpointSupportInfo.  If we cannot determine
what the number of supported watchpoints are, assume that
they will work.  We'll handle the failure
later when we try to create/enable the watchpoint if the
Z2 packet isn't supported.

Add a gdb_remote_client test case.

<rdar://problem/42621432>

llvm-svn: 346561

6 years agoRe-land r343606 "[winasan] Unpoison the stack in NtTerminateThread"
Reid Kleckner [Fri, 9 Nov 2018 22:06:59 +0000 (22:06 +0000)]
Re-land r343606 "[winasan] Unpoison the stack in NtTerminateThread"

This change was reverted because it caused some nacl tests in chromium
to fail. I attempted to reproduce those problems locally, but I was
unable to. Let's reland this and let Chromium's test infrastructure
discover any problems.

llvm-svn: 346560

6 years agoRevert "Exclude wasm target from Windows packaging due to PR39448"
Thomas Lively [Fri, 9 Nov 2018 22:05:51 +0000 (22:05 +0000)]
Revert "Exclude wasm target from Windows packaging due to PR39448"

Summary:
This reverts r346122 now that the failing tests have been
disabled. Depends on D54353.

Reviewers: aheejin, dschuff

Subscribers: fedor.sergeev, sunfish, llvm-commits

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

llvm-svn: 346559

6 years ago[WebAssembly] Disable custom NaN payload tests
Thomas Lively [Fri, 9 Nov 2018 22:04:37 +0000 (22:04 +0000)]
[WebAssembly] Disable custom NaN payload tests

Summary:
These tests fail on 32-bit builds because NaN payload bits in floating point
immediates are not necessarily preserved through compilation. This is because
the MC layer uses native doubles to store these values. The tests will be
reenabled once this problem has been fixed or deleted if we decide we don't care
about lowering payload bits.

Reviewers: aheejin, dschuff

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

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

llvm-svn: 346558

6 years ago[hwasan] Add entire report to abort message on Android.
Evgeniy Stepanov [Fri, 9 Nov 2018 21:54:03 +0000 (21:54 +0000)]
[hwasan] Add entire report to abort message on Android.

Summary:
When reporting a fatal error, collect and add the entire report text to
android_set_abort_message so that it can be found in the tombstone.

Reviewers: kcc, vitalybuka

Subscribers: srhines, kubamracek, llvm-commits

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

llvm-svn: 346557

6 years agoRevert "Revert rL346454: Fix a use-after-free introduced by r344915."
Adrian Prantl [Fri, 9 Nov 2018 21:17:38 +0000 (21:17 +0000)]
Revert "Revert rL346454: Fix a use-after-free introduced by r344915."

This un-reverts commit 346454 with a relaxed CHECK for Windows.

llvm-svn: 346556

6 years ago[clang-tidy] fix PR39583 - ignoring ParenCast for string-literals in pro-bounds-array...
Jonas Toth [Fri, 9 Nov 2018 20:57:28 +0000 (20:57 +0000)]
[clang-tidy] fix PR39583 - ignoring ParenCast for string-literals in pro-bounds-array-to-pointer-decay

Summary:
The fix to the issue that `const char* p = ("foo")` is diagnosed as decay
is to ignored the ParenCast.
Resolves PR39583

Reviewers: aaron.ballman, alexfh, hokein

Reviewed By: aaron.ballman

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

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

llvm-svn: 346555

6 years ago[ASTMatchers] overload ignoringParens for Expr
Jonas Toth [Fri, 9 Nov 2018 20:54:06 +0000 (20:54 +0000)]
[ASTMatchers] overload ignoringParens for Expr

Summary: This patch allows fixing PR39583.

Reviewers: aaron.ballman, sbenza, klimek

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

llvm-svn: 346554

6 years agoRemove llvm include from debugserver, change
Jason Molenda [Fri, 9 Nov 2018 20:31:41 +0000 (20:31 +0000)]
Remove llvm include from debugserver, change
LLVM_FALLTHROUGH's to [[clang::fallthrough]] -
debugserver is only ever compiled on darwin
systems with clang.

llvm-svn: 346553

6 years ago[X86] Move the promotion of v16i16->v16i8 for avx512f but not avx512bw from lowering...
Craig Topper [Fri, 9 Nov 2018 20:09:53 +0000 (20:09 +0000)]
[X86] Move the promotion of v16i16->v16i8 for avx512f but not avx512bw from lowering to isel. Change to use vpmovzx instead of vpmovsx.

With avx512f but not avx512bw we need to extend to v16i32 then truncate that to to v16i8. Previously we emitted both nodes during lowering, but I'm trying to switch to using target independent nodes and with that switched the extend+truncate wou

This patch changes the implementation to what will be necessary with that patch which helps minimize test diffs.

llvm-svn: 346552

6 years ago[OPENMP][NVPTX]Extend number of constructs executed in SPMD mode.
Alexey Bataev [Fri, 9 Nov 2018 20:03:19 +0000 (20:03 +0000)]
[OPENMP][NVPTX]Extend number of constructs executed in SPMD mode.

If the statements between target|teams|distribute directives does not
require execution in master thread, like constant expressions, null
statements, simple declarations, etc., such construct can be xecuted in
SPMD mode.

llvm-svn: 346551

6 years agoBranch/tag all projects with a single commit in release-tagging script.
James Y Knight [Fri, 9 Nov 2018 19:45:13 +0000 (19:45 +0000)]
Branch/tag all projects with a single commit in release-tagging script.

This change updates the release script to use svnmucc to create all
the branches with one commit.

This will ensure that the git tag won't bounce around if the git
migration runs in-between separate commits creating a branch.

Additionally, update the list of projects to include all of the
projects in the monorepo, plus test-suite.

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

llvm-svn: 346550

6 years agoRevert rL346454: Fix a use-after-free introduced by r344915.
Simon Pilgrim [Fri, 9 Nov 2018 19:42:53 +0000 (19:42 +0000)]
Revert rL346454: Fix a use-after-free introduced by r344915.

r344915 added a call to ApplyDebugLocation to the sanitizer check
function emitter. Some of the sanitizers are emitted in the function
epilogue though and the LexicalScopeStack is emptied out before. By
detecting this situation and early-exiting from ApplyDebugLocation the
fallback location is used, which is equivalent to the return location.

rdar://problem/45859802
........
Causes EXPENSIVE_CHECKS build bot failures: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win

llvm-svn: 346549

6 years agoUse the correct address space when bitcasting func pointer to int pointer
Dylan McKay [Fri, 9 Nov 2018 19:42:05 +0000 (19:42 +0000)]
Use the correct address space when bitcasting func pointer to int pointer

When we cast a function pointer to an int pointer, at some pointer later
it gets bitcasted back to a function and called.

In backends that have a nonzero program memory address space specified
in the data layout, the old code would lose the address space data. When
LLVM later attempted to generate the bitcast from i8* to i8(..)*
addrspace(1), it would fail because the pointers are not in the same
address space.

With this patch, the address space of the function will carry on to the
address space of the i8* pointer. This is because all function pointers
in Harvard architectures need to be assigned to the correct address
space.

This has no effect to any in-tree backends except AVR.

llvm-svn: 346548

6 years agoAllow a double-underscore spelling of Clang attributes using double square bracket...
Aaron Ballman [Fri, 9 Nov 2018 19:37:18 +0000 (19:37 +0000)]
Allow a double-underscore spelling of Clang attributes using double square bracket syntax.

This matches a similar behavior with GCC accepting [[gnu::__attr__]] as a alias for [[gnu::attr]] in that clang attributes can now be spelled with two leading and trailing underscores.

I had always intended for this to work, but missed the critical bit. We already had an existing test in test/Preprocessor/has_attribute.cpp for [[clang::__fallthrough__]] but using that spelling would still give an "unknown attribute" diagnostic.

llvm-svn: 346547

6 years ago[AArch64] Support HiSilicon's TSV110 processor
Bryan Chan [Fri, 9 Nov 2018 19:32:08 +0000 (19:32 +0000)]
[AArch64] Support HiSilicon's TSV110 processor

Reviewers: t.p.northover, SjoerdMeijer, kristof.beyls

Reviewed By: kristof.beyls

Subscribers: olista01, javed.absar, kristof.beyls, kristina, llvm-commits

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

llvm-svn: 346546

6 years ago[llvm-mca] Account for buffered resources when analyzing "Super" resources.
Andrea Di Biagio [Fri, 9 Nov 2018 19:30:20 +0000 (19:30 +0000)]
[llvm-mca] Account for buffered resources when analyzing "Super" resources.

This was noticed when working on PR3946.
By construction, a group cannot be used as a "Super" resource. That constraint
is enforced by method `SubtargetEmitter::ExpandProcResource()`.

A Super resource S can be part of a group G. However, method
`SubtargetEmitter::ExpandProcResource()` would not update the number of
consumed resource cycles in G based on S.
In practice, this is perfectly fine because the resource usage is correctly
computed for processor resource units. However, llvm-mca should still check if G
is a buffered resource.
Before this patch, llvm-mca didn't correctly check if S was part of a group that
defines a buffer. So, the instruction descriptor was not correctly set.

For now, the semantic change introduced by this patch doesn't affect any of the
upstream scheduling models. However, it will allow to make some progress on PR3946.

llvm-svn: 346545

6 years ago[MS demangler] Use a slightly shorter unmangling for mangled strings.
Nico Weber [Fri, 9 Nov 2018 19:28:50 +0000 (19:28 +0000)]
[MS demangler] Use a slightly shorter unmangling for mangled strings.

Before: const wchar_t * {L"%"}
Now: L"%"

See also PR39593.
Differential Revision: https://reviews.llvm.org/D54294

llvm-svn: 346544

6 years ago[Hexagon] Fix some -Wunused-function with LLVM_DUMP_METHOD and -Wunused-variable
Fangrui Song [Fri, 9 Nov 2018 19:24:48 +0000 (19:24 +0000)]
[Hexagon] Fix some -Wunused-function with LLVM_DUMP_METHOD and -Wunused-variable

llvm-svn: 346543

6 years agoFix a nondeterminism in the debug info for VLA size expressions.
Adrian Prantl [Fri, 9 Nov 2018 19:17:56 +0000 (19:17 +0000)]
Fix a nondeterminism in the debug info for VLA size expressions.

The artificial variable describing the array size is supposed to be
called "__vla_expr", but this was implemented by retrieving the name
of the associated alloca, which isn't a reliable source for the name,
since nonassert compilers may drop names from LLVM IR.

rdar://problem/45924808

llvm-svn: 346542

6 years ago[SystemZ] Add a couple of missing tests
Ulrich Weigand [Fri, 9 Nov 2018 19:16:21 +0000 (19:16 +0000)]
[SystemZ] Add a couple of missing tests

A few fp128 tests were omitted from test/CodeGen/SystemZ/fp-round-01.ll
since in early days, LLVM couldn't handle implicitly generated library
calls to functions with long double arguments on SystemZ.

This deficiency was actually long since fixed, but those tests are
still missing.  This patch adds the missing tests.  NFC.

llvm-svn: 346541

6 years ago[DWARFv5] Emit normal type units in .debug_info comdats.
Paul Robinson [Fri, 9 Nov 2018 19:06:09 +0000 (19:06 +0000)]
[DWARFv5] Emit normal type units in .debug_info comdats.

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

llvm-svn: 346540

6 years ago[X86] Turn X86ISD::VSEXT into X86ISD::VZEXT if the upper bits aren't demanded.
Craig Topper [Fri, 9 Nov 2018 19:05:51 +0000 (19:05 +0000)]
[X86] Turn X86ISD::VSEXT into X86ISD::VZEXT if the upper bits aren't demanded.

This makes X86ISD::VSEXT more similar to ISD::SIGN_EXTEND and ISD::ZERO_EXTEND.

I'm hoping to replace X86ISD::VSEXT/VZEXT with target independent nodes. Making the target specific nodes similar to the target independent nodes helps minimize test diffs in that patch.

llvm-svn: 346539

6 years ago[CostModel][X86] SK_ExtractSubvector is free if the subvector is at the start of...
Simon Pilgrim [Fri, 9 Nov 2018 19:04:27 +0000 (19:04 +0000)]
[CostModel][X86] SK_ExtractSubvector is free if the subvector is at the start of the source vector

llvm-svn: 346538

6 years ago[Hexagon] Fix unused variable warning in release builds
Jordan Rupprecht [Fri, 9 Nov 2018 18:54:27 +0000 (18:54 +0000)]
[Hexagon] Fix unused variable warning in release builds

llvm-svn: 346537

6 years ago[HIP] Remove useless sections in linked files
Yaxun Liu [Fri, 9 Nov 2018 18:52:05 +0000 (18:52 +0000)]
[HIP] Remove useless sections in linked files

clang-offload-bundler creates __CLANG_OFFLOAD_BUNDLE__* sections in the bundles,
which get into the linked files. These sections are useless after linking. They waste disk
space and cause confusion for clang when directly linked with other object files, therefore
should be removed.

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

llvm-svn: 346536

6 years ago[WebAssembly] Hotfix of WebAssemblyInstructionTableSize after rL346465
Fangrui Song [Fri, 9 Nov 2018 18:32:20 +0000 (18:32 +0000)]
[WebAssembly] Hotfix of WebAssemblyInstructionTableSize after rL346465

llvm-svn: 346535