OSDN Git Service

android-x86/external-llvm.git
6 years ago[BDCE] reduce scope of an assert (PR34179)
Sanjay Patel [Mon, 14 Aug 2017 15:13:46 +0000 (15:13 +0000)]
[BDCE] reduce scope of an assert (PR34179)

The assert was added with r310779 and is usually correct,
but as the test shows, not always. The 'volatile' on the
load is needed to expose the faulty path because without
it, DemandedBits would return that the load is just dead
rather than not demanded, and so we wouldn't hit the
bogus assert.

Also, since the lambda is just a single-line now, get rid
of it and inline the DB.isAllOnesValue() calls.

This should fix (prevent execution of a faulty assert):
https://bugs.llvm.org/show_bug.cgi?id=34179

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

6 years agoReland "[mips][mt][6/7] Add support for mftr, mttr instructions."
Simon Dardis [Mon, 14 Aug 2017 12:28:00 +0000 (12:28 +0000)]
Reland "[mips][mt][6/7] Add support for mftr, mttr instructions."

This adjusts the tests to hopfully pacify the llvm-clang-x86_64-expensive-checks-win
buildbot.

Unlike many other instructions, these instructions have aliases which
take coprocessor registers, gpr register, accumulator (and dsp accumulator)
registers, floating point registers, floating point control registers and
coprocessor 2 data and control operands.

For the moment, these aliases are treated as pseudo instructions which are
expanded into the underlying instruction. As a result, disassembling these
instructions shows the underlying instruction and not the alias.

Reviewers: slthakur, atanasyan

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

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

6 years ago[DAGCombine] Do not try to deduplicate commutative operations if both operand are...
Amaury Sechet [Mon, 14 Aug 2017 11:44:03 +0000 (11:44 +0000)]
[DAGCombine] Do not try to deduplicate commutative operations if both operand are the same.

Summary: It is creating useless work as the commuted nodes is the same as the node we are working on in that case.

Reviewers: jyknight, nemanjai, mkuper, spatel, RKSimon, zvi, bkramer

Subscribers: llvm-commits

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

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

6 years ago[SelectionDAG] combine vextract (v1iX extract_subvector(vNiX, Idx))
Elad Cohen [Mon, 14 Aug 2017 10:49:45 +0000 (10:49 +0000)]
[SelectionDAG] combine vextract (v1iX extract_subvector(vNiX, Idx))
into vextract(vNiX,Idx) when creating vextract with getNode().
This case appeared in AVX512 after fixing pr33349 in r310552.

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

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

6 years ago[llvm-cov] Add an option which maps the location of source directories on another...
Sean Eveson [Mon, 14 Aug 2017 10:20:12 +0000 (10:20 +0000)]
[llvm-cov] Add an option which maps the location of source directories on another machine to your local copies

Summary:
This patch adds the -path-equivalence option (example: llvm-cov show -path-equivalence=/origin/path,/local/path) which maps the source code path from one machine to another when using `llvm-cov show`. This is similar to the -filename-equivalence option, but doesn't require you to specify all the source files on the command line.

This allows you to generate the coverage data on one machine (e.g. in a CI system), and then use llvm-cov on another machine where you have the same code base on a different path.

Reviewers: vsk

Reviewed By: vsk

Subscribers: llvm-commits

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

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

6 years agoMachineInstr: Reason locally about some memory objects before going to AA.
Balaram Makam [Mon, 14 Aug 2017 09:41:40 +0000 (09:41 +0000)]
MachineInstr: Reason locally about some memory objects before going to AA.

This addresses a FIXME in MachineInstr::mayAlias.

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

6 years ago[LoopUnroll] Enable option to peel remainder loop
Sam Parker [Mon, 14 Aug 2017 09:25:26 +0000 (09:25 +0000)]
[LoopUnroll] Enable option to peel remainder loop

On some targets, the penalty of executing runtime unrolling checks
and then not the unrolled loop can be significantly detrimental to
performance. This results in the need to be more conservative with
the unroll count, keeping a trip count of 2 reduces the overhead as
well as increasing the chance of the unrolled body being executed. But
being conservative leaves performance gains on the table.

This patch enables the unrolling of the remainder loop introduced by
runtime unrolling. This can help reduce the overhead of misunrolled
loops because the cost of non-taken branches is much less than the
cost of the backedge that would normally be executed in the remainder
loop. This allows larger unroll factors to be used without suffering
performance loses with smaller iteration counts.

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

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

6 years ago[AArch64] Remove unused MC function
Sam Parker [Mon, 14 Aug 2017 09:16:13 +0000 (09:16 +0000)]
[AArch64] Remove unused MC function

An unused function warning was raised in
https://bugs.llvm.org/show_bug.cgi?id=34178.

The offending function, in AArch64MCCodeEmitter.cpp, was committed by
me last week.

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

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

6 years agoRevert "[DAGCombiner] Extending pattern detection for vector shuffle (REAPPLIED)"
Elad Cohen [Mon, 14 Aug 2017 09:06:00 +0000 (09:06 +0000)]
Revert "[DAGCombiner] Extending pattern detection for vector shuffle (REAPPLIED)"

This reverts commit r310782.

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

6 years ago[ValueTracking] Revert r310583 which enabled functionality that still is
Chandler Carruth [Mon, 14 Aug 2017 07:03:24 +0000 (07:03 +0000)]
[ValueTracking] Revert r310583 which enabled functionality that still is
causing compile time issues.

Moreover, the patch *deleted* the flag in addition to changing the
default, and links to a code review that doesn't even discuss the flag
and just has an update to a Clang test case.

I've followed up on the commit thread to ask for numbers on compile time
at this point, leaving the flag in place until things stabilize, and
pointing at specific code that seems to exhibit excessive compile time
with this patch.

Original commit message for r310583:
"""
[ValueTracking] Enabling ValueTracking patch by default (recommit). Part 2.

The original patch was an improvement to IR ValueTracking on
non-negative integers. It has been checked in to trunk (D18777,
r284022). But was disabled by default due to performance regressions.
Perf impact has improved. The patch would be enabled by default.
""""

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

6 years ago[AVX-512] Add hasSideEffects = 0 to the 8-bit and 16-bit register broadcasts.
Craig Topper [Mon, 14 Aug 2017 05:09:34 +0000 (05:09 +0000)]
[AVX-512] Add hasSideEffects = 0 to the 8-bit and 16-bit register broadcasts.

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

6 years ago[X86] Remove unused argument from the vextract_for_size multiclass. NFC
Craig Topper [Mon, 14 Aug 2017 05:09:33 +0000 (05:09 +0000)]
[X86] Remove unused argument from the vextract_for_size multiclass. NFC

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

6 years ago[AVX512] Remove comment I should have removed in r310808. NFC
Craig Topper [Mon, 14 Aug 2017 05:09:31 +0000 (05:09 +0000)]
[AVX512] Remove comment I should have removed in r310808. NFC

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

6 years ago[opt-viewer] Listify `dict_items` for Py3 indexing
Brian Gesiak [Mon, 14 Aug 2017 04:16:43 +0000 (04:16 +0000)]
[opt-viewer] Listify `dict_items` for Py3 indexing

Summary:
In Python 2, calling `dict.items()` returns an indexable `list`, whereas
on Python 3 it returns a set-like `dict_items` object, which cannot be
indexed. Explicitly onvert the `dict_items` object so that it can be
indexed when using Python 3.

In combination with D36622, D36623, and D36624, this change allows
`opt-viewer.py` to exit successfully when run with Python 3.4.

Test Plan:
Run `opt-viewer.py` using Python 3.4 and confirm it does not encounter a
runtime error when when indexing into `dict.items()`.

Reviewers: anemet

Reviewed By: anemet

Subscribers: llvm-commits

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

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

6 years ago[PowerPC] Revert r310346 (and followups r310356 & r310424) which
Chandler Carruth [Mon, 14 Aug 2017 03:41:00 +0000 (03:41 +0000)]
[PowerPC] Revert r310346 (and followups r310356 & r310424) which
introduce a miscompile bug.

There appears to be a bug where the generated code to extract the sign
bit doesn't work correctly for 32-bit inputs. I've replied to the
original commit pointing out the problem. I think I see by inspection
(and reading the manual for PPC) how to fix this, but I can't be 100%
confident and I also don't know what the best way to test this is.
Currently it seems nearly impossible to get the backend to hit this code
path, but the patch autohr is likely in a better position to craft such
test cases than I am, and based on where the bug is it should be easily
done.

Original commit message for r310346:
"""
[PowerPC] Eliminate compares - add i32 sext/zext handling for SETLE/SETGE

Adds handling for SETLE/SETGE comparisons on i32 values. Furthermore, it
adds the handling for the special case where RHS == 0.

Differential Revision: https://reviews.llvm.org/D34048
"""

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

6 years ago[AVX512] Simplify the instruction defintion for VEXTRACT. NFCI
Craig Topper [Mon, 14 Aug 2017 01:53:10 +0000 (01:53 +0000)]
[AVX512] Simplify the instruction defintion for VEXTRACT. NFCI

The comment about why we couldn't use avx512_maskable appears to have been incorrect.

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

6 years ago[ARM] Tidy-up Cortex-A15 DPR-SPR optimizer implementation
Javed Absar [Mon, 14 Aug 2017 01:38:01 +0000 (01:38 +0000)]
[ARM] Tidy-up Cortex-A15 DPR-SPR optimizer implementation

Modernise the code with range-loops etc

Reviewed by: @fhahn, @rovka
Differential Revision: https://reviews.llvm.org/D36502

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

6 years ago[InstCombine] Simplify and inline FoldOrWithConstants/FoldXorWithConstants
Craig Topper [Mon, 14 Aug 2017 00:04:21 +0000 (00:04 +0000)]
[InstCombine] Simplify and inline FoldOrWithConstants/FoldXorWithConstants

Summary:
These functions were overly complicated. The body of this function was rechecking for an And operation to find the constant, but we already knew we were looking at two Ands ORed together and the pieces are in variables. We already had earlier nearby code that checked for ConstantInts. So just inline the remaining parts into the earlier code.

Next step is to use m_APInt instead of ConstantInt.

Reviewers: spatel, efriedma, davide, majnemer

Reviewed By: spatel

Subscribers: zzheng, llvm-commits

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

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

6 years ago[X86][BMI] Add BEXTR demanded bits test cases (PR34042)
Simon Pilgrim [Sun, 13 Aug 2017 20:35:38 +0000 (20:35 +0000)]
[X86][BMI] Add BEXTR demanded bits test cases (PR34042)

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

6 years ago[X86] Fix typo from r310794. Index = 0 should have been Index == 0.
Craig Topper [Sun, 13 Aug 2017 20:21:12 +0000 (20:21 +0000)]
[X86] Fix typo from r310794. Index = 0 should have been Index == 0.

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

6 years ago[X86] Remove unused pattern fragment that referenced MVT::i1. NFC
Craig Topper [Sun, 13 Aug 2017 20:04:05 +0000 (20:04 +0000)]
[X86] Remove unused pattern fragment that referenced MVT::i1. NFC

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

6 years ago[COFF, ARM64] Use '//' as comment character in assembly files in GNU environments
Martin Storsjo [Sun, 13 Aug 2017 19:42:05 +0000 (19:42 +0000)]
[COFF, ARM64] Use '//' as comment character in assembly files in GNU environments

This allows using semicolons for bundling up more than one
statement per line. This is used within the mingw-w64 project in some
assembly files that contain code for multiple architectures.

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

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

6 years agoRemove RISCV from LLVM_ALL_TARGETS in CMakeLists.txt
Alex Bradbury [Sun, 13 Aug 2017 18:49:33 +0000 (18:49 +0000)]
Remove RISCV from LLVM_ALL_TARGETS in CMakeLists.txt

It was mistakenly added to that list in D23560 (committed in rL285712). RISCV
is an experimental backend and should never have been in that list, I
mistakenly interpreted LLVM_ALL_TARGETS as a list of all targets rather than
targets to build by default. Unfortunately, because of this the RISCV backend
has been building by default when it shouldn't be.

This commet adds a description comment, which should help to avoid such
mistakes in the future.

See my message to llvm-dev for more information and analysis
<http://lists.llvm.org/pipermail/llvm-dev/2017-August/116347.html>.

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

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

6 years ago[AVX512] Correct isExtractSubvectorCheap so that it will return the correct answers...
Craig Topper [Sun, 13 Aug 2017 17:40:02 +0000 (17:40 +0000)]
[AVX512] Correct isExtractSubvectorCheap so that it will return the correct answers for extracting 128-bits from a 512-bit vector and for mask registers.

Previously it would not return true for extracting either of the upper quarters of a 512-bit registers.

For mask registers we support extracting anything from index 0. And otherwise we only support extracting the upper half of a register.

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

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

6 years ago[X86][ARM][TargetLowering] Add SrcVT to isExtractSubvectorCheap
Craig Topper [Sun, 13 Aug 2017 17:29:07 +0000 (17:29 +0000)]
[X86][ARM][TargetLowering] Add SrcVT to isExtractSubvectorCheap

Summary:
Without the SrcVT its hard to know what is really being asked for. For example if your target has 128, 256, and 512 bit vectors. Maybe extracting 128 from 256 is cheap, but maybe extracting 128 from 512 is not.

For x86 we do support extracting a quarter of a 512-bit register. But for i1 vectors we don't have isel patterns for extracting arbitrary pieces. So we need this to have a correct implementation of isExtractSubvectorCheap for mask vectors.

Reviewers: RKSimon, zvi, efriedma

Reviewed By: RKSimon

Subscribers: aemerson, javed.absar, kristof.beyls, llvm-commits

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

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

6 years ago[X86][SandyBridge] Additional updates to the SNB instructions scheduling information
Gadi Haber [Sun, 13 Aug 2017 13:59:24 +0000 (13:59 +0000)]
[X86][SandyBridge] Additional updates to the SNB instructions scheduling information

This is a continuation patch for commit r307529 which completely replaces the scheduling information for the SandyBridge architecture target by modifying the file X86SchedSandyBridge.td located under the X86 Target (see also https://reviews.llvm.org/D35019).

In this patch we added the scheduling information of additional SNB instructions that were missing from the patch commit r307529, fixed the scheduling of several resource groups that include only port0 instead of port05 (i.e., port0 OR port5) and fixed several incorrect instructions' scheduling in the r307529 commit.

The patch also includes the X87 instructions which were missing in previous patch commit r307529 as reported in bugzilla bug 34080.

Reviewers: zvi, RKSimon, chandlerc, igorb, m_zuckerman, craig.topper, aymanmus, dim

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

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

6 years ago[X86][AVX512] Added additional shuffle+trunc test case.
Simon Pilgrim [Sun, 13 Aug 2017 12:30:36 +0000 (12:30 +0000)]
[X86][AVX512] Added additional shuffle+trunc test case.

An existing test should have covered this but a typo caused it to fail. I've kept both as the codegen for the typo case needs addressing as well.

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

6 years ago[X86][TBM] Add tests showing failure to fold RFLAGS result into TBM instructions.
Simon Pilgrim [Sun, 13 Aug 2017 12:16:00 +0000 (12:16 +0000)]
[X86][TBM] Add tests showing failure to fold RFLAGS result into TBM instructions.

And fails to select TBM instructions at all.

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

6 years ago[X86][AsmParser][AVX512] Error appropriately when K0 is tried as a write-mask
Coby Tayree [Sun, 13 Aug 2017 12:03:00 +0000 (12:03 +0000)]
[X86][AsmParser][AVX512] Error appropriately when K0 is tried as a write-mask

K0 isn't expected as a write-mask, so provide a detailed error here, instead of the more generic one (invalid op for insn)
Conforms with gas

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

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

6 years ago[X86][TBM] Regenerate bextri intrinsics tests. NFCI.
Simon Pilgrim [Sun, 13 Aug 2017 11:56:15 +0000 (11:56 +0000)]
[X86][TBM] Regenerate bextri intrinsics tests. NFCI.

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

6 years ago[X86][AVX512] Add combine for TESTM
Guy Blank [Sun, 13 Aug 2017 08:03:37 +0000 (08:03 +0000)]
[X86][AVX512] Add combine for TESTM

Add an X86 combine for TESTM when one of the operands is a BUILD_VECTOR(0,0,...).

TESTM op0, BUILD_VECTOR(0,0,...) -> BUILD_VECTOR(0,0,...)
TESTM BUILD_VECTOR(0,0,...), op1 -> BUILD_VECTOR(0,0,...)

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

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

6 years ago[X86] Early out of combineInsertSubvector for mask vectors.
Craig Topper [Sat, 12 Aug 2017 22:33:58 +0000 (22:33 +0000)]
[X86] Early out of combineInsertSubvector for mask vectors.

The combines here shouldn't be done for mask vectors, but it wasn't clear anything was preventing that.

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

6 years ago[X86] Fix bad comment. NFC
Craig Topper [Sat, 12 Aug 2017 22:33:57 +0000 (22:33 +0000)]
[X86] Fix bad comment. NFC

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

6 years ago[X86] When handling addcarry intrinsic, create the flag result with the correct type...
Craig Topper [Sat, 12 Aug 2017 20:19:44 +0000 (20:19 +0000)]
[X86] When handling addcarry intrinsic, create the flag result with the correct type so we don't crash if we use a memory instruction

Summary:
Previously we were creating the flag result with MVT::Other which is interpretted as a Chain node. If we used a memory form of the instruction we would end up with a copyToReg that consumed the chain result of the adcx instruction instead of the flag result.

Pretty sure we should be using MVT::i32 here, that's what we do other places we create these node types.

We should probably consider this for 5.0 as well.

Reviewers: RKSimon, zvi, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years ago[DAGCombiner] Extending pattern detection for vector shuffle (REAPPLIED)
Simon Pilgrim [Sat, 12 Aug 2017 17:43:25 +0000 (17:43 +0000)]
[DAGCombiner] Extending pattern detection for vector shuffle (REAPPLIED)

If all the operands of a BUILD_VECTOR extract elements from same vector then split the vector efficiently based on the maximum vector access index.

Reapplied with fix to only work with simple value types.

Committed on behalf of @jbhateja (Jatin Bhateja)

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

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

6 years ago[Triple] Add isThumb and isARM functions.
Florian Hahn [Sat, 12 Aug 2017 17:40:18 +0000 (17:40 +0000)]
[Triple] Add isThumb and isARM functions.

Summary:
isThumb returns true for Thumb triples (little and big endian), isARM
returns true for ARM triples (little and big endian).
There are a few more checks using arm/thumb that are not covered by
those functions, e.g. that the architecture is either ARM or Thumb
(little endian) or ARM/Thumb little endian only.

Reviewers: javed.absar, rengolin, kristof.beyls, t.p.northover

Reviewed By: rengolin

Subscribers: llvm-commits, aemerson

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

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

6 years ago[X86] Regenerate merge store tests. NFCI.
Simon Pilgrim [Sat, 12 Aug 2017 17:27:35 +0000 (17:27 +0000)]
[X86] Regenerate merge store tests. NFCI.

Gives us a much better idea of what is going on than just relying on a few checks.

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

6 years ago[BDCE] clear poison generators after turning a value into zero (PR33695, PR34037)
Sanjay Patel [Sat, 12 Aug 2017 16:41:08 +0000 (16:41 +0000)]
[BDCE] clear poison generators after turning a value into zero (PR33695, PR34037)

nsw, nuw, and exact carry implicit assumptions about their operands, so we need
to clear those after trivializing a value. We decided there was no danger for
llvm.assume or metadata, so there's just a comment about that.

This fixes miscompiles as shown in:
https://bugs.llvm.org/show_bug.cgi?id=33695
https://bugs.llvm.org/show_bug.cgi?id=34037

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

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

6 years agoFix some minor typos in the llvm XRay exemple
Sylvestre Ledru [Sat, 12 Aug 2017 15:08:11 +0000 (15:08 +0000)]
Fix some minor typos in the llvm XRay exemple

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

6 years agoD36604: PR34148: Do not assume we can use a copy relocation for an `external_weak...
Richard Smith [Fri, 11 Aug 2017 23:52:28 +0000 (23:52 +0000)]
D36604: PR34148: Do not assume we can use a copy relocation for an `external_weak` global

An `external_weak` global may be intended to resolve as a null pointer if it's
not defined, so it doesn't make sense to use a copy relocation for it.

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

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

6 years ago[libFuzzer] experimental support for Clang's coverage (fprofile-instr-generate),...
Kostya Serebryany [Fri, 11 Aug 2017 23:03:22 +0000 (23:03 +0000)]
[libFuzzer] experimental support for Clang's coverage (fprofile-instr-generate), Linux-only

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

6 years ago[x86] add tests for rotate left/right with masked shifter; NFC
Sanjay Patel [Fri, 11 Aug 2017 22:38:40 +0000 (22:38 +0000)]
[x86] add tests for rotate left/right with masked shifter; NFC

As noted in the test comment, instcombine now produces the masked
shift value even when it's not included in the source, so we should
handle this.

Although the AMD/Intel docs don't say it explicitly, over-rotating
the narrow ops produces the same results. An existence proof that
this works as expected on all x86 comes from gcc 4.9 or later:
https://godbolt.org/g/K6rc1A

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

6 years ago[MIPS] Use ABI to determine stack alignment.
John Baldwin [Fri, 11 Aug 2017 22:07:56 +0000 (22:07 +0000)]
[MIPS] Use ABI to determine stack alignment.

Summary:
The stack alignment depends on the ABI (16 bytes for N32 and N64 and 8
bytes for O32), not the CPU type.

Reviewers: sdardis

Reviewed By: sdardis

Subscribers: atanasyan, arichardson, llvm-commits

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

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

6 years ago[x86] regenerate test checks, add 64-bit run; NFC
Sanjay Patel [Fri, 11 Aug 2017 22:05:33 +0000 (22:05 +0000)]
[x86] regenerate test checks, add 64-bit run; NFC

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

6 years ago[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings...
Eugene Zelenko [Fri, 11 Aug 2017 21:30:02 +0000 (21:30 +0000)]
[Analysis] Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoFix some broken tests.
Zachary Turner [Fri, 11 Aug 2017 21:14:01 +0000 (21:14 +0000)]
Fix some broken tests.

These were pending in a separate patch but I forgot to squash them
before comitting, and this one didn't go through.

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

6 years ago[OptDiag] Updating Remarks in SampleProfile
Eli Friedman [Fri, 11 Aug 2017 21:12:04 +0000 (21:12 +0000)]
[OptDiag] Updating Remarks in SampleProfile

Updating remark API to newer OptimizationDiagnosticInfo API. This
allows remarks to show up in diagnostic yaml file, and enables use
of opt-viewer tool.

Hotness information for remarks (L505 and L751) do not display hotness
information, most likely due to profile information not being
propagated yet. Unsure if this is the desired outcome.

Patch by Tarun Rajendran.

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

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

6 years ago[X86] Don't use fsin/fcos/fsincos instructions ever
Craig Topper [Fri, 11 Aug 2017 20:55:29 +0000 (20:55 +0000)]
[X86] Don't use fsin/fcos/fsincos instructions ever

Summary:
Previously we would use these instructions if sse was disabled and fastmath was enabled.

As mentioned in D28335, this is a bad idea.

Reviewers: efriedma, scanon, DavidKreitzer

Reviewed By: DavidKreitzer

Subscribers: zvi, llvm-commits

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

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

6 years agoFix access to undefined weak symbols in pic code
Rafael Espindola [Fri, 11 Aug 2017 20:49:27 +0000 (20:49 +0000)]
Fix access to undefined weak symbols in pic code

When the access to a weak symbol is not a call, the access has to be
able to produce the value 0 at runtime.

We were sometimes producing code sequences where that was not possible
if the code was leaded more than 4g away from 0.

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

6 years agoOutput S_SECTION symbols to the Linker module.
Zachary Turner [Fri, 11 Aug 2017 20:46:28 +0000 (20:46 +0000)]
Output S_SECTION symbols to the Linker module.

PDBs need to contain 1 module for each object file/compiland,
and a special one synthesized by the linker.  This one contains
a symbol record for each output section in the executable with
its address information.  This patch adds such symbols to the
linker module.  Note that we also are supposed to add an
S_COFFGROUP symbol for what appears to be each input section that
contributes to each output section, but it's not entirely clear
how to generate these yet, so I'm leaving that for a separate
patch.

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

6 years agoAMDGPU: Start adding tail call support
Matt Arsenault [Fri, 11 Aug 2017 20:42:08 +0000 (20:42 +0000)]
AMDGPU: Start adding tail call support

Handle the sibling call cases.

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

6 years ago[libFuzzer] recommend Clang Coverage for coverage visualization
Kostya Serebryany [Fri, 11 Aug 2017 20:32:47 +0000 (20:32 +0000)]
[libFuzzer] recommend Clang Coverage for coverage visualization

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

6 years ago[libFuzzer] Re-enable coverage.test on Darwin.
George Karpenkov [Fri, 11 Aug 2017 20:30:52 +0000 (20:30 +0000)]
[libFuzzer] Re-enable coverage.test on Darwin.

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

6 years agoRevert r310716 (and r310735): [globalisel][tablegen] Support zero-instruction emission.
Daniel Sanders [Fri, 11 Aug 2017 19:19:21 +0000 (19:19 +0000)]
Revert r310716 (and r310735): [globalisel][tablegen] Support zero-instruction emission.

Two of the Windows bots are failing test\CodeGen\X86\GlobalISel\select-inc.mir
which should not have been affected by the change. Reverting while I investigate.

Also reverted r310735 because it builds on r310716.

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

6 years agoAdd documentation for llvm-pdbutil.
Zachary Turner [Fri, 11 Aug 2017 19:00:22 +0000 (19:00 +0000)]
Add documentation for llvm-pdbutil.

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

6 years ago[LLD/PDB] Write actual records to the globals stream.
Zachary Turner [Fri, 11 Aug 2017 19:00:03 +0000 (19:00 +0000)]
[LLD/PDB] Write actual records to the globals stream.

Previously we were writing an empty globals stream.  Windows
tools interpret this as "private symbols are not present in
this PDB", even when they are, so we need to fix this.  Regardless,
without it we don't have information about global variables, so
we need to fix it anyway.  This patch does that.

With this patch, the "lm" command in WinDbg correctly reports
that we have private symbols available, but the "dv" command
still refuses to display local variables.

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

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

6 years ago[mips] clang-format MipsSubtarget.cpp.
John Baldwin [Fri, 11 Aug 2017 18:35:19 +0000 (18:35 +0000)]
[mips] clang-format MipsSubtarget.cpp.

This only fixes a few things and serves as my initial test commit.

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

6 years ago[opt-viewer] Decode HTML bytes for Python 3
Brian Gesiak [Fri, 11 Aug 2017 18:05:26 +0000 (18:05 +0000)]
[opt-viewer] Decode HTML bytes for Python 3

Summary:
When using Python 3, `pygments.highlight()` returns a `bytes` object, not
a `str`, causing the call to `str.replace` on the following line to fail
with a runtime exception:
`TypeError: 'str' does not support the buffer interface`. Decode the
bytes into a string in order to fix the exception.

Test Plan:
Run `opt-viewer.py` with Python 3.4, and confirm no runtime error occurs
when calling `str.replace`.

Reviewers: anemet

Reviewed By: anemet

Subscribers: llvm-commits

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

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

6 years ago[opt-viewer] Use Python 3-compatible iteritems
Brian Gesiak [Fri, 11 Aug 2017 18:02:07 +0000 (18:02 +0000)]
[opt-viewer] Use Python 3-compatible iteritems

Summary:
Replace a usage of a Python 2-specific `dict.iteritems()` with the
Python 3-compatible definition provided at the top of the same file.

Test Plan:
Run `opt-viewer.py` using Python 3 and confirm it no longer encounters a
runtime error when calling `dict.iteritems()`.

Reviewers: anemet

Reviewed By: anemet

Subscribers: llvm-commits

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

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

6 years ago[opt-viewer] Use Python 3-compatible `intern()`
Brian Gesiak [Fri, 11 Aug 2017 17:56:57 +0000 (17:56 +0000)]
[opt-viewer] Use Python 3-compatible `intern()`

Summary:
In Python 2, `intern()` is a builtin function available to all programs.
In Python 3, it was moved into the `sys` module, available as
`sys.intern`. Import it such that, within `optrecord.py`, `intern()` is
available whether run using Python 2 or 3.

Test Plan:
Run `opt-viewer.py` using Python 3, confirm it no longer
encounters a runtime error when `intern()` is called.

Reviewers: anemet

Reviewed By: anemet

Subscribers: llvm-commits

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

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

6 years ago[AMDGPU] Fix santizer error after last commit
Stanislav Mekhanoshin [Fri, 11 Aug 2017 17:54:43 +0000 (17:54 +0000)]
[AMDGPU] Fix santizer error after last commit

Removed useless assert.

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

6 years agoFix typo /NFC
Xinliang David Li [Fri, 11 Aug 2017 17:49:20 +0000 (17:49 +0000)]
Fix typo /NFC

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

6 years ago[globalisel][tablegen] Generate TypeObject table. NFC
Daniel Sanders [Fri, 11 Aug 2017 17:30:37 +0000 (17:30 +0000)]
[globalisel][tablegen] Generate TypeObject table. NFC

Summary:
Generate the type table from the types used by a target rather than hard-coding
the union of types used by all targets.

Depends on D36084

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Reviewed By: rovka

Subscribers: kristof.beyls, igorb, llvm-commits

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

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

6 years agoUpdate libFuzzer documentation for -fsanitize=fuzzer-no-link flag
George Karpenkov [Fri, 11 Aug 2017 17:23:45 +0000 (17:23 +0000)]
Update libFuzzer documentation for -fsanitize=fuzzer-no-link flag

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

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

6 years ago[AMDGPU] Ported and adopted AMDLibCalls pass
Stanislav Mekhanoshin [Fri, 11 Aug 2017 16:42:09 +0000 (16:42 +0000)]
[AMDGPU] Ported and adopted AMDLibCalls pass

The pass does simplifications of well known AMD library calls.
If given -amdgpu-prelink option it works in a pre-link mode which
allows to reference new library functions which will be linked in
later.

In addition it also used to process traditional AMD option
-fuse-native which allows to replace some of the functions with
their fast native implementations from the library.

The necessary glue to pass the prelink option and translate
-fuse-native is to be added to the driver.

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

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

6 years agoOrc: PR33769: Don't rely on comparisons with default constructed iterators
David Blaikie [Fri, 11 Aug 2017 16:38:28 +0000 (16:38 +0000)]
Orc: PR33769: Don't rely on comparisons with default constructed iterators

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

6 years ago[AVX512] Remove and autoupgrade many of the broadcast intrinsics
Craig Topper [Fri, 11 Aug 2017 16:22:45 +0000 (16:22 +0000)]
[AVX512] Remove and autoupgrade many of the broadcast intrinsics

Summary:
This autoupgrades most of the broadcast intrinsics. They've been unused in clang for some time.

This leaves the 32x2 intrinsics because they are still used in clang.

Reviewers: RKSimon, zvi, igorb

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years ago[x86] Enable some support for lowerVectorShuffleWithUndefHalf with AVX-512
Craig Topper [Fri, 11 Aug 2017 16:20:05 +0000 (16:20 +0000)]
[x86] Enable some support for lowerVectorShuffleWithUndefHalf with AVX-512

Summary:
This teaches 512-bit shuffles to detect unused halfs in order to reduce shuffle size.

We may need to refine the 512-bit exit point. I couldn't remember if we had good cross lane shuffles for 8/16 bit with AVX-512 or not.

I believe this is step towards being able to handle D36454 without a special case.

From here we need to improve our ability to combine extract_subvector with insert_subvector and other extract_subvectors. And we need to support narrowing binary operations where we don't demand all elements. This may be improvements to DAGCombiner::narrowExtractedVectorBinOp(by recognizing an insert_subvector in addition to concat) or we may need a target specific combiner.

Reviewers: RKSimon, zvi, delena, jbhateja

Reviewed By: RKSimon, jbhateja

Subscribers: llvm-commits

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

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

6 years ago[x86] use more shift or LEA for select-of-constants (2nd try)
Sanjay Patel [Fri, 11 Aug 2017 15:44:14 +0000 (15:44 +0000)]
[x86] use more shift or LEA for select-of-constants (2nd try)

The previous rev (r310208) failed to account for overflow when subtracting the
constants to see if they're suitable for shift/lea. This version add a check
for that and more test were added in r310490.

We can convert any select-of-constants to math ops:
http://rise4fun.com/Alive/d7d

For this patch, I'm enhancing an existing x86 transform that uses fake multiplies
(they always become shl/lea) to avoid cmov or branching. The current code misses
cases where we have a negative constant and a positive constant, so this is just
trying to plug that hole.

The DAGCombiner diff prevents us from hitting a terrible inefficiency: we can start
with a select in IR, create a select DAG node, convert it into a sext, convert it
back into a select, and then lower it to sext machine code.

Some notes about the test diffs:

1. 2010-08-04-MaskedSignedCompare.ll - We were creating control flow that didn't exist in the IR.
2. memcmp.ll - Choose -1 or 1 is the case that got me looking at this again. We could avoid the
   push/pop in some cases if we used 'movzbl %al' instead of an xor on a different reg? That's a
   post-DAG problem though.
3. mul-constant-result.ll - The trade-off between sbb+not vs. setne+neg could be addressed if
   that's a regression, but those would always be nearly equivalent.
4. pr22338.ll and sext-i1.ll - These tests have undef operands, so we don't actually care about these diffs.
5. sbb.ll - This shows a win for what is likely a common case: choose -1 or 0.
6. select.ll - There's another borderline case here: cmp+sbb+or vs. test+set+lea? Also, sbb+not vs. setae+neg shows up again.
7. select_const.ll - These are motivating cases for the enhancement; replace cmov with cheaper ops.

Assembly differences between movzbl and xor to avoid a partial reg stall are caused later by the X86 Fixup SetCC pass.

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

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

6 years ago[globalisel][tablegen] Support zero-instruction emission.
Daniel Sanders [Fri, 11 Aug 2017 15:40:32 +0000 (15:40 +0000)]
[globalisel][tablegen] Support zero-instruction emission.

Summary:
Support the case where an operand of a pattern is also the whole of the
result pattern. In this case the original result and all its uses must be
replaced by the operand. However, register class restrictions can require
a COPY. This patch handles both cases by always emitting the copy and
leaving it for the register allocator to optimize.

Depends on D35833

Reviewers: ab, t.p.northover, qcolombet, rovka, aditya_nandakumar

Subscribers: javed.absar, kristof.beyls, igorb, llvm-commits

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

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

6 years ago[mips] Lift the assertion on the types that can be used with MipsGPRel
Simon Dardis [Fri, 11 Aug 2017 14:36:05 +0000 (14:36 +0000)]
[mips] Lift the assertion on the types that can be used with MipsGPRel

Post commit review of rL308619 highlighted the need for handling N64
with -fno-pic. Testing reveale a stale assert when generating a GP
relative addressing mode.

This patch removes that assert and adds the necessary patterns for
MIPS64 to perform gp relative addressing with -fno-pic
(and the implicit -mno-abicalls + -mgpopt).

Reviewers: atanasyan, nitesh.jain

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

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

6 years ago[cmake] Expose the dependencies of ExecutionEngine as PUBLIC
Michal Gorny [Fri, 11 Aug 2017 13:25:20 +0000 (13:25 +0000)]
[cmake] Expose the dependencies of ExecutionEngine as PUBLIC

Expose the dependencies of LLVMExecutionEngine library as PUBLIC rather
than PRIVATE when building a shared library. This is necessary because
the library is not contained but exposes API of other LLVM libraries via
its headers.

This causes other libraries to fail to link if the linker verifies for
correctness of -l flags (i.e. fails on indirect dependencies). This e.g.
happens when building LLDB against shared LLVM:

  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTIN4llvm18MCJITMemoryManagerE[_ZTIN4llvm18MCJITMemoryManagerE]+0x10): undefined reference to `typeinfo for llvm::RuntimeDyld::MemoryManager'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN4llvm18MCJITMemoryManagerE[_ZTVN4llvm18MCJITMemoryManagerE]+0x60): undefined reference to `llvm::RuntimeDyld::MemoryManager::anchor()'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0x48): undefined reference to `llvm::RTDyldMemoryManager::deregisterEHFrames()'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0x60): undefined reference to `llvm::RuntimeDyld::MemoryManager::anchor()'
  lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):(.data.rel.ro._ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE[_ZTVN12lldb_private15IRExecutionUnit13MemoryManagerE]+0xd0): undefined reference to `llvm::JITSymbolResolver::anchor()'
  collect2: error: ld returned 1 exit status

Declaring the dependencies as PUBLIC guarantees that any package using
the ExecutionEngine library will also get explicit -l flags for
the dependent libraries guaranteeing that the symbols exposed in headers
could be resolved.

Patch originally written by NAKAMURA Takumi.

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

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

6 years agoImprove handling of insert_subvector of bitcast values
Nirav Dave [Fri, 11 Aug 2017 13:21:41 +0000 (13:21 +0000)]
Improve handling of insert_subvector of bitcast values

Fix insert_subvector / extract_subvector merges of bitcast values.

Reviewers: efriedma, craig.topper, RKSimon

Subscribers: RKSimon, llvm-commits

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

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

6 years ago[X86][DAG] Switch X86 Target to post-legalized store merge
Nirav Dave [Fri, 11 Aug 2017 13:21:35 +0000 (13:21 +0000)]
[X86][DAG] Switch X86 Target to post-legalized store merge

Move store merge to happen after intrinsic lowering to allow lowered
stores to be merged.

Some regressions due in MergeConsecutiveStores to missing
insert_subvector that are addressed in follow up patch.

Reviewers: craig.topper, efriedma, RKSimon

Subscribers: llvm-commits

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

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

6 years ago[AArch64] Enable ARMv8.3-A pointer authentication
Sam Parker [Fri, 11 Aug 2017 13:14:00 +0000 (13:14 +0000)]
[AArch64] Enable ARMv8.3-A pointer authentication

Add assembler and disassembler support for the ARMv8.3-A pointer
authentication instructions.

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

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

6 years ago[AArch64] Remove dotprod from base extension list
Sjoerd Meijer [Fri, 11 Aug 2017 13:12:49 +0000 (13:12 +0000)]
[AArch64] Remove dotprod from base extension list

Dot product is an optional ARMv8.2a extension; remove it from the ARMv8.2a base
extension list. This was introduced in commit r310480.

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

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

6 years ago[ARM] Assembler support for the ARMv8.2a dot product instructions
Sjoerd Meijer [Fri, 11 Aug 2017 09:52:30 +0000 (09:52 +0000)]
[ARM] Assembler support for the ARMv8.2a dot product instructions

Commit r310480 added the AArch64 ARMv8.2a dot product instructions;
this adds the AArch32 instructions.

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

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

6 years ago[DAGCombiner] Remove shuffle support from simplifyShuffleMask
Simon Pilgrim [Fri, 11 Aug 2017 08:37:00 +0000 (08:37 +0000)]
[DAGCombiner] Remove shuffle support from simplifyShuffleMask

rL310372 enabled simplifyShuffleMask to support undef shuffle mask inputs, but its causing hangs.

Removing support until I can triage the problem

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

6 years ago[IfConversion] Maintain the CFG when predicating/merging blocks in IfConvert*
Mikael Holmen [Fri, 11 Aug 2017 06:57:08 +0000 (06:57 +0000)]
[IfConversion] Maintain the CFG when predicating/merging blocks in IfConvert*

Summary:
This fixes PR32721 in IfConvertTriangle and possible similar problems in
IfConvertSimple, IfConvertDiamond and IfConvertForkedDiamond.

In PR32721 we had a triangle

   EBB
   | \
   |  |
   | TBB
   |  /
   FBB

where FBB didn't have any successors at all since it ended with an
unconditional return. Then TBB and FBB were be merged into EBB, but EBB
would still keep its successors, and the use of analyzeBranch and
CorrectExtraCFGEdges wouldn't help to remove them since the return
instruction is not analyzable (at least not on ARM).

The edge updating code and branch probability updating code is now pushed
into MergeBlocks() which allows us to share the same update logic between
more callsites. This lets us remove several dependencies on analyzeBranch
and completely eliminate RemoveExtraEdges.

One thing that showed up with this patch was that IfConversion sometimes
left a successor with 0% probability even if there was no branch or
fallthrough to the successor.

One such example from the test case ifcvt_bad_zero_prob_succ.mir. The
indirect branch tBRIND can only jump to bb.1, but without the patch we
got:

  bb.0:
    successors: %bb.1(0x80000000)

  bb.1:
    successors: %bb.1(0x80000000), %bb.2(0x00000000)
    tBRIND %r1, 1, %cpsr
    B %bb.1

  bb.2:

There is no way to jump from bb.1 to bb2, but still there is a 0% edge
from bb.1 to bb.2.

With the patch applied we instead get the expected:

  bb.0:
    successors: %bb.1(0x80000000)

  bb.1:
    successors: %bb.1(0x80000000)
    tBRIND %r1, 1, %cpsr
    B %bb.1

Since bb.2 had no predecessor at all, it was removed.

Several testcases had to be updated due to this since the removed
successor made the "Branch Probability Basic Block Placement" pass
sometimes place blocks in a different order.

Finally added a couple of new test cases:

* PR32721_ifcvt_triangle_unanalyzable.mir:
  Regression test for the original problem dexcribed in PR 32721.

* ifcvt_triangleWoCvtToNextEdge.mir:
  Regression test for problem that caused a revert of my first attempt
  to solve PR 32721.

* ifcvt_simple_bad_zero_prob_succ.mir:
  Test case showing the problem where a wrong successor with 0% probability
  was previously left.

* ifcvt_[diamond|forked_diamond|simple]_unanalyzable.mir
  Very simple test cases for the simple and (forked) diamond cases
  involving unanalyzable branches that can be nice to have as a base if
  wanting to write more complicated tests.

Reviewers: iteratee, MatzeB, grosser, kparzysz

Reviewed By: kparzysz

Subscribers: kbarton, davide, aemerson, nemanjai, javed.absar, kristof.beyls, llvm-commits

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

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

6 years ago[PM] Switch the CGSCC debug messages to use the standard LLVM debug
Chandler Carruth [Fri, 11 Aug 2017 05:47:13 +0000 (05:47 +0000)]
[PM] Switch the CGSCC debug messages to use the standard LLVM debug
printing techniques with a DEBUG_TYPE controlling them.

It was a mistake to start re-purposing the pass manager `DebugLogging`
variable for generic debug printing -- those logs are intended to be
very minimal and primarily used for testing. More detailed and
comprehensive logging doesn't make sense there (it would only make for
brittle tests).

Moreover, we kept forgetting to propagate the `DebugLogging` variable to
various places making it also ineffective and/or unavailable. Switching
to `DEBUG_TYPE` makes this a non-issue.

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

6 years ago[MachineOutliner] Add RegState::Define to LDRXpost in insertOutlinedCall
Jessica Paquette [Thu, 10 Aug 2017 23:11:24 +0000 (23:11 +0000)]
[MachineOutliner] Add RegState::Define to LDRXpost in insertOutlinedCall

This fixes a MachineVerifier failure in machine-outliner.mir. Not explicitly
adding RegState::Define to the LR argument makes it unhappy because an explicit
definition is marked as a use.

Build failure:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-expensive/7496/testReport/junit/LLVM/CodeGen_AArch64/machine_outliner_mir/

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

6 years agoRevert "[AsmParser] Hash is not a comment on some targets"
Ahmed Bougacha [Thu, 10 Aug 2017 21:23:00 +0000 (21:23 +0000)]
Revert "[AsmParser] Hash is not a comment on some targets"

This reverts commit r310457.

It causes clang-produced IR to fail llvm codegen.

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

6 years agoDisable some IR death tests when SEH is available
Reid Kleckner [Thu, 10 Aug 2017 21:14:07 +0000 (21:14 +0000)]
Disable some IR death tests when SEH is available

They hang for me locally. I suspect that there is a use-after-free when
attempting to destroy an LLVMContext after asserting from the middle of
metadata tracking. It doesn't seem worth debugging it further.

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

6 years agoRevert "[DAG] Cleanup unused nodes after store merge. NFCI."
Nirav Dave [Thu, 10 Aug 2017 21:03:36 +0000 (21:03 +0000)]
Revert "[DAG] Cleanup unused nodes after store merge. NFCI."

This reverts commit r310648 which causes an unexpected assertion failure

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

6 years ago[InstCombine] Make (X|C1)^C2 -> X^(C1^C2) iff X&~C1 == 0 work for splat vectors
Craig Topper [Thu, 10 Aug 2017 20:35:34 +0000 (20:35 +0000)]
[InstCombine] Make (X|C1)^C2 -> X^(C1^C2) iff X&~C1 == 0 work for splat vectors

This also corrects the description to match what was actually implemented. The old comment said X^(C1|C2), but it implemented X^((C1|C2)&~(C1&C2)). I believe ((C1|C2)&~(C1&C2)) is equivalent to (C1^C2).

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

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

6 years ago[DAG] Relax type restriction for store merge
Nirav Dave [Thu, 10 Aug 2017 19:52:45 +0000 (19:52 +0000)]
[DAG]  Relax type restriction for store merge

Summary: Allow stores of bitcastable types to be merged by peeking through BITCAST nodes and recasting stored values constant and vector extract nodes as necessary.

Reviewers: jyknight, hfinkel, efriedma, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years ago[CostModel][X86] Add SSE2 two-src shuffle costs
Simon Pilgrim [Thu, 10 Aug 2017 19:32:35 +0000 (19:32 +0000)]
[CostModel][X86] Add SSE2 two-src shuffle costs

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

6 years ago[ARM] Clarify legal addressing modes for ARM and Thumb2. NFC
Eli Friedman [Thu, 10 Aug 2017 19:31:27 +0000 (19:31 +0000)]
[ARM] Clarify legal addressing modes for ARM and Thumb2. NFC

The existing code is very clever, but not clear, which seems
like the wrong tradeoff here.

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

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

6 years ago[gold-plugin] Use more StringRef. No functionality change intended.
Benjamin Kramer [Thu, 10 Aug 2017 19:28:00 +0000 (19:28 +0000)]
[gold-plugin] Use more StringRef. No functionality change intended.

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

6 years ago[CostModel][X86] Add avx1 two-src shuffle costs
Simon Pilgrim [Thu, 10 Aug 2017 19:02:51 +0000 (19:02 +0000)]
[CostModel][X86] Add avx1 two-src shuffle costs

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

6 years ago[DAG] Cleanup unused nodes after store merge. NFCI.
Nirav Dave [Thu, 10 Aug 2017 18:53:14 +0000 (18:53 +0000)]
[DAG] Cleanup unused nodes after store merge. NFCI.

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

6 years ago[CostModel][X86] Add avx2 two-src shuffle costs
Simon Pilgrim [Thu, 10 Aug 2017 18:29:34 +0000 (18:29 +0000)]
[CostModel][X86] Add avx2 two-src shuffle costs

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

6 years agoMake .file directive to have basename only
Taewook Oh [Thu, 10 Aug 2017 18:17:11 +0000 (18:17 +0000)]
Make .file directive to have basename only

Summary:
Currently LLVM puts directory along with the filename in .file directive, but this behavior doesn't match gcc. There's a no clear description about which one is right (https://sourceware.org/binutils/docs/as/File.html#File), but one document (https://sourceware.org/gdb/current/onlinedocs/stabs/ELF-Linker-Relocation.html) suggests that STT_FILE symbol in elf file is expected to have basename only, which should have a same sting file .file directive according to (https://docs.oracle.com/cd/E26502_01/html/E28388/eoiyg.html).

This also affects badly on the build system that uses hashing, as the directory info could be differnt from developer to developer even when they're working on same file.

Reviewers: pcc, mehdi_amini

Subscribers: llvm-commits

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

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

6 years ago[CostModel][X86] Extend two src shuffle cost tests
Simon Pilgrim [Thu, 10 Aug 2017 18:02:45 +0000 (18:02 +0000)]
[CostModel][X86] Extend two src shuffle cost tests

Cover most 128/256/512/1024-bit cases for vXf64/vXi64, vXf32/vXi32, vXi16 + vXi8

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

6 years ago[InstCombine] Fix a crash in getSelectCondition if we happen to have two inverse...
Craig Topper [Thu, 10 Aug 2017 17:48:14 +0000 (17:48 +0000)]
[InstCombine] Fix a crash in getSelectCondition if we happen to have two inverse vectors of i1 constants.

We used to try to truncate the constant vector to vXi1, but if it's already i1 this would fail. Instead we now use IRBuilder::getZExtOrTrunc which should check the type and only create a trunc if needed. I believe this should trigger constant folding in the IRBuilder and ultimately do the same thing just with the additional type check.

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

6 years ago[InstCombine] Add a DEBUG_COUNTER to InstCombine to limit how many instructions are...
Craig Topper [Thu, 10 Aug 2017 17:48:12 +0000 (17:48 +0000)]
[InstCombine] Add a DEBUG_COUNTER to InstCombine to limit how many instructions are visited for debug

Sometimes it would be nice to stop InstCombine mid way through its combining to see the current IR. By using a debug counter we can place an upper limit on how many instructions to process.

This will also allow skipping the first X combines, but that has the potential to change later combines since earlier canonicalizations might have been skipped.

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

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

6 years ago[DebugCounter] Move the semicolon out of the DEBUG_COUNTER macro and require it to...
Craig Topper [Thu, 10 Aug 2017 17:48:11 +0000 (17:48 +0000)]
[DebugCounter] Move the semicolon out of the DEBUG_COUNTER macro and require it to be placed at the end of each use.

This make it consistent with STATISTIC which it will often appears near.

While there move one DEBUG_COUNTER instance out of an anonymous namespace. It's already declaring a static variable so the namespace is unnecessary.

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

6 years ago[gold-plugin] Avoid race condition when creating temporary files.
Benjamin Kramer [Thu, 10 Aug 2017 17:38:41 +0000 (17:38 +0000)]
[gold-plugin] Avoid race condition when creating temporary files.

This is both a potential security issue and a potential functionality
issue because we create temporary files from multiple threads. Use
the safe version of createTemporaryFile instead.

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

6 years ago[CostModel][X86] Add avx512vbmi broadcast/reverse/single-src shuffle cost tests
Simon Pilgrim [Thu, 10 Aug 2017 17:33:25 +0000 (17:33 +0000)]
[CostModel][X86] Add avx512vbmi broadcast/reverse/single-src shuffle cost tests

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

6 years ago[CostModel][X86] Improve single src shuffle costs
Simon Pilgrim [Thu, 10 Aug 2017 17:27:20 +0000 (17:27 +0000)]
[CostModel][X86] Improve single src shuffle costs

Add missing SK_PermuteSingleSrc costs for AVX2 targets and earlier, also added some of the simpler SK_PermuteTwoSrc costs to support splitting of SK_PermuteSingleSrc shuffles

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