platform/upstream/llvm.git
7 years agoFix signed/unsigned comparison warning in a unit test. This was appearing on
James Henderson [Fri, 7 Apr 2017 08:48:17 +0000 (08:48 +0000)]
Fix signed/unsigned comparison warning in a unit test. This was appearing on
lld-x86_64-darwin13.

llvm-svn: 299749

7 years ago[Core] Fix parallel_for for Linux
James Henderson [Fri, 7 Apr 2017 08:11:28 +0000 (08:11 +0000)]
[Core] Fix parallel_for for Linux

r299635 exposed a latent bug in the Linux implementation of parallel_for, which
resulted in it calling the function outside of the range requested, resulting
later in a segmentation fault. This change fixes this issue and adds a unit test.

llvm-svn: 299748

7 years ago[InstCombine] Handle more commuted cases of ((A & B) | ~A) -> (~A | B)
Craig Topper [Fri, 7 Apr 2017 07:32:00 +0000 (07:32 +0000)]
[InstCombine] Handle more commuted cases of ((A & B) | ~A) -> (~A | B)

llvm-svn: 299747

7 years ago[InstCombine] Add additional tests with varied commuting to show missing combines...
Craig Topper [Fri, 7 Apr 2017 07:31:55 +0000 (07:31 +0000)]
[InstCombine] Add additional tests with varied commuting to show missing combines. NFC

llvm-svn: 299746

7 years ago[InstSimplify] Use Instruction::BinaryOps instead of unsigned for a few function...
Craig Topper [Fri, 7 Apr 2017 05:57:51 +0000 (05:57 +0000)]
[InstSimplify] Use Instruction::BinaryOps instead of unsigned for a few function operands to remove some casts. NFC

llvm-svn: 299745

7 years agoRevert "Allow a standard library to implement conditional noexcept for optional and...
Akira Hatanaka [Fri, 7 Apr 2017 05:55:28 +0000 (05:55 +0000)]
Revert "Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions."

This reverts commit r299734.

llvm-svn: 299744

7 years ago[libc++] Drop support for CRTs older than VS 2015
Shoaib Meenai [Fri, 7 Apr 2017 02:20:52 +0000 (02:20 +0000)]
[libc++] Drop support for CRTs older than VS 2015

LLVM dropped support for Visual Studio versions older than 2015 quite
some time ago, so I consider it safe to drop libc++'s support for older
CRTs. The CRT in Visual Studio 2015 provides a lot of previously missing
functions, so targeting it requires less special casing.

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

llvm-svn: 299743

7 years agoMove a cast out of a function. NFC.
Rafael Espindola [Fri, 7 Apr 2017 01:40:21 +0000 (01:40 +0000)]
Move a cast out of a function. NFC.

The argument was always casted, so cast it in the caller.

llvm-svn: 299742

7 years agoAliasAnalysis: Be less conservative about volatile than atomic.
Daniel Berlin [Fri, 7 Apr 2017 01:28:36 +0000 (01:28 +0000)]
AliasAnalysis: Be less conservative about volatile than atomic.

Summary:
getModRefInfo is meant to answer the question "what impact does this
instruction have on a given memory location" (not even another
instruction).

Long debate on this on IRC comes to the conclusion the answer should be "nothing special".

That is, a noalias volatile store does not affect a memory location
just by being volatile.  Note: DSE and GVN and memdep currently
believe this, because memdep just goes behind AA's back after it says
"modref" right now.

see line 635 of memdep. Prior to this patch we would get modref there, then check aliasing,
and if it said noalias, we would continue.

getModRefInfo *already* has this same AA check, it just wasn't being used because volatile was
lumped in with ordering.

(I am separately testing whether this code in memdep is now dead except for the invariant load case)

Reviewers: jyknight, chandlerc

Subscribers: llvm-commits

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

llvm-svn: 299741

7 years agoRemove unnecessary cast.
Rafael Espindola [Fri, 7 Apr 2017 01:25:01 +0000 (01:25 +0000)]
Remove unnecessary cast.

llvm-svn: 299740

7 years agoAdd missing import
Reid Kleckner [Fri, 7 Apr 2017 01:24:48 +0000 (01:24 +0000)]
Add missing import

llvm-svn: 299739

7 years ago[lit] Fix Darwin pickling errors with process pools
Reid Kleckner [Fri, 7 Apr 2017 01:23:15 +0000 (01:23 +0000)]
[lit] Fix Darwin pickling errors with process pools

For a function to be pickle-able, it has to be in the top-level of a
real Python module. So, I made one for this code snippet.

llvm-svn: 299738

7 years ago[InstCombine] Add more commuted patterns to support folding ((~A & B) | A) -> (A...
Craig Topper [Fri, 7 Apr 2017 00:29:47 +0000 (00:29 +0000)]
[InstCombine] Add more commuted patterns to support folding ((~A & B) | A) -> (A | B).

llvm-svn: 299737

7 years ago[WebAssembly] Fix -Wcovered-switch-default warning
Derek Schuff [Thu, 6 Apr 2017 23:52:01 +0000 (23:52 +0000)]
[WebAssembly] Fix -Wcovered-switch-default warning

llvm-svn: 299736

7 years agoAdd noexcept(false) to more strongly indicate that not being noexcept is important...
Billy Robert O'Neal III [Thu, 6 Apr 2017 23:50:33 +0000 (23:50 +0000)]
Add noexcept(false) to more strongly indicate that not being noexcept is important for hash tests.

llvm-svn: 299735

7 years agoAllow a standard library to implement conditional noexcept for optional and unique_pt...
Billy Robert O'Neal III [Thu, 6 Apr 2017 23:50:21 +0000 (23:50 +0000)]
Allow a standard library to implement conditional noexcept for optional and unique_ptr hash functions.

These tests were unconditionally asserting that optional and unique_ptr declare throwing hashes, but MSVC++ implements conditional noexcept forwarding that of the underlying hash function. As a result we were failing these tests but there's nothing forbidding strengthening noexcept in that way.

Changed the ASSERT_NOT_NOEXCEPT asserts to use types which themselves have non-noexcept hash functions.

llvm-svn: 299734

7 years agoAllow specification of what kinds of class members to dump.
Zachary Turner [Thu, 6 Apr 2017 23:43:39 +0000 (23:43 +0000)]
Allow specification of what kinds of class members to dump.

Previously when dumping class definitions, there were only
two modes - on or off.  But it's useful to sometimes get a
little more fine-grained.  For example, you might only want
to see the record layout (for example to look for extraneous
padding).  This patch adds a third mode, layout mode, which
does exactly that.  Only this-relative data members are
displayed in this mode.

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

llvm-svn: 299733

7 years ago[llvm-pdbdump] Allow pretty to only dump specific types of types.
Zachary Turner [Thu, 6 Apr 2017 23:43:12 +0000 (23:43 +0000)]
[llvm-pdbdump] Allow pretty to only dump specific types of types.

Previously we just had the -types option, which would dump all
classes, typedefs, and enums.  But this produces a lot of output
if you only want to view classes, for example.  This patch breaks
this down into 3 additional options, -classes, -enums, and
-typedefs, and keeps the -types option around which implies all
3 more specific options.

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

llvm-svn: 299732

7 years agoAdd an end-to-end testcase for address sanitizer.
Adrian Prantl [Thu, 6 Apr 2017 23:36:44 +0000 (23:36 +0000)]
Add an end-to-end testcase for address sanitizer.

llvm-svn: 299731

7 years agoAdd a test for debug info with the safestack sanitizer enabled.
Adrian Prantl [Thu, 6 Apr 2017 23:30:51 +0000 (23:30 +0000)]
Add a test for debug info with the safestack sanitizer enabled.

llvm-svn: 299730

7 years agoAdd more tests for ExtractContextAndIdentifier
Eugene Zemtsov [Thu, 6 Apr 2017 23:12:43 +0000 (23:12 +0000)]
Add more tests for ExtractContextAndIdentifier

llvm-svn: 299729

7 years agoCOFF: support the /appcontainer flag
Saleem Abdulrasool [Thu, 6 Apr 2017 23:07:53 +0000 (23:07 +0000)]
COFF: support the /appcontainer flag

The /appcontainer flag indicates that the module may only be used inside
an application container (for isolation).  This has been supported by
link.exe since Windows 8.0.  It sets an additional bit in the PE DLL
Characteristics flag to indicate the behavioural change.

llvm-svn: 299728

7 years agoAMDGPU/GFX9: Fix shared and private aperture queries
Konstantin Zhuravlyov [Thu, 6 Apr 2017 23:02:33 +0000 (23:02 +0000)]
AMDGPU/GFX9: Fix shared and private aperture queries

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

llvm-svn: 299727

7 years agoRemove the default subtarget from the Power port. It's unnecessary and harmful if...
Eric Christopher [Thu, 6 Apr 2017 23:01:30 +0000 (23:01 +0000)]
Remove the default subtarget from the Power port. It's unnecessary and harmful if used.

llvm-svn: 299726

7 years ago[InstCombine] Add a few cases for OR we fail to optimize due to missing commuted...
Craig Topper [Thu, 6 Apr 2017 23:00:22 +0000 (23:00 +0000)]
[InstCombine] Add a few cases for OR we fail to optimize due to missing commuted patterns checks.

llvm-svn: 299725

7 years agoRevert "Revert "[ARM] Add Kryo to available targets""
Yi Kong [Thu, 6 Apr 2017 22:47:47 +0000 (22:47 +0000)]
Revert "Revert "[ARM] Add Kryo to available targets""

This reverts commit dc9458d5a747a02a9a8f198b84c2b92a6939a8dd.

Added missing case for PreISelOperandLatencyAdjustment.

llvm-svn: 299724

7 years agoTurn on -addr-sink-using-gep by default.
Eli Friedman [Thu, 6 Apr 2017 22:42:18 +0000 (22:42 +0000)]
Turn on -addr-sink-using-gep by default.

The new codepath has been in the tree for years, and there isn't any
reason to use two codepaths here.

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

llvm-svn: 299723

7 years agoRename refersToGotEntry needsGot and add comments.
Rui Ueyama [Thu, 6 Apr 2017 22:39:11 +0000 (22:39 +0000)]
Rename refersToGotEntry needsGot and add comments.

This patch addresses a post-commit review comment for r299615.

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

llvm-svn: 299722

7 years agoNew C++ function name parsing logic (Resubmit)
Eugene Zemtsov [Thu, 6 Apr 2017 22:36:02 +0000 (22:36 +0000)]
New C++ function name parsing logic (Resubmit)

Current implementation of CPlusPlusLanguage::MethodName::Parse() doesn't
get anywhere close to covering full extent of possible function declarations.
It causes incorrect behavior in avoid-stepping and sometimes messes
printing of thread backtrace.

This change implements more methodical parsing logic based on clang
lexer and simple recursive parser.

Examples:
void std::vector<Class, std::allocator<Class>>::_M_emplace_back_aux<Class const&>(Class const&)
void (*&std::_Any_data::_M_access<void (*)()>())()

Previous version of this change (D31451) was rolled back due to an issue
with Objective-C selectors being incorrectly recognized as a C++ identifier.

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

llvm-svn: 299721

7 years ago[X86] Revert r299387 due to AVX legalization infinite loop.
Michael Kuperstein [Thu, 6 Apr 2017 22:33:25 +0000 (22:33 +0000)]
[X86] Revert r299387 due to AVX legalization infinite loop.

llvm-svn: 299720

7 years agoTry to fix FreeBSD build after IWYU changes.
Zachary Turner [Thu, 6 Apr 2017 22:18:59 +0000 (22:18 +0000)]
Try to fix FreeBSD build after IWYU changes.

llvm-svn: 299719

7 years agoFix build failure in unit test.
Zachary Turner [Thu, 6 Apr 2017 21:57:39 +0000 (21:57 +0000)]
Fix build failure in unit test.

llvm-svn: 299718

7 years agoCall updateAlignment before assignAddresses.
Rafael Espindola [Thu, 6 Apr 2017 21:40:22 +0000 (21:40 +0000)]
Call updateAlignment before assignAddresses.

The alignment expression cannot depend on '.', so we can compute it
early.

llvm-svn: 299717

7 years agoMove call to findMemoryRegion before assignAddresses.
Rafael Espindola [Thu, 6 Apr 2017 21:31:24 +0000 (21:31 +0000)]
Move call to findMemoryRegion before assignAddresses.

This removes a bit more work from assignAddresses.

llvm-svn: 299716

7 years ago[InstCombine] Remove testing assert I accidentally left in r299710.
Craig Topper [Thu, 6 Apr 2017 21:29:43 +0000 (21:29 +0000)]
[InstCombine] Remove testing assert I accidentally left in r299710.

llvm-svn: 299715

7 years agoiwyu fixes for lldbCore.
Zachary Turner [Thu, 6 Apr 2017 21:28:29 +0000 (21:28 +0000)]
iwyu fixes for lldbCore.

This adjusts header file includes for headers and source files
in Core.  In doing so, one dependency cycle is eliminated
because all the includes from Core to that project were dead
includes anyway.  In places where some files in other projects
were only compiling due to a transitive include from another
header, fixups have been made so that those files also include
the header they need.  Tested on Windows and Linux, and plan
to address failures on OSX and FreeBSD after watching the
bots.

llvm-svn: 299714

7 years agoRemove redundant argument. NFC.
Rafael Espindola [Thu, 6 Apr 2017 21:26:03 +0000 (21:26 +0000)]
Remove redundant argument. NFC.

llvm-svn: 299713

7 years agoAMDGPU: Diagnose illegal SGPR to VGPR copies
Matt Arsenault [Thu, 6 Apr 2017 21:09:53 +0000 (21:09 +0000)]
AMDGPU: Diagnose illegal SGPR to VGPR copies

This is possible in ways that are not compiler bugs,
so stop asserting on them.

This emits an extra error when emitting objects when it
can't encode the new pseudo, but I'm not sure that matters.

llvm-svn: 299712

7 years ago[CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs
Petr Hosek [Thu, 6 Apr 2017 21:06:33 +0000 (21:06 +0000)]
[CMake][libcxx] Use check_c_compiler_flag to check for nodefaultlibs

We're using -nodefaultlibs to avoid the dependency on C++ library
when using check_cxx_compiler_flag, and as such we cannot use
check_cxx_compiler_flag to check the availability of -nodefaultlibs
itself.

llvm-svn: 299711

7 years ago[InstCombine] When checking to see if we can turn subtracts of 2^n - 1 into xor,...
Craig Topper [Thu, 6 Apr 2017 21:06:03 +0000 (21:06 +0000)]
[InstCombine] When checking to see if we can turn subtracts of 2^n - 1 into xor, we only need to call computeKnownBits on the RHS not the whole subtract. While there use isMask instead of isPowerOf2(C+1)

Calling computeKnownBits on the RHS should allows us to recurse one step further. isMask is equivalent to the isPowerOf2(C+1) except in the case where C is all ones. But that was already handled earlier by creating a not which is an Xor with all ones. So this should be fine.

llvm-svn: 299710

7 years agoCache the result of findSection.
Rafael Espindola [Thu, 6 Apr 2017 21:05:39 +0000 (21:05 +0000)]
Cache the result of findSection.

This avoids calling it multiple times. In particular, we don't have to
call in in assignAddresses any more.

llvm-svn: 299709

7 years agoAMDGPU: Replace fp16SrcZerosHighBits with a whitelist
Matt Arsenault [Thu, 6 Apr 2017 20:58:30 +0000 (20:58 +0000)]
AMDGPU: Replace fp16SrcZerosHighBits with a whitelist

FCOPYSIGN is lowered to bit operations which don't clear the high
bits.

llvm-svn: 299708

7 years ago[PGO] Preserve GlobalsAA in pgo-memop-opt pass.
Rong Xu [Thu, 6 Apr 2017 20:56:00 +0000 (20:56 +0000)]
[PGO] Preserve GlobalsAA in pgo-memop-opt pass.

Preserve GlobalsAA analysis in memory intrinsic calls optimization based on
profiled size.

llvm-svn: 299707

7 years ago[llvm-extract] Add option for recursive extraction
Keno Fischer [Thu, 6 Apr 2017 20:51:40 +0000 (20:51 +0000)]
[llvm-extract] Add option for recursive extraction

Summary:
Particularly, with --delete, this can be very useful for testing
new optimizations on some hotspots, without having to run it on the whole
application. E.g. as such:
```
llvm-extract app.bc --recursive --rfunc .*hotspot.* > hotspot.bc
llvm-extract app.bc --recursive --delete --rfunc .*hotspot.* > residual.bc
llc -filetype=obj residual.bc > residual.o
llc -filetype=obj hotspot.bc > hotspot.o
cc -o app residual.o hotspot.o
```

Reviewed By: davide
Differential Revision: https://reviews.llvm.org/D31722

llvm-svn: 299706

7 years agoTry to fix FreeBSD build after iwyu changes.
Zachary Turner [Thu, 6 Apr 2017 20:51:22 +0000 (20:51 +0000)]
Try to fix FreeBSD build after iwyu changes.

llvm-svn: 299705

7 years ago[InstCombine] Remove redundant combine from visitAnd
Craig Topper [Thu, 6 Apr 2017 20:41:48 +0000 (20:41 +0000)]
[InstCombine] Remove redundant combine from visitAnd

This combine is fully handled by SimplifyDemandedInstructionBits as of r299658 where I fixed this code to ensure the Add/Sub had only a single user. Otherwise it would fire and create additional instructions. That fix resulted in an improvement to code generated for tsan which is why I committed it before deleting.

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

llvm-svn: 299704

7 years ago[BFIterator] Remove an assertion that doesn't hold. NFCI.
Davide Italiano [Thu, 6 Apr 2017 20:32:10 +0000 (20:32 +0000)]
[BFIterator] Remove an assertion that doesn't hold. NFCI.

llvm-svn: 299703

7 years agoRevert "Turn some C-style vararg into variadic templates"
Mehdi Amini [Thu, 6 Apr 2017 20:23:57 +0000 (20:23 +0000)]
Revert "Turn some C-style vararg into variadic templates"

This reverts commit r299699, the examples needs to be updated.

llvm-svn: 299702

7 years ago[SelectionDAG] [ARM CodeGen] Fix chain information of LowerMUL
Huihui Zhang [Thu, 6 Apr 2017 20:22:51 +0000 (20:22 +0000)]
[SelectionDAG] [ARM CodeGen] Fix chain information of LowerMUL

In LowerMUL, the chain information is not preserved for the new
created Load SDNode.

For example, if a Store alias with one of the operand of Mul.
The Load for that operand need to be scheduled before the Store.
The dependence is recorded in the chain of Store, in TokenFactor.
However, when lowering MUL, the SDNodes for the new Loads for
VMULL are not updated in the TokenFactor for the Store. Thus the
chain is not preserved for the lowered VMULL.

llvm-svn: 299701

7 years ago[clang-tidy] Reuse FileID in getLocation
Chih-Hung Hsieh [Thu, 6 Apr 2017 20:19:26 +0000 (20:19 +0000)]
[clang-tidy] Reuse FileID in getLocation

One FileID per warning will increase and overflow NextLocalOffset
when input file is large with many warnings.
Reusing FileID avoids this problem.

This requires changes in getColumnNumber, D31406, rL299681.

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

llvm-svn: 299700

7 years agoTurn some C-style vararg into variadic templates
Mehdi Amini [Thu, 6 Apr 2017 20:09:31 +0000 (20:09 +0000)]
Turn some C-style vararg into variadic templates

Module::getOrInsertFunction is using C-style vararg instead of
variadic templates.

From a user prospective, it forces the use of an annoying nullptr
to mark the end of the vararg, and there's not type checking on the
arguments. The variadic template is an obvious solution to both
issues.

Patch by: Serge Guelton <serge.guelton@telecom-bretagne.eu>

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

llvm-svn: 299699

7 years ago[asan] Fix dead stripping of globals on Linux (compiler-rt).
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:52 +0000 (19:55 +0000)]
[asan] Fix dead stripping of globals on Linux (compiler-rt).

This is a re-land of r298173, r298169, r298159.

llvm-svn: 299698

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:17 +0000 (19:55 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

This is a re-land of r298158 rebased on D31358. This time,
asan.module_ctor is put in a comdat as well to avoid quadratic
behavior in Gold.

llvm-svn: 299697

7 years ago[asan] Put ctor/dtor in comdat.
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:13 +0000 (19:55 +0000)]
[asan] Put ctor/dtor in comdat.

When possible, put ASan ctor/dtor in comdat.

The only reason not to is global registration, which can be
TU-specific. This is not the case when there are no instrumented
globals. This is also limited to ELF targets, because MachO does
not have comdat, and COFF linkers may GC comdat constructors.

The benefit of this is a lot less __asan_init() calls: one per DSO
instead of one per TU. It's also necessary for the upcoming
gc-sections-for-globals change on Linux, where multiple references to
section start symbols trigger quadratic behaviour in gold linker.

This is a rebase of r298756.

llvm-svn: 299696

7 years ago[asan] Delay creation of asan ctor.
Evgeniy Stepanov [Thu, 6 Apr 2017 19:55:09 +0000 (19:55 +0000)]
[asan] Delay creation of asan ctor.

Create the constructor in the module pass.
This in needed for the GC-friendly globals change, where the constructor can be
put in a comdat  in some cases, but we don't know about that in the function
pass.

This is a rebase of r298731 which was reverted due to a false alarm.

llvm-svn: 299695

7 years agoBitcode: Do not create FNENTRYs for aliases of functions.
Peter Collingbourne [Thu, 6 Apr 2017 19:39:24 +0000 (19:39 +0000)]
Bitcode: Do not create FNENTRYs for aliases of functions.

There doesn't seem to be any point in doing this.

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

llvm-svn: 299694

7 years agoReplace a few uses of basename.
Rafael Espindola [Thu, 6 Apr 2017 19:38:24 +0000 (19:38 +0000)]
Replace a few uses of basename.

This replaces a few uses of basename with the recently introduced lit
replacements.

llvm-svn: 299693

7 years ago[StripDeadDebugInfo] Drop dead CUs entirely
Keno Fischer [Thu, 6 Apr 2017 19:26:22 +0000 (19:26 +0000)]
[StripDeadDebugInfo] Drop dead CUs entirely

Summary:
Prior to this while it would delete the dead DIGlobalVariables, it would
leave dead DICompileUnits and everything referenced therefrom. For a bit
bitcode file with thousands of compile units those dead nodes easily
outnumbered the real ones. Clean that up.

Reviewed By: aprantl
Differential Revision: https://reviews.llvm.org/D31720

llvm-svn: 299692

7 years ago[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address...
Yaxun Liu [Thu, 6 Apr 2017 19:18:36 +0000 (19:18 +0000)]
[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address space mapping

Change constant address space from 4 to 2 for the new address space mapping in Clang.

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

llvm-svn: 299691

7 years ago[AMDGPU] Temporarily change constant address space from 4 to 2
Yaxun Liu [Thu, 6 Apr 2017 19:17:32 +0000 (19:17 +0000)]
[AMDGPU] Temporarily change constant address space from 4 to 2

Our final address space mapping is to let constant address space to be 4 to match nvptx.
However for now we will make it 2 to avoid unnecessary work in FE/BE/devlib
about intrinsics returning constant pointers.

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

llvm-svn: 299690

7 years agoRevert "[ARM] Add Kryo to available targets"
Yi Kong [Thu, 6 Apr 2017 19:16:14 +0000 (19:16 +0000)]
Revert "[ARM] Add Kryo to available targets"

This reverts commit 942d6e6f58bf7e63810dd7cbcbce1fdfa5ebc6d4.

Build breakage.

llvm-svn: 299689

7 years ago[SDAG] Fix visitAND optimization to deal with vector extract case again.
Nirav Dave [Thu, 6 Apr 2017 19:05:41 +0000 (19:05 +0000)]
[SDAG] Fix visitAND optimization to deal with vector extract case again.

Summary:
Fix case elided by rL298920.

Fixes PR32545.

Reviewers: eli.friedman, RKSimon

Subscribers: llvm-commits

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

llvm-svn: 299688

7 years ago[InstSimplify] Remove unreachable default from SimplifyBinOp.
Craig Topper [Thu, 6 Apr 2017 18:59:08 +0000 (18:59 +0000)]
[InstSimplify] Remove unreachable default from SimplifyBinOp.

We have dedicated handlers for every opcode so nothing can get here anymore. The switch doesn't get detected as fully covered because Opcode is an unsigned. Casting to Instruction::BinaryOps still doesn't detect it because BinaryOpsEnd is in the enum and 1 past the last opcode.

llvm-svn: 299687

7 years agoSome of Eric's buildbots don't like this test. Disable it while I figure out why.
Marshall Clow [Thu, 6 Apr 2017 18:54:37 +0000 (18:54 +0000)]
Some of Eric's buildbots don't like this test. Disable it while I figure out why.

llvm-svn: 299686

7 years agoNewGVN: Rename some functions for consistency
Daniel Berlin [Thu, 6 Apr 2017 18:52:58 +0000 (18:52 +0000)]
NewGVN: Rename some functions for consistency

llvm-svn: 299685

7 years agoNewGVN: Fixup some small issues
Daniel Berlin [Thu, 6 Apr 2017 18:52:55 +0000 (18:52 +0000)]
NewGVN: Fixup some small issues

llvm-svn: 299684

7 years agoNewGVN: Fix a small formatting issue in performSymbolicLoadEvaluation.
Daniel Berlin [Thu, 6 Apr 2017 18:52:53 +0000 (18:52 +0000)]
NewGVN: Fix a small formatting issue in performSymbolicLoadEvaluation.

llvm-svn: 299683

7 years agoNewGVN: This patch makes memory congruence work for all types of
Daniel Berlin [Thu, 6 Apr 2017 18:52:50 +0000 (18:52 +0000)]
NewGVN: This patch makes memory congruence work for all types of
memorydefs, not just stores.  Along the way, we audit and fixup issues
about how we were tracking memory leaders, and improve the verifier
to notice more memory congruency issues.

llvm-svn: 299682

7 years ago[Basic] getColumnNumber returns location of CR+LF on Windows
Chih-Hung Hsieh [Thu, 6 Apr 2017 18:36:50 +0000 (18:36 +0000)]
[Basic] getColumnNumber returns location of CR+LF on Windows

When fixing a Clang-Tidy bug in D31406,
reuse of FileID enabled the missing highlightRange function.
Assertion in highlightRange failed because the end-of-range column
number was 2 + the last column of a line on Windows.
This fix is required to enable D31406.

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

llvm-svn: 299681

7 years agoRecommit awk tests with warnings removed. Initial commit r299652, reverted r299656.
Marshall Clow [Thu, 6 Apr 2017 18:34:36 +0000 (18:34 +0000)]
Recommit awk tests with warnings removed. Initial commit r299652, reverted r299656.

llvm-svn: 299680

7 years agoRevert r299672: Add a virtual destructor to a class with virtual methods.
Ivan Krasin [Thu, 6 Apr 2017 18:22:25 +0000 (18:22 +0000)]
Revert r299672: Add a virtual destructor to a class with virtual methods.

Reason: breaks sanitizers builds.

Original Differential Revision: https://reviews.llvm.org/D317

llvm-svn: 299679

7 years ago[AMDGPU] Translate reqd_work_group_size into amdgpu_flat_work_group_size
Stanislav Mekhanoshin [Thu, 6 Apr 2017 18:15:44 +0000 (18:15 +0000)]
[AMDGPU] Translate reqd_work_group_size into amdgpu_flat_work_group_size

These two attributes specify the same info in a different way.
AMGPU BE only checks the latter as a target specific attribute
as opposed to language specific reqd_work_group_size.

This change produces amdgpu_flat_work_group_size out of
reqd_work_group_size if specified.

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

llvm-svn: 299678

7 years agoXFAIL TestDataFormatterLibcxxVBool on Linux & Android
Tamas Berghammer [Thu, 6 Apr 2017 18:15:43 +0000 (18:15 +0000)]
XFAIL TestDataFormatterLibcxxVBool on Linux & Android

The skipping logic for the test have been fixed recently but the test is
very flakey on the buildbot.

llvm-svn: 299677

7 years agoiwyu fixes on lldbUtility.
Zachary Turner [Thu, 6 Apr 2017 18:12:24 +0000 (18:12 +0000)]
iwyu fixes on lldbUtility.

This patch makes adjustments to header file includes in
lldbUtility based on recommendations by the iwyu tool
(include-what-you-use).  The goal here is to make sure that
all files include the exact set of headers which are needed
for that file only, to eliminate cases of dead includes (e.g.
someone deleted some code but forgot to delete the header
includes that that code necessitated), and to eliminate the
case where header includes are picked up transitively.

llvm-svn: 299676

7 years agoAdd __ffssi2 implementation to compiler-rt builtins
Dimitry Andric [Thu, 6 Apr 2017 18:12:02 +0000 (18:12 +0000)]
Add __ffssi2 implementation to compiler-rt builtins

Summary:
During MIPS implementation work for FreeBSD, John Baldwin (jhb@FreeBSD.org)
found that gcc 6.x emits calls to __ffssi2() when compiling libc and some
userland programs in the base system.

Add it to compiler-rt's builtins, based off of the existing __ffsdi2()
implementation.  Also update the CMake files and add a test case.

Reviewers: howard.hinnant, weimingz, rengolin, compnerd

Reviewed By: weimingz

Subscribers: dberris, mgorny, llvm-commits, emaste

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

llvm-svn: 299675

7 years ago[ARM] Add Kryo to available targets
Yi Kong [Thu, 6 Apr 2017 18:10:08 +0000 (18:10 +0000)]
[ARM] Add Kryo to available targets

Summary:
Host CPU detection now supports Kryo, so we need to recognize it in ARM
target.

Reviewers: mcrosier, t.p.northover, rengolin, echristo, srhines

Reviewed By: t.p.northover, echristo

Subscribers: aemerson

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

llvm-svn: 299674

7 years agoAdd DEBUGGER and CHECKs back to dbg-arg.c
Adrian Prantl [Thu, 6 Apr 2017 17:59:50 +0000 (17:59 +0000)]
Add DEBUGGER and CHECKs back to dbg-arg.c

When this testcase was migrated from IR to source the DEBUGGER
commands were not migrated together with the rest of the testcase. It
was also compiling without debug info.

Make the testcase slightly less useless by adding them back in :-)

llvm-svn: 299673

7 years agoAdd a virtual destructor to a class with virtual methods.
Ivan Krasin [Thu, 6 Apr 2017 17:58:45 +0000 (17:58 +0000)]
Add a virtual destructor to a class with virtual methods.

Summary:
Recently, Clang enabled the check for virtual destructors
in the presence of virtual methods. That broke the bootstrap
build. Fixing it.

Reviewers: pcc

Reviewed By: pcc

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 299672

7 years agoFix unused lambda capture. Follow up to r299653.
Ivan Krasin [Thu, 6 Apr 2017 17:42:05 +0000 (17:42 +0000)]
Fix unused lambda capture. Follow up to r299653.

llvm-svn: 299671

7 years agoEnable builds of darwin lsan by default
Francis Ricci [Thu, 6 Apr 2017 17:41:26 +0000 (17:41 +0000)]
Enable builds of darwin lsan by default

Summary: Testing and asan leak detection are disabled by default.

Reviewers: kubamracek, kcc

Subscribers: srhines, llvm-commits, mgorny

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

llvm-svn: 299669

7 years agoAdd a testcase for variable-length arrays.
Adrian Prantl [Thu, 6 Apr 2017 17:40:31 +0000 (17:40 +0000)]
Add a testcase for variable-length arrays.

VLAs are special-cased in the frontend. This testcase ensures that the
contract between clang and llvm won't be accidentally broken by future
refactorings.

llvm-svn: 299668

7 years agoAMDGPU: Stop using CCAssignToRegWithShadow
Matt Arsenault [Thu, 6 Apr 2017 17:37:27 +0000 (17:37 +0000)]
AMDGPU: Stop using CCAssignToRegWithShadow

This does not do what it is attempting to use it for
and requires working around in LowerFormalArguments.

llvm-svn: 299667

7 years agoFix unused typedef. Follow up to r299575.
Ivan Krasin [Thu, 6 Apr 2017 17:35:35 +0000 (17:35 +0000)]
Fix unused typedef. Follow up to r299575.

llvm-svn: 299666

7 years ago[InstSimplify] Teach SimplifyMulInst to recognize vectors of i1 as And. Not just...
Craig Topper [Thu, 6 Apr 2017 17:33:37 +0000 (17:33 +0000)]
[InstSimplify] Teach SimplifyMulInst to recognize vectors of i1 as And. Not just scalar i1.

llvm-svn: 299665

7 years ago[Hexagon] Change the vector scaling for vector offsets
Krzysztof Parzyszek [Thu, 6 Apr 2017 17:28:21 +0000 (17:28 +0000)]
[Hexagon] Change the vector scaling for vector offsets

Keep full offset value on MI-level instructions, but have it scaled down
in the MC-level instructions.

llvm-svn: 299664

7 years ago[FIX] Fix ScheduleTreeOptimizer::optimizeMatMulPattern
Roman Gareev [Thu, 6 Apr 2017 17:25:08 +0000 (17:25 +0000)]
[FIX] Fix ScheduleTreeOptimizer::optimizeMatMulPattern

Use new values of the dimensions during their permutation.

llvm-svn: 299663

7 years agoRestore the initial ordering of dimensions before applying the pattern matching
Roman Gareev [Thu, 6 Apr 2017 17:09:54 +0000 (17:09 +0000)]
Restore the initial ordering of dimensions before applying the pattern matching

Dimensions of band nodes can be implicitly permuted by the algorithm applied
during the schedule generation.

For example, in case of the following matrix-matrix multiplication,

for (i = 0; i < 1024; i++)
  for (k = 0; k < 1024; k++)
    for (j = 0; j < 1024; j++)
      C[i][j] += A[i][k] * B[k][j];

it can produce the following schedule tree

domain: "{ Stmt_for_body6[i0, i1, i2] : 0 <= i0 <= 1023 and 0 <= i1 <= 1023 and
                                        0 <= i2 <= 1023 }"
child:
  schedule: "[{ Stmt_for_body6[i0, i1, i2] -> [(i0)] },
              { Stmt_for_body6[i0, i1, i2] -> [(i1)] },
              { Stmt_for_body6[i0, i1, i2] -> [(i2)] }]"
  permutable: 1
  coincident: [ 1, 1, 0 ]

The current implementation of the pattern matching optimizations relies on the
initial ordering of dimensions. Otherwise, it can produce the miscompilation
(e.g., [1]).

This patch helps to restore the initial ordering of dimensions by recreating
the band node when the corresponding conditions are satisfied.

Refs.:

[1] - https://bugs.llvm.org/show_bug.cgi?id=32500

Reviewed-by: Michael Kruse <llvm@meinersbur.de>
Differential Revision: https://reviews.llvm.org/D31741

llvm-svn: 299662

7 years ago[TSan] Adjust expectation for check_analyze.sh
Craig Topper [Thu, 6 Apr 2017 17:09:08 +0000 (17:09 +0000)]
[TSan] Adjust expectation for check_analyze.sh

r299658 fixed a case where InstCombine was replicating instructions instead of combining. Fixing this reduced the number of pushes and pops in the __tsan_read and __tsan_write functions.

Adjust the expectations to account for this after talking to Dmitry Vyukov.

llvm-svn: 299661

7 years ago[ADT] Add a generic breadth-first-search graph iterator.
Davide Italiano [Thu, 6 Apr 2017 17:03:04 +0000 (17:03 +0000)]
[ADT] Add a generic breadth-first-search graph iterator.

This will be used in LCSSA to speed up the canonicalization.

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

llvm-svn: 299660

7 years ago[AMDGPU] Eliminate barrier if workgroup size is not greater than wavefront size
Stanislav Mekhanoshin [Thu, 6 Apr 2017 16:48:30 +0000 (16:48 +0000)]
[AMDGPU] Eliminate barrier if workgroup size is not greater than wavefront size

If a workgroup size is known to be not greater than wavefront size
the s_barrier instruction is not needed since all threads are guarantied
to come to the same point at the same time.

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

llvm-svn: 299659

7 years ago[InstCombine] Fix a case where we weren't checking that an instruction had a single...
Craig Topper [Thu, 6 Apr 2017 16:42:46 +0000 (16:42 +0000)]
[InstCombine] Fix a case where we weren't checking that an instruction had a single use resulting in extra instructions being created.

llvm-svn: 299658

7 years ago[clang-tidy] Temporarily disable a test-case that does not work on windows.
Gabor Horvath [Thu, 6 Apr 2017 15:58:57 +0000 (15:58 +0000)]
[clang-tidy] Temporarily disable a test-case that does not work on windows.

llvm-svn: 299657

7 years agoRevert "Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and propo...
Mehdi Amini [Thu, 6 Apr 2017 15:56:55 +0000 (15:56 +0000)]
Revert "Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541"

This reverts commit r299652, 32bits MacOS is broken.

llvm-svn: 299656

7 years agoRevert r299635 because it exposed a latent bug.
James Henderson [Thu, 6 Apr 2017 15:22:58 +0000 (15:22 +0000)]
Revert r299635 because it exposed a latent bug.

llvm-svn: 299655

7 years ago[AMDGPU] Resubmit SDWA peephole: enable by default
Sam Kolton [Thu, 6 Apr 2017 15:03:28 +0000 (15:03 +0000)]
[AMDGPU] Resubmit SDWA peephole: enable by default
Reviewers: vpykhtin, rampitec, arsenm

Subscribers: qcolombet, kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye

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

llvm-svn: 299654

7 years ago[analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector"
Artem Dergachev [Thu, 6 Apr 2017 14:34:07 +0000 (14:34 +0000)]
[analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector"

Hopefully fix crashes by unshadowing the variable.

Original commit message:

A big part of the clone detection code is functionality for filtering clones and
clone groups based on different criteria. So far this filtering process was
hardcoded into the CloneDetector class, which made it hard to understand and,
ultimately, to extend.

This patch splits the CloneDetector's logic into a sequence of reusable
constraints that are used for filtering clone groups. These constraints
can be turned on and off and reodreder at will, and new constraints are easy
to implement if necessary.

Unit tests are added for the new constraint interface.

This is a refactoring patch - no functional change intended.

Patch by Raphael Isemann!

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

llvm-svn: 299653

7 years agoRestore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing...
Marshall Clow [Thu, 6 Apr 2017 14:32:42 +0000 (14:32 +0000)]
Restore Missing awk regex tests. Thanks to dexonsmith for noticing, and proposing this as https://reviews.llvm.org/D16541

llvm-svn: 299652

7 years ago[clang-tidy] Update docs and help message
Alexander Kornienko [Thu, 6 Apr 2017 14:27:00 +0000 (14:27 +0000)]
[clang-tidy] Update docs and help message

llvm-svn: 299651

7 years agoAvoid the -Wdocumentation-unknown-command warning in Clang's C API docs
Alex Lorenz [Thu, 6 Apr 2017 14:03:25 +0000 (14:03 +0000)]
Avoid the -Wdocumentation-unknown-command warning in Clang's C API docs

rdar://20441985

llvm-svn: 299650

7 years ago[clang-tidy] Add FormatStyle configuration option.
Alexander Kornienko [Thu, 6 Apr 2017 13:41:29 +0000 (13:41 +0000)]
[clang-tidy] Add FormatStyle configuration option.

llvm-svn: 299649