platform/upstream/llvm.git
7 years agoclang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thisc...
NAKAMURA Takumi [Thu, 11 May 2017 02:39:30 +0000 (02:39 +0000)]
clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc.

llvm-svn: 302757

7 years agoRemove redundant initialization. NFC
Paul Robinson [Thu, 11 May 2017 02:07:08 +0000 (02:07 +0000)]
Remove redundant initialization. NFC

Post-commit review of r301940 by David Blaikie.

llvm-svn: 302756

7 years agoDon't use posix_memalign under MinGW
Eric Fiselier [Thu, 11 May 2017 02:01:05 +0000 (02:01 +0000)]
Don't use posix_memalign under MinGW

llvm-svn: 302755

7 years agoApply libc++ MinGW CMake fix to libc++abi
Eric Fiselier [Thu, 11 May 2017 02:00:25 +0000 (02:00 +0000)]
Apply libc++ MinGW CMake fix to libc++abi

llvm-svn: 302754

7 years agoAdd temporary workaround to allow in-tree libc++ builds on Windows
Eric Fiselier [Thu, 11 May 2017 01:44:30 +0000 (01:44 +0000)]
Add temporary workaround to allow in-tree libc++ builds on Windows

llvm-svn: 302753

7 years agoFinal (hopefully) fix for the build bots.
Zachary Turner [Thu, 11 May 2017 00:22:18 +0000 (00:22 +0000)]
Final (hopefully) fix for the build bots.

This time it actually occurred to me to change the #defines
to actually test the pre-processed out codepath.  Hopefully
this time it works.

llvm-svn: 302752

7 years agoTry again to fix the buildbots.
Zachary Turner [Thu, 11 May 2017 00:18:52 +0000 (00:18 +0000)]
Try again to fix the buildbots.

TaskGroup and Latch need to be in llvm::parallel::detail, not
in llvm::detail.

llvm-svn: 302751

7 years agoPR22877: When constructing an array via a constructor with a default argument
Richard Smith [Thu, 11 May 2017 00:17:17 +0000 (00:17 +0000)]
PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

llvm-svn: 302750

7 years agoFix build errors with Parallel.
Zachary Turner [Thu, 11 May 2017 00:09:30 +0000 (00:09 +0000)]
Fix build errors with Parallel.

llvm-svn: 302749

7 years ago[Support] Move Parallel algorithms from LLD to LLVM.
Zachary Turner [Thu, 11 May 2017 00:03:52 +0000 (00:03 +0000)]
[Support] Move Parallel algorithms from LLD to LLVM.

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

llvm-svn: 302748

7 years ago[libFuzzer] fix a compiler warning
Kostya Serebryany [Wed, 10 May 2017 23:59:03 +0000 (23:59 +0000)]
[libFuzzer] fix a compiler warning

llvm-svn: 302747

7 years agoRevert "[SDAG] Relax conditions under stores of loaded values can be merged"
David L. Jones [Wed, 10 May 2017 23:56:21 +0000 (23:56 +0000)]
Revert "[SDAG] Relax conditions under stores of loaded values can be merged"

This reverts r302712.

The change fails with ASAN enabled:

ERROR: AddressSanitizer: use-after-poison on address ... at ...
READ of size 2 at ... thread T0
  #0 ... in llvm::SDNode::getNumValues() const <snip>/include/llvm/CodeGen/SelectionDAGNodes.h:855:42
  #1 ... in llvm::SDNode::hasAnyUseOfValue(unsigned int) const <snip>/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:7270:3
  #2 ... in llvm::SDValue::use_empty() const <snip> include/llvm/CodeGen/SelectionDAGNodes.h:1042:17
  #3 ... in (anonymous namespace)::DAGCombiner::MergeConsecutiveStores(llvm::StoreSDNode*) <snip>/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:12944:7

Reviewers: niravd

Subscribers: llvm-commits

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

llvm-svn: 302746

7 years ago[IR] Rollback changes in r302744 which caused buildbots failures.
Eugene Zelenko [Wed, 10 May 2017 23:53:40 +0000 (23:53 +0000)]
[IR] Rollback changes in r302744 which caused buildbots failures.

llvm-svn: 302745

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

llvm-svn: 302744

7 years agoWorkaround -W#warnings on Windows until the correct fixes can land
Eric Fiselier [Wed, 10 May 2017 23:29:13 +0000 (23:29 +0000)]
Workaround -W#warnings on Windows until the correct fixes can land

llvm-svn: 302743

7 years ago[PHIElimination] Use the same name for DEBUG_TYPE and pass name.
Davide Italiano [Wed, 10 May 2017 23:13:26 +0000 (23:13 +0000)]
[PHIElimination] Use the same name for DEBUG_TYPE and pass name.

In an attempt to reduce the confusion.

llvm-svn: 302742

7 years agoclang/lib/Tooling/RefactoringCallbacks.cpp: Avoid std::errc::bad_message.
NAKAMURA Takumi [Wed, 10 May 2017 22:30:44 +0000 (22:30 +0000)]
clang/lib/Tooling/RefactoringCallbacks.cpp: Avoid std::errc::bad_message.

llvm-svn: 302741

7 years agoPartially revert r302685 and swith Apple-style full LTO builds to
Adrian Prantl [Wed, 10 May 2017 22:14:23 +0000 (22:14 +0000)]
Partially revert r302685 and swith Apple-style full LTO builds to
-gline-tables-only. The memory consumption is apparently still too
much for some of the green dragon builders.

<rdar://problem/28672159>

llvm-svn: 302740

7 years ago[libc++abi] Disable libc++ extern templates project-wide
Shoaib Meenai [Wed, 10 May 2017 21:52:39 +0000 (21:52 +0000)]
[libc++abi] Disable libc++ extern templates project-wide

libc++abi can't depend on libc++, so disable extern templates in libc++
headers project-wide. This was previously done in cxa_demangle.cpp, but
I consider it more appropriate to do at the cmake level (since none of
libc++abi's source files can use libc++ extern templates).

I also think the _LIBCPP_NO_EXCEPTIONS in cxa_demangle.cpp is
suspicious, but I'm doing one thing at a time.

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

llvm-svn: 302739

7 years ago[Myriad] Pass -Xclang and -mllvm flags to moviCompile
James Y Knight [Wed, 10 May 2017 21:48:13 +0000 (21:48 +0000)]
[Myriad] Pass -Xclang and -mllvm flags to moviCompile

Patch by Walter Lee.

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

llvm-svn: 302738

7 years agoChanges missed from r302732.
Richard Smith [Wed, 10 May 2017 21:47:30 +0000 (21:47 +0000)]
Changes missed from r302732.

llvm-svn: 302737

7 years agoRemove usages of _LIBCPP_MSVC which is never defined
Eric Fiselier [Wed, 10 May 2017 21:40:58 +0000 (21:40 +0000)]
Remove usages of _LIBCPP_MSVC which is never defined

llvm-svn: 302736

7 years ago[NFC] [Fortran Support] move Fortran array detection testcases
Siddharth Bhat [Wed, 10 May 2017 21:35:14 +0000 (21:35 +0000)]
[NFC] [Fortran Support] move Fortran array detection testcases

move these testcases to where they belong: ScopDetect

llvm-svn: 302735

7 years agoFix MinGW build to use Pthread when the header is available.
Eric Fiselier [Wed, 10 May 2017 21:34:58 +0000 (21:34 +0000)]
Fix MinGW build to use Pthread when the header is available.

Some MinGW configurations use WinPThread instead of the native
threading interfaces. When this happens libc++ doesn't build because
it tries to use the wrong threading API.

This patch attempts to correctly detect and enable pthreads; Selecting
them when __MINGW32__ is defined and __has_include(<pthread.h>) is true.
I'm not sure if this works correctly 100% of the time but it seemed
like the most correct approach available.

llvm-svn: 302734

7 years ago[InstCombine] remove fold that swaps xor/or with constants; NFCI
Sanjay Patel [Wed, 10 May 2017 21:33:55 +0000 (21:33 +0000)]
[InstCombine] remove fold that swaps xor/or with constants; NFCI

// (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)

This canonicalization was added at:
https://reviews.llvm.org/rL7264

By moving xors out/down, we can more easily combine constants. I'm adding
tests that do not change with this patch, so we can verify that those kinds
of transforms are still happening.

This is no-functional-change-intended because there's a later fold:
// (X^C)|Y -> (X|Y)^C iff Y&C == 0
...and demanded-bits appears to guarantee that any fold that would have
hit the fold we're removing here would be caught by that 2nd fold.

Similar reasoning was used in:
https://reviews.llvm.org/rL299384

The larger motivation for removing this code is that it could interfere with
the fix for PR32706:
https://bugs.llvm.org/show_bug.cgi?id=32706

Ie, we're not checking if the 'xor' is actually a 'not', so we could reverse
a 'not' optimization and cause an infinite loop by altering an 'xor X, -1'.

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

llvm-svn: 302733

7 years agoImprove diagnosis of unknown template name.
Richard Smith [Wed, 10 May 2017 21:32:16 +0000 (21:32 +0000)]
Improve diagnosis of unknown template name.

When an undeclared identifier in a context that requires a type is followed by
'<', only look for type templates when typo-correcting, tweak the diagnostic
text to say that a template name (not a type name) was undeclared, and parse
the template arguments when recovering from the error.

llvm-svn: 302732

7 years agoDon't interfere with the __builtin_foo namespace under MSVC
Eric Fiselier [Wed, 10 May 2017 21:30:04 +0000 (21:30 +0000)]
Don't interfere with the __builtin_foo namespace under MSVC

This patch follows up on feedback received in the review for
D32988. Specifically that libc++ should not mess with the
__builtin namespace, and that libc++ should use __popcnt to implement
__pop_count under MSVC.

llvm-svn: 302731

7 years agoAMDGPU: Make some packed shuffles free
Matt Arsenault [Wed, 10 May 2017 21:29:33 +0000 (21:29 +0000)]
AMDGPU: Make some packed shuffles free

VOP3P instructions can encode access to either
half of the register.

llvm-svn: 302730

7 years agoAMDGPU: Add new subtarget features for gfx9 flat instructions
Matt Arsenault [Wed, 10 May 2017 21:19:05 +0000 (21:19 +0000)]
AMDGPU: Add new subtarget features for gfx9 flat instructions

Flat instructions gain an immediate offset, and 2 new
sets of segment specific flat instructions are added.

llvm-svn: 302729

7 years agoFix bad #endif in msvc_stdlib_force_include.hpp.
Billy Robert O'Neal III [Wed, 10 May 2017 20:58:30 +0000 (20:58 +0000)]
Fix bad #endif in msvc_stdlib_force_include.hpp.

llvm-svn: 302728

7 years ago[libc++] Refactor Windows support headers.
Eric Fiselier [Wed, 10 May 2017 20:57:45 +0000 (20:57 +0000)]
[libc++] Refactor Windows support headers.

Summary:
This patch refactors and tries to remove as much of the Windows support headers as possible. This is needed because they currently introduce super weird include cycles and dependencies between STL and libc headers.

The changes in this patch are:

* remove `support/win32/support.h` completely. The required parts have either been moved into `support/win32/msvc_support.h` (for `MSVC` only helpers not needed by Clang), or directly into their respective `foo.h` headers.

* Combine `locale_win32.h` and `locale_mgmt_win32.h` into a single headers, this header should only be included within `__locale` or `locale` to avoid include cycles.

* Remove the unneeded parts of `limits_win32.h` and re-name it to `limits_msvc_win32.h` since it's only needed by Clang.

I've tested this patch using Clang on Windows, but I suspect it might technically regress our non-existent support for MSVC. Is somebody able to double check?

This refactor is needed to support upcoming fixes to `<locale>` on Windows.

Reviewers: bcraig, rmaprath, compnerd, EricWF

Reviewed By: EricWF

Subscribers: majnemer, cfe-commits

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

llvm-svn: 302727

7 years ago[Simplify] Mark variables as used. NFC.
Michael Kruse [Wed, 10 May 2017 20:45:10 +0000 (20:45 +0000)]
[Simplify] Mark variables as used. NFC.

Mark one more variable as used that is needed in assertions.

llvm-svn: 302726

7 years ago[Simplify] Mark variables as used. NFC.
Michael Kruse [Wed, 10 May 2017 20:42:02 +0000 (20:42 +0000)]
[Simplify] Mark variables as used. NFC.

Mark variables as used that are needed in assertions.

llvm-svn: 302725

7 years agoImplement LWG 2591 - Patch from K-Ballo
Eric Fiselier [Wed, 10 May 2017 20:37:43 +0000 (20:37 +0000)]
Implement LWG 2591 - Patch from K-Ballo

llvm-svn: 302724

7 years agoXFAIL is_trivially_copyable test for compilers that don't implement Core 2094
Eric Fiselier [Wed, 10 May 2017 20:19:35 +0000 (20:19 +0000)]
XFAIL is_trivially_copyable test for compilers that don't implement Core 2094

llvm-svn: 302723

7 years ago[Fix][Fortran Support] Don't use -debug-only in pattern matching test cases
Siddharth Bhat [Wed, 10 May 2017 20:10:17 +0000 (20:10 +0000)]
[Fix][Fortran Support] Don't use -debug-only in pattern matching test cases

-debug-only is unnecessary and causes the tests to break in Release
mode. Remove the option to opt in the test cases.

llvm-svn: 302722

7 years agoFix enable_shared_from_this test in C++11
Eric Fiselier [Wed, 10 May 2017 20:09:20 +0000 (20:09 +0000)]
Fix enable_shared_from_this test in C++11

llvm-svn: 302721

7 years agoFix errored return value in CheckFunctionReturnType and add a fixit hint
Erich Keane [Wed, 10 May 2017 20:03:16 +0000 (20:03 +0000)]
Fix errored return value in CheckFunctionReturnType and add a fixit hint

As discovered by ChenWJ and listed on cfe-dev, the error for Objective C
return type ended up being wrong. This fixes that. Additionally, as a
"while we're there", the other usages of this error and the usage of the
FP above both use a FixItHint, so I'll add it here.

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

llvm-svn: 302720

7 years agoRemove unused #include.
Rui Ueyama [Wed, 10 May 2017 20:02:41 +0000 (20:02 +0000)]
Remove unused #include.

llvm-svn: 302719

7 years agoRename parallelFor -> parallelForEachN.
Rui Ueyama [Wed, 10 May 2017 20:02:19 +0000 (20:02 +0000)]
Rename parallelFor -> parallelForEachN.

So that it is clear that the function is a wrapper for for_each_n.

llvm-svn: 302718

7 years ago[ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers...
Craig Topper [Wed, 10 May 2017 20:01:48 +0000 (20:01 +0000)]
[ConstantRange] Fix the early out in ConstantRange::multiply for positive numbers to really do what the comment says

r271020 added an early out to skip the signed multiply portion of ConstantRange::multiply. The comment says we don't need to do signed multiply if the range is only positive numbers, but the implemented check only ensures that the start of the range is positive. It doesn't look at the end of the range.

This patch checks the end of the range instead. Because Upper is one more than the end we have to see if its positive or if its one past the last positive number.

llvm-svn: 302717

7 years ago[APInt] Add negate helper method to implement twos complement. Use it to shorten...
Craig Topper [Wed, 10 May 2017 20:01:38 +0000 (20:01 +0000)]
[APInt] Add negate helper method to implement twos complement. Use it to shorten code.

llvm-svn: 302716

7 years ago[DeLICM] Avoid compiler warning. NFC.
Michael Kruse [Wed, 10 May 2017 19:58:52 +0000 (19:58 +0000)]
[DeLICM] Avoid compiler warning. NFC.

gcc 5.4 warns about using a C-style case to case away a const.
Use case a const_cast instead.

llvm-svn: 302715

7 years ago[NewGVN] Introduce a definesNoMemory() helper and use it.
Davide Italiano [Wed, 10 May 2017 19:57:43 +0000 (19:57 +0000)]
[NewGVN] Introduce a definesNoMemory() helper and use it.

This is nice as is, but it will be used in my next patch to
fix a bug. Suggested by Daniel Berlin.

llvm-svn: 302714

7 years agoClean up LIT failure output by not showing the entire environment
Eric Fiselier [Wed, 10 May 2017 19:55:42 +0000 (19:55 +0000)]
Clean up LIT failure output by not showing the entire environment

llvm-svn: 302713

7 years ago[SDAG] Relax conditions under stores of loaded values can be merged
Nirav Dave [Wed, 10 May 2017 19:53:41 +0000 (19:53 +0000)]
[SDAG] Relax conditions under stores of loaded values can be merged

Summary:

Allow consecutive stores whose values come from consecutive loads to
merged in the presense of other uses of the loads. Previously this was
disallowed as in general the merged load cannot be shared with the
other uses. Merging N stores into 1 may cause as many as N redundant
loads. However in the context of caching this should have neglible
affect on memory pressure and reduce instruction count making it
almost always a win.

Fixes PR32086.

Reviewers: spatel, jyknight, andreadb, hfinkel, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 302712

7 years ago[DeLICM] Always normalize domain. NFC.
Michael Kruse [Wed, 10 May 2017 19:50:45 +0000 (19:50 +0000)]
[DeLICM] Always normalize domain. NFC.

Some isl functions can simplify their __isl_keep arguments. The
argument object after the call uses different contraints to represent
the same set. Different contraints can result in different outputs
when printed to a string.

In assert builds additional isl functions are called (in assert() or
mentioned, these can change the internal representation of its read-only
arguments such that printed strings are different in debug and non-debug
builds.

What happened here is that a call to isl_set_is_equal inside an assert
in getScatterFor normalizes one of its arguments such that one redundant
constraint is removed. The redundant constraint therefore does not appear
in the string representing the domain, which FileCheck notices as a
regression test failure compared to a build with assertions disabled.

This fix removes the redundant contraints the domain from the start such
that the redundant contraint is removed in assert and non-assert builds.
Isl adds a flag to such sets such that the removal of redundancies is
not done multiple times (here: by isl_set_is_equal).

Thanks to Tobias Grosser for reporting and hinting to the cause.

llvm-svn: 302711

7 years agoUpdate is_trivially_copyable tests with CWG 2094
Billy Robert O'Neal III [Wed, 10 May 2017 19:43:31 +0000 (19:43 +0000)]
Update is_trivially_copyable tests with CWG 2094

Clang 5.0 implements these changes here: https://github.com/llvm-mirror/clang/commit/87cd035326a39523eeb1b295ad36cff337141ef9
MSVC++ will implement these changes in the first toolset update to 2017.

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

llvm-svn: 302710

7 years ago[libc++] Fix PR32979 - types with a private std::enable_shared_from_this base break...
Eric Fiselier [Wed, 10 May 2017 19:35:49 +0000 (19:35 +0000)]
[libc++] Fix PR32979 -  types with a private std::enable_shared_from_this base break shared_ptr

Summary:
This patch fixes bugs.llvm.org/PR32979.

[util.smartptr.shared.const] says:
> In the constructor definitions below, enables shared_from_this with p, for a pointer p of type Y*, means
> that if Y has an unambiguous and accessible base class that is a specialization of enable_shared_from_-
> this.

This means that libc++ needs to respect the access specifier of the base class, and not attempt to construct
and enabled_shared_from_this base if it is private. However access specifiers don't affect overload resolution
so our current implementation will attempt to construct the private base.

This patch uses SFINAE to correctly detect if the shared_ptr input has an accessible enable_shared_from_this
base class.

Reviewers: mclow.lists

Reviewed By: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 302709

7 years agoUse a DenseMap in LinkerScript::getCmd.
Rafael Espindola [Wed, 10 May 2017 19:13:38 +0000 (19:13 +0000)]
Use a DenseMap in LinkerScript::getCmd.

This improves many-sections.s with a linker script from 22s to 0.9s.

llvm-svn: 302708

7 years ago[test] support machinery changes for EDG & C1XX /Za
Casey Carter [Wed, 10 May 2017 19:10:49 +0000 (19:10 +0000)]
[test] support machinery changes for EDG & C1XX /Za

This change works around a couple of bugs:

1. EDG doesn't like explicit constexpr in a derived class. This program:

  struct Base {};
  struct Derived : Base {
      constexpr Derived() = default;
  };

  triggers "error: defaulted default constructor cannot be constexpr."

2. C1XX with /Za has no idea which constructor needs to be valid for copy elision.

The change also conditionally disables parts of the msvc_stdlib_force_include.hpp header that conflict with external configuration when _LIBCXX_IN_DEVCRT is defined.

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

llvm-svn: 302707

7 years agoRefactor OutputSection to OutputSectionCommand mapping.
Rafael Espindola [Wed, 10 May 2017 19:00:23 +0000 (19:00 +0000)]
Refactor OutputSection to OutputSectionCommand mapping.

We now always use getCmd. I will optimize it in a followup commit.

llvm-svn: 302706

7 years agoEnsure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builder
Teresa Johnson [Wed, 10 May 2017 18:52:16 +0000 (18:52 +0000)]
Ensure non-null ProfileSummaryInfo passed to ModuleSummaryIndex builder

This fixes a ubsan bot failure after r302597, which made getProfileCount
non-static, but ended up invoking it on a null ProfileSummaryInfo object
in some cases from buildModuleSummaryIndex.

Most testing passed because the non-static getProfileCount currently
doesn't access any member variables, but I found this when testing a
follow on patch (D32877) that adds a member variable access.

llvm-svn: 302705

7 years ago[APInt] Make toString use udivrem instead of calling the divide helper method directl...
Craig Topper [Wed, 10 May 2017 18:15:24 +0000 (18:15 +0000)]
[APInt] Make toString use udivrem instead of calling the divide helper method directly. Do a better job of reusing allocations while looping. NFCI

This lets toString take advantage of the degenerate case checks in udivrem and is just generally cleaner.

One minor downside of this is that the divisor APInt now needs to be the same size as Tmp which requires an additional allocation. But we were doing a poor job of reusing allocations before so the new code should still be an improvement.

llvm-svn: 302704

7 years ago[APInt] Use uint32_t instead of unsigned for the storage type throughout the divide...
Craig Topper [Wed, 10 May 2017 18:15:20 +0000 (18:15 +0000)]
[APInt] Use uint32_t instead of unsigned for the storage type throughout the divide code. Use Lo_32/Hi_32/Make_64 helpers instead of casts and shifts. NFCI

llvm-svn: 302703

7 years ago[APInt] Use getRawData to slightly simplify some code.
Craig Topper [Wed, 10 May 2017 18:15:17 +0000 (18:15 +0000)]
[APInt] Use getRawData to slightly simplify some code.

llvm-svn: 302702

7 years ago[APInt] Remove check for single word since single word was handled earlier in the...
Craig Topper [Wed, 10 May 2017 18:15:14 +0000 (18:15 +0000)]
[APInt] Remove check for single word since single word was handled earlier in the function. NFC

llvm-svn: 302701

7 years ago[ConstantRange] Add test case showing a case where we pick too large of a range for...
Craig Topper [Wed, 10 May 2017 18:15:06 +0000 (18:15 +0000)]
[ConstantRange] Add test case showing a case where we pick too large of a range for multiply after r271020.

llvm-svn: 302700

7 years agoSmall refactoring in DAGCombine. NFC
Amaury Sechet [Wed, 10 May 2017 17:58:28 +0000 (17:58 +0000)]
Small refactoring in DAGCombine. NFC

llvm-svn: 302699

7 years agoFix use of now removed %exec test substitution
Eric Fiselier [Wed, 10 May 2017 17:52:53 +0000 (17:52 +0000)]
Fix use of now removed %exec test substitution

llvm-svn: 302698

7 years agoRename variables to conform to LLVM naming conventions.
Zachary Turner [Wed, 10 May 2017 17:39:18 +0000 (17:39 +0000)]
Rename variables to conform to LLVM naming conventions.

llvm-svn: 302697

7 years ago[Fix] [Fortran Support] Fix variable name & make testcase activate on release
Siddharth Bhat [Wed, 10 May 2017 17:27:48 +0000 (17:27 +0000)]
[Fix] [Fortran Support] Fix variable name & make testcase activate on release

There was:
    #ifdef NDEBUG

This should be:
    #ifndef NDEBUG

Also, the variable name was incorrect. Fixed the variable name.

llvm-svn: 302696

7 years ago[Sema] Objective-C++ support for type trait __is_base_of
Erik Pilkington [Wed, 10 May 2017 17:18:56 +0000 (17:18 +0000)]
[Sema] Objective-C++ support for type trait __is_base_of

rdar://24308607

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

llvm-svn: 302695

7 years ago[ELF] Improve error message for incompatible section types
Rui Ueyama [Wed, 10 May 2017 16:57:50 +0000 (16:57 +0000)]
[ELF] Improve error message for incompatible section types

Previously we were not printing out the type of the incompatible section
which made it difficult to determine what the problem was.

The error message format has been change to the following:

  error: section type mismatch for .shstrtab
  >>> <internal>:(.shstrtab): SHT_STRTAB
  >>> output section .shstrtab: Unknown

Patch by Alexander Richardson.

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

llvm-svn: 302694

7 years agoRevert "Add dyld to sanitizer procmaps on darwin"
Francis Ricci [Wed, 10 May 2017 16:33:46 +0000 (16:33 +0000)]
Revert "Add dyld to sanitizer procmaps on darwin"

This breaks several tests because we don't always have
access to __cxa_guard functions

This reverts commit 45eb470c3e9e8f6993a204e247c33d4092237efe.

llvm-svn: 302693

7 years agoRevert "Disable static caching of dyld header on Go sanitizers"
Francis Ricci [Wed, 10 May 2017 16:33:43 +0000 (16:33 +0000)]
Revert "Disable static caching of dyld header on Go sanitizers"

This is a problem on more than just the go sanitizers, so it's
not a good enough fix for the issue.

llvm-svn: 302692

7 years ago[XRay] Fix XRay PPC return value bug.
Tim Shen [Wed, 10 May 2017 16:28:21 +0000 (16:28 +0000)]
[XRay] Fix XRay PPC return value bug.

Summary:
This bug is caused by the incorrect handling of return-value registers.

According to OpenPOWER 64-Bit ELF V2 ABI 2.2.5, up to 2 general-purpose
registers are going to be used for return values, and up to 8 floating
point registers or vector registers are going to be used for return
values.

Reviewers: dberris, echristo

Subscribers: nemanjai, llvm-commits

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

llvm-svn: 302691

7 years agoFix -DLLVM_ENABLE_THREADS=OFF build of lld after r302613
Hans Wennborg [Wed, 10 May 2017 16:25:54 +0000 (16:25 +0000)]
Fix -DLLVM_ENABLE_THREADS=OFF build of lld after r302613

llvm-svn: 302690

7 years ago[AST] RecursiveASTVisitor should not crash on lambdas with type attributes
Alex Lorenz [Wed, 10 May 2017 16:21:00 +0000 (16:21 +0000)]
[AST] RecursiveASTVisitor should not crash on lambdas with type attributes

rdar://31960860

llvm-svn: 302689

7 years ago[clang-tidy][CMake] Make clang-tidy usable as distribution component
Petr Hosek [Wed, 10 May 2017 16:20:54 +0000 (16:20 +0000)]
[clang-tidy][CMake] Make clang-tidy usable as distribution component

Use add_clang_tool rather than add_clang_executable to support
clang-tidy as a distribution component.

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

llvm-svn: 302688

7 years ago[ELF] Define __ehdr_start unconditionally even when using linker script
Petr Hosek [Wed, 10 May 2017 16:20:33 +0000 (16:20 +0000)]
[ELF] Define __ehdr_start unconditionally even when using linker script

This behavior differs from the semantics implemented by GNU linkers
which only define this symbol iff ELF headers are in the memory
mapped segment.

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

llvm-svn: 302687

7 years ago[XRay] Fix the test func-id-utils.cc on PPC.
Tim Shen [Wed, 10 May 2017 16:07:03 +0000 (16:07 +0000)]
[XRay] Fix the test func-id-utils.cc on PPC.

Summary:
The test fails on PPC, because the address of a function may vary
depending on whether the "taker" shares the same ToC (roughly, in the
same "module") as the function.

Therefore the addresses of the functions taken in func-id-utils.cc may be
different from the addresses taken in xray runtime.

Change the test to be permissive on address comparison.

Reviewers: dberris, echristo

Subscribers: llvm-commits

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

llvm-svn: 302686

7 years agoBuild the Apple-style stage2 with full debug info
Adrian Prantl [Wed, 10 May 2017 15:58:22 +0000 (15:58 +0000)]
Build the Apple-style stage2 with full debug info

Green dragon had a green stage2 modules bot for a long time now[1] and
it is time to retire it and make a modules build the default for
Apple-style stage2 builds.

This patch switches the debug info generation from -gline-tables-only
to -g since full debug info does no longer cause any memory issues
even for full LTO builds [2].

[1] http://green.lab.llvm.org/green/job/clang-stage2-cmake-modulesRDA_build/
[2] http://llvm.org/devmtg/2015-10/#talk19
rdar://problem/28672159

llvm-svn: 302685

7 years ago[InstSimplify, InstCombine] move 'or' simplification tests; NFC
Sanjay Patel [Wed, 10 May 2017 15:57:47 +0000 (15:57 +0000)]
[InstSimplify, InstCombine] move 'or' simplification tests; NFC

Surprisingly, I don't think these are redundant for InstSimplify.
They were just misplaced as InstCombine tests.

llvm-svn: 302684

7 years ago[X86][SSE] Check vec_set BUILD_VECTOR tests on both 32 and 64-bit targets
Simon Pilgrim [Wed, 10 May 2017 15:52:59 +0000 (15:52 +0000)]
[X86][SSE] Check vec_set BUILD_VECTOR tests on both 32 and 64-bit targets

llvm-svn: 302683

7 years ago[libclang] Fix typo in doc-comment, NFC
Argyrios Kyrtzidis [Wed, 10 May 2017 15:48:16 +0000 (15:48 +0000)]
[libclang] Fix typo in doc-comment, NFC

llvm-svn: 302682

7 years agoDisable static caching of dyld header on Go sanitizers
Francis Ricci [Wed, 10 May 2017 15:40:29 +0000 (15:40 +0000)]
Disable static caching of dyld header on Go sanitizers

This causes buildbot failures due to undefined __cxa_guard_acquire

llvm-svn: 302681

7 years ago[cmake] Disable building enable_execute_stack.c for baremetal targets.
Catherine Moore [Wed, 10 May 2017 15:34:25 +0000 (15:34 +0000)]
[cmake] Disable building enable_execute_stack.c for baremetal targets.

Disable building enable_execute_stack.c for targets that do not have
support for mprotect().

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

llvm-svn: 302680

7 years ago[AArch64][RegisterBankInfo] Change the default mapping of fp stores.
Quentin Colombet [Wed, 10 May 2017 15:19:41 +0000 (15:19 +0000)]
[AArch64][RegisterBankInfo] Change the default mapping of fp stores.

For stores, check if the stored value is defined by a floating point
instruction and if yes, we return a default mapping with FPR instead
of GPR.

llvm-svn: 302679

7 years ago[AArch64] Enable use of reduction intrinsics.
Amara Emerson [Wed, 10 May 2017 15:15:38 +0000 (15:15 +0000)]
[AArch64] Enable use of reduction intrinsics.

The new experimental reduction intrinsics can now be used, so I'm enabling this
for AArch64. We will need this for SVE anyway, so it makes sense to do this for
NEON reductions as well.

The existing code to match shufflevector patterns are replaced with a direct
lowering of the reductions to AArch64-specific nodes. Tests updated with the
new, simpler, representation.

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

llvm-svn: 302678

7 years ago[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls...
Argyrios Kyrtzidis [Wed, 10 May 2017 15:10:36 +0000 (15:10 +0000)]
[libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls marked with external_source_symbol attribute

llvm-svn: 302677

7 years ago[InstCombine] remove redundant tests
Sanjay Patel [Wed, 10 May 2017 14:54:49 +0000 (14:54 +0000)]
[InstCombine] remove redundant tests

The first test in this file is duplicated exactly in and.ll -> test33.
We have commuted and vector variants there too.

The second test is a composite of 2 folds. The first fold is tested
independently in add.ll -> flip_and_mask (including vector variant).
After that transform fires, the IR is identical to the first transform.

llvm-svn: 302676

7 years agoMark LinkerScript as final.
Rafael Espindola [Wed, 10 May 2017 14:45:15 +0000 (14:45 +0000)]
Mark LinkerScript as final.

We used to inherit from it, but don't need it anymore.

llvm-svn: 302675

7 years ago[InstCombine] fix auto-generated FileCheck-captured variable refs
Sanjay Patel [Wed, 10 May 2017 14:40:04 +0000 (14:40 +0000)]
[InstCombine] fix auto-generated FileCheck-captured variable refs

The script at utils/update_test_checks.py has (had?) a bug when variables
start with the same sequence of letters (clearly, not all of the time).

llvm-svn: 302674

7 years agoAdd dyld to sanitizer procmaps on darwin
Francis Ricci [Wed, 10 May 2017 14:38:04 +0000 (14:38 +0000)]
Add dyld to sanitizer procmaps on darwin

Summary:
Sanitizer procmaps uses dyld apis to iterate over the list of images
in the process. This is much more performan than manually recursing
over all of the memory regions in the process, however, dyld does
not report itself in the list of images. In order to prevent reporting
leaks from dyld globals and to symbolize dyld functions in stack traces,
this patch special-cases dyld and ensures that it is added to the
list of modules.

This is accomplished by recursing through the memory map of the process
until a dyld Mach header is found. While this recursion is expensive,
it is run before the full set of images has been loaded in the process,
so only a few calls are required. The result is cached so that it never
needs to be searched for when the full process memory map exists, as this
would be incredibly slow, on the order of minutes for leak sanitizer with
only 25 or so libraries loaded.

Reviewers: alekseyshl, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 302673

7 years agoRemove one more use of section names.
Rafael Espindola [Wed, 10 May 2017 14:35:20 +0000 (14:35 +0000)]
Remove one more use of section names.

llvm-svn: 302672

7 years agoRemove another use of section names. NFC.
Rafael Espindola [Wed, 10 May 2017 14:28:31 +0000 (14:28 +0000)]
Remove another use of section names. NFC.

llvm-svn: 302671

7 years agoReland: [mips] Impose a threshold for coercion of aggregates
Petar Jovanovic [Wed, 10 May 2017 14:28:18 +0000 (14:28 +0000)]
Reland: [mips] Impose a threshold for coercion of aggregates

    Modified MipsABIInfo::classifyArgumentType so that it now coerces
    aggregate structures only if the size of said aggregate is less than
    16/64 bytes, depending on the ABI.

    Patch by Stefan Maksimovic.

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

with minor changes (use regexp instead of the hardcoded values) to the test.

llvm-svn: 302670

7 years ago[InstCombine] fix typo in test comment; NFC
Sanjay Patel [Wed, 10 May 2017 14:25:23 +0000 (14:25 +0000)]
[InstCombine] fix typo in test comment; NFC

llvm-svn: 302669

7 years ago[ELF] - Don't segfault when assigning non-calculatable absolute symbol value.
George Rimar [Wed, 10 May 2017 14:23:33 +0000 (14:23 +0000)]
[ELF] - Don't segfault when assigning non-calculatable absolute symbol value.

This is PR32664.

Issue was revealed by linux kernel script which was:

SECTIONS {
 . = (0xffffffff80000000 + ALIGN(0x1000000, 0x200000));
 phys_startup_64 = ABSOLUTE(startup_64 - 0xffffffff80000000);

 .text : AT(ADDR(.text) - 0xffffffff80000000) {
.....
  *(.head.text)
Where startup_64 is in .head.text.

At the place of assignment to phys_startup_64 we can not calculate absolute value for startup_64
because .text section has no VA assigned. Two patches were prepared earlier to address this: D32173 and D32174.

And in comments for D32173 was suggested not try to support this case, but error out.

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

llvm-svn: 302668

7 years ago[SystemZ] Add miscellaneous instructions
Ulrich Weigand [Wed, 10 May 2017 14:20:15 +0000 (14:20 +0000)]
[SystemZ] Add miscellaneous instructions

This adds a few missing instructions for the assembler and
disassembler.  Those should be the last missing general-
purpose (Chapter 7) instructions for the z10 ISA.

llvm-svn: 302667

7 years ago[ELF] - Use LLVM_FALLTHROUGH in code.
George Rimar [Wed, 10 May 2017 14:19:59 +0000 (14:19 +0000)]
[ELF] - Use LLVM_FALLTHROUGH in code.

When compiling LLD using GCC 7 it reports warnings like:
"warning: this statement may fall through [-Wimplicit-fallthrough=]"

LLVM has LLVM_FALLTHROUGH macro which can be used to avoid such warnings.
Together with D33036 this patch fixes them.

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

llvm-svn: 302666

7 years ago[SystemZ] Add missing arithmetic instructions
Ulrich Weigand [Wed, 10 May 2017 14:18:47 +0000 (14:18 +0000)]
[SystemZ] Add missing arithmetic instructions

This adds the remaining general arithmetic instructions
for assembler / disassembler use.  Most of these are not
useful for codegen; a few might be, and those are listed
in the README.txt for future improvements.

llvm-svn: 302665

7 years ago[llvm-readobj] Improve errors on invalid binary
Sam Clegg [Wed, 10 May 2017 14:18:11 +0000 (14:18 +0000)]
[llvm-readobj] Improve errors on invalid binary

The previous code was discarding the error message from
createBinary() by calling errorToErrorCode().
This meant that such error were always reported unhelpfully
as "Invalid data was encountered while parsing the file".

Other tools such as llvm-objdump already produce a more
the error message in this case.

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

llvm-svn: 302664

7 years ago[OpenMP] Changes in the plugin interface
George Rokos [Wed, 10 May 2017 14:12:36 +0000 (14:12 +0000)]
[OpenMP] Changes in the plugin interface

This patch chagnes the plugin interface so that:
1) future plugins can take advantage of systems with shared CPU/device storage
2) instead of using base addresses, target regions are launched by providing target addresseds and base offsets explicitly.

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

llvm-svn: 302663

7 years agoRemove another use of section names. NFC.
Rafael Espindola [Wed, 10 May 2017 14:12:02 +0000 (14:12 +0000)]
Remove another use of section names. NFC.

llvm-svn: 302662

7 years agoDon't use section names in getFiller. NFC.
Rafael Espindola [Wed, 10 May 2017 14:01:13 +0000 (14:01 +0000)]
Don't use section names in getFiller. NFC.

This is just faster and avoids using names.

llvm-svn: 302661

7 years agochang type from 'int' to 'size_t'. This will fix revision number 302652
Michael Zuckerman [Wed, 10 May 2017 14:00:57 +0000 (14:00 +0000)]
chang type from 'int' to 'size_t'. This will fix revision number 302652

llvm-svn: 302660

7 years ago[InstCombine] add (ashr (shl i32 X, 31), 31), 1 --> and (not X), 1
Sanjay Patel [Wed, 10 May 2017 13:56:52 +0000 (13:56 +0000)]
[InstCombine] add (ashr (shl i32 X, 31), 31), 1 --> and (not X), 1

This is another step towards favoring 'not' ops over random 'xor' in IR:
https://bugs.llvm.org/show_bug.cgi?id=32706

This transformation may have occurred in longer IR sequences using computeKnownBits,
but that could be much more expensive to calculate.

As the scalar result shows, we do not currently favor 'not' in all cases. The 'not'
created by the transform is transformed again (unnecessarily). Vectors don't have
this problem because vectors are (wrongly) excluded from several other combines.

llvm-svn: 302659

7 years agoclang-format: refine calculating brace types.
Martin Probst [Wed, 10 May 2017 13:53:29 +0000 (13:53 +0000)]
clang-format: refine calculating brace types.

Summary:
For C++ code, opening parenthesis following a } indicate a braced init. For JavaScript and other languages, this is an invalid syntactical construct, unless the closing parenthesis belongs to a function - in which situation its a BK_Block.

This fixes indenting IIFEs following top level functions:

    function foo() {}
    (function() { codeHere(); }());

clang-format used to collapse these lines together.

Subscribers: klimek

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

llvm-svn: 302658