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

7 years ago[X86][AVX2] Fix costs for v4i64 ashr by splat
Simon Pilgrim [Sun, 14 May 2017 20:25:42 +0000 (20:25 +0000)]
[X86][AVX2] Fix costs for v4i64 ashr by splat

llvm-svn: 303022

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

llvm-svn: 303021

7 years ago[X86] Add avx512vl command lines to the 128/256-bit vector-lzcnt tests so we can...
Craig Topper [Sun, 14 May 2017 19:38:11 +0000 (19:38 +0000)]
[X86] Add avx512vl command lines to the 128/256-bit vector-lzcnt tests so we can see what compare instructions are being used in the lookup table code.

I noticed the 512-bit lzcnts don't use the X86 specific lookup table code and instead use the EXPAND case in LegalizeDAG. I was toying around with fixing this and noticed it would require compare instructions that generate i1 masks and then converting from mask to vector. Then I noticed that we don't test which compares are used with avx512vl and no avx512cd.

llvm-svn: 303020

7 years ago[X86] Cleanup some of the check-prefixes in the vector-lzcnt tests.
Craig Topper [Sun, 14 May 2017 19:38:09 +0000 (19:38 +0000)]
[X86] Cleanup some of the check-prefixes in the vector-lzcnt tests.

Remove an unneeded prefix from the 32-bit command line. Make all the 64-bit triples match. Replace ALL with X64 and remove it from the 32-bit test.

llvm-svn: 303019

7 years ago[X86] Remove unused value from IntrinsicType enum. NFC
Craig Topper [Sun, 14 May 2017 19:38:06 +0000 (19:38 +0000)]
[X86] Remove unused value from IntrinsicType enum. NFC

llvm-svn: 303018

7 years ago[X86][AVX1] Account for cost of extract/insert of 256-bit SDIV/UDIV by mul sequences
Simon Pilgrim [Sun, 14 May 2017 18:52:15 +0000 (18:52 +0000)]
[X86][AVX1] Account for cost of extract/insert of 256-bit SDIV/UDIV by mul sequences

llvm-svn: 303017

7 years agoRevert r302978 and r302981.
Akira Hatanaka [Sun, 14 May 2017 18:46:19 +0000 (18:46 +0000)]
Revert r302978 and r302981.

Revert the two commits to understand why the following aarch64 bot is
failing.

http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-aarch64-linux

llvm-svn: 303016

7 years agoFix DynamicLibraryTest.cpp on FreeBSD and NetBSD
Dimitry Andric [Sun, 14 May 2017 18:35:38 +0000 (18:35 +0000)]
Fix DynamicLibraryTest.cpp on FreeBSD and NetBSD

Summary:

After rL301562, on FreeBSD the DynamicLibrary unittests fail, because
the test uses getMainExecutable("DynamicLibraryTests", Ptr), and since
the path does not contain any slashes, retrieving the main executable
will not work.

Reimplement getMainExecutable() for FreeBSD and NetBSD using sysctl(3),
which is more reliable than fiddling with relative or absolute paths.

Also add retrieval of the original argv[] from the GoogleTest framework,
to use as a fallback for other OSes.

Reviewers: emaste, marsupial, hans, krytarowski

Reviewed By: krytarowski

Subscribers: krytarowski, llvm-commits

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

llvm-svn: 303015

7 years ago[COFF] Gracefully handle empty .drectve sections
Shoaib Meenai [Sun, 14 May 2017 18:34:56 +0000 (18:34 +0000)]
[COFF] Gracefully handle empty .drectve sections

Running `llvm-readobj -coff-directives msvcrt.lib` resulted in this error:

    Invalid data was encountered while parsing the file

This happened because some of the object files in the archive have empty
`.drectve` sections. These empty sections result in a `parse_failed` error being
returned from `COFFObjectFile::getSectionContents()`, which in turn caused
`llvm-readobj` to stop. With this change, `getSectionContents` now returns
success, and like before the resulting array is empty.

Patch by Dave Lee.

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

llvm-svn: 303014

7 years ago[X86][XOP] XOP's general v16i8 shifts will be used instead of v8i16 shift + mask.
Simon Pilgrim [Sun, 14 May 2017 17:59:46 +0000 (17:59 +0000)]
[X86][XOP] XOP's general v16i8 shifts will be used instead of v8i16 shift + mask.

Tweak cost model to match what lowering actually does.

llvm-svn: 303013

7 years ago[X86][SSE] Account for cost of extract/insert of v32i8 vector shifts
Simon Pilgrim [Sun, 14 May 2017 17:36:07 +0000 (17:36 +0000)]
[X86][SSE] Account for cost of extract/insert of v32i8 vector shifts

llvm-svn: 303012

7 years ago[StringExtras] Add llvm::to_integer.
Zachary Turner [Sun, 14 May 2017 17:11:05 +0000 (17:11 +0000)]
[StringExtras] Add llvm::to_integer.

This is a very thin wrapper around StringRef::getAsInteger.
It serves three purposes.

1) It allows a cleaner syntax when you have something other than
   a StringRef - for example, a std::string or an llvm::SmallString.
   Previously, in this case you would have to write something like:
      StringRef(MyStr).getAsInteger(0, Result)
   by explicitly constructing a temporary StringRef.  This can be
   done implicitly however with the new function by just writing:
      to_integer(MyStr, ...).
2) Correcting the travesty that is getAsInteger's return value.
   This function returns true on success, and false on failure.
   While this may cause confusion with people familiar with the
   getAsInteger API, there seems to be widespread agreement that
   the return semantics of getAsInteger was a mistake.
3) It allows the Radix to be deduced as a default argument by
   putting it last in the parameter list.  Most uses of getAsInteger
   pass 0 for the first argument.  With this syntax it can just be
   omitted.

llvm-svn: 303011

7 years ago[X86][XOP] Account for cost of extract/insert of 256-bit vector shifts
Simon Pilgrim [Sun, 14 May 2017 13:38:53 +0000 (13:38 +0000)]
[X86][XOP] Account for cost of extract/insert of 256-bit vector shifts

llvm-svn: 303010

7 years ago[X86][AVX] Allow 32-bit targets to peek through subvectors to extract constant splats...
Simon Pilgrim [Sun, 14 May 2017 11:46:26 +0000 (11:46 +0000)]
[X86][AVX] Allow 32-bit targets to peek through subvectors to extract constant splats for vXi64 shifts.

llvm-svn: 303009

7 years ago[X86][AVX] Add additional 32-bit target vector shift tests
Simon Pilgrim [Sun, 14 May 2017 11:13:03 +0000 (11:13 +0000)]
[X86][AVX] Add additional 32-bit target vector shift tests

Shows issue with 32-bits not being able to peek through subvectors to extract constant splats

llvm-svn: 303008

7 years ago[Simplify] Remove some leftover dead code
Tobias Grosser [Sun, 14 May 2017 09:20:56 +0000 (09:20 +0000)]
[Simplify] Remove some leftover dead code

llvm-svn: 303007

7 years ago[Polly] Fix code generation of llvm.expect intrinsic
Tobias Grosser [Sun, 14 May 2017 09:09:54 +0000 (09:09 +0000)]
[Polly] Fix code generation of llvm.expect intrinsic

At the time of code generation, an instruction with an llvm intrinsic is ignored
in copyBB. However, if the value of the instruction is used later in the
program, the value needs to be synthesized. However, this is causing some issues
with the instructions being generated in a hoisted basic block.

Removing llvm.expect from the list of ignored intrinsics fixes this bug.

This resolves http://llvm.org/PR32324.

Contributed-by: Annanay Agarwal <cs14btech11001@iith.ac.in>
Tags: #polly

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

llvm-svn: 303006

7 years agoupdate of the url
Sylvestre Ledru [Sun, 14 May 2017 07:55:01 +0000 (07:55 +0000)]
update of the url

llvm-svn: 303005

7 years ago[InstSimplify] Add patterns for folding (A & B) | (~A ^ B) -> (~A ^ B) and its commut...
Craig Topper [Sun, 14 May 2017 07:54:43 +0000 (07:54 +0000)]
[InstSimplify] Add patterns for folding (A & B) | (~A ^ B) -> (~A ^ B) and its commuted variants.

We already had (A & ~B) | (A ^ B), but we missed the cases where the not was part of the xor.

llvm-svn: 303004

7 years agofoo
Craig Topper [Sun, 14 May 2017 07:54:40 +0000 (07:54 +0000)]
foo

llvm-svn: 303003

7 years ago[BasicAA] Alphabetize includes. NFC
Craig Topper [Sun, 14 May 2017 06:18:34 +0000 (06:18 +0000)]
[BasicAA] Alphabetize includes. NFC

llvm-svn: 303002

7 years ago[clang-tidy] TwineLocalCheck: add param # checking
Yan Wang [Sun, 14 May 2017 04:14:59 +0000 (04:14 +0000)]
[clang-tidy] TwineLocalCheck: add param # checking

Summary:
The statement **getArg** tries to get the first one without checking, which may cause segmentation fault.

Reviewers: chh, bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, xazax.hun

Tags: #clang-tools-extra

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

llvm-svn: 303001

7 years agoRenable test that was disabled due to cost analysis
Xinliang David Li [Sun, 14 May 2017 02:58:39 +0000 (02:58 +0000)]
Renable test that was disabled due to cost analysis

llvm-svn: 303000

7 years agoFix test failure on windows -- do not return deleted func
Xinliang David Li [Sun, 14 May 2017 02:54:02 +0000 (02:54 +0000)]
Fix test failure on windows -- do not return deleted func

llvm-svn: 302999

7 years ago[llvm-pdbdump] Add the option to sort functions and data.
Zachary Turner [Sun, 14 May 2017 01:13:40 +0000 (01:13 +0000)]
[llvm-pdbdump] Add the option to sort functions and data.

llvm-svn: 302998

7 years ago[SelectionDAG] Added support for EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts in...
Simon Pilgrim [Sat, 13 May 2017 22:10:58 +0000 (22:10 +0000)]
[SelectionDAG] Added support for EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts in ComputeNumSignBits

llvm-svn: 302997

7 years agoAdd missing files
Peter Collingbourne [Sat, 13 May 2017 22:10:13 +0000 (22:10 +0000)]
Add missing files

llvm-svn: 302996

7 years agoMove lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.
Peter Collingbourne [Sat, 13 May 2017 22:06:46 +0000 (22:06 +0000)]
Move lib/LibDriver -> lib/ToolDrivers/llvm-lib. NFCI.

This reorganisation prevents us from cluttering up the top-level lib directory
with more driver libraries such as llvm-dlltool (see D29892).

llvm-svn: 302995

7 years ago[X86][SSE] Test showing missing EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts support...
Simon Pilgrim [Sat, 13 May 2017 21:50:18 +0000 (21:50 +0000)]
[X86][SSE] Test showing missing EXTRACT_SUBVECTOR/CONCAT_VECTORS demandedelts support in ComputeNumSignBits

llvm-svn: 302994

7 years ago[SelectionDAG] Add VECTOR_SHUFFLE support to ComputeNumSignBits
Simon Pilgrim [Sat, 13 May 2017 19:57:10 +0000 (19:57 +0000)]
[SelectionDAG] Add VECTOR_SHUFFLE support to ComputeNumSignBits

llvm-svn: 302993

7 years ago[X86][SSE] Test showing inability of ComputeNumSignBits to resolve shuffles
Simon Pilgrim [Sat, 13 May 2017 17:41:07 +0000 (17:41 +0000)]
[X86][SSE] Test showing inability of ComputeNumSignBits to resolve shuffles

llvm-svn: 302992

7 years ago[ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSi...
Craig Topper [Sat, 13 May 2017 17:22:16 +0000 (17:22 +0000)]
[ValueTracking] Remove const_casts on several calls to computeKnownBits and ComputeSignBit. NFC

llvm-svn: 302991

7 years agoMSan: Mark MemorySanitizer tests that use x86 intrinsics as REQUIRES: x86
Justin Bogner [Sat, 13 May 2017 16:24:38 +0000 (16:24 +0000)]
MSan: Mark MemorySanitizer tests that use x86 intrinsics as REQUIRES: x86

Tests that use target intrinsics are inherently target specific. Mark
them as such.

llvm-svn: 302990

7 years ago[x86, SSE] AVX1 PR28129 (256-bit all-ones rematerialization)
Simon Pilgrim [Sat, 13 May 2017 13:42:35 +0000 (13:42 +0000)]
[x86, SSE] AVX1 PR28129 (256-bit all-ones rematerialization)

Further perf tests on Jaguar indicate that:

vxorps  %ymm0, %ymm0, %ymm0
vcmpps  $15, %ymm0, %ymm0, %ymm0

is consistently faster (by about 9%) than:

vpcmpeqd  %xmm0, %xmm0, %xmm0
vinsertf128  $1, %xmm0, %ymm0, %ymm0

Testing equivalent code on a SandyBridge (E5-2640) puts it slightly (~3%) faster as well.

Committed on behalf of @dtemirbulatov

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

llvm-svn: 302989

7 years ago[LoopOptimizer][Fix]PR32859, PR24738
Simon Pilgrim [Sat, 13 May 2017 13:25:57 +0000 (13:25 +0000)]
[LoopOptimizer][Fix]PR32859, PR24738

The Loop vectorizer pass introduced undef value while it is fixing output of LCSSA form.
Here it is:

before: %e.0.ph = phi i32 [ 0, %for.inc.2.i ]
after: %e.0.ph = phi i32 [ 0, %for.inc.2.i ], [ undef, %middle.block ]

and after this change we have:

%e.0.ph = phi i32 [ 0, %for.inc.2.i ]
%e.0.ph = phi i32 [ 0, %for.inc.2.i ], [ 0, %middle.block ]

Committed on behalf of @dtemirbulatov

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

llvm-svn: 302988

7 years ago[Simplify] Remove identical write removal. NFC.
Michael Kruse [Sat, 13 May 2017 12:20:57 +0000 (12:20 +0000)]
[Simplify] Remove identical write removal. NFC.

Removal of overwritten writes currently encompasses all the cases
of the identical write removal.

There is an observable behavioral change in that the last, instead
of the first, MemoryAccess is kept. This should not affect the
generated code, however.

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

llvm-svn: 302987