platform/upstream/llvm.git
6 years agoAdd CMake support for building for MinGW
Martin Storsjo [Mon, 2 Oct 2017 20:46:37 +0000 (20:46 +0000)]
Add CMake support for building for MinGW

This section is similar to what already exists in libcxx and libcxxabi.

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

llvm-svn: 314716

6 years agoAMDGPU: Fix typos
Matt Arsenault [Mon, 2 Oct 2017 20:31:18 +0000 (20:31 +0000)]
AMDGPU: Fix typos

llvm-svn: 314715

6 years agoAMDGPU: Fix potentially incorrectly matching check lines
Matt Arsenault [Mon, 2 Oct 2017 20:31:16 +0000 (20:31 +0000)]
AMDGPU: Fix potentially incorrectly matching check lines

These check lines are supposed to make sure the new d16
load instructions aren't used, but the expected instruction
name is a prefix of the incorrect instruction name.

llvm-svn: 314714

6 years agoAdd support for custom loaders to the sanitizer symbolizer
Francis Ricci [Mon, 2 Oct 2017 20:22:16 +0000 (20:22 +0000)]
Add support for custom loaders to the sanitizer symbolizer

Summary:
Adds a fallback mode to procmaps when the symbolizer
fails to locate a module for a given address by using
dl_iterate_phdr.

Reviewers: kubamracek, rnk, vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: srhines, llvm-commits

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

llvm-svn: 314713

6 years ago[InstCombine] auto-generate complete checks; NFC
Sanjay Patel [Mon, 2 Oct 2017 20:16:59 +0000 (20:16 +0000)]
[InstCombine] auto-generate complete checks; NFC

llvm-svn: 314712

6 years agoFix a data race found by tsan.
Rui Ueyama [Mon, 2 Oct 2017 20:16:13 +0000 (20:16 +0000)]
Fix a data race found by tsan.

Reads from `Live` and writes to `OutputOff` in the following code race
even though they are logically independent because they are bitfields
sharing the same word.

  for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) {
    if (!Sec->Pieces[I].Live)
      continue;
    CachedHashStringRef Str = Sec->getData(I);
    size_t ShardId = getShardId(Str.hash());
    if ((ShardId & (Concurrency - 1)) == ThreadId)
      Sec->Pieces[I].OutputOff = Shards[ShardId].add(Str);
  }

llvm-svn: 314711

6 years ago[InstCombine] add icmp (shr X, Y), 0 test; NFC
Sanjay Patel [Mon, 2 Oct 2017 20:07:15 +0000 (20:07 +0000)]
[InstCombine] add icmp (shr X, Y), 0 test; NFC

llvm-svn: 314710

6 years agoFix two header comments. NFC.
Hans Wennborg [Mon, 2 Oct 2017 19:48:28 +0000 (19:48 +0000)]
Fix two header comments. NFC.

llvm-svn: 314709

6 years agoAdd std::move in RefactoringActionRulesTest.cpp
Alex Lorenz [Mon, 2 Oct 2017 19:02:42 +0000 (19:02 +0000)]
Add std::move in RefactoringActionRulesTest.cpp

Should fix http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental

llvm-svn: 314708

6 years agoRewrite a comment.
Rui Ueyama [Mon, 2 Oct 2017 18:54:59 +0000 (18:54 +0000)]
Rewrite a comment.

llvm-svn: 314707

6 years agoAdd support for Myriad ma2x8x series of CPUs
Walter Lee [Mon, 2 Oct 2017 18:50:57 +0000 (18:50 +0000)]
Add support for Myriad ma2x8x series of CPUs

Summary:
Also:
- Add support for some older Myriad CPUs that were missing.
- Fix some incorrect compiler defines for exisitng CPUs.

Reviewers: jyknight

Subscribers: fedor.sergeev

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

llvm-svn: 314706

6 years agoAdd support for Myriad ma2x8x series of CPUs
Walter Lee [Mon, 2 Oct 2017 18:50:48 +0000 (18:50 +0000)]
Add support for Myriad ma2x8x series of CPUs

Summary: Also add support for some older Myriad CPUs that were missing.

Reviewers: jyknight

Subscribers: fedor.sergeev

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

llvm-svn: 314705

6 years ago[refactor] Simplify the refactoring interface
Alex Lorenz [Mon, 2 Oct 2017 18:42:43 +0000 (18:42 +0000)]
[refactor] Simplify the refactoring interface

This commit simplifies the interface for the refactoring action rules and the
refactoring requirements. It merges the selection constraints and the selection
requirements into one class. The refactoring actions rules must now be
implemented using subclassing instead of raw function / lambda pointers. This
change also removes a bunch of template-based traits and other
template definitions that are now redundant.

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

llvm-svn: 314704

6 years agointeger/sub_sat: Use clang builtin instead of llvm asm
Jan Vesely [Mon, 2 Oct 2017 18:39:03 +0000 (18:39 +0000)]
integer/sub_sat: Use clang builtin instead of llvm asm

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314703

6 years agointeger/add_sat: Use clang builtin instead of llvm asm
Jan Vesely [Mon, 2 Oct 2017 18:39:00 +0000 (18:39 +0000)]
integer/add_sat: Use clang builtin instead of llvm asm

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314702

6 years agointeger/clz: Use clang builtin instead of llvm asm
Jan Vesely [Mon, 2 Oct 2017 18:38:57 +0000 (18:38 +0000)]
integer/clz: Use clang builtin instead of llvm asm

The generated llvm IR mostly identical. char/uchar case is a bit worse.

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314701

6 years agoAdd a testcase to check that debug info is upgraded when compiling LLVM IR
Adrian Prantl [Mon, 2 Oct 2017 18:31:52 +0000 (18:31 +0000)]
Add a testcase to check that debug info is upgraded when compiling LLVM IR
through clang.

llvm-svn: 314700

6 years agoMove the stripping of invalid debug info from the Verifier to AutoUpgrade.
Adrian Prantl [Mon, 2 Oct 2017 18:31:29 +0000 (18:31 +0000)]
Move the stripping of invalid debug info from the Verifier to AutoUpgrade.

This came out of a recent discussion on llvm-dev
(https://reviews.llvm.org/D38042). Currently the Verifier will strip
the debug info metadata from a module if it finds the dbeug info to be
malformed. This feature is very valuable since it allows us to improve
the Verifier by making it stricter without breaking bcompatibility,
but arguable the Verifier pass should not be modifying the IR. This
patch moves the stripping of broken debug info into AutoUpgrade
(UpgradeDebugInfo to be precise), which is a much better location for
this since the stripping of malformed (i.e., produced by older, buggy
versions of Clang) is a (harsh) form of AutoUpgrade.

This change is mostly NFC in nature, the one big difference is the
behavior when LLVM module passes are introducing malformed debug
info. Prior to this patch, a NoAsserts build would have printed a
warning and stripped the debug info, after this patch the Verifier
will report a fatal error. I believe this behavior is actually more
desirable anyway.

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

llvm-svn: 314699

6 years ago[InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp...
Sanjay Patel [Mon, 2 Oct 2017 18:26:44 +0000 (18:26 +0000)]
[InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

llvm-svn: 314698

6 years agoRevert "Add /System/Library/PrivateFrameworks as a header search path."
Douglas Gregor [Mon, 2 Oct 2017 18:22:19 +0000 (18:22 +0000)]
Revert "Add /System/Library/PrivateFrameworks as a header search path."

This reverts commit f7a95215a435aa8d5f64f43a8bb23ba077270755.

llvm-svn: 314697

6 years ago[InstCombine] add icmp (lshr X, C1), C2 test; NFC
Sanjay Patel [Mon, 2 Oct 2017 18:16:17 +0000 (18:16 +0000)]
[InstCombine] add icmp (lshr X, C1), C2 test; NFC

llvm-svn: 314696

6 years agoFix building on macOS after SVN r314492
Martin Storsjo [Mon, 2 Oct 2017 18:14:06 +0000 (18:14 +0000)]
Fix building on macOS after SVN r314492

That commit incorrectly expanded the assumption that defined(__APPLE__)
implies SjLj exception handling, which only is true within ARM
code sections.

llvm-svn: 314695

6 years agoUpdate getMergedLocation to check the instruction type and merge properly.
Dehao Chen [Mon, 2 Oct 2017 18:13:14 +0000 (18:13 +0000)]
Update getMergedLocation to check the instruction type and merge properly.

Summary: If the merged instruction is call instruction, we need to set the scope to the closes common scope between 2 locations, otherwise it will cause trouble when the call is getting inlined.

Reviewers: dblaikie, aprantl

Reviewed By: dblaikie, aprantl

Subscribers: llvm-commits, sanjoy

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

llvm-svn: 314694

6 years ago[clangd] Handle workspace/didChangeWatchedFiles
Marc-Andre Laperle [Mon, 2 Oct 2017 18:00:37 +0000 (18:00 +0000)]
[clangd] Handle workspace/didChangeWatchedFiles

Summary:
The client can send notifications when it detects watched files have
changed. This patch adds the protocol handling for this type of notification.
For now, the notification will be passed down to the ClangdServer, but it will
not be acted upon. However, this will become useful for the indexer to react
to file changes.
The events could also potentially be used to invalidate other caches
(compilation database, etc).

This change also updates the VSCode extension so that it sends the events.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewers: ilya-biryukov, Nebiroth

Subscribers: ilya-biryukov

Tags: #clang-tools-extra

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

llvm-svn: 314693

6 years ago[Analyzer] Make testing scripts flake8 compliant
George Karpenkov [Mon, 2 Oct 2017 17:59:12 +0000 (17:59 +0000)]
[Analyzer] Make testing scripts flake8 compliant

Differential Review: https://reviews.llvm.org/D38213

llvm-svn: 314692

6 years ago[CUDA] Fix name of __activemask()
Jonas Hahnfeld [Mon, 2 Oct 2017 17:50:11 +0000 (17:50 +0000)]
[CUDA] Fix name of __activemask()

The name has two underscores in the official CUDA documentation:
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#warp-vote-functions

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

llvm-svn: 314691

6 years agoCodeView symbol dumper: use symbolic names for registers
Hans Wennborg [Mon, 2 Oct 2017 17:44:47 +0000 (17:44 +0000)]
CodeView symbol dumper: use symbolic names for registers

https://reviews.llvm.org/D38469

llvm-svn: 314690

6 years agoRevert "[Sema] Warn on attribute nothrow conflicting with language specifiers"
Reid Kleckner [Mon, 2 Oct 2017 17:16:14 +0000 (17:16 +0000)]
Revert "[Sema] Warn on attribute nothrow conflicting with language specifiers"

This reverts r314461.

It is warning on user code that uses END_COM_MAP(), which expands to
declare QueryInterface with conflicting exception specifers. I've spent
a while trying to understand why, but haven't been able to extract a
reduced test case. Let's revert and I'll keep trying.

llvm-svn: 314689

6 years agoEliminate ftrunc if source is know to be rounded
Stanislav Mekhanoshin [Mon, 2 Oct 2017 16:57:07 +0000 (16:57 +0000)]
Eliminate ftrunc if source is know to be rounded

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

llvm-svn: 314688

6 years agoUpdate IUnknown lit test to pass on Win32
Erich Keane [Mon, 2 Oct 2017 16:49:32 +0000 (16:49 +0000)]
Update IUnknown lit test to pass on Win32

llvm-svn: 314687

6 years ago[OPENMP] Capture argument of `device` clause for target-based
Alexey Bataev [Mon, 2 Oct 2017 16:32:39 +0000 (16:32 +0000)]
[OPENMP] Capture argument of `device` clause for target-based
directives.

The argument of the `device` clause in target-based executable
directives must be captured to support codegen for the `target`
directives with the `depend` clauses.

llvm-svn: 314686

6 years ago[dwarfdump] Add -show-form
Jonas Devlieghere [Mon, 2 Oct 2017 16:02:04 +0000 (16:02 +0000)]
[dwarfdump] Add -show-form

This enables printing of DWARF form types after the DWARF attribute
types.

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

llvm-svn: 314685

6 years agoRevert "Add support for custom loaders to the sanitizer symbolizer"
Francis Ricci [Mon, 2 Oct 2017 15:55:11 +0000 (15:55 +0000)]
Revert "Add support for custom loaders to the sanitizer symbolizer"

This reverts commit r314671, which hangs on the gcc sanitizer buildbot.

llvm-svn: 314684

6 years ago[clang-format] Fix regression about short functions after #else
Krasimir Georgiev [Mon, 2 Oct 2017 15:53:37 +0000 (15:53 +0000)]
[clang-format] Fix regression about short functions after #else

Summary:
This patch fixes a regression introduced in r312904, where the formatter confuses
the `else` in `#else` with an `else` of an `if-else` statement.
For example, formatting this code with google style
```
#ifdef A
int f() {}
#else
int f() {}
#endif
```
resulted in
```
#ifdef A
int f() {}
#else
int f() {
}
#endif
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 314683

6 years ago[X86][SSE] Add PACKSS/PACKUS constant folding tests
Simon Pilgrim [Mon, 2 Oct 2017 15:43:26 +0000 (15:43 +0000)]
[X86][SSE] Add PACKSS/PACKUS constant folding tests

llvm-svn: 314682

6 years agoRegenerate test (missing broadcast constant comments). NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 15:22:35 +0000 (15:22 +0000)]
Regenerate test (missing broadcast constant comments). NFCI.

Still avoiding the floating point comments to prevent linux/windows discrepancies.

llvm-svn: 314681

6 years agoRegenerate test (missing broadcast constant comments). NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 15:21:14 +0000 (15:21 +0000)]
Regenerate test (missing broadcast constant comments). NFCI.

llvm-svn: 314680

6 years agoRegenerate test. NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 15:16:30 +0000 (15:16 +0000)]
Regenerate test. NFCI.

llvm-svn: 314679

6 years ago[clangd] Command line arg to specify compile_commands.json path
Ilya Biryukov [Mon, 2 Oct 2017 15:13:20 +0000 (15:13 +0000)]
[clangd] Command line arg to specify compile_commands.json path

Summary: Adds compileCommands command line argument to specify an absolute path directly to the requested compile_commands.json for flags.

Reviewed By: ilya-biryukov

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

llvm-svn: 314678

6 years ago[clangd] Run clang-format on the source code. NFC.
Ilya Biryukov [Mon, 2 Oct 2017 15:10:41 +0000 (15:10 +0000)]
[clangd] Run clang-format on the source code. NFC.

llvm-svn: 314677

6 years agouse range-for-loops; NFCI
Sanjay Patel [Mon, 2 Oct 2017 15:02:06 +0000 (15:02 +0000)]
use range-for-loops; NFCI

llvm-svn: 314676

6 years ago[MIPS] Fix PLT entries generation in case of linking regular and microMIPS code
Simon Atanasyan [Mon, 2 Oct 2017 14:56:41 +0000 (14:56 +0000)]
[MIPS] Fix PLT entries generation in case of linking regular and microMIPS code

Currently LLD calls the `isMicroMips` routine to determine type of PLT entries
needs to be generated: regular or microMIPS. This routine checks ELF
header flags in the `FirstObj` to retrieve type of linked object files.
So if the first file does not contain microMIPS code, LLD will generate
PLT entries with regular (non-microMIPS) code only.

Ideally, if a PLT entry is referenced by microMIPS code only this entry
should contain microMIPS code, if a PLT entry is referenced by regular
code this entry should contain regular code. In a "mixed" case the PLT
entry can be either microMIPS or regular, but each "cross-mode-call" has
additional cost.

It's rather difficult to implement this ideal solution. But we can
assume that if there is an input object file with microMIPS code, the
most part of the code is microMIPS too. So we need to deduce type of PLT
entries based on finally calculated ELF header flags and do not check
only the first input object file.

This change implements this.
  - The `getMipsEFlags` renamed to the `calcMipsEFlags`. The function
    called from the `LinkerDriver::link`. Result is stored in
    the Configuration::MipsEFlags field.
  - The `isMicroMips` and `isMipsR6` routines access the `MipsEFlags`
    field to get and check calculated ELF flags.
  - New types of PLT records created when necessary.

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

llvm-svn: 314675

6 years ago[AsmParser] Support GAS's .print directive
Coby Tayree [Mon, 2 Oct 2017 14:36:31 +0000 (14:36 +0000)]
[AsmParser] Support GAS's .print directive

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

llvm-svn: 314674

6 years ago[OPENMP] Fix test, NFC.
Alexey Bataev [Mon, 2 Oct 2017 14:35:31 +0000 (14:35 +0000)]
[OPENMP] Fix test, NFC.

llvm-svn: 314673

6 years agoImprove FreeBSD kernel debugging
Ed Maste [Mon, 2 Oct 2017 14:35:07 +0000 (14:35 +0000)]
Improve FreeBSD kernel debugging

FreeBSD kernel modules are actually relocatable (.o) ELF files and this
previously caused some issues for LLDB. This change addresses these when
using lldb to symbolicate FreeBSD kernel backtraces.

The major problems:

- Relocations were not being applied to the DWARF debug info despite
  there being code to do this. Several issues prevented it from working:

  - Relocations are computed at the same time as the symbol table, but
    in the case of split debug files, symbol table parsing always
    redirects to the primary object file, meaning that relocations would
    never be applied in the debug file.

  - There's actually no guarantee that the symbol table has been parsed
    yet when trying to parse debug information.

  - When actually applying relocations, it will segfault because the
    object files are not mapped with MAP_PRIVATE and PROT_WRITE.

- LLDB returned invalid results when performing ordinary address-to-
  symbol resolution. It turned out that the addresses specified in the
  section headers were all 0, so LLDB believed all the sections had
  overlapping "file addresses" and would sometimes return a symbol from
  the wrong section.

Patch by Brian Koropoff

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

llvm-svn: 314672

6 years agoAdd support for custom loaders to the sanitizer symbolizer
Francis Ricci [Mon, 2 Oct 2017 14:30:58 +0000 (14:30 +0000)]
Add support for custom loaders to the sanitizer symbolizer

Summary:
Adds a fallback mode to procmaps when the symbolizer
fails to locate a module for a given address by using
dl_iterate_phdr.

Reviewers: kubamracek, rnk, vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: srhines, llvm-commits

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

llvm-svn: 314671

6 years ago[OPENMP] Simplify codegen for non-offloading code.
Alexey Bataev [Mon, 2 Oct 2017 14:20:58 +0000 (14:20 +0000)]
[OPENMP] Simplify codegen for non-offloading code.

Simplified and generalized codegen for non-offloading part that works if
offloading is failed or condition of the `if` clause is `false`.

llvm-svn: 314670

6 years agoremove duplicate comments, reposition related functions; NFC
Sanjay Patel [Mon, 2 Oct 2017 14:03:17 +0000 (14:03 +0000)]
remove duplicate comments, reposition related functions; NFC

llvm-svn: 314669

6 years agoDependent Address Space Support Test Fix
Andrew Gozillon [Mon, 2 Oct 2017 13:32:59 +0000 (13:32 +0000)]
Dependent Address Space Support Test Fix

Modifying a non-type template integer arguement that is causing errors
in some builds as it's too large for 32-bit longs. This hopefully (and
seems to when testing) should fix all of the build bot errors relating
to this test. I also modified the name of the function call to be more
apt.

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

llvm-svn: 314668

6 years ago[X86][SSE] Fix -Wsign-compare problems introduced in r314658
Bjorn Pettersson [Mon, 2 Oct 2017 12:46:38 +0000 (12:46 +0000)]
[X86][SSE] Fix -Wsign-compare problems introduced in r314658

The refactoring in
"[X86][SSE] Add createPackShuffleMask helper function. NFCI."
resulted in warning when compiling the code (seen in build bots).

This patch restores some types from int to unsigned to avoid
those warnings.

llvm-svn: 314667

6 years ago[Debug info] Handle endianness when moving debug info for split integer values
Bjorn Pettersson [Mon, 2 Oct 2017 12:46:32 +0000 (12:46 +0000)]
[Debug info] Handle endianness when moving debug info for split integer values

Summary:
Take the target's endianness into account when splitting the
debug information in DAGTypeLegalizer::SetExpandedInteger.

This patch fixes so that, for big-endian targets, the fragment
expression corresponding to the high part of a split integer
value is placed at offset 0, in order to correctly represent
the memory address order.

I have attached a PPC32 reproducer where the resulting DWARF
pieces for a 64-bit integer were incorrectly reversed.

Patch by: dstenb

Reviewers: JDevlieghere, aprantl, dblaikie

Reviewed By: JDevlieghere, aprantl, dblaikie

Subscribers: nemanjai

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

llvm-svn: 314666

6 years ago[ScopBuilder] Iterate over statement instructions. NFC.
Michael Kruse [Mon, 2 Oct 2017 11:41:33 +0000 (11:41 +0000)]
[ScopBuilder] Iterate over statement instructions. NFC.

Iterate over statement instructions instead over basic block
instructions when creating MemoryAccesses. It allows making the creation
of MemoryAccesses independent of how the basic blocks are split into
multiple ScopStmts.

llvm-svn: 314665

6 years ago[ScopBuilder] Build invariant loads separately.
Michael Kruse [Mon, 2 Oct 2017 11:41:27 +0000 (11:41 +0000)]
[ScopBuilder] Build invariant loads separately.

Create the MemoryAccesses of invariant loads separately and before
all other MemoryAccesses.

Invariant loads are classified as synthesizable and therefore are not
contained in any statement. When iterating over all instructions of all
statements, the invariant loads are consequently not processed and
iterating over them separately becomes necessary.

This patch can change the order in which MemoryAccesses are created, but
otherwise has no functional change.

Some temporary code is introduced to ensure correctness, but will be
removed in the next commit.

llvm-svn: 314664

6 years ago[ScopBuilder] Build escaping dependencies separately.
Michael Kruse [Mon, 2 Oct 2017 11:41:19 +0000 (11:41 +0000)]
[ScopBuilder] Build escaping dependencies separately.

Instructions that compute escaping values might be synthesizable and
therefore not contained in any ScopStmt. When buildAccessFunctions is
changed to only iterate over the instruction list of statement,
"free" instructions still need to be written. We do this after the
main MemoryAccesses have been created.

This can change the order in which MemoryAccesses are created, but has
otherwise no functional change.

llvm-svn: 314663

6 years ago[ScopBuilder] Specialize exit block handling. NFC.
Michael Kruse [Mon, 2 Oct 2017 11:41:12 +0000 (11:41 +0000)]
[ScopBuilder] Specialize exit block handling. NFC.

Decouple handling of exit block PHIs and other MemoryAccesses. Exit PHIs
only need the PHI handling part of buildAccessFunctions but requires
code for skipping them in while creating other MemoryAcesses.

This change will make it easier to modify how statement MemoryAccesses
are created without considering the exit block special case.

llvm-svn: 314662

6 years ago[ForwardOpTree] Fix out-of-quota in assertion.
Michael Kruse [Mon, 2 Oct 2017 11:41:06 +0000 (11:41 +0000)]
[ForwardOpTree] Fix out-of-quota in assertion.

llvm-svn: 314661

6 years ago[CodeGen] Have a special function to get TBAA info for may-alias accesses
Ivan A. Kosarev [Mon, 2 Oct 2017 11:10:04 +0000 (11:10 +0000)]
[CodeGen] Have a special function to get TBAA info for may-alias accesses

This is part of D37826 reworked to be a separate patch to
simplify review.

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

llvm-svn: 314660

6 years agoUse %run for running CFI tests
Filipe Cabecinhas [Mon, 2 Oct 2017 10:21:26 +0000 (10:21 +0000)]
Use %run for running CFI tests

Reviewers: pcc, krasin, eugenis

Subscribers: llvm-commits

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

llvm-svn: 314659

6 years ago[X86][SSE] Add createPackShuffleMask helper function. NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 10:12:51 +0000 (10:12 +0000)]
[X86][SSE] Add createPackShuffleMask helper function. NFCI.

llvm-svn: 314658

6 years ago[CodeGen] Do not refer to complete TBAA info where we actually deal with just TBAA...
Ivan A. Kosarev [Mon, 2 Oct 2017 09:54:47 +0000 (09:54 +0000)]
[CodeGen] Do not refer to complete TBAA info where we actually deal with just TBAA access types

This patch fixes misleading names of entities related to getting,
setting and generation of TBAA access type descriptors.

This is effectively an attempt to provide a review for D37826 by
breaking it into smaller pieces.

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

llvm-svn: 314657

6 years ago[X86][SSE] matchBinaryVectorShuffle - add support for different src/dst value shuffle...
Simon Pilgrim [Mon, 2 Oct 2017 09:45:08 +0000 (09:45 +0000)]
[X86][SSE] matchBinaryVectorShuffle - add support for different src/dst value shuffle types

Preparation for support for combining to PACKSS/PACKUS

llvm-svn: 314656

6 years ago[PowerPC] support ZERO_EXTEND in tryBitPermutation
Hiroshi Inoue [Mon, 2 Oct 2017 09:24:00 +0000 (09:24 +0000)]
[PowerPC] support ZERO_EXTEND in tryBitPermutation

This patch add a support of ISD::ZERO_EXTEND in PPCDAGToDAGISel::tryBitPermutation to increase the opportunity to use rotate-and-mask by reordering ZEXT and ANDI.
Since tryBitPermutation stops analyzing nodes if it hits a ZEXT node while traversing SDNodes, we want to avoid ZEXT between two nodes that can be folded into a rotate-and-mask instruction.

For example, we allow these nodes

      t9: i32 = add t7, Constant:i32<1>
    t11: i32 = and t9, Constant:i32<255>
  t12: i64 = zero_extend t11
t14: i64 = shl t12, Constant:i64<2>

to be folded into a rotate-and-mask instruction.
Such case often happens in array accesses with logical AND operation in the index, e.g. array[i & 0xFF];

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

llvm-svn: 314655

6 years ago[ELF] - Stop removing sections in removeUnusedSyntheticSections().
George Rimar [Mon, 2 Oct 2017 09:11:13 +0000 (09:11 +0000)]
[ELF] - Stop removing sections in removeUnusedSyntheticSections().

That makes code a bit more consistent. Instead of removing sections there
we can just mark them as dead. So that removeEmptyCommands() will
handle the rest.

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

llvm-svn: 314654

6 years agoFix typo in comment. NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 09:10:50 +0000 (09:10 +0000)]
Fix typo in comment. NFCI.

llvm-svn: 314653

6 years ago[X86] Cleanup uses of computeKnownBits by using MaskedValueIsZero helper instead...
Simon Pilgrim [Mon, 2 Oct 2017 09:08:45 +0000 (09:08 +0000)]
[X86] Cleanup uses of computeKnownBits by using MaskedValueIsZero helper instead. NFCI.

llvm-svn: 314652

6 years ago[X86][LLVM]Expanding Supports lowerInterleaved{store|load}() in X86InterleavedAccess...
Michael Zuckerman [Mon, 2 Oct 2017 07:35:25 +0000 (07:35 +0000)]
[X86][LLVM]Expanding Supports lowerInterleaved{store|load}() in X86InterleavedAccess (VF64 stride 3-4)
I continue to support different VF interleaved and in this pass for this patch,
I added the vf64 stride3 support for both load and store.
I also added support fot the stride4 store.

Reviewers:
1. zvi
2. dorit
3. igorb
4. guyblank

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

Change-Id: I3d238efedf217d1768b348d710de1efa2f19d27b
llvm-svn: 314651

6 years agoDependent Address Space Support Test File
Andrew Gozillon [Mon, 2 Oct 2017 06:31:25 +0000 (06:31 +0000)]
Dependent Address Space Support Test File

Adding regression test for Dependent Address Spaces in relation to
https://reviews.llvm.org/D33666 I forgot to svn add the test file
before commiting the prior changes. I appologies.

llvm-svn: 314650

6 years agoDependent Address Space Support
Andrew Gozillon [Mon, 2 Oct 2017 06:25:51 +0000 (06:25 +0000)]
Dependent Address Space Support

This patch relates to: https://reviews.llvm.org/D33666 This adds support
for template parameters to be passed to the address_space attribute.
The main goal is to add further flexibility to the attribute and allow
for it to be used easily with templates.

The main additions are a new type (DependentAddressSpaceType) alongside
its TypeLoc and its mangling. As well as the logic required to support
dependent address spaces which mainly resides in TreeTransform.h and
SemaType.cpp.

llvm-svn: 314649

6 years ago[X86] Fix copy pasto in X86FastISel::fastEmitInst_rrrr.
Craig Topper [Mon, 2 Oct 2017 05:46:53 +0000 (05:46 +0000)]
[X86] Fix copy pasto in X86FastISel::fastEmitInst_rrrr.

The 4th operand was not being constrained and the third operand was being constrained twice.

llvm-svn: 314648

6 years ago[X86] Use a bool flag instead of assigning an unsigned to two different values that...
Craig Topper [Mon, 2 Oct 2017 05:46:52 +0000 (05:46 +0000)]
[X86] Use a bool flag instead of assigning an unsigned to two different values that we only use in an equality comparison.

llvm-svn: 314647

6 years ago[cmake] Add a separate CMake var to control profile runtime
Michal Gorny [Mon, 2 Oct 2017 05:03:55 +0000 (05:03 +0000)]
[cmake] Add a separate CMake var to control profile runtime

Make it possible to control building profile runtime separately from
other options. Before r313549, the profile runtime building was
controlled along with sanitizers. However, since that commit it is built
unconditionally which results in multiple builds for people building
different runtimes separately.

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

llvm-svn: 314646

6 years agoUpdate for LLVM change.
Rui Ueyama [Mon, 2 Oct 2017 02:09:58 +0000 (02:09 +0000)]
Update for LLVM change.

r314639 ([X86] Change register&memory TEST instructions from MRMSrcMem
to MRMDstMem) broke the test.

llvm-svn: 314645

6 years ago[ICF] Include section contents in section hash values.
Rui Ueyama [Mon, 2 Oct 2017 01:21:07 +0000 (01:21 +0000)]
[ICF] Include section contents in section hash values.

Computing section content hashes early seems like a win in terms of
performance. It increases a chance that two different sections will get
different class IDs from the beginning.

Without threads, this patch improves Chromium link time by about 0.3
seconds. With threads, by 0.1 seconds. That's less than 1% time saving
but not bad for a small patch.

llvm-svn: 314644

6 years ago[X86] Use _NOREX MOVZX instructions for some patterns even in 32-bit mode.
Craig Topper [Mon, 2 Oct 2017 00:44:50 +0000 (00:44 +0000)]
[X86] Use _NOREX MOVZX instructions for some patterns even in 32-bit mode.

This unifies the patterns between both modes. This should be effectively NFC since all the available registers in 32-bit mode statisfy this constraint.

llvm-svn: 314643

6 years ago[Hexagon] Check vector elements for equivalence in the HexagonVectorLoopCarriedReuse...
Ron Lieberman [Mon, 2 Oct 2017 00:34:07 +0000 (00:34 +0000)]
[Hexagon] Check vector elements for equivalence in the HexagonVectorLoopCarriedReuse pass

    If the two instructions being compared for equivalence have corresponding operands
    that are integer constants, then check their values to determine equivalence.

    Patch by Suyog Sarda!

llvm-svn: 314642

6 years ago[Hexagon] Patch to Extract i1 element from vector of i1
Ron Lieberman [Mon, 2 Oct 2017 00:16:15 +0000 (00:16 +0000)]
[Hexagon] Patch to Extract i1 element from vector of i1

This patch extracts 1 element from vector consisting
of elements of size 1 bit at given index.

llvm-svn: 314641

6 years ago[InstCombine] Use APInt for all the math in foldICmpDivConstant
Craig Topper [Sun, 1 Oct 2017 23:53:54 +0000 (23:53 +0000)]
[InstCombine] Use APInt for all the math in foldICmpDivConstant

Summary: This currently uses ConstantExpr to do its math, but as noted in a TODO it can all be done directly on APInt.

Reviewers: spatel, majnemer

Reviewed By: majnemer

Subscribers: llvm-commits

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

llvm-svn: 314640

6 years ago[X86] Change register&memory TEST instructions from MRMSrcMem to MRMDstMem
Craig Topper [Sun, 1 Oct 2017 23:53:53 +0000 (23:53 +0000)]
[X86] Change register&memory TEST instructions from MRMSrcMem to MRMDstMem

Summary:
Intel documentation shows the memory operand as the first operand. But we currently treat it as the second operand. Conceptually the order doesn't matter since it doesn't write memory. We have aliases to parse with the operands in either order and the isel matching is commutable.

For the register&register form order does matter for the assembly parser. PR22995 was previously filed and fixed by changing the register&register form from MRMSrcReg to MRMDestReg to match gas. Ideally the memory form should match by using MRMDestMem.

I believe this supercedes D38025 which was trying to switch the register&register form back to pre-PR22995.

Reviewers: aymanmus, RKSimon, zvi

Reviewed By: aymanmus

Subscribers: llvm-commits

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

llvm-svn: 314639

6 years ago[X86] Remove a couple unnecessary COPY_TO_REGCLASS from some output patterns where...
Craig Topper [Sun, 1 Oct 2017 23:53:50 +0000 (23:53 +0000)]
[X86] Remove a couple unnecessary COPY_TO_REGCLASS from some output patterns where the instruction already produces the correct register class.

llvm-svn: 314638

6 years agoInline hot functions.
Rui Ueyama [Sun, 1 Oct 2017 23:46:31 +0000 (23:46 +0000)]
Inline hot functions.

llvm-svn: 314637

6 years ago[ScopDetect] Do not add loads out of the SCoP to required invariant loads.
Michael Kruse [Sun, 1 Oct 2017 22:19:28 +0000 (22:19 +0000)]
[ScopDetect] Do not add loads out of the SCoP to required invariant loads.

Loads before the SCoP are always invariant within the SCoP and
therefore are no "required invariant loads". An assertion failes in
ScopBuilder when it finds such an invariant load.

Fix by not adding such loads to the required invariant load list. This
likely will cause the region to be not considered a valid SCoP.
We may want to unconditionally accept instructions defined before
the region as valid invariant conditions instead of rejecting them.

This fixes a compilation crash of SPEC CPU2006 453.povray's
render.cpp.

llvm-svn: 314636

6 years agoSjLj: Fix building after SVN r314632
Martin Storsjo [Sun, 1 Oct 2017 20:22:40 +0000 (20:22 +0000)]
SjLj: Fix building after SVN r314632

The code moved from Unwind_AppleExtras.cpp to Unwind-sjlj.c needed
a few minor modifications to build as C instead of C++.

llvm-svn: 314635

6 years agoLet get_work_dim take exactly 0 arguments
Jeroen Ketema [Sun, 1 Oct 2017 20:11:46 +0000 (20:11 +0000)]
Let get_work_dim take exactly 0 arguments

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314634

6 years agoDo no circularly define NULL
Jeroen Ketema [Sun, 1 Oct 2017 20:10:14 +0000 (20:10 +0000)]
Do no circularly define NULL

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314633

6 years agoSjLj: make the SjLj implementation more portable
Saleem Abdulrasool [Sun, 1 Oct 2017 20:06:48 +0000 (20:06 +0000)]
SjLj: make the SjLj implementation more portable

This moves the definition of the internal helpers
`__Unwind_SjLj_GetTopOfFunctionStack` and
`__Unwind_SjLj_SetTopOfFunctionStack` into `Unwind-sjlj.c`.  These are
not extra functions specific to Apple, but rather are internal
implementation details of SjLj support in the LLVM libunwind
implementation.

This allows us to remove the internal header unwind_ext.h, as these
functions are not meant to be used as SPI either.  Because they are
static, they will be given implicit hidden visibility, but due to the
simplicity should get fully inlined into the actual use.

Use the C11 standard static TLS annotation (`_Thread_local`) if
possible, otherwise, use the Windows specific `__declspec(thread)` when
targeting Windows or the GNU `__thread` extension.  In theory, it should
be possible for this implementation to use a `pthread_setspecific` and
`pthread_getspecific` on platforms with pthreads or `SetFlsValue` and
`GetFlsValue` on Windows for non-static TLS.  However, static TLS tends
to be significantly faster, so we really should prefer that over the
dynamic TLS approach.  On Apple environments, when not building for the
loader (dyld), use the pre-allocated TLS slot in the loader rather than
the local static TLS variable.

Note that the un-threaded support of libunwind is still present as
before, however, it is unsafe to use in a threaded environment as the
cleanup stack may be mutated incorrectly due to lack of locking across
threads.  In the static TLS model, the lock is unneeded as each thread
of execution retains its own copy of the cleanup stack.

Take the opportunity to clean up the comment block, removing the iOS
specific note as the SjLj implementation can be used outside of the
context of iOS.  Convert the rest of the explanation to a doxygen style
comment block.

llvm-svn: 314632

6 years ago[X86][SSE] Add faux shuffle combining support for PACKUS
Simon Pilgrim [Sun, 1 Oct 2017 18:43:48 +0000 (18:43 +0000)]
[X86][SSE] Add faux shuffle combining support for PACKUS

llvm-svn: 314631

6 years ago[X86][AVX2] Simplify PACKUS combine test
Simon Pilgrim [Sun, 1 Oct 2017 18:17:39 +0000 (18:17 +0000)]
[X86][AVX2] Simplify PACKUS combine test

Trying to use a AND mask is tricky as after legalization its nigh impossible for computeKnownBits to do anything with it

llvm-svn: 314630

6 years ago[X86][SSE] Improve shuffle combining of PACKSS instructions.
Simon Pilgrim [Sun, 1 Oct 2017 17:54:55 +0000 (17:54 +0000)]
[X86][SSE] Improve shuffle combining of PACKSS instructions.

Support unary packing and fix the faux shuffle mask for vectors larger than 128 bits.

llvm-svn: 314629

6 years ago[X86][SSE] Add shuffle combining tests with PACKSS/PACKUS
Simon Pilgrim [Sun, 1 Oct 2017 17:30:44 +0000 (17:30 +0000)]
[X86][SSE] Add shuffle combining tests with PACKSS/PACKUS

llvm-svn: 314628

6 years ago[x86] formatting; NFC
Sanjay Patel [Sun, 1 Oct 2017 14:39:10 +0000 (14:39 +0000)]
[x86] formatting; NFC

llvm-svn: 314627

6 years agopre-commit adding test for broadcastm pattern
Jina Nahias [Sun, 1 Oct 2017 14:25:21 +0000 (14:25 +0000)]
pre-commit adding test for broadcastm pattern

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

Change-Id: Ifbc4189549f2f59995019a86f85f989c04e4d37d
llvm-svn: 314626

6 years agoAdd missing REQUIRES line
Tobias Grosser [Sun, 1 Oct 2017 13:14:40 +0000 (13:14 +0000)]
Add missing REQUIRES line

llvm-svn: 314625

6 years ago[GPGPU] Set Polly's RTC to false in case invariant load hoisting fails
Tobias Grosser [Sun, 1 Oct 2017 12:39:14 +0000 (12:39 +0000)]
[GPGPU] Set Polly's RTC to false in case invariant load hoisting fails

This matches the behavior we already have in lib/Codegen/CodeGeneration.cpp and
makes sure that we fall back to the original code. It seems when invariant load
hoisting was introduced to the GPGPU backend we missed to reset the RTC flag,
such that kernels where invariant load hoisting failed executed the 'optimized'
SCoP, which however is set to a simple 'unreachable'. Unsurprisingly, this
results in hard to debug issues that are a lot of fun to debug.

llvm-svn: 314624

6 years agoTest Commit.
Andrew Gozillon [Sun, 1 Oct 2017 12:16:24 +0000 (12:16 +0000)]
Test Commit.

llvm-svn: 314623

6 years agoRevert r314579: "Recommi r314561 after fixing over-debug assertion".
Daniel Jasper [Sun, 1 Oct 2017 09:53:53 +0000 (09:53 +0000)]
Revert r314579: "Recommi r314561 after fixing over-debug assertion".

And follow-up r314585.
Leads to segfaults. I'll forward reproduction instructions to the patch
author.

Also, for a recommit, still add the original patch description.
Otherwise, it becomes really tedious to find out what a patch actually
does. The fact that it is a recommit with a fix is somewhat secondary.

llvm-svn: 314622

6 years agoAdding test for interleved, case stride 4 vf64 store<NFC>.
Michael Zuckerman [Sun, 1 Oct 2017 09:37:38 +0000 (09:37 +0000)]
Adding test for interleved, case stride 4 vf64 store<NFC>.

Change-Id: I9ea62aac81b763c83d26613dca6fcd846997a017
llvm-svn: 314621

6 years ago[lit] Fix running lit tests in unconfigured source dir
Michal Gorny [Sun, 1 Oct 2017 07:13:25 +0000 (07:13 +0000)]
[lit] Fix running lit tests in unconfigured source dir

Fix llvm_tools_dir attribute access not to fail when the variable is not
present. This directory is not really necessary to run lit tests,
and the code already accounts for it being None.

The reference was added in r313407, and it breaks the stand-alone lit
package in Gentoo.

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

llvm-svn: 314620

6 years agoSeparate the logic when handling indirect calls in SamplePGO ThinLTO compile phase...
Dehao Chen [Sun, 1 Oct 2017 05:24:51 +0000 (05:24 +0000)]
Separate the logic when handling indirect calls in SamplePGO ThinLTO compile phase and other phases.

Summary: In SamplePGO ThinLTO compile phase, we will not invoke ICP as it may introduce confusion to the 2nd annotation. This patch extracted that logic and makes it clearer before profile annotation. In the mean time, we need to make function importing process both inlined callsites as well as not promoted indirect callsites.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: sanjoy, mehdi_amini, llvm-commits, inglorion

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

llvm-svn: 314619

6 years agoFix .rst formatting error.
Rui Ueyama [Sun, 1 Oct 2017 03:50:48 +0000 (03:50 +0000)]
Fix .rst formatting error.

llvm-svn: 314618

6 years agoUpdate benchmark numbers.
Rui Ueyama [Sun, 1 Oct 2017 03:47:02 +0000 (03:47 +0000)]
Update benchmark numbers.

llvm-svn: 314617