platform/upstream/llvm.git
7 years agoAdd "REQUIRES:" to the last few tests that use target specific intrinsics
Justin Bogner [Mon, 15 May 2017 22:15:22 +0000 (22:15 +0000)]
Add "REQUIRES:" to the last few tests that use target specific intrinsics

llvm-svn: 303123

7 years ago[AMDGPU] Kill now unused phiInfoElementGetDebugLoc(). NFCI.
Davide Italiano [Mon, 15 May 2017 22:10:15 +0000 (22:10 +0000)]
[AMDGPU] Kill now unused phiInfoElementGetDebugLoc(). NFCI.

llvm-svn: 303122

7 years ago[Sema] Use CK_NoOp instead CK_Invalid in tryGCCVectorConvertAndSplat
Vitaly Buka [Mon, 15 May 2017 22:04:03 +0000 (22:04 +0000)]
[Sema] Use CK_NoOp instead CK_Invalid in tryGCCVectorConvertAndSplat

This fix UBSAN bots after r302935. Storing non-defined values in enum is
undefined behavior.

Other places, where "if (ScalarCast != CK_Invalid)" is used, never get to the
"if" with CK_Invalid. tryGCCVectorConvertAndSplat can get to the "if" with
CK_Invalid and it looks like expected case. So we have to use something other
than CK_Invalid, e.g. CK_NoOp.

llvm-svn: 303121

7 years ago[APInt] Simplify a for loop initialization based on the fact that 'n' is known to...
Craig Topper [Mon, 15 May 2017 22:01:03 +0000 (22:01 +0000)]
[APInt] Simplify a for loop initialization based on the fact that 'n' is known to be 1 by an earlier 'if'.

llvm-svn: 303120

7 years ago[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Mon, 15 May 2017 21:57:41 +0000 (21:57 +0000)]
[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

llvm-svn: 303119

7 years agoAArch64: use linker-private symbols for globals in MachO.
Tim Northover [Mon, 15 May 2017 21:51:38 +0000 (21:51 +0000)]
AArch64: use linker-private symbols for globals in MachO.

We don't use section-relative relocations on AArch64, so all symbols must be at
least visible to the linker (i.e. properly global or l_whatever, but not
L_whatever).

llvm-svn: 303118

7 years agoPR32288: Describe a bool parameter's DWARF location with a simple register
David Blaikie [Mon, 15 May 2017 21:34:01 +0000 (21:34 +0000)]
PR32288: Describe a bool parameter's DWARF location with a simple register

There's no need (& a bit incorrect) to mask off the high bits of the
register reference when describing a simple bool value.

Reviewers: aprantl

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

llvm-svn: 303117

7 years ago[SLP] Enable 64-bit wide vectorization on AArch64
Adam Nemet [Mon, 15 May 2017 21:15:01 +0000 (21:15 +0000)]
[SLP] Enable 64-bit wide vectorization on AArch64

ARM Neon has native support for half-sized vector registers (64 bits).  This
is beneficial for example for 2D and 3D graphics.  This patch adds the option
to lower MinVecRegSize from 128 via a TTI in the SLP Vectorizer.

*** Performance Analysis

This change was motivated by some internal benchmarks but it is also
beneficial on SPEC and the LLVM testsuite.

The results are with -O3 and PGO.  A negative percentage is an improvement.
The testsuite was run with a sample size of 4.

** SPEC

* CFP2006/482.sphinx3  -3.34%

A pretty hot loop is SLP vectorized resulting in nice instruction reduction.
This used to be a +22% regression before rL299482.

* CFP2000/177.mesa     -3.34%
* CINT2000/256.bzip2   +6.97%

My current plan is to extend the fix in rL299482 to i16 which brings the
regression down to +2.5%.  There are also other problems with the codegen in
this loop so there is further room for improvement.

** LLVM testsuite

* SingleSource/Benchmarks/Misc/ReedSolomon               -10.75%

There are multiple small SLP vectorizations outside the hot code.  It's a bit
surprising that it adds up to 10%.  Some of this may be code-layout noise.

* MultiSource/Benchmarks/VersaBench/beamformer/beamformer -8.40%

The opt-viewer screenshot can be seen at F3218284.  We start at a colder store
but the tree leads us into the hottest loop.

* MultiSource/Applications/lambda-0.1.3/lambda            -2.68%
* MultiSource/Benchmarks/Bullet/bullet                    -2.18%

This is using 3D vectors.

* SingleSource/Benchmarks/Shootout-C++/Shootout-C++-lists +6.67%

Noise, binary is unchanged.

* MultiSource/Benchmarks/Ptrdist/anagram/anagram          +4.90%

There is an additional SLP in the cold code.  The test runs for ~1sec and
prints out over 2000 lines. This is most likely noise.

* MultiSource/Applications/aha/aha                        +1.63%
* MultiSource/Applications/JM/lencod/lencod               +1.41%
* SingleSource/Benchmarks/Misc/richards_benchmark         +1.15%

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

llvm-svn: 303116

7 years agoRevert r302678 "[AArch64] Enable use of reduction intrinsics."
Hans Wennborg [Mon, 15 May 2017 20:59:32 +0000 (20:59 +0000)]
Revert r302678 "[AArch64] Enable use of reduction intrinsics."

This caused PR33053.

Original commit message:

> The new experimental reduction intrinsics can now be used, so I'm enabling this
> for AArch64. We will need this for SVE anyway, so it makes sense to do this for
> NEON reductions as well.
>
> The existing code to match shufflevector patterns are replaced with a direct
> lowering of the reductions to AArch64-specific nodes. Tests updated with the
> new, simpler, representation.
>
> Differential Revision: https://reviews.llvm.org/D32247

llvm-svn: 303115

7 years ago[asan] One more test for -fsanitize-address-globals-dead-stripping.
Evgeniy Stepanov [Mon, 15 May 2017 20:43:48 +0000 (20:43 +0000)]
[asan] One more test for -fsanitize-address-globals-dead-stripping.

llvm-svn: 303114

7 years ago[asan] Better workaround for gold PR19002.
Evgeniy Stepanov [Mon, 15 May 2017 20:43:42 +0000 (20:43 +0000)]
[asan] Better workaround for gold PR19002.

See the comment for more details. Test in a follow-up CFE commit.

llvm-svn: 303113

7 years ago[builtins] Fix a check from __GNU__ to __GNUC__ for disabling executable stack.
Manoj Gupta [Mon, 15 May 2017 20:41:17 +0000 (20:41 +0000)]
[builtins] Fix a check from __GNU__ to __GNUC__ for disabling executable stack.

Summary:
Neither GCC nor Clang define __GNU__. Instead use __GNUC__ for the check.

Reviewers: echristo, rengolin, compnerd

Subscribers: srhines, krytarowski, llvm-commits

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

llvm-svn: 303112

7 years agoRe-submit AMDGPUMachineCFGStructurizer.
Jan Sjodin [Mon, 15 May 2017 20:18:37 +0000 (20:18 +0000)]
Re-submit AMDGPUMachineCFGStructurizer.

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

llvm-svn: 303111

7 years ago[TypeSystem] Fix inspection of Objective-C object types
Sean Callanan [Mon, 15 May 2017 19:55:20 +0000 (19:55 +0000)]
[TypeSystem] Fix inspection of Objective-C object types

ptr_refs exposed a problem in ClangASTContext's implementation: it
uses an accessor to downcast a QualType to an
ObjCObjectPointerType, but the accessor is not fully general.
getAs() is the safer way to go.

I've added a test case that uses ptr_refs in a way that would
crash before the fix.

<rdar://problem/31363513>

llvm-svn: 303110

7 years agoAArch64: diagnose unrecognized features in .cpu directive.
Tim Northover [Mon, 15 May 2017 19:42:15 +0000 (19:42 +0000)]
AArch64: diagnose unrecognized features in .cpu directive.

We were silently ignoring any features we couldn't match up, which led to
errors in an inline asm block missing the conventional "\n\t".

llvm-svn: 303108

7 years ago[NewGVN] Remove unused setDefiningExpr(). NFCI.
Davide Italiano [Mon, 15 May 2017 19:35:40 +0000 (19:35 +0000)]
[NewGVN] Remove unused setDefiningExpr(). NFCI.

llvm-svn: 303107

7 years agoclang-format: [JS] for async loops.
Martin Probst [Mon, 15 May 2017 19:33:20 +0000 (19:33 +0000)]
clang-format: [JS] for async loops.

Summary:
JavaScript supports asynchronous loop iteration in async functions:

    for async (const x of y) ...

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 303106

7 years ago[InstCombine] restrict icmp fold with 2 sdiv exact operands (PR32949)
Sanjay Patel [Mon, 15 May 2017 19:27:53 +0000 (19:27 +0000)]
[InstCombine] restrict icmp fold with 2 sdiv exact operands (PR32949)

This is the InstCombine counterpart to D32954.
I added some comments about the code duplication in:
rL302436

Alive-based verification:
http://rise4fun.com/Alive/dPw

This is a 2nd fix for the problem reported in:
https://bugs.llvm.org/show_bug.cgi?id=32949

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

llvm-svn: 303105

7 years ago[InstSimplify] restrict icmp fold with 2 sdiv exact operands (PR32949)
Sanjay Patel [Mon, 15 May 2017 19:16:49 +0000 (19:16 +0000)]
[InstSimplify] restrict icmp fold with 2 sdiv exact operands (PR32949)

These folds were introduced with https://reviews.llvm.org/rL127064 as part of solving:
https://bugs.llvm.org/show_bug.cgi?id=9343

As shown here:
http://rise4fun.com/Alive/C8
...however, the sdiv exact case needs a stronger predicate.

I opted for duplicated code instead of adding another fallthrough because I think that's
easier to read (and edit in case we need/want to restrict/loosen the predicates any more).

This should fix:
https://bugs.llvm.org/show_bug.cgi?id=32949
https://bugs.llvm.org/show_bug.cgi?id=32948

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

llvm-svn: 303104

7 years agobuiltins: fix filtering aliased targets
Saleem Abdulrasool [Mon, 15 May 2017 19:09:13 +0000 (19:09 +0000)]
builtins: fix filtering aliased targets

Some build targets (e.g. i686) have aliased names (e.g. i386).  We would
get multiple definitions previously and have the linker arbitrarily
select a definition on those aliased targets.  Make this more
deterministic by checking those aliases.

llvm-svn: 303103

7 years agoThe patch adds CTLZ idiom recognition.
Evgeny Stupachenko [Mon, 15 May 2017 19:08:56 +0000 (19:08 +0000)]
The patch adds CTLZ idiom recognition.

Summary:

The following loops should be recognized:
i = 0;
while (n) {
  n = n >> 1;
  i++;
  body();
}
use(i);

And replaced with builtin_ctlz(n) if body() is empty or
for CPUs that have CTLZ instruction converted to countable:

for (j = 0; j < builtin_ctlz(n); j++) {
  n = n >> 1;
  i++;
  body();
}
use(builtin_ctlz(n));

Reviewers: rengolin, joerg

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

From: Evgeny Stupachenko <evstupac@gmail.com>
llvm-svn: 303102

7 years agoFix for KMP_AFFINITY=respect with multiple processor groups
Jonathan Peyton [Mon, 15 May 2017 19:05:59 +0000 (19:05 +0000)]
Fix for KMP_AFFINITY=respect with multiple processor groups

An assert() was being tripped when KMP_AFFINITY=respect + Multiple Processor
Groups. Let __kmp_affinity_create_proc_group_map() function be able to create
address2os object which contains a single group by deleting restriction that
process affinity mask must span multiple groups.

llvm-svn: 303101

7 years ago[NewGVN] Fix verification of MemoryPhis in verifyMemoryCongruency().
Davide Italiano [Mon, 15 May 2017 18:50:53 +0000 (18:50 +0000)]
[NewGVN] Fix verification of MemoryPhis in verifyMemoryCongruency().

verifyMemoryCongruency() filters out trivially dead MemoryDef(s),
as we find them immediately dead, before moving from TOP to a new
congruence class.
This fixes the same problem for PHI(s) skipping MemoryPhis if all
the operands are dead.

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

llvm-svn: 303100

7 years ago[AArch64][Falkor] Fix sched details for FMOV
Geoff Berry [Mon, 15 May 2017 18:50:22 +0000 (18:50 +0000)]
[AArch64][Falkor] Fix sched details for FMOV

llvm-svn: 303099

7 years agoRevert 303091.
Jan Sjodin [Mon, 15 May 2017 18:39:47 +0000 (18:39 +0000)]
Revert 303091.

llvm-svn: 303098

7 years agoDisable threads in a few tests.
Rafael Espindola [Mon, 15 May 2017 18:29:14 +0000 (18:29 +0000)]
Disable threads in a few tests.

They are too slow otherwise. We track the issue in pr32942.

llvm-svn: 303097

7 years agoAdd support for handling ifuncs to GlobalValue::getBaseObject
Teresa Johnson [Mon, 15 May 2017 18:28:29 +0000 (18:28 +0000)]
Add support for handling ifuncs to GlobalValue::getBaseObject

Summary:
All GlobalIndirectSymbol types (not just GlobalAlias) should return
their base object.

Without this patch LTO would warn "Unable to determine comdat of
alias!" for an ifunc.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, llvm-commits

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

llvm-svn: 303096

7 years ago[clang-tidy] Fix a typo: dequeue => deque
Haojian Wu [Mon, 15 May 2017 18:18:28 +0000 (18:18 +0000)]
[clang-tidy] Fix a typo: dequeue => deque

llvm-svn: 303095

7 years agoRevert "[ClangD] Refactor clangd into separate components"
Adam Nemet [Mon, 15 May 2017 18:14:35 +0000 (18:14 +0000)]
Revert "[ClangD] Refactor clangd into separate components"

This reverts commit r303067.

Caused http://green.lab.llvm.org/green/job/clang-stage1-configure-RA/34305/

And even after Simon's fix there is still a test failure.

llvm-svn: 303094

7 years agoRevert "Fix windows buildbots - missing include and namespace"
Adam Nemet [Mon, 15 May 2017 18:14:31 +0000 (18:14 +0000)]
Revert "Fix windows buildbots - missing include and namespace"

This reverts commit r303078.

One test is still failing even after this:
http://green.lab.llvm.org/green/job/clang-stage1-configure-RA_check/31374/consoleFull#18373900728254eaf0-7326-4999-85b0-388101f2d404

llvm-svn: 303093

7 years ago[SCEV] Use copy initialization of APInts instead of direct initialization.
Craig Topper [Mon, 15 May 2017 18:14:16 +0000 (18:14 +0000)]
[SCEV] Use copy initialization of APInts instead of direct initialization.

This is based on post commit feed back from r302769.

llvm-svn: 303092

7 years agoAdd AMDGPUMachineCFGStructurizer.
Jan Sjodin [Mon, 15 May 2017 18:13:56 +0000 (18:13 +0000)]
Add AMDGPUMachineCFGStructurizer.

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

llvm-svn: 303091

7 years ago[InstCombine] use m_OneUse to reduce code; NFCI
Sanjay Patel [Mon, 15 May 2017 18:08:17 +0000 (18:08 +0000)]
[InstCombine] use m_OneUse to reduce code; NFCI

llvm-svn: 303090

7 years agoELF: --gdb-index: Change findSection to return an InputSection.
Peter Collingbourne [Mon, 15 May 2017 17:59:21 +0000 (17:59 +0000)]
ELF: --gdb-index: Change findSection to return an InputSection.

We should only ever expect this function to return a regular
InputSection; I would not expect a function definition to be in a
MergeInputSection or EhInputSection. We were previously crashing
in writeTo if this function returned a section that was not an
InputSection because we do not set OutSec for such sections.

This can happen in practice if a function is defined in an empty
section which shares its offset-in-file with a MergeInputSection,
as in the provided test case.

A better fix for this bug would be to fix the
DWARFUnit::collectAddressRanges() interface to provide section
information (see D33183), but this at least fixes the crash.

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

llvm-svn: 303089

7 years agoELF: --gdb-index: Do not add dead sections to the address area.
Peter Collingbourne [Mon, 15 May 2017 17:53:26 +0000 (17:53 +0000)]
ELF: --gdb-index: Do not add dead sections to the address area.

Fixes PR33032.

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

llvm-svn: 303088

7 years ago[libFuzzer] fix a warning from Wunreachable-code-loop-increment reported by Christian...
Kostya Serebryany [Mon, 15 May 2017 17:39:42 +0000 (17:39 +0000)]
[libFuzzer] fix a warning from Wunreachable-code-loop-increment reported by Christian Holler. This also fixes a logical bug, which however does not affect the libFuzzer's ability too much (I wasn't able to create a differentiating test)

llvm-svn: 303087

7 years agoRemove some outdated comments
Jonathan Peyton [Mon, 15 May 2017 17:39:16 +0000 (17:39 +0000)]
Remove some outdated comments

llvm-svn: 303086

7 years agoMake google-build-using-namespace skip std::.*literals
Alexander Kornienko [Mon, 15 May 2017 17:37:48 +0000 (17:37 +0000)]
Make google-build-using-namespace skip std::.*literals

Summary:
C++14 added a couple of user-defined literals in the standard library. E.g.
std::chrono_literals and std::literals::chrono_literals . Using them
requires a using directive so do not warn in google-build-using-namespace
if namespace name starts with "std::" and ends with "literals".

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits

Patch by Martin Ejdestig!

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

llvm-svn: 303085

7 years agoCodeGen: BlockPlacement: Increase tail duplication size for O3.
Kyle Butt [Mon, 15 May 2017 17:30:47 +0000 (17:30 +0000)]
CodeGen: BlockPlacement: Increase tail duplication size for O3.

At O3 we are more willing to increase size if we believe it will improve
performance. The current threshold for tail-duplication of 2 instructions is
conservative, and can be relaxed at O3.

Benchmark results:
llvm test-suite:
6% improvement in aha, due to duplication of loop latch
3% improvement in hexxagon

2% slowdown in lpbench. Seems related, but couldn't completely diagnose.

Internal google benchmark:
Produces 4% improvement on internal google protocol buffer serialization
benchmarks.

Differential-Revision: https://reviews.llvm.org/D32324
llvm-svn: 303084

7 years ago[ubsan] Don't enable debug info in all tests
Reid Kleckner [Mon, 15 May 2017 17:25:10 +0000 (17:25 +0000)]
[ubsan] Don't enable debug info in all tests

Add a lit substitution (I chose %gmlt) so that only stack trace tests
get debug info.

We need a lit substition so that this expands to -gline-tables-only
-gcodeview on Windows. I think in the future we should reconsider the
need for -gcodeview from the GCC driver, but for now, this is necessary.

llvm-svn: 303083

7 years ago[NVPTX] Don't flag StoreParam/LoadParam memory chain operands as ReadMem/WriteMem...
Simon Pilgrim [Mon, 15 May 2017 17:17:44 +0000 (17:17 +0000)]
[NVPTX] Don't flag StoreParam/LoadParam memory chain operands as ReadMem/WriteMem (PR32146)

Follow up to D33147

NVPTXTargetLowering::LowerCall was trusting the default argument values.

Fixes another 17 of the NVPTX '-verify-machineinstrs with EXPENSIVE_CHECKS' errors in PR32146.

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

llvm-svn: 303082

7 years ago[clang-tidy] Partly rewrite readability-simplify-boolean-expr using RAV
Alexander Kornienko [Mon, 15 May 2017 17:06:51 +0000 (17:06 +0000)]
[clang-tidy] Partly rewrite readability-simplify-boolean-expr using RAV

The check was using AST matchers in a very inefficient manner. By rewriting the
BinaryOperator-related parts using RAV, the check was sped up by a factor of
up to 10000 on some files (mostly, generated code using binary operators in
tables), but also significantly sped up for regular large files.
As a side effect, the code became clearer and more readable.

llvm-svn: 303081

7 years agobuild_llvm_package.bat: Minor updates
Hans Wennborg [Mon, 15 May 2017 16:50:48 +0000 (16:50 +0000)]
build_llvm_package.bat: Minor updates

llvm-svn: 303080

7 years agoAdd the .clang-format file which the formatting was based on
Jonathan Peyton [Mon, 15 May 2017 16:39:42 +0000 (16:39 +0000)]
Add the .clang-format file which the formatting was based on

llvm-svn: 303079

7 years agoFix windows buildbots - missing include and namespace
Simon Pilgrim [Mon, 15 May 2017 16:36:11 +0000 (16:36 +0000)]
Fix windows buildbots - missing include and namespace

llvm-svn: 303078

7 years ago[OPENMP] Check DSA for variables captured by value.
Alexey Bataev [Mon, 15 May 2017 16:26:15 +0000 (16:26 +0000)]
[OPENMP] Check DSA for variables captured by value.

Currently clang checks for default data sharing attributes only for
variables captured in OpenMP regions by reference. Patch adds checks for
variables captured by value.

llvm-svn: 303077

7 years agoDisable a test in TestReturnValue on arm64 linux
Pavel Labath [Mon, 15 May 2017 16:25:28 +0000 (16:25 +0000)]
Disable a test in TestReturnValue on arm64 linux

as described in pr33042, we cannot reliably retrieve the return value on
arm64 in cases it is returned via x8 pointer. I tried to do this as
surgically as possible and disabled it only on targets I know to be
affected, as the code is still useful, even though it can only work on
best-effort basis.

llvm-svn: 303076

7 years agoAdd an extra test for archive symbol tables.
Rafael Espindola [Mon, 15 May 2017 15:56:23 +0000 (15:56 +0000)]
Add an extra test for archive symbol tables.

The table should include only defined symbols.

llvm-svn: 303075

7 years ago[SLPVectorizer][X86] Add vectorization tests for vXi64/vXi32/vXi16/VXi8 add/sub/mul
Simon Pilgrim [Mon, 15 May 2017 15:48:15 +0000 (15:48 +0000)]
[SLPVectorizer][X86] Add vectorization tests for vXi64/vXi32/vXi16/VXi8 add/sub/mul

llvm-svn: 303074

7 years ago[AArch64] Enable FeatureFuseAES on Cortex-A72.
Florian Hahn [Mon, 15 May 2017 15:15:22 +0000 (15:15 +0000)]
[AArch64] Enable FeatureFuseAES on Cortex-A72.

This patch enables fusing dependent AESE/AESMC and AESD/AESIMC
instruction pairs on Cortex-A72, as recommended in the Software
Optimization Guide, section 4.10.

llvm-svn: 303073

7 years ago[OpenCL] Emit function-scope variable in constant address space as static variable
Yaxun Liu [Mon, 15 May 2017 14:47:47 +0000 (14:47 +0000)]
[OpenCL] Emit function-scope variable in constant address space as static variable

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

llvm-svn: 303072

7 years ago[sanitizer] Change SizeClassAllocator32 to accept just one template
Kostya Kortchinsky [Mon, 15 May 2017 14:47:19 +0000 (14:47 +0000)]
[sanitizer] Change SizeClassAllocator32 to accept just one template

Summary:
With rL279771, SizeClassAllocator64 was changed to accept only one template
instead of 5, for the following reasons: "First, this will make the mangled
names shorter. Second, this will make adding more parameters simpler". This
patch mirrors that work for SizeClassAllocator32.

This is in preparation for introducing the randomization of chunks in the
32-bit SizeClassAllocator in a later patch.

Reviewers: kcc, alekseyshl, dvyukov

Reviewed By: alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 303071

7 years ago[AMDGPU][MC] Corrected several VI opcodes to avoid printing _e64
Dmitry Preobrazhensky [Mon, 15 May 2017 14:28:23 +0000 (14:28 +0000)]
[AMDGPU][MC] Corrected several VI opcodes to avoid printing _e64

See bug 32936: https://bugs.llvm.org//show_bug.cgi?id=32936

Reviewers: artem.tamazov, vpykhtin

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

llvm-svn: 303070

7 years ago[SLPVectorizer][X86] Add vectorization tests for vXi64/vXi32/vXi16/VXi8 shifts
Simon Pilgrim [Mon, 15 May 2017 14:27:11 +0000 (14:27 +0000)]
[SLPVectorizer][X86] Add vectorization tests for vXi64/vXi32/vXi16/VXi8 shifts

llvm-svn: 303069

7 years ago[index] References to fields from template instantiations should refer to
Alex Lorenz [Mon, 15 May 2017 14:26:22 +0000 (14:26 +0000)]
[index] References to fields from template instantiations should refer to
fields in base templates

rdar://32197158

llvm-svn: 303068

7 years ago[ClangD] Refactor clangd into separate components
Ilya Biryukov [Mon, 15 May 2017 14:17:35 +0000 (14:17 +0000)]
[ClangD] Refactor clangd into separate components

Summary: Major refactoring to split LSP implementation, Clang API calls and threading(mostly synchronization)

Reviewers: bkramer, krasimir

Reviewed By: bkramer

Subscribers: cfe-commits, mgorny, klimek

Tags: #clang-tools-extra

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

llvm-svn: 303067

7 years agoDrop nonexisting ScopPassManager directory
Tobias Grosser [Mon, 15 May 2017 14:12:30 +0000 (14:12 +0000)]
Drop nonexisting ScopPassManager directory

llvm-svn: 303066

7 years agoAdjust formatting
Tobias Grosser [Mon, 15 May 2017 14:12:27 +0000 (14:12 +0000)]
Adjust formatting

llvm-svn: 303065

7 years ago[Polly][NewPM] Add missing Unittests
Philip Pfaffe [Mon, 15 May 2017 13:52:10 +0000 (13:52 +0000)]
[Polly][NewPM] Add missing Unittests

llvm-svn: 303064

7 years agoTest commit(changed comment)
Ilya Biryukov [Mon, 15 May 2017 13:50:46 +0000 (13:50 +0000)]
Test commit(changed comment)

llvm-svn: 303063

7 years ago[Polly][NewPM][WIP] Add a ScopPassManager
Philip Pfaffe [Mon, 15 May 2017 13:43:01 +0000 (13:43 +0000)]
[Polly][NewPM][WIP] Add a ScopPassManager

This patch adds both a ScopAnalysisManager and a ScopPassManager.

The ScopAnalysisManager is itself a Function-Analysis, and manages
analyses on Scops. The ScopPassManager takes care of building Scop pass
pipelines.

This patch is marked WIP because I've left two FIXMEs which I need to
think about some more. Both of these deal with invalidation:

Deferred invalidation is currently not implemented. Deferred
invalidation deals with analyses which cache references to other
analysis results. If these results are invalidated, invalidation needs
to be propagated into the caching analyses.
The ScopPassManager as implemented assumes that ScopPasses do not affect
other Scops in any way. There has been some discussion about this on
other patch threads, however it makes sense to reiterate this for this
specific patch.
I'm uploading this patch even though it's incomplete to encourage
discussion and give you an impression of how this is going to work.

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

llvm-svn: 303062

7 years agoFix darwin build for r303058
Pavel Labath [Mon, 15 May 2017 13:41:38 +0000 (13:41 +0000)]
Fix darwin build for r303058

llvm-svn: 303061

7 years ago[Polly][CMake] Exclude isl_config from the polly-check-format target.
Philip Pfaffe [Mon, 15 May 2017 13:20:26 +0000 (13:20 +0000)]
[Polly][CMake] Exclude isl_config from the polly-check-format target.

Summary:
The custom `polly-check-format` target runs clang-format over all source files in the directory tree excluding lib/External. `isl_config.h` is a header file that is generated by CMake in the build directory, and it's not correctly formatted (which I also wouldn't consider necessary, as it is a generated file).

If the build directory is actually inside the Polly source directory (which it might be if you're building Polly out-of-tree), that check always fails. Hence this patch excludes this file from the check-format target.

Reviewers: Meinersbur, grosser

Reviewed By: grosser

Subscribers: mgorny, llvm-commits, pollydev

Tags: #polly

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

llvm-svn: 303060

7 years agoTest commit.
Dinar Temirbulatov [Mon, 15 May 2017 13:14:04 +0000 (13:14 +0000)]
Test commit.

llvm-svn: 303059

7 years agoRemove an expensive lock from Timer
Pavel Labath [Mon, 15 May 2017 13:02:37 +0000 (13:02 +0000)]
Remove an expensive lock from Timer

The Timer destructor would grab a global mutex in order to update
execution time. Add a class to define a category once, statically; the
class adds itself to an atomic singly linked list, and thus subsequent
updates only need to use an atomic rather than grab a lock and perform a
hashtable lookup.

Differential Revision: https://reviews.llvm.org/D32823
Patch by Scott Smith <scott.smith@purestorage.com>.

llvm-svn: 303058

7 years ago[Polly][Fortran Support] Fix two testcases for the loadable-library use-case
Philip Pfaffe [Mon, 15 May 2017 12:58:31 +0000 (12:58 +0000)]
[Polly][Fortran Support] Fix two testcases for the loadable-library use-case

llvm-svn: 303057

7 years ago[Polly][NewPM] Port ScopInfo to the new PassManager
Philip Pfaffe [Mon, 15 May 2017 12:55:14 +0000 (12:55 +0000)]
[Polly][NewPM] Port ScopInfo to the new PassManager

llvm-svn: 303056

7 years ago[AMDGPU][MC] Removed V_MQSAD_U16_U8
Dmitry Preobrazhensky [Mon, 15 May 2017 12:37:03 +0000 (12:37 +0000)]
[AMDGPU][MC] Removed V_MQSAD_U16_U8

This instruction does not really exist

See Bug 33018: https://bugs.llvm.org//show_bug.cgi?id=33018

Reviewers: vpykhtin, artem.tamazov

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

llvm-svn: 303055

7 years ago[ARM] Mark LEApcrel instructions as isAsCheapAsAMove
John Brawn [Mon, 15 May 2017 11:57:54 +0000 (11:57 +0000)]
[ARM] Mark LEApcrel instructions as isAsCheapAsAMove

Doing this means that if an LEApcrel is used in two places we will rematerialize
instead of generating two MOVs. This is particularly useful for printfs using
the same format string, where we want to generate an address into a register
that's going to get corrupted by the call.

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

llvm-svn: 303054

7 years ago[ARM] Mark LEApcrel as not having side effects
John Brawn [Mon, 15 May 2017 11:50:21 +0000 (11:50 +0000)]
[ARM] Mark LEApcrel as not having side effects

Doing this lets us hoist it out of loops, and I've also marked it as
rematerializable the same as the thumb1 and thumb2 counterparts.

It looks like it being marked as such was just a mistake, as the commit that
made that change only mentions LEApcrelJT and in thumb1 and thumb2 only the
LEApcrelJT instructions were marked as having side-effects, so it looks like
the intent was to only mark LEApcrelJT as having side-effects but LEApcrel was
accidentally marked as such also.

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

llvm-svn: 303053

7 years ago[NFC] [Fortran Support] Fix findFADGlobalNonAlloc pattern match comment
Siddharth Bhat [Mon, 15 May 2017 11:49:19 +0000 (11:49 +0000)]
[NFC] [Fortran Support] Fix findFADGlobalNonAlloc pattern match comment

llvm-svn: 303052

7 years ago[DWARF] - Speedup handling of relocations in DWARFContextInMemory.
George Rimar [Mon, 15 May 2017 11:45:28 +0000 (11:45 +0000)]
[DWARF] - Speedup handling of relocations in DWARFContextInMemory.

I am working on a speedup of building .gdb_index in LLD and
noticed that relocations that are proccessed in DWARFContextInMemory often uses
the same symbol in a row. This patch introduces caching to reduce the relocations
proccessing time.

For benchmark,
I took debug LLC binary objects configured with -ggnu-pubnames and linked it using LLD.

Link time without --gdb-index is about 4,45s.
Link time with --gdb-index: a) Without patch: 19,16s b) With patch: 15,52s
That means time spent on --gdb-index in this configuration is
19,16s - 4,45s = 14,71s (without patch) vs 15,52s - 4,45s = 11,07s (with patch).

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

llvm-svn: 303051

7 years ago[X86] Relocate code of replacement of subtarget unsupported masked memory intrinsics...
Ayman Musa [Mon, 15 May 2017 11:30:54 +0000 (11:30 +0000)]
[X86] Relocate code of replacement of subtarget unsupported masked memory intrinsics to run also on -O0 option.

Currently, when masked load, store, gather or scatter intrinsics are used, we check in CodeGenPrepare pass if the subtarget support these intrinsics, if not we replace them with scalar code - this is a functional transformation not an optimization (not optional).

CodeGenPrepare pass does not run when the optimization level is set to CodeGenOpt::None (-O0).

Functional transformation should run with all optimization levels, so here I created a new pass which runs on all optimization levels and does no more than this transformation.

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

llvm-svn: 303050

7 years agoJavaScript allows parameter lists to include trailing commas:
Martin Probst [Mon, 15 May 2017 11:15:29 +0000 (11:15 +0000)]
JavaScript allows parameter lists to include trailing commas:

    myFunction(param1, param2,);

For symmetry with other parenthesized lists ([...], {...}), clang-format should
wrap parenthesized lists one-per-line if they contain a trailing comma:

    myFunction(
        param1,
        param2,
    );

This is particularly useful in function declarations or calls with many
arguments, e.g. commonly in constructors.

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

llvm-svn: 303049

7 years ago[index] Visit and store information about namespace alias declarations
Alex Lorenz [Mon, 15 May 2017 10:56:31 +0000 (10:56 +0000)]
[index] Visit and store information about namespace alias declarations

rdar://32195226

llvm-svn: 303048

7 years ago[NVPTX] Don't rely on default arguments to SelectionDAG::getMemIntrinsicNode. NFC.
Simon Pilgrim [Mon, 15 May 2017 10:47:48 +0000 (10:47 +0000)]
[NVPTX] Don't rely on default arguments to SelectionDAG::getMemIntrinsicNode. NFC.

NFC followup to D33147, this explicitly sets all the arguments (instead of relying on the defaults) to SelectionDAG::getMemIntrinsicNode to help identify -verify-machineinstrs issues.

llvm-svn: 303047

7 years ago[index] Store correct location for namespace nested name qualifiers
Alex Lorenz [Mon, 15 May 2017 10:41:04 +0000 (10:41 +0000)]
[index] Store correct location for namespace nested name qualifiers

rdar://32195200

llvm-svn: 303046

7 years ago[index] Avoid a crash that happens when looking up a dependent name
Alex Lorenz [Mon, 15 May 2017 10:20:39 +0000 (10:20 +0000)]
[index] Avoid a crash that happens when looking up a dependent name
in a record that has no definition

rdar://32194921

llvm-svn: 303045

7 years ago[TableGen] Add EncoderMethod to RegisterOperand
Sam Kolton [Mon, 15 May 2017 10:13:07 +0000 (10:13 +0000)]
[TableGen] Add EncoderMethod to RegisterOperand

Reviewers: stoklund, grosbach, vpykhtin

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

llvm-svn: 303044

7 years ago[RegisterBankInfo] Remove overly-agressive asserts
Tom Stellard [Mon, 15 May 2017 09:52:33 +0000 (09:52 +0000)]
[RegisterBankInfo] Remove overly-agressive asserts

Summary:
We were asserting in RegisterBankInfo if RBI.copyCost() returns
UINT_MAX.  This is OK for RegBankSelect::Mode::Fast since we only
try one instruction mapping and can't recover from this, but for
RegBankSelect::Mode::Greedy we will be considering multiple
instruction mappings, so we can recover if we see a UNIT_MAX copy
cost.

The copy cost for one pair of register banks in the AMDGPU backend
will be UNIT_MAX, so this patch will prevent AMDGPU tests from
breaking.

Reviewers: ab, qcolombet, t.p.northover, dsanders

Reviewed By: qcolombet

Subscribers: tpr, llvm-commits

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

llvm-svn: 303043

7 years agoCMake: Fix docs-llvm-man target when clang+llvm is in the same source tree
Tom Stellard [Mon, 15 May 2017 09:34:23 +0000 (09:34 +0000)]
CMake: Fix docs-llvm-man target when clang+llvm is in the same source tree

Summary:
This was broken by r302499.  Configuring with -DLLVM_BUILD_DOCS=ON would
cause the docs-llvm-man target not to be created.

Reviewers: anemet, beanz

Reviewed By: anemet

Subscribers: llvm-commits, mgorny

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

llvm-svn: 303042

7 years agoMCObjectStreamer : fail with a diagnostic when emitting an out of range value.
Arnaud A. de Grandmaison [Mon, 15 May 2017 08:43:27 +0000 (08:43 +0000)]
MCObjectStreamer : fail with a diagnostic when emitting an out of range value.

We were previously silently emitting bogus data in release mode,
making it very hard to diagnose the error, or crashing with an
assert in debug mode. A proper diagnostic is now always emitted
when the value to be emitted is out of range.

llvm-svn: 303041

7 years ago[Fortran Support] Add pattern match for Fortran Arrays that are parameters.
Siddharth Bhat [Mon, 15 May 2017 08:41:30 +0000 (08:41 +0000)]
[Fortran Support] Add pattern match for Fortran Arrays that are parameters.

- This breaks the previous assumption that Fortran Arrays are `GlobalValue`.

- The names of functions were getting unwieldy. So, I renamed the
Fortran related functions.

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

llvm-svn: 303040

7 years ago[Simplify] Fix r302986 that introduced non-inferrable templates.
Siddharth Bhat [Mon, 15 May 2017 08:18:51 +0000 (08:18 +0000)]
[Simplify] Fix r302986 that introduced non-inferrable templates.

- auto + decltype + template use was not inferrable in
  `Transform/Simplify.cpp accessesInOrder`.

- changed code to explicitly construct required vector instead of using
  higher order iterator helpers.

- Failing compiler spec:
    Apple LLVM version 7.3.0 (clang-703.0.31)
    Target: x86_64-apple-darwin15.6.0

llvm-svn: 303039

7 years agoclang-format: [JS] fix non-null assertion operator recognition.
Martin Probst [Mon, 15 May 2017 08:15:53 +0000 (08:15 +0000)]
clang-format: [JS] fix non-null assertion operator recognition.

Summary:
`getIdentifierInfo()` includes all keywords, whereas non-null assertion
operators should only be recognized after non-keywords or pseudo keywords.
Ideally this should list all tokens that clang-format recognizes as a keyword,
but that are pseudo or no keywords in JS. For the time being, just recognize
the specific bits users ran into (`namespace` in this case).

Reviewers: djasper

Subscribers: klimek

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

llvm-svn: 303038

7 years agoRevert r302965 - [modules] When creating a declaration, cache its owning
Daniel Jasper [Mon, 15 May 2017 07:51:10 +0000 (07:51 +0000)]
Revert r302965 - [modules] When creating a declaration, cache its owning
module immediately

Also revert dependent r302969. This is leading to crashes.
Will provide more details reproduction instructions to Richard.

llvm-svn: 303037

7 years ago[GlobalISel][X86] G_BR instruction select test
Igor Breger [Mon, 15 May 2017 07:03:38 +0000 (07:03 +0000)]
[GlobalISel][X86] G_BR instruction select test

llvm-svn: 303036

7 years ago[ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits.
Craig Topper [Mon, 15 May 2017 06:39:41 +0000 (06:39 +0000)]
[ValueTracking] Replace all uses of ComputeSignBit with computeKnownBits.

This patch finishes off the conversion of ComputeSignBit to computeKnownBits.

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

llvm-svn: 303035

7 years agoAdd '#' to test regex that I forgot in r303025.
Daniel Jasper [Mon, 15 May 2017 04:58:27 +0000 (04:58 +0000)]
Add '#' to test regex that I forgot in r303025.

llvm-svn: 303034

7 years ago[ConstantRange] Fix what appear to be copy and paste mistakes in the unittest.
Craig Topper [Mon, 15 May 2017 04:40:19 +0000 (04:40 +0000)]
[ConstantRange] Fix what appear to be copy and paste mistakes in the unittest.

llvm-svn: 303033

7 years agoMove some code into ScalarEvolution.cpp; NFC
Sanjoy Das [Mon, 15 May 2017 04:22:09 +0000 (04:22 +0000)]
Move some code into ScalarEvolution.cpp; NFC

I need to add some asserts to these constructors that are easier to
add once they're in the .cpp file.

llvm-svn: 303032

7 years ago[DOXYGEN] Minor improvements in doxygen comments.
Ekaterina Romanova [Mon, 15 May 2017 03:25:04 +0000 (03:25 +0000)]
[DOXYGEN] Minor improvements in doxygen comments.

Separated very long brief sections into two sections.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

llvm-svn: 303031

7 years agoSilence buildbots by tweaking an IR codegen test to be less specific w register names.
Faisal Vali [Mon, 15 May 2017 02:56:02 +0000 (02:56 +0000)]
Silence buildbots by tweaking an IR codegen test to be less specific w register names.

llvm-svn: 303030

7 years ago[InstCombine] Merge duplicate functionality between InstCombine and ValueTracking
Craig Topper [Mon, 15 May 2017 02:44:08 +0000 (02:44 +0000)]
[InstCombine] Merge duplicate functionality between InstCombine and ValueTracking

Summary:
Merge overflow computation for signed add,
appearing both in InstCombine and ValueTracking.

As part of the merge,
cleanup the interface for overflow checks in InstCombine.

Patch by Yoav Ben-Shalom.

Reviewers: craig.topper, majnemer

Reviewed By: craig.topper

Subscribers: takuto.ikuta, llvm-commits

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

llvm-svn: 303029

7 years ago[InstCombine] Remove 'return' of a called function that also returned void. NFC
Craig Topper [Mon, 15 May 2017 02:30:27 +0000 (02:30 +0000)]
[InstCombine] Remove 'return' of a called function that also returned void. NFC

llvm-svn: 303028

7 years ago[NFC] Remove some comments (IR aid) from a test file erroneous committed in r303026
Faisal Vali [Mon, 15 May 2017 01:54:02 +0000 (01:54 +0000)]
[NFC] Remove some comments (IR aid) from a test file erroneous committed in r303026

llvm-svn: 303027

7 years agoFix PR32933: crash on lambda capture of VLA
Faisal Vali [Mon, 15 May 2017 01:49:19 +0000 (01:49 +0000)]
Fix PR32933: crash on lambda capture of VLA

https://bugs.llvm.org/show_bug.cgi?id=32933

Turns out clang wasn't really handling vla's (*) in C++11's for-range entirely correctly.

For e.g. This would lead to generation of buggy IR:

  void foo(int b) {
    int vla[b];
    b = -1;  // This store would affect the '__end = vla + b'
    for (int &c : vla)
      c = 0;
  }

Additionally, code-gen would get confused when VLA's were reference-captured by lambdas, and then used in a for-range, which would result in an attempt to generate IR for '__end = vla + b' within the lambda's body - without any capture of 'b' - hence the assertion.

This patch modifies clang, so that for VLA's it translates the end pointer approximately into:
  __end = __begin + sizeof(vla)/sizeof(vla->getElementType())

As opposed to the __end = __begin + b;

I considered passing a magic value into codegen - or having codegen special case the '__end' variable when it referred to a variably-modified type, but I decided against that approach, because it smelled like I would be increasing a complicated form of coupling, that I think would be even harder to maintain than the above approach (which can easily be optimized (-O1) to refer to the run-time bound that was calculated upon array's creation or copied into the lambda's closure object).

(*) why oh why gcc would you enable this by default?! ;)

llvm-svn: 303026

7 years agoFix two tests that weren't correctly copied.
Daniel Jasper [Sun, 14 May 2017 22:07:50 +0000 (22:07 +0000)]
Fix two tests that weren't correctly copied.

One didn't correctly fine the regex variable, the other still had a RUN
line for FNOBUILTIN-checks, which weren't copied to the file.

llvm-svn: 303025

7 years ago[X86] Utilize SelectionDAG::getSelect(). NFC.
Zvi Rackover [Sun, 14 May 2017 21:30:38 +0000 (21:30 +0000)]
[X86] Utilize SelectionDAG::getSelect(). NFC.

Replace SelectionDAG::getNode(ISD::SELECT, ...)
and SelectionDAG::getNode(ISD::VSELECT, ...)
with SelectionDAG::getSelect(...)
Saves a few lines of code and in some cases saves the need to explicitly
check the type of the desired node.

llvm-svn: 303024

7 years ago[X86][AVX1] Account for cost of extract/insert of 256-bit shifts
Simon Pilgrim [Sun, 14 May 2017 20:52:11 +0000 (20:52 +0000)]
[X86][AVX1] Account for cost of extract/insert of 256-bit shifts

llvm-svn: 303023