platform/upstream/llvm.git
8 years agoReverting r275284 due to platform-specific test failures
Andrew Kaylor [Wed, 13 Jul 2016 19:09:16 +0000 (19:09 +0000)]
Reverting r275284 due to platform-specific test failures

llvm-svn: 275304

8 years agoImplement FunctionDecl::getDefinition() to be consistent with
Yaron Keren [Wed, 13 Jul 2016 19:04:51 +0000 (19:04 +0000)]
Implement FunctionDecl::getDefinition() to be consistent with
VarDecl, TagDecl, EnumDecl, RecordDecl, CXXRecordDecl.

Use getDefinition in two locations to make the code more readable.

llvm-svn: 275303

8 years agoadd more tests for zexty xor sandwiches
Sanjay Patel [Wed, 13 Jul 2016 18:58:55 +0000 (18:58 +0000)]
add more tests for zexty xor sandwiches

...mmm sandwiches

llvm-svn: 275302

8 years agoAdd GotEntrySize/GotPltEntrySize to ELF target.
Rui Ueyama [Wed, 13 Jul 2016 18:55:14 +0000 (18:55 +0000)]
Add GotEntrySize/GotPltEntrySize to ELF target.

Patch by H.J Lu.

For x86-64 psABI, the entry size of .got and .got.plt sections is 8
bytes for both LP64 and ILP32.  Add GotEntrySize and GotPltEntrySize
to ELF target instead of using size of ELFT::uint.  Now we can generate
a simple working x32 executable.

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

llvm-svn: 275301

8 years ago[X86][SSE] Regenerate truncated shift test
Simon Pilgrim [Wed, 13 Jul 2016 18:50:10 +0000 (18:50 +0000)]
[X86][SSE] Regenerate truncated shift test

Check SSE2 and AVX2 implementations

llvm-svn: 275300

8 years agoRegenerate test
Simon Pilgrim [Wed, 13 Jul 2016 18:46:37 +0000 (18:46 +0000)]
Regenerate test

llvm-svn: 275299

8 years agoRename VAStart -> ImageBase. NFC.
Rui Ueyama [Wed, 13 Jul 2016 18:40:59 +0000 (18:40 +0000)]
Rename VAStart -> ImageBase. NFC.

Config members are named after corresponding command line options.
This patch renames VAStart ImageBase so that they are in line with
--image-base.

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

llvm-svn: 275298

8 years agoadd test for zexty xor sandwich
Sanjay Patel [Wed, 13 Jul 2016 18:40:38 +0000 (18:40 +0000)]
add test for zexty xor sandwich

llvm-svn: 275297

8 years agoFix header comment in unittests/CodeGen/DIEHashTest.cpp.
Justin Lebar [Wed, 13 Jul 2016 18:38:20 +0000 (18:38 +0000)]
Fix header comment in unittests/CodeGen/DIEHashTest.cpp.

llvm-svn: 275296

8 years ago[ELF] Rename the test to reflect the option name
Petr Hosek [Wed, 13 Jul 2016 18:31:44 +0000 (18:31 +0000)]
[ELF] Rename the test to reflect the option name

This is to follow the convention of naming the test after the name
of the option.

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

llvm-svn: 275295

8 years agoMove mempcpy_call.ll to X86 subdirectory
Krzysztof Parzyszek [Wed, 13 Jul 2016 18:28:45 +0000 (18:28 +0000)]
Move mempcpy_call.ll to X86 subdirectory

llvm-svn: 275294

8 years agoFix warning in ObjectTransformLayerTest.
Justin Lebar [Wed, 13 Jul 2016 18:27:49 +0000 (18:27 +0000)]
Fix warning in ObjectTransformLayerTest.

Doing "I++" inside of an EXPECT_* triggers

  warning: expression with side effects has no effect in an unevaluated context

because EXPECT_* partially expands to

  EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(MockObjects[I++] + 1)) == 1)>

which is an unevaluated context.

llvm-svn: 275293

8 years ago[ADT] Add LLVM_MARK_AS_BITMASK_ENUM, used to enable bitwise operations on enums witho...
Justin Lebar [Wed, 13 Jul 2016 18:23:16 +0000 (18:23 +0000)]
[ADT] Add LLVM_MARK_AS_BITMASK_ENUM, used to enable bitwise operations on enums without static_cast.

Summary: Normally when you do a bitwise operation on an enum value, you
get back an instance of the underlying type (e.g. int).  But using this
macro, bitwise ops on your enum will return you back instances of the
enum.  This is particularly useful for enums which represent a
combination of flags.

Suppose you have a function which takes an int and a set of flags.  One
way to do this would be to take two numeric params:

  enum SomeFlags { F1 = 1, F2 = 2, F3 = 4, ... };
  void Fn(int Num, int Flags);

  void foo() {
    Fn(42, F2 | F3);
  }

But now if you get the order of arguments wrong, you won't get an error.

You might try to fix this by changing the signature of Fn so it accepts
a SomeFlags arg:

  enum SomeFlags { F1 = 1, F2 = 2, F3 = 4, ... };
  void Fn(int Num, SomeFlags Flags);

  void foo() {
    Fn(42, static_cast<SomeFlags>(F2 | F3));
  }

But now we need a static cast after doing "F2 | F3" because the result
of that computation is the enum's underlying type.

This patch adds a mechanism which gives us the safety of the second
approach with the brevity of the first.

  enum SomeFlags {
    F1 = 1, F2 = 2, F3 = 4, ..., F_MAX = 128,
    LLVM_MARK_AS_BITMASK_ENUM(F_MAX)
  };

  void Fn(int Num, SomeFlags Flags);

  void foo() {
    Fn(42, F2 | F3);  // No static_cast.
  }

The LLVM_MARK_AS_BITMASK_ENUM macro enables overloads for bitwise
operators on SomeFlags.  Critically, these operators return the enum
type, not its underlying type, so you don't need any static_casts.

An advantage of this solution over the previously-proposed BitMask class
[0, 1] is that we don't need any wrapper classes -- we can operate
directly on the enum itself.

The approach here is somewhat similar to OpenOffice's typed_flags_set
[2].  But we skirt the need for a wrapper class (and a good deal of
complexity) by judicious use of enable_if.  We SFINAE on the presence of
a particular enumerator (added by the LLVM_MARK_AS_BITMASK_ENUM macro)
instead of using a traits class so that it's impossible to use the enum
before the overloads are present.  The solution here also seamlessly
works across multiple namespaces.

[0] http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20150622/283369.html
[1] http://lists.llvm.org/pipermail/llvm-commits/attachments/20150623/073434b6/attachment.obj
[2] https://cgit.freedesktop.org/libreoffice/core/tree/include/o3tl/typed_flags_set.hxx

Reviewers: chandlerc, rsmith

Subscribers: llvm-commits

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

llvm-svn: 275292

8 years agoFix warnings in FunctionTest.cpp.
Justin Lebar [Wed, 13 Jul 2016 18:17:46 +0000 (18:17 +0000)]
Fix warnings in FunctionTest.cpp.

Because of the goop involved in the EXPECT_EQ macro, we were getting the
following warning

  expression with side effects has no effect in an unevaluated context

because the "I++" was being used inside of a template type:

  switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(Args[I++])) == 1)>::Compare("Args[I++]", "&A", Args[I++], &A))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "../src/unittests/IR/FunctionTest.cpp", 94, gtest_ar.failure_message()) = ::testing::Message();

llvm-svn: 275291

8 years ago[analyzer] Implement a methond to discover origin region of a symbol.
Artem Dergachev [Wed, 13 Jul 2016 18:07:26 +0000 (18:07 +0000)]
[analyzer] Implement a methond to discover origin region of a symbol.

This encourages checkers to make logical decisions depending on
value of which region was the symbol under consideration
introduced to denote.

A similar technique is already used in a couple of checkers;
they were modified to call the new method.

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

llvm-svn: 275290

8 years ago[InstCombine] extend vector select matching for non-splat constants
Sanjay Patel [Wed, 13 Jul 2016 18:07:02 +0000 (18:07 +0000)]
[InstCombine] extend vector select matching for non-splat constants

In D21740, we discussed trying to make this a more general matcher. However, I didn't see a clean
way to handle the regular m_Not cases and these non-splat vector patterns, so I've opted for the
direct approach here. If there are other potential uses of areInverseVectorBitmasks(), we could
move that helper function to a higher level.

There is an open question as to which is of these forms should be considered the canonical IR:
  %sel = select <4 x i1> <i1 true, i1 false, i1 false, i1 true>, <4 x i32> %a, <4 x i32> %b
  %shuf = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 5, i32 6, i32 3>

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

llvm-svn: 275289

8 years agoAMDGPU/SI: Emit the number of SGPR and VGPR spills
Marek Olsak [Wed, 13 Jul 2016 17:35:15 +0000 (17:35 +0000)]
AMDGPU/SI: Emit the number of SGPR and VGPR spills

Summary:
v2: don't count SGPRs spilled to scratch twice

I think this is sufficient. It doesn't count private memory usage, which
happens often and uses scratch but isn't technically a spill. The private
memory usage can be computed by:
  [scratch_per_thread - vgpr_spills - a random multiple of SGPR spills].

The fact SGPR spills add very high numbers to the scratch size make that
computation a guessing game, but I don't have a solution to that.

Reviewers: tstellarAMD

Subscribers: arsenm, kzhuravl

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

llvm-svn: 275288

8 years agoFix a check in the objc trampoline handler
Stephane Sezer [Wed, 13 Jul 2016 17:34:26 +0000 (17:34 +0000)]
Fix a check in the objc trampoline handler

Summary:
The function FunctionCaller::WriteFunctionArguments returns false on
errors, so they should check for the false return value.

Change by Walter Erquinigo <a20012251@gmail.com>

Reviewers: jingham, clayborg

Subscribers: lldb-commits

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

llvm-svn: 275287

8 years agoRemove comment that isn't needed anymore.
Greg Clayton [Wed, 13 Jul 2016 17:25:55 +0000 (17:25 +0000)]
Remove comment that isn't needed anymore.

<rdar://problem/24599697>

llvm-svn: 275285

8 years agoFix for Bug 26903, adds support to inline __builtin_mempcpy
Andrew Kaylor [Wed, 13 Jul 2016 17:25:11 +0000 (17:25 +0000)]
Fix for Bug 26903, adds support to inline __builtin_mempcpy

Patch by Sunita Marathe

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

llvm-svn: 275284

8 years agoPR28516: Fix LangRef description of call and invoke to match IR changes for typeless...
David Blaikie [Wed, 13 Jul 2016 17:21:34 +0000 (17:21 +0000)]
PR28516: Fix LangRef description of call and invoke to match IR changes for typeless pointers

llvm-svn: 275283

8 years ago[OpenMP] Initial implementation of parse+sema for OpenMP clause 'is_device_ptr' of...
Carlo Bertolli [Wed, 13 Jul 2016 17:16:49 +0000 (17:16 +0000)]
[OpenMP] Initial implementation of parse+sema for OpenMP clause 'is_device_ptr' of target

http://reviews.llvm.org/D22070

llvm-svn: 275282

8 years agoCentralize the way symbol and functions are looked up by making a Module::LookupInfo...
Greg Clayton [Wed, 13 Jul 2016 17:12:24 +0000 (17:12 +0000)]
Centralize the way symbol and functions are looked up by making a Module::LookupInfo class that does all of the heavy lifting.

Background: symbols and functions can be looked up by full mangled name and by basename. SymbolFile and ObjectFile are expected to be able to do the lookups based on full mangled name or by basename, so when the user types something that is incomplete, we must be able to look it up efficiently. For example the user types "a::b::c" as a symbol to set a breakpoint on, we will break this down into a 'lookup "c"' and then weed out N matches down to just the ones that match "a::b::c". Previously this was done manaully in many functions by calling Module::PrepareForFunctionNameLookup(...) and then doing the lookup and manually pruning the results down afterward with duplicated code. Now all places use Module::LookupInfo to do the work in one place.

This allowed me to fix the name lookups to look for "func" with eFunctionNameTypeFull as the "name_type_mask", and correctly weed the results:

"func", "func()", "func(int)", "a::func()", "b::func()", and "a::b::func()" down to just "func", "func()", "func(int)". Previously we would have set 6 breakpoints, now we correctly set just 3. This also extends to the expression parser when it looks up names for functions it needs to not get multiple results so we can call the correct function.

<rdar://problem/24599697>

llvm-svn: 275281

8 years agoConstuct a sentry object in istream::readsome, and handle failures appropriately...
Marshall Clow [Wed, 13 Jul 2016 16:58:48 +0000 (16:58 +0000)]
Constuct a sentry object in istream::readsome, and handle failures appropriately. Fixes PR#28217.

llvm-svn: 275280

8 years ago[include-fixer] Implement adding missing namespace qualifiers in vim integration.
Haojian Wu [Wed, 13 Jul 2016 16:43:54 +0000 (16:43 +0000)]
[include-fixer] Implement adding missing namespace qualifiers in vim integration.

Summary:
The patch extends include-fixer's "-output-headers", and "-insert-headers"
command line options to make it dump more information (e.g. QualifiedSymbol),
so that vim-integration can add missing qualifiers.

Reviewers: bkramer

Subscribers: cfe-commits

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

llvm-svn: 275279

8 years agoPatchableFunction: Skip pseudos that do not create code
Matthias Braun [Wed, 13 Jul 2016 16:37:29 +0000 (16:37 +0000)]
PatchableFunction: Skip pseudos that do not create code

This fixes http://llvm.org/PR28524

llvm-svn: 275278

8 years ago[ThinLTO/gold] Enable symbol resolution in distributed backend case
Teresa Johnson [Wed, 13 Jul 2016 16:35:56 +0000 (16:35 +0000)]
[ThinLTO/gold] Enable symbol resolution in distributed backend case

While testing a follow-on change to enable index-based symbol resolution
and internalization in the distributed backends, I realized that a test
case change I made in r275247 was only required because we were not
analyzing symbols in the claimed files in thinlto-index-only mode.

In the fixed test case there should be no internalization because we are
linking in -shared mode, so f() is in fact exported, which is detected
properly when we analyze symbols in thinlto-index-only mode. Note that
this is not (yet) a correctness issue (because we are not yet performing
the index-based linkage optimizations in the distributed backends -
that's coming in a follow-on patch).

llvm-svn: 275277

8 years ago[x86][SSE/AVX] optimize pcmp results better (PR28484)
Sanjay Patel [Wed, 13 Jul 2016 16:04:07 +0000 (16:04 +0000)]
[x86][SSE/AVX] optimize pcmp results better (PR28484)

We know that pcmp produces all-ones/all-zeros bitmasks, so we can use that behavior to avoid unnecessary constant loading.

One could argue that load+and is actually a better solution for some CPUs (Intel big cores) because shifts don't have the
same throughput potential as load+and on those cores, but that should be handled as a CPU-specific later transformation if
it ever comes up. Removing the load is the more general x86 optimization. Note that the uneven usage of vpbroadcast in the
test cases is filed as PR28505:
https://llvm.org/bugs/show_bug.cgi?id=28505

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

llvm-svn: 275276

8 years agoAdd accelerator code generation pass skeleton
Tobias Grosser [Wed, 13 Jul 2016 15:54:58 +0000 (15:54 +0000)]
Add accelerator code generation pass skeleton

Add a new pass to serve as basis for automatic accelerator mapping in Polly.
The pass structure and the analyses preserved are copied from
CodeGeneration.cpp, as we will rely on IslNodeBuilder and IslExprBuilder for
LLVM-IR code generation.

Polly's accelerator code generation is enabled with -polly-target=gpu

I would like to use this commit as opportunity to thank Yabin Hu for his work in
the context of two Google summer of code projects during which he implemented
initial prototypes of the Polly accelerator code generation -- in parts this
code is already available in todays Polly (e.g., tools/GPURuntime). More will
come as part of the upcoming Polly ACC changes.

Reviewers: Meinersbur

Subscribers: pollydev, llvm-commits

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

llvm-svn: 275275

8 years agoAdd ppcg-0.04 to lib/External
Tobias Grosser [Wed, 13 Jul 2016 15:54:47 +0000 (15:54 +0000)]
Add ppcg-0.04 to lib/External

ppcg will be used to provide mapping decisions for GPU code generation.

As we do not use C as input language, we do not include pet. However, we include
pet.h from pet 82cacb71 plus a set of dummy functions to ensure ppcg links
without problems.

The version of ppcg committed is unmodified ppcg-0.04 which has been well tested
in the context of LLVM. It does not provide an official library interface yet,
which means that in upcoming commits we will add minor modifications to make
necessary functionality accessible. We will aim to upstream these modifications
after we gained enough experience with GPU generation support in Polly to
propose a stable interface.

Reviewers: Meinersbur

Subscribers: pollydev, llvm-commits

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

llvm-svn: 275274

8 years ago[ConstantFolding] Use sdiv_ov
David Majnemer [Wed, 13 Jul 2016 15:53:46 +0000 (15:53 +0000)]
[ConstantFolding] Use sdiv_ov

This is a simplification, there should be no functional change.

llvm-svn: 275273

8 years ago[X86][AVX512] Add support for VPERMILPD/VPERMILPS variable shuffle mask comments
Simon Pilgrim [Wed, 13 Jul 2016 15:45:36 +0000 (15:45 +0000)]
[X86][AVX512] Add support for VPERMILPD/VPERMILPS variable shuffle mask comments

llvm-svn: 275272

8 years ago[OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target...
Carlo Bertolli [Wed, 13 Jul 2016 15:37:16 +0000 (15:37 +0000)]
[OpenMP] Initial implementation of parse+sema for clause use_device_ptr of 'target data'

http://reviews.llvm.org/D21904

This patch is similar to the implementation of 'private' clause: it adds a list of private pointers to be used within the target data region to store the device pointers returned by the runtime.
Please refer to the following document for a full description of what the runtime witll return in this case (page 10 and 11):
https://github.com/clang-omp/OffloadingDesign

I am happy to answer any question related to the runtime interface to help reviewing this patch.

llvm-svn: 275271

8 years ago[X86][AVX] Add support for target shuffle combining to VPERMILPS variable shuffle...
Simon Pilgrim [Wed, 13 Jul 2016 15:10:43 +0000 (15:10 +0000)]
[X86][AVX] Add support for target shuffle combining to VPERMILPS variable shuffle mask

Added AVX512F VPERMILPS shuffle decoding support

llvm-svn: 275270

8 years ago[ELF] - Add predefined sections to output sections list in one place.
George Rimar [Wed, 13 Jul 2016 14:26:31 +0000 (14:26 +0000)]
[ELF] - Add predefined sections to output sections list in one place.

Minor cleanup.
Currently it looks wierd that having method addPredefinedSections()
we still add 2 sections outside it without real reasons.
Patch fixes that.

Differential revision: http://reviews.llvm.org/D19981

llvm-svn: 275269

8 years agoAMDGPU/SI: Add support for R_AMDGPU_GOTPCREL
Tom Stellard [Wed, 13 Jul 2016 14:23:33 +0000 (14:23 +0000)]
AMDGPU/SI: Add support for R_AMDGPU_GOTPCREL

Reviewers: rafael, ruiu, tony-tye, arsenm, kzhuravl

Subscribers: arsenm, llvm-commits, kzhuravl

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

llvm-svn: 275268

8 years ago[PCH] Add a fno-pch-timestamp option to cc1 to disable inclusion of timestamps in...
Pierre Gousseau [Wed, 13 Jul 2016 14:21:11 +0000 (14:21 +0000)]
[PCH] Add a fno-pch-timestamp option to cc1 to disable inclusion of timestamps in PCH files.

This is to allow distributed build systems, that do not preserve time stamps, to use PCH files.

Second and last part of the patch proposed at:

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

llvm-svn: 275267

8 years agoRename llc's -fpreserve-as-comments flag -preserve-as-comments.
Nirav Dave [Wed, 13 Jul 2016 14:20:41 +0000 (14:20 +0000)]
Rename llc's -fpreserve-as-comments flag -preserve-as-comments.

llvm-svn: 275266

8 years ago[MC] Fix lexing ordering in assembly label parsing to preserve same line
Nirav Dave [Wed, 13 Jul 2016 14:03:12 +0000 (14:03 +0000)]
[MC] Fix lexing ordering in assembly label parsing to preserve same line
comment placement.

llvm-svn: 275265

8 years ago[RT-ARM] Syntax unified for aeabi_mem* functions
Renato Golin [Wed, 13 Jul 2016 14:01:15 +0000 (14:01 +0000)]
[RT-ARM] Syntax unified for aeabi_mem* functions

Use unified syntax for builtins/arm/aeabi_mem*.S.

This makes these files consistent with the others.

This fixes a problem on the linker, which can fail with the message
"relocation truncated to fit: R_ARM_THM_JUMP11 against symbol"

Patch by Kor Nielsen.

llvm-svn: 275264

8 years ago[clang-tidy] Fix misc-definitions-in-headers misplaced fixing to fully templated...
Haojian Wu [Wed, 13 Jul 2016 13:55:29 +0000 (13:55 +0000)]
[clang-tidy] Fix misc-definitions-in-headers misplaced fixing to fully templated function.

Reviewers: alexfh, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 275263

8 years ago[X86][SSE] Check for lane crossing shuffles before trying to combine to PSHUFB
Simon Pilgrim [Wed, 13 Jul 2016 12:48:41 +0000 (12:48 +0000)]
[X86][SSE] Check for lane crossing shuffles before trying to combine to PSHUFB

Removes a return-on-fail that was making it tricky to add other variable mask shuffles.

llvm-svn: 275262

8 years ago[PCH] Fix timestamp check on windows hosts.
Pierre Gousseau [Wed, 13 Jul 2016 11:58:28 +0000 (11:58 +0000)]
[PCH] Fix timestamp check on windows hosts.

On Linux, if the timestamp of a header file, included in the pch, is modified, then including the pch without regenerating it causes a fatal error, which is reasonable.
On Windows the check is ifdefed out, allowing the compilation to continue in a broken state.
The root of the broken state is that, if timestamps dont match, the preprocessor will reparse a header without discarding the pch data.
This leads to "#pragma once" header to be included twice.
The reason behind the ifdefing of the check lacks documentation, and was done 6 years ago.
This change tentatively removes the ifdefing.

First part of patch proposed at:

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

llvm-svn: 275261

8 years agoAdd "support" for DW_CFA_GNU_args_size to the unwinder
Pavel Labath [Wed, 13 Jul 2016 10:55:24 +0000 (10:55 +0000)]
Add "support" for DW_CFA_GNU_args_size to the unwinder

Summary:
This adds the knowledge of the DW_CFA_GNU_args_size instruction to the eh_frame parsing code.
Right now it is ignored as I am unsure how is it supposed to be handled, but now we are at least
able to parse the rest of the FDE containing this instruction.

I also add a fix for a bug which was exposed by this instruction. Namely, a mismatched sequence
of remember/restore instructions in the input could cause us to pop an empty stack and crash. Now
we just log the error and ignore the offending instruction.

Reviewers: jasonmolenda

Subscribers: lldb-commits

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

llvm-svn: 275260

8 years ago[OpenCL] Fix code generation of kernel pipe parameters.
Alexey Bader [Wed, 13 Jul 2016 10:28:13 +0000 (10:28 +0000)]
[OpenCL] Fix code generation of kernel pipe parameters.

Improved test with user define structure pipe type case.

Reviewers: Anastasia, pxli168
Subscribers: yaxunl, cfe-commits

Differential revision: http://reviews.llvm.org/D21744

llvm-svn: 275259

8 years agoReverted r275257 "[ELF] - Implement extern "c++" version script tag"
George Rimar [Wed, 13 Jul 2016 08:19:04 +0000 (08:19 +0000)]
Reverted r275257 "[ELF] - Implement extern "c++" version script tag"

It broke build bots:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/8204
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/19432

llvm-svn: 275258

8 years ago[ELF] - Implement extern "c++" version script tag
George Rimar [Wed, 13 Jul 2016 07:46:00 +0000 (07:46 +0000)]
[ELF] - Implement extern "c++" version script tag

Patch implements 'extern' version script tag.
Currently only values in quotes(") are supported.

Matching of externs is performed in the same pass as exact match of globals.

Differential revision: http://reviews.llvm.org/D21930

llvm-svn: 275257

8 years agofix missing whitespace in sphinx doc
Etienne Bergeron [Wed, 13 Jul 2016 06:37:39 +0000 (06:37 +0000)]
fix missing whitespace in sphinx doc

llvm-svn: 275256

8 years agofix incorrect xref in sphinx doc
Etienne Bergeron [Wed, 13 Jul 2016 06:10:37 +0000 (06:10 +0000)]
fix incorrect xref in sphinx doc

llvm-svn: 275255

8 years agofix missing newline in sphinx doc
Etienne Bergeron [Wed, 13 Jul 2016 06:06:48 +0000 (06:06 +0000)]
fix missing newline in sphinx doc

llvm-svn: 275254

8 years agoAMDGPU: Fold out no-op kill intrinsics
Matt Arsenault [Wed, 13 Jul 2016 06:04:22 +0000 (06:04 +0000)]
AMDGPU: Fold out no-op kill intrinsics

llvm-svn: 275253

8 years agoAMDGPU: WQM cleanups
Matt Arsenault [Wed, 13 Jul 2016 05:55:15 +0000 (05:55 +0000)]
AMDGPU: WQM cleanups

- Add new TTI instruction checks
- Don't use const for blocks that are mutated.
- Checking isBranch and isTerminator should be redundant

llvm-svn: 275252

8 years ago[ConstantFolding] Don't treat negative GEP offsets as positive
David Majnemer [Wed, 13 Jul 2016 05:16:16 +0000 (05:16 +0000)]
[ConstantFolding] Don't treat negative GEP offsets as positive

GEP offsets are signed, don't treat them as huge positive numbers.

llvm-svn: 275251

8 years ago[BFI] Add new LazyBFI analysis pass
Adam Nemet [Wed, 13 Jul 2016 05:01:48 +0000 (05:01 +0000)]
[BFI] Add new LazyBFI analysis pass

Summary:
This is necessary for D21771.  In order to add the hotness attribute to
optimization remarks we need BFI to be available in all passes that emit
optimization remarks.

However we don't want to pay for computing BFI unless the hotness
attribute is requested.

This is achieved by making BFI lazy at the very high-level through a new
analysis pass -- BFI is not calculated unless requested.

I am adding a test to check the laziness under D21771 where the first
user of the analysis is added.

Reviewers: hfinkel, dexonsmith, davidxl

Subscribers: davidxl, dexonsmith, llvm-commits

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

llvm-svn: 275250

8 years ago[ConstantFolding] Cleanups
David Majnemer [Wed, 13 Jul 2016 04:22:12 +0000 (04:22 +0000)]
[ConstantFolding] Cleanups

No functional change is intended, just a minor cleanup.

llvm-svn: 275249

8 years agovim: separate the keywords into one per line
Saleem Abdulrasool [Wed, 13 Jul 2016 03:47:58 +0000 (03:47 +0000)]
vim: separate the keywords into one per line

This achieves the same result as previously by using line wrapping.  This allows
us to have one keyword per line which makes adding a new keyword significantly
easier, especially if they are inserted in a lexicographical sort order as you
no longer need to reflow the content around it.

This only does the keywords as that is the group which changes more often.

llvm-svn: 275248

8 years ago[ThinLTO/gold] ThinLTO internalization fixes
Teresa Johnson [Wed, 13 Jul 2016 03:42:41 +0000 (03:42 +0000)]
[ThinLTO/gold] ThinLTO internalization fixes

Internalization was missing cases where we originally had a local symbol
that was promoted eagerly but not actually exported. This is because we
were only internalizing the set of global (non-local) symbols that were
PREVAILAING_DEF_IRONLY. Instead, collect the set of global symbols that
are referenced outside of a single IR file, and skip internalization for
those.

llvm-svn: 275247

8 years ago[IR] Make getIndexedOffsetInType return a signed result
David Majnemer [Wed, 13 Jul 2016 03:42:38 +0000 (03:42 +0000)]
[IR] Make getIndexedOffsetInType return a signed result

A GEPed offset can go negative, the result of getIndexedOffsetInType
should according be a signed type.

llvm-svn: 275246

8 years agovim: add local_unnamed_addr keyword
Saleem Abdulrasool [Wed, 13 Jul 2016 03:36:05 +0000 (03:36 +0000)]
vim: add local_unnamed_addr keyword

The `local_unnamed_addr` was introduced in SVN r272709.  Update the syntax
highlighting rules.

llvm-svn: 275245

8 years ago[ConstantFold] Don't incorrectly infer inbounds on array GEP
David Majnemer [Wed, 13 Jul 2016 03:24:41 +0000 (03:24 +0000)]
[ConstantFold] Don't incorrectly infer inbounds on array GEP

The many levels of nesting inside the responsible code made it easy for
bugs to sneak in.  Flattening the logic makes it easier to see what's
going on.

llvm-svn: 275244

8 years ago[LoopVectorize] Further cleanups
David Majnemer [Wed, 13 Jul 2016 03:24:38 +0000 (03:24 +0000)]
[LoopVectorize] Further cleanups

No functional change is intended, just a minor cleanup.

llvm-svn: 275243

8 years agoCOFF: drop the dependency on LIB.EXE for implibs
Saleem Abdulrasool [Wed, 13 Jul 2016 03:19:27 +0000 (03:19 +0000)]
COFF: drop the dependency on LIB.EXE for implibs

lld currently relies on lib.exe in order to generate an empty import library.
The "empty" import library consists of 5 members:
  - first linker member
  - second linker member
  - Import Descriptor
  - NULL Import Descriptor
  - NULl Thunk

The first two entries (first and second linker members) are string tables which
are never updated.  Therefore, they may as well as not be present.  A subsequent
change to add that is probably warranted.  However, this does not prevent the
use of the linker.

The Import Descriptor is the content which is most important.  It provides an
Import Name Table entry for the library (as specified by the LIBRARY directive
in the DEF file).  Additionally, it contains undefined references to the NULL
Import Descriptor and the library NULL Thunk Data.  This ensures that the linker
will pull in the subsequent objects from the import library for the link.  The
Import Descriptor has a single symbol (__IMPORT_DESCRIPTOR_<Library>) which
contains 3 relocations, one to the INT (Import Name Table) entry, one to the ILT
(Import Lookup Table) entry, and one to the IAT (Import Address Table) entry.

The NULL Import Descriptor is the last import descriptor and terminates the
import descriptor array.  It contains a single symbol
(__NULL_IMPORT_DESCRIPTOR).

The NULL Thunk contains a single symbol (\x7f<Library>_NULL_THUNK_DATA) and
provides the terminator for the ILT and IAT.

These files are currently constructed manually following the example of the
Short Import Library format.  This is arguably less than ideal, and it may be
possible to use MCAssembler and feed it the fragments to construct the object.

The major difference between the LIB (LINK) generated objects and the ones
generated here is that they are all one section shorter (.debug$S) as they do
not contain the debug information and one symbol shorter (@comp.id) as they do
not contain the RICH signature.

Move the logic related to the librarian into a new source file (Librarian.cpp).

llvm-svn: 275242

8 years agoCodeGen: minor cleanup, NFC
Saleem Abdulrasool [Wed, 13 Jul 2016 02:58:44 +0000 (02:58 +0000)]
CodeGen: minor cleanup, NFC

Initialise more members in initializer lists.  Invert the condition that had
grown to be pretty confusing.  The `_objc_empty_vtable` is only used on macOS
<10.9.  This simplifies the code.  NFC.

llvm-svn: 275241

8 years ago[X86] Remove some seemingly unnecessary patterns that supported vector zext/sext...
Craig Topper [Wed, 13 Jul 2016 02:21:25 +0000 (02:21 +0000)]
[X86] Remove some seemingly unnecessary patterns that supported vector zext/sext with 256-bit source types producing a 256-bit result.

These patterns just extracted the source down to 128-bits to use the instructions. AVX512 seems to have blindly copied them over for VLX, but did not create similar patterns for 512-bit sources. So I'm hoping the backend can't actually produce these cases.

llvm-svn: 275240

8 years agoFix ScalarEvolutionExpander step scaling bug
Keno Fischer [Wed, 13 Jul 2016 01:28:12 +0000 (01:28 +0000)]
Fix ScalarEvolutionExpander step scaling bug

The expandAddRecExprLiterally function incorrectly transforms
`[Start + Step * X]` into `Step * [Start + X]` instead of the correct
transform of `[Step * X] + Start`.

This caused https://github.com/JuliaLang/julia/issues/14704#issuecomment-174126219
due to what appeared to be sufficiently complicated loop interactions.

Patch by Jameson Nash (jameson@juliacomputing.com).

Reviewers: sanjoy
Differential Revision: http://reviews.llvm.org/D16505

llvm-svn: 275239

8 years agoRemove another unused variable from r275216
Teresa Johnson [Tue, 12 Jul 2016 23:49:17 +0000 (23:49 +0000)]
Remove another unused variable from r275216

Remove another variable added in r275216 that was only used in debug
mode.

llvm-svn: 275238

8 years agoRevert r275223, which committed the wrong thing.
Sean Callanan [Tue, 12 Jul 2016 23:31:42 +0000 (23:31 +0000)]
Revert r275223, which committed the wrong thing.

llvm-svn: 275237

8 years agoAdd -m elf32_x86_64.
Rui Ueyama [Tue, 12 Jul 2016 23:28:33 +0000 (23:28 +0000)]
Add -m elf32_x86_64.

Patch by H.J. Lu.

This patch adds -m elf32_x86_64 to lld. But it doesn't generate working
x32 binaries.

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

llvm-svn: 275236

8 years agoAdd ILP32 support to X86_64TargetInfo.
Rui Ueyama [Tue, 12 Jul 2016 23:28:31 +0000 (23:28 +0000)]
Add ILP32 support to X86_64TargetInfo.

Patch by H.J. Lu.

As x86-64 psABI supports both LP64 and ILP32, this patch adds <ELFT>
template to X86_64TargetInfo.

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

llvm-svn: 275235

8 years agoSimplify. NFC.
Rui Ueyama [Tue, 12 Jul 2016 23:28:30 +0000 (23:28 +0000)]
Simplify. NFC.

Config->Pic is true if (Config->Pie || Config->Shared) is true,
so this extra check was redundant.

llvm-svn: 275234

8 years ago[CUDA] Use the multi-element remove function in EraseUnwantedCUDAMatches.
Justin Lebar [Tue, 12 Jul 2016 23:23:13 +0000 (23:23 +0000)]
[CUDA] Use the multi-element remove function in EraseUnwantedCUDAMatches.

Summary:
Bug pointed out by Benjamin Kramer in r264008.  I think the bug is
benign because by the time this is called, we should only have at most
two overloads to consider (either a host and a device overload, or a
host+device overload, but not all three).

Reviewers: tra

Subscribers: cfe-commits, bkramer

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

llvm-svn: 275233

8 years ago[CUDA] Add additional testcases for EraseUnwantedCUDAMatches.
Justin Lebar [Tue, 12 Jul 2016 23:23:12 +0000 (23:23 +0000)]
[CUDA] Add additional testcases for EraseUnwantedCUDAMatches.

Summary:
Specifically, this patch adds testcases for all three calls to
EraseUnwantedCUDAMatches.  The addr-of-overloaded-fn test I accidentally
neutered in r264207, which moved much of
CodeGenCUDA/function-overload.cu into SemaCUDA/function-overload.cu.
The coverage from overloaded-delete test is new.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 275232

8 years ago[CUDA] Don't assume that destructors can't be overloaded.
Justin Lebar [Tue, 12 Jul 2016 23:23:01 +0000 (23:23 +0000)]
[CUDA] Don't assume that destructors can't be overloaded.

Summary:
You can overload a destructor in CUDA, and SemaOverload needs to be
tweaked not to crash when it sees an explicit call to an overloaded
destructor.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

llvm-svn: 275231

8 years ago[LV] Do not invalidate use-lists we're iterating over.
Michael Kuperstein [Tue, 12 Jul 2016 23:11:34 +0000 (23:11 +0000)]
[LV] Do not invalidate use-lists we're iterating over.

Should make sanitizers happier.

llvm-svn: 275230

8 years agoRemove assert since it was crashing the mutli process driver tests. Made the code...
Greg Clayton [Tue, 12 Jul 2016 23:07:50 +0000 (23:07 +0000)]
Remove assert since it was crashing the mutli process driver tests. Made the code behave correctly when indexes are out of range or the collection is empty and is "log enable lldb unwind" is enabled, log an error message.

llvm-svn: 275226

8 years agoThis doesn't compiler on Darwin. Skipping it.
Greg Clayton [Tue, 12 Jul 2016 23:06:28 +0000 (23:06 +0000)]
This doesn't compiler on Darwin. Skipping it.

llvm-svn: 275225

8 years agoAdd missing files for r275222
Dehao Chen [Tue, 12 Jul 2016 22:42:24 +0000 (22:42 +0000)]
Add missing files for r275222

New pass manager for LICM.

Summary: Port LICM to the new pass manager.

Reviewers: davidxl, silvas

Subscribers: krasin, vitalybuka, silvas, davide, sanjoy, llvm-commits, mehdi_amini

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

llvm-svn: 275224

8 years agoMark TagDecls as having external visible storage, like ContainerDecls.
Sean Callanan [Tue, 12 Jul 2016 22:42:07 +0000 (22:42 +0000)]
Mark TagDecls as having external visible storage, like ContainerDecls.

The lookup tables can get out of date during the lifetime of the object so we
need to preserve LLDB's ability to answer questions about TagDecls' contents.

<rdar://problem/20751935>

llvm-svn: 275223

8 years agoNew pass manager for LICM.
Dehao Chen [Tue, 12 Jul 2016 22:37:48 +0000 (22:37 +0000)]
New pass manager for LICM.

Summary: Port LICM to the new pass manager.

Reviewers: davidxl, silvas

Subscribers: krasin, vitalybuka, silvas, davide, sanjoy, llvm-commits, mehdi_amini

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

llvm-svn: 275222

8 years agoGlobalISel: freeze reserved regs after IRTranslator.
Tim Northover [Tue, 12 Jul 2016 22:23:42 +0000 (22:23 +0000)]
GlobalISel: freeze reserved regs after IRTranslator.

We can freeze the registers after the MachineFrameInfo has been configured (by
telling it about calls, inline asm, ...). This doesn't happen at all yet, but
will be part of IR translation.

Fixes -verify-machineinstrs assertion.

llvm-svn: 275221

8 years agoAMDGPU: Follow up to r275203
Matt Arsenault [Tue, 12 Jul 2016 21:41:32 +0000 (21:41 +0000)]
AMDGPU: Follow up to r275203

I meant to squash this into it.

llvm-svn: 275220

8 years agoRemove unused variable to fix bot failure from r275216
Teresa Johnson [Tue, 12 Jul 2016 21:29:05 +0000 (21:29 +0000)]
Remove unused variable to fix bot failure from r275216

Remove unused variable added in r275216. Should fix bot failure:
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/24665

llvm-svn: 275219

8 years agoThe test case I added is PowerPC specific but I accidentally
Nemanja Ivanovic [Tue, 12 Jul 2016 21:24:08 +0000 (21:24 +0000)]
The test case I added is PowerPC specific but I accidentally
had it in the wrong directory. Moved it to CodeGen/PowerPC.

Sorry about the noise.

llvm-svn: 275218

8 years ago[LV] Remove wrong assumption about LCSSA
Michael Kuperstein [Tue, 12 Jul 2016 21:24:06 +0000 (21:24 +0000)]
[LV] Remove wrong assumption about LCSSA

The LCSSA pass itself will not generate several redundant PHI nodes in a single
exit block. However, such redundant PHI nodes don't violate LCSSA form, and may
be introduced by passes that preserve LCSSA, and/or preserved by the LCSSA pass
itself. So, assuming a single PHI node per exit block is not safe.

llvm-svn: 275217

8 years agoRefactor indirect call promotion profitability analysis (NFC)
Teresa Johnson [Tue, 12 Jul 2016 21:13:44 +0000 (21:13 +0000)]
Refactor indirect call promotion profitability analysis (NFC)

Summary:
Refactored the profitability analysis out of the IC promotion pass and
into lib/Analysis so that it can be accessed by the summary index
builder in a follow-on patch to enable IC promotion in ThinLTO (D21932).

Reviewers: davidxl, xur

Subscribers: llvm-commits

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

llvm-svn: 275216

8 years ago[Power9] Add codegen for VSX word insert/extract instructions
Nemanja Ivanovic [Tue, 12 Jul 2016 21:00:10 +0000 (21:00 +0000)]
[Power9] Add codegen for VSX word insert/extract instructions

This patch corresponds to review:
http://reviews.llvm.org/D20239

It adds exploitation of XXINSERTW and XXEXTRACTUW instructions that
are useful in some cases for inserting and extracting vector elements of
v4[if]32 vectors.

llvm-svn: 275215

8 years agoReview fixes to lit documentation
Piotr Padlewski [Tue, 12 Jul 2016 20:59:17 +0000 (20:59 +0000)]
Review fixes to lit documentation

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 275214

8 years ago[LoopAccessAnalysis] Some minor cleanups
David Majnemer [Tue, 12 Jul 2016 20:31:46 +0000 (20:31 +0000)]
[LoopAccessAnalysis] Some minor cleanups

Use range-base for loops.
Use auto when appropriate.

No functional change is intended.

llvm-svn: 275213

8 years ago[X86][AVX] Add support for target shuffle combining to VPERM2F128/VPERM2I128
Simon Pilgrim [Tue, 12 Jul 2016 20:27:32 +0000 (20:27 +0000)]
[X86][AVX] Add support for target shuffle combining to VPERM2F128/VPERM2I128

llvm-svn: 275212

8 years agoAdd more tests for LWG#2582. No code changes needed, just tests.
Marshall Clow [Tue, 12 Jul 2016 20:15:46 +0000 (20:15 +0000)]
Add more tests for LWG#2582. No code changes needed, just tests.

llvm-svn: 275211

8 years agolibc++: name anonymous structs
JF Bastien [Tue, 12 Jul 2016 20:14:52 +0000 (20:14 +0000)]
libc++: name anonymous structs

As discussed in http://reviews.llvm.org/D22073

llvm-svn: 275210

8 years ago[sanitizers] Allocate 12MB for stack instead of 134MB
Reid Kleckner [Tue, 12 Jul 2016 20:10:28 +0000 (20:10 +0000)]
[sanitizers] Allocate 12MB for stack instead of 134MB

The thread registry test was failing to allocate 25 threads with stack
size 134MB, which is pretty reasonable.

Also print the error code in our pthread wrappers in case this happens
again.

llvm-svn: 275209

8 years ago[SCCP] Constant fold structs if all the lattice value are constant.
Davide Italiano [Tue, 12 Jul 2016 19:54:19 +0000 (19:54 +0000)]
[SCCP] Constant fold structs if all the lattice value are constant.

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

llvm-svn: 275208

8 years ago[asan] Fix interception unittest on Windows64.
Etienne Bergeron [Tue, 12 Jul 2016 19:39:07 +0000 (19:39 +0000)]
[asan] Fix interception unittest on Windows64.

mov edi,edi is _not_ NOP in 64-bit, use 66,90h instead.
This bug was causing interception unittest to crash on
Windows64 (windows 8 and windows 10).

Credits to etienneb for finding the root cause.

Patch by: Wei Wang
Differential Revision: http://reviews.llvm.org/D22274

llvm-svn: 275207

8 years ago[ELF] Support for setting the base address
Petr Hosek [Tue, 12 Jul 2016 19:37:53 +0000 (19:37 +0000)]
[ELF] Support for setting the base address

The -image-base option allows for overriding the base address.

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

llvm-svn: 275206

8 years ago[LoopVectorize] Assorted cleanups
David Majnemer [Tue, 12 Jul 2016 19:35:15 +0000 (19:35 +0000)]
[LoopVectorize] Assorted cleanups

Use range-based for loops instead of doing everything manually.
Use auto when appropriate.

No functional change is intended.

llvm-svn: 275205

8 years agoX86FixupBWInsts: No need for forward liveness analysis.
Matthias Braun [Tue, 12 Jul 2016 19:04:30 +0000 (19:04 +0000)]
X86FixupBWInsts: No need for forward liveness analysis.

With r274952 and r275201 in place there are no cases left where a
forward liveness analysis yields different results than a backward one.
So we can remove the forward stepping logic.

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

llvm-svn: 275204

8 years agoAMDGPU: Fix verifier error with kill intrinsic
Matt Arsenault [Tue, 12 Jul 2016 19:01:23 +0000 (19:01 +0000)]
AMDGPU: Fix verifier error with kill intrinsic

Don't create a terminator in the middle of the block.
We should probably get rid of this intrinsic.

llvm-svn: 275203

8 years ago[PM] Port LoopIdiomRecognize Pass to new PM
Dehao Chen [Tue, 12 Jul 2016 18:45:51 +0000 (18:45 +0000)]
[PM] Port LoopIdiomRecognize Pass to new PM

Summary: Port LoopIdiomRecognize Pass to new PM

Reviewers: davidxl

Subscribers: davide, sanjoy, mzolotukhin, llvm-commits

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

llvm-svn: 275202

8 years agoBranchFolding: Use LivePhysReg to update live in lists.
Matthias Braun [Tue, 12 Jul 2016 18:44:33 +0000 (18:44 +0000)]
BranchFolding: Use LivePhysReg to update live in lists.

Use LivePhysRegs with a backwards walking algorithm to update live in
lists, this way the results do not depend on the presence of kill flags
anymore.

This patch also reduces the number of registers added as live-in.
Previously all pristine registers as well as all sub registers of a
super register were added resulting in unnecessarily large live in
lists. This fixed https://llvm.org/PR25263.

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

llvm-svn: 275201