OSDN Git Service

android-x86/external-llvm.git
7 years ago[llvm-config] Fixing one check where shared libs implied dylib
Chris Bieneman [Tue, 13 Dec 2016 23:08:52 +0000 (23:08 +0000)]
[llvm-config] Fixing one check where shared libs implied dylib

We shouldn't print the dylib if LinkDylib is false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289609 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm-config: Set LinkMode in addition to LinkDyLib when using --ignore-llvm
Derek Schuff [Tue, 13 Dec 2016 23:01:53 +0000 (23:01 +0000)]
llvm-config: Set LinkMode in addition to LinkDyLib when using --ignore-llvm

Summary:
LinkDyLib is only used (before arg processing) to set up the default for
LinkMode. So reset LinkMode as well, and process before --link-shared or
--link-static to allow those flags to continue to override it.

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289608 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] fix an UB (invalid shift) spotted by ubsan. The code worked fine by luck...
Kostya Serebryany [Tue, 13 Dec 2016 22:49:14 +0000 (22:49 +0000)]
[libFuzzer] fix an UB (invalid shift) spotted by ubsan. The code worked fine by luck, because the way shifts actually work on clang+x86

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-config] Add --ignore-libllvm
Chris Bieneman [Tue, 13 Dec 2016 22:17:59 +0000 (22:17 +0000)]
[llvm-config] Add --ignore-libllvm

This flag forces off linking libLLVM. This should resolve some issues reported on llvm-commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289605 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Tue, 13 Dec 2016 22:13:50 +0000 (22:13 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289604 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange CoverageTracker from a global variable to member variable to avoid breaking...
Dehao Chen [Tue, 13 Dec 2016 22:13:18 +0000 (22:13 +0000)]
Change CoverageTracker from a global variable to member variable to avoid breaking thread-safety. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289603 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-land "[SCEVExpander] Use llvm data structures; NFC"
Sanjoy Das [Tue, 13 Dec 2016 22:04:58 +0000 (22:04 +0000)]
Re-land "[SCEVExpander] Use llvm data structures; NFC"

This change re-lands r289215, by reverting r289482.  The underlying
issue that caused it to be reverted has been fixed by Tim Northover in
r289496.

Original commit message for r289215:

[SCEVExpander] Use llvm data structures; NFC

Original commit message for r289482:

Revert "[SCEVExpander] Use llvm data structures; NFC"

This reverts r289215 (git SHA1 cb7b86a1).  It breaks the ubsan build
because a DenseMap that keys off of `AssertingVH<T>` will hit UB when it
tries to cast the empty and tombstone keys to `T *` (due to insufficient
alignment).

This is the relevant stack trace (thanks to Mike Aizatsky):

    #0 0x25cf100 in llvm::AssertingVH<llvm::PHINode>::getValPtr() const llvm/include/llvm/IR/ValueHandle.h:212:39
    #1 0x25cea20 in llvm::AssertingVH<llvm::PHINode>::operator=(llvm::AssertingVH<llvm::PHINode> const&) llvm/include/llvm/IR/ValueHandle.h:234:19
    #2 0x25d0092 in llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >, llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >::clear() llvm/include/llvm/ADT/DenseMap.h:113:23

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289602 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IRCE] Avoid loop optimizations on pre and post loops
Anna Thomas [Tue, 13 Dec 2016 21:05:21 +0000 (21:05 +0000)]
[IRCE] Avoid loop optimizations on pre and post loops

Summary:
This patch will add loop metadata on the pre and post loops generated by IRCE.
Currently, we have metadata for disabling optimizations such as vectorization,
unrolling, loop distribution and LICM versioning (and confirmed that these
optimizations check for the metadata before proceeding with the transformation).

The pre and post loops generated by IRCE need not go through loop opts (since
these are slow paths).

Added two test cases as well.

Reviewers: sanjoy, reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289588 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LV] Don't vectorize when we have a small static bound on trip count
Michael Kuperstein [Tue, 13 Dec 2016 20:38:18 +0000 (20:38 +0000)]
[LV] Don't vectorize when we have a small static bound on trip count

We currently check if the exact trip count is known and is smaller than the
"tiny loop" bound. We should be checking the maximum bound on the trip count
instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289583 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with...
Peter Collingbourne [Tue, 13 Dec 2016 20:30:12 +0000 (20:30 +0000)]
ADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with new[].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289582 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Add OwningArrayRef class.
Peter Collingbourne [Tue, 13 Dec 2016 20:24:24 +0000 (20:24 +0000)]
ADT: Add OwningArrayRef class.

This is a MutableArrayRef that owns its array.
I plan to use this in D22296.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289579 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObject: Make IRObjectFile own multiple modules and enumerate symbols from all modules.
Peter Collingbourne [Tue, 13 Dec 2016 20:20:17 +0000 (20:20 +0000)]
Object: Make IRObjectFile own multiple modules and enumerate symbols from all modules.

This implements multi-module support in IRObjectFile.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289578 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObject: Remove module accessors from IRObjectFile, and hide its constructor.
Peter Collingbourne [Tue, 13 Dec 2016 20:10:22 +0000 (20:10 +0000)]
Object: Remove module accessors from IRObjectFile, and hide its constructor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289577 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Port the legacy LTO API to ModuleSymbolTable.
Peter Collingbourne [Tue, 13 Dec 2016 20:01:58 +0000 (20:01 +0000)]
LTO: Port the legacy LTO API to ModuleSymbolTable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289576 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Port the new LTO API to ModuleSymbolTable.
Peter Collingbourne [Tue, 13 Dec 2016 19:43:49 +0000 (19:43 +0000)]
LTO: Port the new LTO API to ModuleSymbolTable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289574 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGeneralize strided store pattern in interleave access pass
Alina Sbirlea [Tue, 13 Dec 2016 19:32:36 +0000 (19:32 +0000)]
Generalize strided store pattern in interleave access pass

Summary:
This patch aims to generalize matching of the strided store accesses to more general masks.
The more general rule is to have consecutive accesses based on the stride:
[x, y, ... z, x+1, y+1, ...z+1, x+2, y+2, ...z+2, ...]
All elements in the masks need not form a contiguous space, there may be gaps.
As before, undefs are allowed and filled in with adjacent element loads.

Reviewers: HaoLiu, mssimpso

Subscribers: mkuper, delena, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289573 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "AArch64CollectLOH: Rewrite as block-local analysis."
Matthias Braun [Tue, 13 Dec 2016 19:08:17 +0000 (19:08 +0000)]
Revert "AArch64CollectLOH: Rewrite as block-local analysis."

This is not always behaving as expected as it turns out block live-in
lists are only correct most of the time. Still waiting for reviews on
https://reviews.llvm.org/D27559 to have them correct all of the time.

See also http://llvm.org/PR31361, rdar://25117107

This reverts commit r288567.
This reverts commit r288561.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289570 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[bpf] change llvm-objdump to print dec instead of hex
Alexei Starovoitov [Tue, 13 Dec 2016 19:07:08 +0000 (19:07 +0000)]
[bpf] change llvm-objdump to print dec instead of hex

since bpf instruction stream is multiple of 8 change llvm-objdump
to print decimal instruction number instead of hex address, so that
users don't have to do this math manually to match kernel verifier output

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289569 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGlobalISel: fix GOT accesses on AArch64.
Tim Northover [Tue, 13 Dec 2016 18:25:38 +0000 (18:25 +0000)]
GlobalISel: fix GOT accesses on AArch64.

We were using the correct pseudo-instruction, but because the operand's flags
weren't set correctly we still ended up emitting incorrect relocations during
MC lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289566 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting...
Greg Clayton [Tue, 13 Dec 2016 18:25:19 +0000 (18:25 +0000)]
Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting attributes

Many places pass around a DWARFDebugInfoEntryMinimal and a DWARFUnit. It is easy to get things wrong by using the wrong DWARFUnit with a DWARFDebugInfoEntryMinimal. This patch creates a DWARFDie class that contains the DWARFUnit and DWARFDebugInfoEntryMinimal objects so that they can't get out of sync. All attribute extraction has been moved out of DWARFDebugInfoEntryMinimal and into DWARFDie. DWARFDebugInfoEntryMinimal was also renamed to DWARFDebugInfoEntry.

DWARFDie objects are temporary objects that are used by clients and contain 2 pointers that you always need to have anyway. Keeping them grouped will avoid errors and simplify many of the attribute extracting APIs by not having to pass in a DWARFUnit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289565 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Add missing header needed for Windows.
Marcos Pividori [Tue, 13 Dec 2016 17:46:48 +0000 (17:46 +0000)]
[libFuzzer] Add missing header needed for Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289564 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Avoid name collision with Windows API.
Marcos Pividori [Tue, 13 Dec 2016 17:46:40 +0000 (17:46 +0000)]
[libFuzzer] Avoid name collision with Windows API.

Windows uses some macros to replace DeleteFile() by DeleteFileA() or
DeleteFileW(). This was causing an error at link time.
DeleteFile was renamed to RemoveFile().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289563 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Implement DirName() for Windows.
Marcos Pividori [Tue, 13 Dec 2016 17:46:32 +0000 (17:46 +0000)]
[libFuzzer] Implement DirName() for Windows.

Implement DirName from scratch to avoid dependencies on external libraries.
It's based on MSDN documentation for Naming Files, Paths, and Namespaces.

The algorithm can't simply start from the end and look backwards for the
first separator, because we need to preserve the prefix that represent
the root location. We shouldn't remove anything there. In Windows we
have many different options, like:
 \\Server\Share\ , \ , C: , C:\ , \\?\C:\ , \\?\UNC\Server\Share\
We remove the last separator in the rest of the path, if it exists.

It was implemented to have a similar behaviour to dirname() in linux,
removing trailing separators, returning "." when the path doesn't
contain separators, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289562 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Fix bug in detecting timeouts when input string is empty.
Marcos Pividori [Tue, 13 Dec 2016 17:46:25 +0000 (17:46 +0000)]
[libFuzzer] Fix bug in detecting timeouts when input string is empty.

I added a new flag RunningCB to know if the Fuzzer's main thread is
running the CB function, instead of using (!CurrentUnitSize).
(!CurrentUnitSize) doesn't work properly. For example, in FuzzerLoop.cpp,
inside ShuffleAndMinimize() function, we execute the callback with an
empty string (size=0). Previous implementation failed to detect timeouts
in that execution.
Also, I add a regression test for that case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289561 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Clean up headers and file formatting of LibFuzzer files.
Marcos Pividori [Tue, 13 Dec 2016 17:46:11 +0000 (17:46 +0000)]
[libFuzzer] Clean up headers and file formatting of LibFuzzer files.

Reorganize #includes to follow LLVM Coding Standards.
Include some missing headers. Required to use `Printf()`.

Aside from that, this patch contains no functional change.
It is purely a re-organization.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289560 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Properly use unsigned for workers, jobs and NumberOfCpuCores.
Marcos Pividori [Tue, 13 Dec 2016 17:45:53 +0000 (17:45 +0000)]
[libFuzzer] Properly use unsigned for workers, jobs and NumberOfCpuCores.

std::thread::hardware_concurrency() returns an unsigned, so I modify
NumberOfCpuCores() to return unsigned too.
The number of cpus is used to define the number of workers, so I decided
to update the worker and jobs flags to be declared as unsigned too.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289559 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Properly use unsigned for Process ID.
Marcos Pividori [Tue, 13 Dec 2016 17:45:44 +0000 (17:45 +0000)]
[libFuzzer] Properly use unsigned for Process ID.

Use unsigned for PID instead of signed int. GetCurrentProcessId() returns
an unsigned (DWORD) so we must be sure we can deal with all possible values.
I use a long unsigned to be sure it can hold a 32 bit unsigned (DWORD).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289558 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Improve Signal Handler interface.
Marcos Pividori [Tue, 13 Dec 2016 17:45:20 +0000 (17:45 +0000)]
[libFuzzer] Improve Signal Handler interface.

Add new flags to FuzzingOptions to represent the different conditions
on the signal handling. These options are passed when calling
SetSignalHandler().
This changes simplify the implementation of Windows's exception
handling. Now we can define a unique handler for all the exceptions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289557 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix the test cases committed in r289521.
Rong Xu [Tue, 13 Dec 2016 17:34:29 +0000 (17:34 +0000)]
Fix the test cases committed in r289521.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289556 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Regenerate vector of pointers tests
Simon Pilgrim [Tue, 13 Dec 2016 17:22:39 +0000 (17:22 +0000)]
[X86][SSE] Regenerate vector of pointers tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289555 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ADT] Add llvm::StringLiteral.
Zachary Turner [Tue, 13 Dec 2016 17:03:49 +0000 (17:03 +0000)]
[ADT] Add llvm::StringLiteral.

StringLiteral is a wrapper around a string literal useful for
replacing global tables of char arrays with global tables of
StringRefs that can initialized in a constexpr context, avoiding
the invocation of a global constructor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289551 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ADCE] Add code to remove dead branches
David Callahan [Tue, 13 Dec 2016 16:42:18 +0000 (16:42 +0000)]
[ADCE] Add code to remove dead branches

Summary:
This is last in of a series of patches to evolve ADCE.cpp to support
removing of unnecessary control flow.

This patch adds the code to update the control and data flow graphs
to remove the dead control flow.

Also update unit tests to test the capability to remove dead,
may-be-infinite loop which is enabled by the switch
-adce-remove-loops.

Previous patches:

D23824 [ADCE] Add handling of PHI nodes when removing control flow
D23559 [ADCE] Add control dependence computation
D23225 [ADCE] Modify data structures to support removing control flow
D23065 [ADCE] Refactor anticipating new functionality (NFC)
D23102 [ADCE] Refactoring for new functionality (NFC)

Reviewers: dberlin, majnemer, nadav, mehdi_amini

Subscribers: llvm-commits, david2050, freik, twoh

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289548 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse more detailed assertion messages in the code introduced by r289538
Artur Pilipenko [Tue, 13 Dec 2016 16:26:15 +0000 (16:26 +0000)]
Use more detailed assertion messages in the code introduced by r289538

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289545 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix a buildbot failure introduced by r289538
Artur Pilipenko [Tue, 13 Dec 2016 14:55:31 +0000 (14:55 +0000)]
Fix a buildbot failure introduced by r289538

Build failed because of unused variable in product mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289540 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombiner] Match load by bytes idiom and fold it into a single load
Artur Pilipenko [Tue, 13 Dec 2016 14:21:14 +0000 (14:21 +0000)]
[DAGCombiner] Match load by bytes idiom and fold it into a single load

Match a pattern where a wide type scalar value is loaded by several narrow loads and combined by shifts and ors. Fold it into a single load or a load and a bswap if the targets supports it.

Assuming little endian target:
  i8 *a = ...
  i32 val = a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24)
=>
  i32 val = *((i32)a)

  i8 *a = ...
  i32 val = (a[0] << 24) | (a[1] << 16) | (a[2] << 8) | a[3]
=>
  i32 val = BSWAP(*((i32)a))

This optimization was discussed on llvm-dev some time ago in "Load combine pass" thread. We came to the conclusion that we want to do this transformation late in the pipeline because in presence of atomic loads load widening is irreversible transformation and it might hinder other optimizations.

Eventually we'd like to support folding patterns like this where the offset has a variable and a constant part:
  i32 val = a[i] | (a[i + 1] << 8) | (a[i + 2] << 16) | (a[i + 3] << 24)

Matching the pattern above is easier at SelectionDAG level since address reassociation has already happened and the fact that the loads are adjacent is clear. Understanding that these loads are adjacent at IR level would have involved looking through geps/zexts/adds while looking at the addresses.

The general scheme is to match OR expressions by recursively calculating the origin of individual bits which constitute the resulting OR value. If all the OR bits come from memory verify that they are adjacent and match with little or big endian encoding of a wider value. If so and the load of the wider type (and bswap if needed) is allowed by the target generate a load and a bswap if needed.

Reviewed By: hfinkel, RKSimon, filcab

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289538 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMove BaseIndexOffset in DAGCombiner.cpp so it will be available for the upcoming...
Artur Pilipenko [Tue, 13 Dec 2016 14:16:02 +0000 (14:16 +0000)]
Move BaseIndexOffset in DAGCombiner.cpp so it will be available for the upcoming user

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289537 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG] computeKnownBits - simplified knownbits sign extension. NFCI.
Simon Pilgrim [Tue, 13 Dec 2016 13:36:27 +0000 (13:36 +0000)]
[SelectionDAG] computeKnownBits - simplified knownbits sign extension. NFCI.

We don't need to extract+test the sign bit of the known ones/zeros, we can use sext which will handle all of this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289534 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips][rtdyld] Move MIPS relocation resolution to a subclass and implement N32 reloca...
Simon Dardis [Tue, 13 Dec 2016 11:39:18 +0000 (11:39 +0000)]
[mips][rtdyld] Move MIPS relocation resolution to a subclass and implement N32 relocations

N32 relocations are only correct for individual relocations at the moment.
Support for relocation composition will follow in a later patch.

Patch By: Daniel Sanders

Reviwers: vkalintiris, atanasyan

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289532 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] Fix comment to respect 80 chars per line; NFC
Simon Dardis [Tue, 13 Dec 2016 11:10:53 +0000 (11:10 +0000)]
[mips] Fix comment to respect 80 chars per line; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289530 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] Fix compact branch hazard detection
Simon Dardis [Tue, 13 Dec 2016 11:07:51 +0000 (11:07 +0000)]
[mips] Fix compact branch hazard detection

In certain cases it is possible that transient instructions such as
%reg = IMPLICIT_DEF as a single instruction in a basic block to reach
the MipsHazardSchedule pass. This patch teaches MipsHazardSchedule to
properly look through such cases.

Reviewers: vkalintiris, zoran.jovanovic

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289529 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GlobalISel] Move extendRegister where it belongs. NFCI
Diana Picus [Tue, 13 Dec 2016 10:46:12 +0000 (10:46 +0000)]
[GlobalISel] Move extendRegister where it belongs. NFCI

Apparently I missed this one when I moved ValueHandler back in r288658. Sorry!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289528 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][InstCombine] Fix SimplifyDemandedVectorElts to handle frcz scalar intrinsics...
Craig Topper [Tue, 13 Dec 2016 07:45:45 +0000 (07:45 +0000)]
[X86][InstCombine] Fix SimplifyDemandedVectorElts to handle frcz scalar intrinsics correctly.

Only the lower bits of the input element are used. And only the lower element can be undef since the upper bits are zeroed.

Have InstCombineCalls call SimplifyDemandedVectorElts for these intrinsics to reuse this support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289523 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm/test/Transforms/PGOProfile/noreturncall.ll REQUIRES asserts due to -debug-only.
NAKAMURA Takumi [Tue, 13 Dec 2016 07:04:03 +0000 (07:04 +0000)]
llvm/test/Transforms/PGOProfile/noreturncall.ll REQUIRES asserts due to -debug-only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289522 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PGO] Fix insane counts due to nonreturn calls
Rong Xu [Tue, 13 Dec 2016 06:41:14 +0000 (06:41 +0000)]
[PGO] Fix insane counts due to nonreturn calls

Summary:
Since we don't break BBs for function calls. We might get some insane counts
(wrap of unsigned) in the presence of noreturn calls.

This patch sets these counts to zero instead of the wrapped number.

Reviewers: davidxl

Subscribers: xur, eraman, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289521 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCCP] Debug diagnostic goes under DEBUG(). NFCI.
Davide Italiano [Tue, 13 Dec 2016 05:56:04 +0000 (05:56 +0000)]
[SCCP] Debug diagnostic goes under DEBUG(). NFCI.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289519 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVR] Add an 'relax memory operation' pass
Dylan McKay [Tue, 13 Dec 2016 05:53:14 +0000 (05:53 +0000)]
[AVR] Add an 'relax memory operation' pass

Summary:
This pass will be used to relax instructions which use out of bounds
memory accesses to equivalent operations that can work with the
addresses.

The pass currently implements relaxation for the STDWPtrQRr instruction.

Without this pass, an assertion error would be hit in the pseudo expansion pass.

In the future, we will need to add more instructions to this pass. We can do
that on a case-by-case basic.

Reviewers: arsenm, kparzysz

Subscribers: wdng, llvm-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289517 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[peephole] Enhance folding logic to work for STATEPOINTs
Philip Reames [Tue, 13 Dec 2016 01:38:41 +0000 (01:38 +0000)]
[peephole] Enhance folding logic to work for STATEPOINTs

The general idea here is to get enough of the existing restrictions out of the way that the already existing folding logic in foldMemoryOperand can kick in for STATEPOINTs and fold references to immutable stack slots. The key changes are:

    Support for folding multiple operands at once which reference the same load
    Support for folding multiple loads into a single instruction
    Walk all the operands of the instruction for varidic instructions (this is a bug fix!)

Once this lands, I'll post another patch which refactors the TII interface here. There's nothing actually x86 specific about the x86 code used here.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289510 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Statepoints] Reuse stack slots more than once within a basic block
Philip Reames [Tue, 13 Dec 2016 01:21:15 +0000 (01:21 +0000)]
[Statepoints] Reuse stack slots more than once within a basic block

The stack slot reuse code had a really amusing bug. We ended up only reusing a stack slot exact once (initial use + reuse) within a basic block. If we had a third statepoint to process, we ended up allocating a new set of stack slots. If we crossed a basic block boundary, the set got cleared. As a result, code which is invoke heavy doesn't see the problem, but multiple calls within a basic block does. Net result: as we optimize invokes into calls, lowering gets worse.

The root error here is that the bitmap uses by the custom allocator wasn't kept in sync. The result was that we ended up resizing the bitmap on the next statepoint (to handle the cross block case), reset the bit once, but then never reset it again.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289509 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] don't require extra flags with -minimize_crash=1 (default to -max_total_t...
Kostya Serebryany [Tue, 13 Dec 2016 00:40:47 +0000 (00:40 +0000)]
[libFuzzer] don't require extra flags with -minimize_crash=1 (default to -max_total_time=600). Also respect exact_artifact_path when outputting the end result

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289506 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMissed a file in r289503.
Chris Bieneman [Tue, 13 Dec 2016 00:32:43 +0000 (00:32 +0000)]
Missed a file in r289503.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289504 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LIT] Fix system-windows
Chris Bieneman [Tue, 13 Dec 2016 00:29:56 +0000 (00:29 +0000)]
[LIT] Fix system-windows

Turns out if you were on windows and your default target wasn't windows the system-windows feature wasn't getting enabled.

This fixes that and updates the coff-dwarf test to rely on the new "target-windows" feature. That test was the reason why system-windows was changed to not always be enabled on Windows hosts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289503 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Suppress LLVM::tools/llvm-symbolizer/coff-dwarf.test for mingw, for now."
Chris Bieneman [Tue, 13 Dec 2016 00:29:51 +0000 (00:29 +0000)]
Revert "Suppress LLVM::tools/llvm-symbolizer/coff-dwarf.test for mingw, for now."

This reverts commit r249937.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289502 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-config] Unsupported should be win32
Chris Bieneman [Mon, 12 Dec 2016 23:42:08 +0000 (23:42 +0000)]
[llvm-config] Unsupported should be win32

Hopefully this will fix the failing Windows bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289497 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStop lying about pointers' required alignments.
Tim Northover [Mon, 12 Dec 2016 23:29:07 +0000 (23:29 +0000)]
Stop lying about pointers' required alignments.

These extra specializations were added in the depths of history (r67984 from
2009) and are clearly problematic now. The pointers actually are aligned to the
default (8 bytes), since otherwise UBsan would be complaining loudly.

I *think* it originally made sense because there was no "alignof" to infer the
correct value so the generic case went with what malloc returned (8-byte
aliged objects), and on 32-bit machines this specialization was correct. It
became wrong when we started compiling for 64-bit, and caused a UBSan failure
when we tried to put a ValueHandle into a DenseMap.

Should fix the Green Dragon UBSan bot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289496 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Implement Timers for Windows.
Marcos Pividori [Mon, 12 Dec 2016 23:25:11 +0000 (23:25 +0000)]
[libFuzzer] Implement Timers for Windows.

Implemented timeouts for Windows using TimerQueueTimers.
Timers are used to supervise the time of execution of the
callback function that is being fuzzed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289495 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] fix test specifications
Sanjay Patel [Mon, 12 Dec 2016 23:16:35 +0000 (23:16 +0000)]
[x86] fix test specifications

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289493 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] fix test specifications and auto-generate checks
Sanjay Patel [Mon, 12 Dec 2016 23:15:15 +0000 (23:15 +0000)]
[x86] fix test specifications and auto-generate checks

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289492 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CMake] Multi-target builtins build
Petr Hosek [Mon, 12 Dec 2016 23:15:10 +0000 (23:15 +0000)]
[CMake] Multi-target builtins build

This change enables building builtins for multiple different targets
using LLVM runtimes directory.

To specify the builtin targets to be built, use the LLVM_BUILTIN_TARGETS
variable, where the value is the list of targets.  To pass a per target
variable to the builtin build, you can set BUILTINS_<target>_<variable>
where <variable> will be passed to the builtin build for <target>.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289491 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Disable all llvm-config tests for now, will investigate later"
Chris Bieneman [Mon, 12 Dec 2016 23:14:58 +0000 (23:14 +0000)]
Revert "Disable all llvm-config tests for now, will investigate later"

This reverts commit r260386.

These tests all pass for me locally. I have no idea if they will pass on all configurations, so I'll watch the bots closely.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289490 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-config] Fix bug where `--libfiles` and `--names` would produce
Dan Liew [Mon, 12 Dec 2016 23:07:22 +0000 (23:07 +0000)]
[llvm-config] Fix bug where `--libfiles` and `--names` would produce
incorrect output when LLVM is built with `LLVM_BUILD_LLVM_DYLIB`.

`llvm-config` previously produced output like this

```
$ llvm-config --libfiles
/usr/lib/liblibLLVM-4.0svn.so.so
$ llvm-config --libnames
liblibLLVM-4.0svn.so.so
```

The library prefix and shared library extension were added to
the library name twice which was wrong.

I wanted to write a test cases for this but it looks like **all**
`llvm-config` tests were disabled by r260386 so I'll leave this for
now.

Subscribers: llvm-commits, tstellarAMD

Reviewers: beanz, DiamondLovesYou, axw

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289488 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAvoid infinite loops in branch folding
Andrew Kaylor [Mon, 12 Dec 2016 23:05:38 +0000 (23:05 +0000)]
Avoid infinite loops in branch folding

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289486 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format to fix post-commit feedback
Chris Bieneman [Mon, 12 Dec 2016 23:05:15 +0000 (23:05 +0000)]
clang-format to fix post-commit feedback

Thanks dblaikie!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289485 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-config] Fix cflags test looking for "error"
Chris Bieneman [Mon, 12 Dec 2016 23:03:28 +0000 (23:03 +0000)]
[llvm-config] Fix cflags test looking for "error"

This test is (I think) actually trying to make sure no errors are printed, but it hits on the string "error" in flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289484 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Remove system-libs.test for now"
Chris Bieneman [Mon, 12 Dec 2016 23:03:01 +0000 (23:03 +0000)]
Revert "Remove system-libs.test for now"

This reverts commit r260281.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289483 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SCEVExpander] Use llvm data structures; NFC"
Sanjoy Das [Mon, 12 Dec 2016 23:00:12 +0000 (23:00 +0000)]
Revert "[SCEVExpander] Use llvm data structures; NFC"

This reverts r289215 (git SHA1 cb7b86a1).  It breaks the ubsan build
because a DenseMap that keys off of `AssertingVH<T>` will hit UB when it
tries to cast the empty and tombstone keys to `T *` (due to insufficient
alignment).

This is the relevant stack trace (thanks to Mike Aizatsky):

    #0 0x25cf100 in llvm::AssertingVH<llvm::PHINode>::getValPtr() const llvm/include/llvm/IR/ValueHandle.h:212:39
    #1 0x25cea20 in llvm::AssertingVH<llvm::PHINode>::operator=(llvm::AssertingVH<llvm::PHINode> const&) llvm/include/llvm/IR/ValueHandle.h:234:19
    #2 0x25d0092 in llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >, llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >::clear() llvm/include/llvm/ADT/DenseMap.h:113:23

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289482 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] split one slow test into several, for more parallel testing
Kostya Serebryany [Mon, 12 Dec 2016 22:55:25 +0000 (22:55 +0000)]
[libFuzzer] split one slow test into several, for more parallel testing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289481 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix MSVC build after 289461; MSVC isn't sure if this is std:: or llvm::
Nico Weber [Mon, 12 Dec 2016 22:46:40 +0000 (22:46 +0000)]
Fix MSVC build after 289461; MSVC isn't sure if this is std:: or llvm::

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289480 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] make SimpleCmpTest a bit simpler to crack and more verbose
Kostya Serebryany [Mon, 12 Dec 2016 22:39:33 +0000 (22:39 +0000)]
[libFuzzer] make  SimpleCmpTest a bit simpler to crack and more verbose

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289477 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] fix formatting; NFC
Sanjay Patel [Mon, 12 Dec 2016 22:31:01 +0000 (22:31 +0000)]
[x86] fix formatting; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289476 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AMDGPU, PowerPC, TableGen] Fix some Clang-tidy modernize and Include What You Use...
Eugene Zelenko [Mon, 12 Dec 2016 22:23:53 +0000 (22:23 +0000)]
[AMDGPU, PowerPC, TableGen] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289475 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APFloatTest] Use std::make_tuple to make GCC 4.8 happy
Tim Shen [Mon, 12 Dec 2016 22:16:08 +0000 (22:16 +0000)]
[APFloatTest] Use std::make_tuple to make GCC 4.8 happy

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289474 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PPC] Prefer direct move on power8 if load 1 or 2 bytes to VSR
Guozhi Wei [Mon, 12 Dec 2016 22:09:02 +0000 (22:09 +0000)]
[PPC] Prefer direct move on power8 if load 1 or 2 bytes to VSR

Power8 has MTVSRWZ but no LXSIBZX/LXSIHZX, so move 1 or 2 bytes to VSR through MTVSRWZ is much faster than store the extended value into stack and load it with LXSIWZX.
This patch fixes pr31144.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289473 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[APFloat] Implement PPCDoubleDouble add and subtract.
Tim Shen [Mon, 12 Dec 2016 21:59:30 +0000 (21:59 +0000)]
[APFloat] Implement PPCDoubleDouble add and subtract.

Summary:
I looked at libgcc's implementation (which is based on the paper,
Software for Doubled-Precision Floating-Point Computations", by Seppo Linnainmaa,
ACM TOMS vol 7 no 3, September 1981, pages 272-283.) and made it generic to
arbitrary IEEE floats.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289472 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SLP] Fix sign-extends for type-shrinking
Matthew Simpson [Mon, 12 Dec 2016 21:11:04 +0000 (21:11 +0000)]
[SLP] Fix sign-extends for type-shrinking

This patch ensures the correct minimum bit width during type-shrinking.
Previously when type-shrinking, we always sign-extended values back to their
original width. However, if we are going to sign-extend, and the sign bit is
unknown, we have to increase the minimum bit width by one bit so the
sign-extend will fill the upper bits correctly. If the sign bit is known to be
zero, we can perform a zero-extend instead. This should fix PR31243.

Reference: https://llvm.org/bugs/show_bug.cgi?id=31243
Differential Revision: https://reviews.llvm.org/D27466

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289470 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] build libFuzzer itself with asan
Kostya Serebryany [Mon, 12 Dec 2016 20:58:10 +0000 (20:58 +0000)]
[libFuzzer] build libFuzzer itself with asan

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289469 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRecommit r288212: Emit 'no line' information for interesting 'orphan' instructions.
Paul Robinson [Mon, 12 Dec 2016 20:49:11 +0000 (20:49 +0000)]
Recommit r288212: Emit 'no line' information for interesting 'orphan' instructions.

DWARF specifies that "line 0" really means "no appropriate source
location" in the line table.  By default, use this for branch targets
and some other cases that have no specified source location, to
prevent inheriting unfortunate line numbers from physically preceding
instructions (which might be from completely unrelated source).

Updated patch allows enabling or suppressing this behavior for all
unspecified source locations.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289468 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] respect -max_len during merge
Kostya Serebryany [Mon, 12 Dec 2016 20:39:35 +0000 (20:39 +0000)]
[libFuzzer] respect -max_len during merge

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289467 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ThinLTO] Remove useless code (NFC)
Teresa Johnson [Mon, 12 Dec 2016 20:34:28 +0000 (20:34 +0000)]
[ThinLTO] Remove useless code (NFC)

Should have been removed in r288446.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289466 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRefactor BitcodeReader: move Metadata and ValueId handling in their own class/file
Mehdi Amini [Mon, 12 Dec 2016 19:34:26 +0000 (19:34 +0000)]
Refactor BitcodeReader: move Metadata and ValueId handling in their own class/file

Summary:
I'm planning on changing the way we load metadata to enable laziness.
I'm getting lost in this gigantic files, and gigantic class that is the bitcode
reader. This is a first toward splitting it in a few coarse components that
are more easily understandable.

Reviewers: pcc, tejohnson

Subscribers: mgorny, llvm-commits, dexonsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289461 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove IsMetadataMaterialized from BitcodeReader (NFC)
Mehdi Amini [Mon, 12 Dec 2016 19:23:39 +0000 (19:23 +0000)]
Remove IsMetadataMaterialized from BitcodeReader (NFC)

Summary: It does not seem useful.

Reviewers: pcc, dexonsmith

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289457 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LiveRangeEdit] Add assert string and descriptive comment.
Geoff Berry [Mon, 12 Dec 2016 19:12:41 +0000 (19:12 +0000)]
[LiveRangeEdit] Add assert string and descriptive comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289456 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix compile with GCC 5 or later
Dimitry Andric [Mon, 12 Dec 2016 19:05:52 +0000 (19:05 +0000)]
Fix compile with GCC 5 or later

Summary:

Compiling with GCC 5 or later can fail with a bogus error "constructor
required before non-static data member for
llvm::ValueEnumerator::MDRange::First has been parsed".

This was originally fixed upstream in GCC PR 70528, but later this fix
was reverted, and released versions of GCC still show the bogus error.

To work around this, replace MDRange's declaration of a default
constructor with a definition.

Reviewers: dexonsmith, rsmith, rivanvx

Subscribers: llvm-commits, dim, dexonsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289454 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[SCEVExpand] do not hoist divisions by zero (PR30935)"
Reid Kleckner [Mon, 12 Dec 2016 18:52:32 +0000 (18:52 +0000)]
Revert "[SCEVExpand] do not hoist divisions by zero (PR30935)"

Reverts r289412. It caused an OOB PHI operand access in instcombine when
ASan is enabled. Reduction in progress.

Also reverts "[SCEVExpander] Add a test case related to r289412"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289453 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[mips] For PIC code convert unconditional jump to unconditional branch
Simon Atanasyan [Mon, 12 Dec 2016 17:40:26 +0000 (17:40 +0000)]
[mips] For PIC code convert unconditional jump to unconditional branch

Unconditional branch uses relative addressing which is the right choice
in case of position independent code.

This is a fix for the bug:
https://dmz-portal.mips.com/bugz/show_bug.cgi?id=2445

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289448 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: llvm.amdgcn.interp.mov is a source of divergence
Nicolai Haehnle [Mon, 12 Dec 2016 16:52:19 +0000 (16:52 +0000)]
AMDGPU: llvm.amdgcn.interp.mov is a source of divergence

Summary:
While the result is constant across a single primitive, each pixel
shader wave can have pixels from multiple primitives.

Reviewers: tstellarAMD, arsenm

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289447 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoremove stale FIXME note from test; NFC
Sanjay Patel [Mon, 12 Dec 2016 16:20:21 +0000 (16:20 +0000)]
remove stale FIXME note from test; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289445 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Regenerate vector bitcast/widening tests.
Simon Pilgrim [Mon, 12 Dec 2016 16:15:45 +0000 (16:15 +0000)]
[X86] Regenerate vector bitcast/widening tests.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289443 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] fix bug when offsetting case values of a switch (PR31260)
Sanjay Patel [Mon, 12 Dec 2016 16:13:52 +0000 (16:13 +0000)]
[InstCombine] fix bug when offsetting case values of a switch (PR31260)

We could truncate the condition and then try to fold the add into the
original condition value causing wrong case constants to be used.

Move the offset transform ahead of the truncate transform and return
after each transform, so there's no chance of getting confused values.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289442 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ThinLTO] Import only necessary DICompileUnit fields
Teresa Johnson [Mon, 12 Dec 2016 16:09:30 +0000 (16:09 +0000)]
[ThinLTO] Import only necessary DICompileUnit fields

Summary:
As discussed on mailing list, for ThinLTO importing we don't need
to import all the fields of the DICompileUnit. Don't import enums,
macros, retained types lists. Also only import local scoped imported
entities. Since we don't currently import any global variables,
we also don't need to import the list of global variables (added an
assert to verify none are being imported).

This is being done by pre-populating the value map entries to map
the unneeded metadata to nullptr. For the imported entities, we can
simply replace the source module's list with a new list containing
only those needed imported entities. This is done in the IRLinker
constructor so that value mapping automatically does the desired
mapping.

Reviewers: mehdi_amini, dexonsmith, dblaikie, aprantl

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289441 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] clean up range-for-loops in visitSwitchInst(); NFCI
Sanjay Patel [Mon, 12 Dec 2016 15:52:56 +0000 (15:52 +0000)]
[InstCombine] clean up range-for-loops in visitSwitchInst(); NFCI

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289439 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Regenerate test.
Simon Pilgrim [Mon, 12 Dec 2016 15:47:53 +0000 (15:47 +0000)]
[X86] Regenerate test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289438 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add test to show PR31260 miscompile; NFC
Sanjay Patel [Mon, 12 Dec 2016 15:28:44 +0000 (15:28 +0000)]
[InstCombine] add test to show PR31260 miscompile; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289437 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEVExpander] Add a test case related to r289412
Sanjoy Das [Mon, 12 Dec 2016 14:57:11 +0000 (14:57 +0000)]
[SCEVExpander] Add a test case related to r289412

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289435 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate inline argument comment. NFCI.
Simon Pilgrim [Mon, 12 Dec 2016 13:43:15 +0000 (13:43 +0000)]
Update inline argument comment. NFCI.

combineX86ShufflesRecursively 'HasPSHUFB' flag has been the more generic 'HasVariableMask' flag for some time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289430 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Add support for combining SSE VSHLI/VSRLI uniform constant shifts.
Simon Pilgrim [Mon, 12 Dec 2016 13:33:58 +0000 (13:33 +0000)]
[X86][SSE] Add support for combining SSE VSHLI/VSRLI uniform constant shifts.

Fixes some missed constant folding opportunities and allows us to combine shuffles that end with a logical bit shift.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289429 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Lower suitably sign-extended mul vXi64 using PMULDQ
Simon Pilgrim [Mon, 12 Dec 2016 10:49:15 +0000 (10:49 +0000)]
[X86][SSE] Lower suitably sign-extended mul vXi64 using PMULDQ

PMULDQ returns the 64-bit result of the signed multiplication of the lower 32-bits of vXi64 vector inputs, we can lower with this if the sign bits stretch that far.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289426 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG] Add support for EXTRACT_SUBVECTOR to ComputeNumSignBits
Simon Pilgrim [Mon, 12 Dec 2016 10:29:43 +0000 (10:29 +0000)]
[SelectionDAG] Add support for EXTRACT_SUBVECTOR to ComputeNumSignBits

Pre-commit as discussed on D27657

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289425 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Teach selectScalarSSELoad to accept full 128-bit vector loads and the X86ISD...
Craig Topper [Mon, 12 Dec 2016 07:57:24 +0000 (07:57 +0000)]
[X86] Teach selectScalarSSELoad to accept full 128-bit vector loads and the X86ISD::VZEXT_LOAD opcode.

Disable peephole on some of the tests that no longer require it to properly fold scalar intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289424 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Change CMPSS/CMPSD intrinsic instructions to use sse_load_f32/f64 as its memory...
Craig Topper [Mon, 12 Dec 2016 07:57:21 +0000 (07:57 +0000)]
[X86] Change CMPSS/CMPSD intrinsic instructions to use sse_load_f32/f64 as its memory pattern instead of full vector load.

These intrinsics only load a single element. We should use sse_loadf32/f64 to give more options of what loads it can match.

Currently these instructions are often only getting their load folded thanks to the load folding in the peephole pass. I plan to add more types of loads to sse_load_f32/64 so we can match without the peephole.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289423 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Remove some intrinsic instructions from hasPartialRegUpdate
Craig Topper [Mon, 12 Dec 2016 05:07:17 +0000 (05:07 +0000)]
[X86] Remove some intrinsic instructions from hasPartialRegUpdate

Summary:
These intrinsic instructions are all selected from intrinsics that have well defined behavior for where the upper bits come from. It's not the same place as the lower bits.

As you can see we were suppressing load folding for these instructions in some cases. In none of the cases was the separate load helping avoid a partial dependency on the destination register. So we should just go ahead and allow the load to be folded.

Only foldMemoryOperand was suppressing folding for these. They all have patterns for folding sse_load_f32/f64 that aren't gated with OptForSize, but sse_load_f32/f64 doesn't allow 128-bit vector loads. It only allows scalar_to_vector and vzmovl of scalar loads to match. There's no reason we can't allow a 128-bit vector load to be narrowed so I would like to fix sse_load_f32/f64 to allow that. And if I do that it changes some of these same test cases to fold the load too.

Reviewers: spatel, zvi, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289419 91177308-0d34-0410-b5e6-96231b3b80d8