platform/upstream/llvm.git
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

6 years ago[TTI] Flip vector types in getShuffleCost SK_ExtractSubvector call
Simon Pilgrim [Fri, 9 Nov 2018 18:30:59 +0000 (18:30 +0000)]
[TTI] Flip vector types in getShuffleCost SK_ExtractSubvector call

For SK_ExtractSubvector, the default 'Ty' type is the source operand type and 'SubTy' is the destination subvector type

I got this the wrong way around when I added rL346510

llvm-svn: 346534

6 years ago[AMDGPU] Cleanup optimize-if-exec-masking.mir test. NFC.
Stanislav Mekhanoshin [Fri, 9 Nov 2018 18:23:39 +0000 (18:23 +0000)]
[AMDGPU] Cleanup optimize-if-exec-masking.mir test. NFC.

llvm-svn: 346533

6 years ago[Hexagon] Implement noreturn optimization
Brendon Cahoon [Fri, 9 Nov 2018 18:16:24 +0000 (18:16 +0000)]
[Hexagon] Implement noreturn optimization

Eliminate the stack frame in functions with the noreturn nounwind
attributes, and when the noreturn-stack-elim target feature is
enabled. This reduces the code and stack space needed for noreturn
functions.

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

llvm-svn: 346532

6 years agoAdd total function byte size and inline function byte size to "llvm-dwarfdump --stati...
Greg Clayton [Fri, 9 Nov 2018 18:10:02 +0000 (18:10 +0000)]
Add total function byte size and inline function byte size to "llvm-dwarfdump --statistics"

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

llvm-svn: 346531

6 years ago[DAGCombiner][X86][Mips] Enable combineShuffleOfScalars to run between vector op...
Craig Topper [Fri, 9 Nov 2018 18:04:34 +0000 (18:04 +0000)]
[DAGCombiner][X86][Mips] Enable combineShuffleOfScalars to run between vector op legalization and DAG legalization. Fix bad one use check in combineShuffleOfScalars

It's possible for vector op legalization to generate a shuffle. If that happens we should give a chance for DAG combine to combine that with a build_vector input.

I also fixed a bug in combineShuffleOfScalars that was considering the number of uses on a undef input to a shuffle. We don't care how many times undef is used.

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

llvm-svn: 346530

6 years ago[llvm-strings] Fix whitespaces to match strings output.
Jordan Rupprecht [Fri, 9 Nov 2018 18:03:21 +0000 (18:03 +0000)]
[llvm-strings] Fix whitespaces to match strings output.

Summary:
The current implementation prepends a space on every line, making it difficult to compare against GNU strings.

The space appears to have come from handling --radix in rL292707. The space is for making sure there's a space between the radix and the value; however the space is still emitted even when there is no radix. This change fixes that so the space is only emitted when there is a radix.

Reviewers: jhenderson

Reviewed By: jhenderson

Subscribers: llvm-commits, compnerd

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

llvm-svn: 346529

6 years ago[AMDGPU] Always pass TRI into findRegister[Use/Def]OperandIdx
Stanislav Mekhanoshin [Fri, 9 Nov 2018 17:58:59 +0000 (17:58 +0000)]
[AMDGPU] Always pass TRI into findRegister[Use/Def]OperandIdx

This only covers AMDGPU BE, hopefully all occurrences.

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

llvm-svn: 346528

6 years agoAdd missing include
Adrian Prantl [Fri, 9 Nov 2018 17:58:05 +0000 (17:58 +0000)]
Add missing include

llvm-svn: 346527

6 years agoDriver: Make -fsanitize=shadow-call-stack compatible with -fsanitize-minimal-runtime.
Peter Collingbourne [Fri, 9 Nov 2018 17:54:49 +0000 (17:54 +0000)]
Driver: Make -fsanitize=shadow-call-stack compatible with -fsanitize-minimal-runtime.

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

llvm-svn: 346526

6 years agoAdd missing include
Adrian Prantl [Fri, 9 Nov 2018 17:44:20 +0000 (17:44 +0000)]
Add missing include

llvm-svn: 346525

6 years ago[clangd] Fix clang-tidy warnings.
Kadir Cetinkaya [Fri, 9 Nov 2018 17:33:48 +0000 (17:33 +0000)]
[clangd] Fix clang-tidy warnings.

llvm-svn: 346524

6 years ago[Hexagon] Place globals with explicit .sdata section in small data
Krzysztof Parzyszek [Fri, 9 Nov 2018 17:31:22 +0000 (17:31 +0000)]
[Hexagon] Place globals with explicit .sdata section in small data

Both -fPIC and -G0 disable placement of globals in small data section,
but if a global has an explicit section assigmnent placing it in small
data, it should go there anyway.

llvm-svn: 346523

6 years agoType safe version of MachinePassRegistry
Serge Guelton [Fri, 9 Nov 2018 17:19:45 +0000 (17:19 +0000)]
Type safe version of MachinePassRegistry

Previous version used type erasure through a `void* (*)()` pointer,
which triggered gcc warning and implied a lot of reinterpret_cast.

This version should make it harder to hit ourselves in the foot.

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

llvm-svn: 346522

6 years agoIntroduce the _Clang scoped attribute token.
Aaron Ballman [Fri, 9 Nov 2018 17:19:45 +0000 (17:19 +0000)]
Introduce the _Clang scoped attribute token.

Currently, we only accept clang as the scoped attribute identifier for double square bracket attributes provided by Clang, but this has the potential to conflict with user-defined macros. To help alleviate these concerns, this introduces the _Clang scoped attribute identifier as an alias for clang. It also introduces a warning with a fixit on the off chance someone attempts to use __clang__ as the scoped attribute (which is a predefined compiler identification macro).

llvm-svn: 346521

6 years agoUse the correct address space when emitting the ctor function list
Dylan McKay [Fri, 9 Nov 2018 17:15:06 +0000 (17:15 +0000)]
Use the correct address space when emitting the ctor function list

This patch modifies clang so that, if compiling for a target that
explicitly specifies a nonzero program memory address space, the
constructor list global will have the same address space as the
functions it contains.

AVR is the only in-tree backend which has a nonzero program memory
address space.

Without this, the IR verifier would always fail if a constructor
was used on a Harvard architecture backend.

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

llvm-svn: 346520

6 years agoAnnotate switch with LLVM_FALLTHROUGH
Adrian Prantl [Fri, 9 Nov 2018 17:11:17 +0000 (17:11 +0000)]
Annotate switch with LLVM_FALLTHROUGH

llvm-svn: 346519

6 years ago[docs][statepoints] Reformulate open issues list
Philip Reames [Fri, 9 Nov 2018 17:09:16 +0000 (17:09 +0000)]
[docs][statepoints] Reformulate open issues list

Some have been partially resolved, so update that.  And restructure to make it easie to find and search.

llvm-svn: 346518

6 years ago[NativePDB] Fix completion of enum types.
Zachary Turner [Fri, 9 Nov 2018 17:08:26 +0000 (17:08 +0000)]
[NativePDB] Fix completion of enum types.

This was originally submitted in a patch which fixed two unrelated
bugs at the same time.  This portion of the fix was reverted because
it broke several other things.  However, the fix employed originally
was totally wrong, and attempted to change something in the ValueObject
printer when actually the bug was in the NativePDB plugin.  We need
to mark forward enum decls as having external storage, otherwise
we won't be asked to complete them when the time comes.  This patch
implements the proper fix, and updates tests accordingly.

llvm-svn: 346517

6 years ago[WebAssembly] Respect `--no-mangle` in more locations
Sam Clegg [Fri, 9 Nov 2018 16:57:41 +0000 (16:57 +0000)]
[WebAssembly] Respect `--no-mangle` in more locations

`--no-demangle` now also applies to the name section.  This change
was motivated by the rust team that have a slightly different name
mangling scheme to the standard C++ itanium one and prefer to do their
de-mangling as a post-link setp.

Patch by Alex Crichton!

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

llvm-svn: 346516

6 years agoFix -Wsign-compare warning
Fangrui Song [Fri, 9 Nov 2018 16:45:37 +0000 (16:45 +0000)]
Fix -Wsign-compare warning

llvm-svn: 346515

6 years ago[llvm-cov] Remove "default:" label in the switch covering all enum values.
Max Moroz [Fri, 9 Nov 2018 16:44:36 +0000 (16:44 +0000)]
[llvm-cov] Remove "default:" label in the switch covering all enum values.

Summary:
Fixing the build breakage:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27309

Reviewers: vsk, allevato, Dor1s

Reviewed By: Dor1s

Subscribers: llvm-commits

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

llvm-svn: 346514

6 years ago[docs][statepoint] Expand a bit on problems with mixing references and raw pointers...
Philip Reames [Fri, 9 Nov 2018 16:40:34 +0000 (16:40 +0000)]
[docs][statepoint] Expand a bit on problems with mixing references and raw pointers since it keeps coming up in discussions

llvm-svn: 346513

6 years ago[Power9] Allow gpr callee saved spills in prologue to vectors registers
Zaara Syeda [Fri, 9 Nov 2018 16:36:24 +0000 (16:36 +0000)]
[Power9] Allow gpr callee saved spills in prologue to vectors registers

Currently in llvm, CalleeSavedInfo can only assign a callee saved register to
stack frame index to be spilled in the prologue. We would like to enable
spilling gprs to vector registers. This patch adds the capability to spill to
other registers aside from just the stack. It also adds the changes for power9
to spill gprs to volatile vector registers when they are available.
This happens only for leaf functions when using the option
-ppc-enable-pe-vector-spills.

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

llvm-svn: 346512

6 years ago[NativePDB] Add support for bitfield records.
Zachary Turner [Fri, 9 Nov 2018 16:29:19 +0000 (16:29 +0000)]
[NativePDB] Add support for bitfield records.

Bitfields are represented as LF_MEMBER records whose TypeIndex
points to an LF_BITFIELD record that describes the bit width,
bit offset, and underlying type of the bitfield.  All we need to
do is resolve these when resolving record types.

llvm-svn: 346511

6 years ago[CostModel] Add SK_ExtractSubvector handling to getInstructionThroughput (PR39368)
Simon Pilgrim [Fri, 9 Nov 2018 16:28:19 +0000 (16:28 +0000)]
[CostModel] Add SK_ExtractSubvector handling to getInstructionThroughput (PR39368)

Add ShuffleVectorInst::isExtractSubvectorMask helper to match shuffle masks.

llvm-svn: 346510

6 years ago[docs][statepoint] tweak a title
Philip Reames [Fri, 9 Nov 2018 16:27:04 +0000 (16:27 +0000)]
[docs][statepoint] tweak a title

llvm-svn: 346509

6 years agoRevert "[DEBUGINFO, NVPTX]DO not emit ',debug' option if no debug info or only debug...
Alexey Bataev [Fri, 9 Nov 2018 16:22:35 +0000 (16:22 +0000)]
Revert "[DEBUGINFO, NVPTX]DO not emit ',debug' option if no debug info or only debug directives are requested."

This reverts commit r345972. Need to update the description + possibly
to update the patch itself after discussion with Eric Christofer.

llvm-svn: 346508

6 years ago[OPENMP][NVPTX]Allow to use shared memory for the
Alexey Bataev [Fri, 9 Nov 2018 16:18:04 +0000 (16:18 +0000)]
[OPENMP][NVPTX]Allow to use shared memory for the
target|teams|distribute variables.

If the total size of the variables, declared in target|teams|distribute
regions, is less than the maximal size of shared memory available, the
buffer is allocated in the shared memory.

llvm-svn: 346507

6 years ago[llvm-cov] Add lcov tracefile export format.
Max Moroz [Fri, 9 Nov 2018 16:10:44 +0000 (16:10 +0000)]
[llvm-cov] Add lcov tracefile export format.

Summary:
lcov tracefiles are used by various coverage reporting tools and build
systems (e.g., Bazel). It is a simple text-based format to parse and
more convenient to use than the JSON export format, which needs
additional processing to map regions/segments back to line numbers.

It's a little unfortunate that "text" format is now overloaded to refer
specifically to JSON for export, but I wanted to avoid making any
breaking changes to the UI of the llvm-cov tool at this time.

Patch by Tony Allevato (@allevato).

Reviewers: Dor1s, vsk

Reviewed By: Dor1s, vsk

Subscribers: mgorny, llvm-commits

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

llvm-svn: 346506

6 years agoResubmit "Fix bug in PE/COFF plugin."
Zachary Turner [Fri, 9 Nov 2018 16:06:44 +0000 (16:06 +0000)]
Resubmit "Fix bug in PE/COFF plugin."

The original commit was actually 2 unrelated bug fixes, but it turns
out the second bug fix wasn't quite correct, so the entire patch was
reverted.  Resubmitting this half of the patch by itself, then will
follow up with a new patch which fixes the rest of the issue in a
more appropriate way.

llvm-svn: 346505