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

7 years ago[Simplify] Remove writes that are overwritten.
Michael Kruse [Sat, 13 May 2017 11:49:34 +0000 (11:49 +0000)]
[Simplify] Remove writes that are overwritten.

Remove memory writes that are overwritten by later writes. This works
for StoreInsts:

      store double 21.0, double* %A
      store double 42.0, double* %A

scalar writes at the end of a statement and mixes of these.

Multiple writes can be the result of DeLICM, which might map multiple
writes to the same location when it knows that these do no conflict
(for instance because they write the same value). Such writes
interfere with pattern-matched optimization such as gemm and may not
get removed by other LLVM passes after code generation.

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

llvm-svn: 302986

7 years agoThis reverts r302984
Vivek Pandya [Sat, 13 May 2017 10:59:05 +0000 (10:59 +0000)]
This reverts r302984

llvm-svn: 302985

7 years agoSimplify MIR Output used for Codegen Testing
Vivek Pandya [Sat, 13 May 2017 08:55:43 +0000 (08:55 +0000)]
Simplify MIR Output used for Codegen Testing

- MIRYamlMapping: Default value provided for fields which have optional
mappings. Implemented == operators for required classes. When a field's value is
same as default value specified YAML IO class will not print it.

- MIRPrinter: Above mentioned behaviour is not on by default. If -simplify-mir
option not specified, then make yaml::Output to print fields with default values
too.

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

llvm-svn: 302984

7 years ago[APInt] Use Lo_32/Hi_32/Make_64 in a few more places in the divide code. NFCI
Craig Topper [Sat, 13 May 2017 07:14:17 +0000 (07:14 +0000)]
[APInt] Use Lo_32/Hi_32/Make_64 in a few more places in the divide code. NFCI

llvm-svn: 302983

7 years ago[InstCombine] Prevent InstCombine from triggering an extra iteration if something...
Craig Topper [Sat, 13 May 2017 06:56:04 +0000 (06:56 +0000)]
[InstCombine] Prevent InstCombine from triggering an extra iteration if something changed in the initial Worklist creation

Summary:
If the Worklist build causes an IR change this change flag currently factors into the flag for running another iteration of the iteration loop. But only changes during processing should trigger another loop.

This patch captures the worklist creation change flag into the outside the loop flag currently used for DbgDeclares and only sends that flag up to the caller. Rerunning the loop only depends on IC.run() now.

This uses the debug output of InstCombine to determine if one or two iterations run. I couldn't think of a better way to detect it since the second spurious iteration shoudn't make any visible changes. Just wasted computation.

I can do a pre-commit of the test case with the CHECK-NOT as a CHECK if this is an ok way to check this.

This is a subset of D31678 as I'm still not sure how to verify the analysis behavior for that.

Reviewers: davide, majnemer, spatel, chandlerc

Reviewed By: davide

Subscribers: llvm-commits

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

llvm-svn: 302982

7 years ago[libcxxabi] Do not align field unwindHeader when building for ARM EHABI.
Akira Hatanaka [Sat, 13 May 2017 06:28:17 +0000 (06:28 +0000)]
[libcxxabi] Do not align field unwindHeader when building for ARM EHABI.

For ARM EHABI, _Unwind_Exception is an alias of _Unwind_Control_Block,
which is not aligned, so we shouldn't align unwindHeader either.

rdar://problem/25364625

llvm-svn: 302981

7 years agoConstProp: Split x86 SSE intrinsic tests out of calls.ll
Justin Bogner [Sat, 13 May 2017 05:52:17 +0000 (05:52 +0000)]
ConstProp: Split x86 SSE intrinsic tests out of calls.ll

This allows us to mark this as `REQUIRES: x86`, since it uses x86
target specific intrinsics.

llvm-svn: 302980

7 years agoInstCombine: Move tests that use target intrinsics into subdirectories
Justin Bogner [Sat, 13 May 2017 05:39:46 +0000 (05:39 +0000)]
InstCombine: Move tests that use target intrinsics into subdirectories

Tests with target intrinsics are inherently target specific, so it
doesn't actually make sense to run them if we've excluded their
target.

llvm-svn: 302979

7 years ago[libcxxabi] Align unwindHeader on a double-word boundary.
Akira Hatanaka [Sat, 13 May 2017 03:14:49 +0000 (03:14 +0000)]
[libcxxabi] Align unwindHeader on a double-word boundary.

r276215 made a change to annotate _Unwind_Exception with attribute
"aligned" so that an exception object following field __cxa_exception
is sufficiently aligned. This fix hasn't been incorporated to unwind.h
on Darwin since it is an ABI breaking change.

Instead of annotating struct _Unwind_Exception with the attribute, this
commit annotates field unwindHeader of __cxa_exception. This ensures the
exception object is sufficiently aligned without breaking the ABI.

This recommits r302763 with fixes to RUN lines in the test case.

rdar://problem/25364625

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

llvm-svn: 302978

7 years agoDisable llvm/test/Transforms/NewGVN/pr32934.ll while Davide is investigating.
NAKAMURA Takumi [Sat, 13 May 2017 03:05:38 +0000 (03:05 +0000)]
Disable llvm/test/Transforms/NewGVN/pr32934.ll while Davide is investigating.

llvm-svn: 302977

7 years ago[NewGVN] XFAIL a flaky test until I find out what's going on.
Davide Italiano [Sat, 13 May 2017 02:45:47 +0000 (02:45 +0000)]
[NewGVN] XFAIL a flaky test until I find out what's going on.

I bet the change is correct but this test seems to expose some underlying
problem that manifest only on some buildbots, and I'm not able to reproduce
locally. Unfortunately I can't debug right now but I don't want to annoy
people with spurious failures, so I'll XFAIL until I can take a look (over
the weekend).

llvm-svn: 302976

7 years ago[ASTImporter] Improve handling of incomplete types
Sean Callanan [Sat, 13 May 2017 00:46:33 +0000 (00:46 +0000)]
[ASTImporter] Improve handling of incomplete types

ASTImporter has some bugs when it's importing types
that themselves come from an ExternalASTSource. This
is exposed particularly in the behavior when
comparing complete TagDecls with forward
declarations. This patch does several things:

- Adds a test case making sure that conflicting
  forward-declarations are resolved correctly;
- Extends the clang-import-test harness to test
  two-level importing, so that we make sure we
  complete types when necessary; and
- Fixes a few bugs I found this way. Failure to
  complete types was one; however, I also discovered
  that complete RecordDecls aren't properly added to
  the redecls chain for existing forward
  declarations.

llvm-svn: 302975

7 years ago[APInt] Fix typo in comment. NFC
Craig Topper [Sat, 13 May 2017 00:35:30 +0000 (00:35 +0000)]
[APInt] Fix typo in comment. NFC

llvm-svn: 302974

7 years ago[AVR] When lowering Select8/Select16, put newly generated MBBs in the same spot
Dylan McKay [Sat, 13 May 2017 00:22:34 +0000 (00:22 +0000)]
[AVR] When lowering Select8/Select16, put newly generated MBBs in the same spot

Contributed by Dr. Gergő Érdi.

Fixes a bug.

Raised from (https://github.com/avr-rust/rust/issues/49).

llvm-svn: 302973

7 years agoAA: Use generic intrinsics for tests instead of target specific ones
Justin Bogner [Sat, 13 May 2017 00:12:52 +0000 (00:12 +0000)]
AA: Use generic intrinsics for tests instead of target specific ones

Update a few tests to use llvm.masked.load/store instead of arm neon
vector loads and stores, and move the tests that are actually specific
to those arm intrinsics to their own files. This lets us mark the
tests that use target specific intrinsics as requiring those targets.

llvm-svn: 302972

7 years ago[CodeView] Silence some -Wsign-compare warnings
Justin Bogner [Sat, 13 May 2017 00:11:39 +0000 (00:11 +0000)]
[CodeView] Silence some -Wsign-compare warnings

llvm-svn: 302971

7 years ago[AVR] Remove an unused variable
Dylan McKay [Sat, 13 May 2017 00:00:26 +0000 (00:00 +0000)]
[AVR] Remove an unused variable

llvm-svn: 302970

7 years agoAdd LangOptions method to query whether we are tracking the owning module for a local...
Richard Smith [Sat, 13 May 2017 00:00:16 +0000 (00:00 +0000)]
Add LangOptions method to query whether we are tracking the owning module for a local declaration.

In preparation for expanding this behavior to cover additional cases.

llvm-svn: 302969

7 years ago[PartialInlining] Profile based cost analysis
Xinliang David Li [Fri, 12 May 2017 23:41:43 +0000 (23:41 +0000)]
[PartialInlining] Profile based cost analysis

Implemented frequency based cost/saving analysis
and related options.

The pass is now in a state ready to be turne on
in the pipeline (in follow up).

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

llvm-svn: 302967

7 years agoRemove unused tracking of owning module for MacroInfo objects.
Richard Smith [Fri, 12 May 2017 23:40:52 +0000 (23:40 +0000)]
Remove unused tracking of owning module for MacroInfo objects.

llvm-svn: 302966

7 years ago[modules] When creating a declaration, cache its owning module immediately
Richard Smith [Fri, 12 May 2017 23:27:00 +0000 (23:27 +0000)]
[modules] When creating a declaration, cache its owning module immediately
rather than waiting until it's queried.

Currently this is only applied to local submodule visibility mode, as we don't
yet allocate storage for the owning module in non-local-visibility modules
compilations.

llvm-svn: 302965

7 years ago[GISel]: Add a getConstantFPVRegVal utility
Aditya Nandakumar [Fri, 12 May 2017 22:54:52 +0000 (22:54 +0000)]
[GISel]: Add a getConstantFPVRegVal utility

This might be useful across various GISel Passes

https://reviews.llvm.org/D33051

llvm-svn: 302964

7 years ago[GISel]: Fix undefined behavior while accessing DefaultAction map
Aditya Nandakumar [Fri, 12 May 2017 22:43:58 +0000 (22:43 +0000)]
[GISel]: Fix undefined behavior while accessing DefaultAction map

We end up dereferencing the end iterator here when the Aspect doesn't exist in the DefaultAction map.
Change the API to return Optional<LLT> and return None when not found.
Also update the callers to handle the None case

llvm-svn: 302963

7 years ago[XRay] Fix build with libc++ (NFC).
Eugene Zelenko [Fri, 12 May 2017 22:26:42 +0000 (22:26 +0000)]
[XRay] Fix build with libc++ (NFC).

llvm-svn: 302962

7 years ago[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).
Eugene Zelenko [Fri, 12 May 2017 22:25:07 +0000 (22:25 +0000)]
[IR] Fix some Clang-tidy modernize-use-using warnings; other minor fixes (NFC).

llvm-svn: 302961

7 years ago[TLI] Add mapping for various '__<func>_finite' forms of the math routines to SVML...
Andrew Kaylor [Fri, 12 May 2017 22:11:26 +0000 (22:11 +0000)]
[TLI] Add mapping for various '__<func>_finite' forms of the math routines to SVML routines

Patch by Chris Chrulski

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

llvm-svn: 302957

7 years ago[ConstantFolding] Add folding for various math '__<func>_finite' routines generated...
Andrew Kaylor [Fri, 12 May 2017 22:11:20 +0000 (22:11 +0000)]
[ConstantFolding] Add folding for various math '__<func>_finite' routines generated from -ffast-math

Patch by Chris Chrulski

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

llvm-svn: 302956

7 years ago[TLI] Add declarations for various math header file routines from math-finite.h that...
Andrew Kaylor [Fri, 12 May 2017 22:11:12 +0000 (22:11 +0000)]
[TLI] Add declarations for various math header file routines from math-finite.h that create '__<func>_finite as functions

Patch by Chris Chrulski

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

llvm-svn: 302955

7 years agoFixed the OS X build after Error -> Status rename.
Sean Callanan [Fri, 12 May 2017 21:53:44 +0000 (21:53 +0000)]
Fixed the OS X build after Error -> Status rename.

llvm-svn: 302954

7 years ago[APInt] Add early outs for a division by 1 to udiv/urem/udivrem
Craig Topper [Fri, 12 May 2017 21:45:50 +0000 (21:45 +0000)]
[APInt] Add early outs for a division by 1 to udiv/urem/udivrem

We already counted the number of bits in the RHS so its pretty cheap to just check if the RHS is 1.

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

llvm-svn: 302953

7 years ago[APInt] In udivrem, remember the bit width in a local variable so we don't reread...
Craig Topper [Fri, 12 May 2017 21:45:44 +0000 (21:45 +0000)]
[APInt] In udivrem, remember the bit width in a local variable so we don't reread it from the LHS which might be aliased with Quotient or Remainder.

This helped the compiler generate better code for the single word case. It was able to remember that the bit width was still a single word when it created the Remainder APInt and not create code for it possibly being multiword.

llvm-svn: 302952

7 years agoLTO: Don't verify modules twice in verifyMergedModuleOnce
Adrian Prantl [Fri, 12 May 2017 21:38:32 +0000 (21:38 +0000)]
LTO: Don't verify modules twice in verifyMergedModuleOnce

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

llvm-svn: 302951

7 years ago[Doc] Document "Splat" in the lexicon
Sanjay Patel [Fri, 12 May 2017 21:30:31 +0000 (21:30 +0000)]
[Doc] Document "Splat" in the lexicon

Patch by Wei-Ren Chen (陳韋任)!

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

llvm-svn: 302950

7 years ago[x86] add vector tests for demanded bits; NFC
Sanjay Patel [Fri, 12 May 2017 20:53:48 +0000 (20:53 +0000)]
[x86] add vector tests for demanded bits; NFC

llvm-svn: 302949

7 years agoFix build on Mac OS.
Eugene Zemtsov [Fri, 12 May 2017 20:44:09 +0000 (20:44 +0000)]
Fix build on Mac OS.

llvm-svn: 302948