platform/upstream/llvm.git
7 years ago[LoopUnroll] Remap references in peeled iteration
Serge Pavlov [Sun, 26 Mar 2017 16:46:53 +0000 (16:46 +0000)]
[LoopUnroll] Remap references in peeled iteration

References in cloned blocks must be remapped prior to dominator
calculation.

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

llvm-svn: 298811

7 years ago[LLDB] OpenBSD support
Kamil Rytarowski [Sun, 26 Mar 2017 15:34:57 +0000 (15:34 +0000)]
[LLDB] OpenBSD support

Summary:
Add basic OpenBSD support. This is enough to be able to analyze core dumps for OpenBSD/amd64, OpenBSD/arm, OpenBSD/arm64 and OpenBSD/i386.

Note that part of the changes to source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp fix a bug that probably affects other platforms as well.  The GetProgramHeaderByIndex() interface use 1-based indices, but in some case when looping over the headers the, the loop starts at 0 and misses the last header.  This caused problems on OpenBSD since OpenBSD core dumps have the PT_NOTE segment as the last program header.

Reviewers: joerg, labath, krytarowski

Reviewed By: krytarowski

Subscribers: aemerson, emaste, rengolin, srhines, krytarowski, mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 298810

7 years agotsan: add new mutex annotations
Dmitry Vyukov [Sun, 26 Mar 2017 15:27:04 +0000 (15:27 +0000)]
tsan: add new mutex annotations

There are several problems with the current annotations (AnnotateRWLockCreate and friends):
- they don't fully support deadlock detection (we need a hook _before_ mutex lock)
- they don't support insertion of random artificial delays to perturb execution (again we need a hook _before_ mutex lock)
- they don't support setting extended mutex attributes like read/write reentrancy (only "linker init" was bolted on)
- they don't support setting mutex attributes if a mutex don't have a "constructor" (e.g. static, Java, Go mutexes)
- they don't ignore synchronization inside of lock/unlock operations which leads to slowdown and false negatives
The new annotations solve of the above problems. See tsan_interface.h for the interface specification and comments.

Reviewed in https://reviews.llvm.org/D31093

llvm-svn: 298809

7 years ago[IR] Switch to more normal template parameter names ending in `T`
Chandler Carruth [Sun, 26 Mar 2017 14:24:06 +0000 (14:24 +0000)]
[IR] Switch to more normal template parameter names ending in `T`
instead of `Ty`.

The `Ty` suffix is much more commonly used for LLVM `Type` variable
names, so this seemed like a particularly confusing collision.

llvm-svn: 298808

7 years agoFix signed/unsigned comparison warnings.
Simon Pilgrim [Sun, 26 Mar 2017 13:59:17 +0000 (13:59 +0000)]
Fix signed/unsigned comparison warnings.

llvm-svn: 298807

7 years ago[X86][SSE] Add computeKnownBitsForTargetNode support for (V)PSLL/(V)PSRL instructions
Simon Pilgrim [Sun, 26 Mar 2017 13:17:55 +0000 (13:17 +0000)]
[X86][SSE] Add computeKnownBitsForTargetNode support for (V)PSLL/(V)PSRL instructions

llvm-svn: 298806

7 years ago[X86][AVX512F] Fix reg class for VMOVSSZrr/VMOVSSZrrk and VMOVSDZrr/VMOVSDZrrk
Simon Pilgrim [Sun, 26 Mar 2017 12:52:28 +0000 (12:52 +0000)]
[X86][AVX512F] Fix reg class for VMOVSSZrr/VMOVSSZrrk and VMOVSDZrr/VMOVSDZrrk

Fixed -verify-machineinstrs errors in fast-isel-select-sse.ll (one of many in PR27481)

The VMOVSSZrr/VMOVSSZrrk and VMOVSDZrr/VMOVSDZrrk instructions were assuming both source registers were V128X when the second is actually supposed to be FR32X/FR64X

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

llvm-svn: 298805

7 years agoFix MSVC signed/unsigned comparison warnings.
Simon Pilgrim [Sun, 26 Mar 2017 11:17:05 +0000 (11:17 +0000)]
Fix MSVC signed/unsigned comparison warnings.

llvm-svn: 298804

7 years agoRegenerate test
Simon Pilgrim [Sun, 26 Mar 2017 10:33:03 +0000 (10:33 +0000)]
Regenerate test

llvm-svn: 298803

7 years agoRegenerate test
Simon Pilgrim [Sun, 26 Mar 2017 10:31:37 +0000 (10:31 +0000)]
Regenerate test

The CHECK-DAG aren't necessary and get in the way of automated checks

llvm-svn: 298802

7 years agoRegenerate tests to remove duplicated checks
Simon Pilgrim [Sun, 26 Mar 2017 10:28:39 +0000 (10:28 +0000)]
Regenerate tests to remove duplicated checks

llvm-svn: 298801

7 years ago [GlobalISel][X86] support G_FRAME_INDEX instruction selection.
Igor Breger [Sun, 26 Mar 2017 08:11:12 +0000 (08:11 +0000)]
 [GlobalISel][X86] support G_FRAME_INDEX instruction selection.

    Summary:
    Support G_FRAME_INDEX instruction selection.

    Reviewers: zvi, rovka, ab, qcolombet

    Reviewed By: ab

    Subscribers: llvm-commits, dberris, kristof.beyls, eladcohen, guyblank

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

llvm-svn: 298800

7 years agoSplit the SimplifyCFG pass into two variants.
Joerg Sonnenberger [Sun, 26 Mar 2017 06:44:08 +0000 (06:44 +0000)]
Split the SimplifyCFG pass into two variants.

The first variant contains all current transformations except
transforming switches into lookup tables. The second variant
contains all current transformations.

The switch-to-lookup-table conversion results in code that is more
difficult to analyze and optimize by other passes. Most importantly,
it can inhibit Dead Code Elimination. As such it is often beneficial to
only apply this transformation very late. A common example is inlining,
which can often result in range restrictions for the switch expression.

Changes in execution time according to LNT:
SingleSource/Benchmarks/Misc/fp-convert +3.03%
MultiSource/Benchmarks/ASC_Sequoia/CrystalMk/CrystalMk -11.20%
MultiSource/Benchmarks/Olden/perimeter/perimeter -10.43%
and a couple of smaller changes. For perimeter it also results 2.6%
a smaller binary.

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

llvm-svn: 298799

7 years agoAdd check for BSD when setting LIB_NAMES for GNU ld
Andrew Wilkins [Sun, 26 Mar 2017 05:58:48 +0000 (05:58 +0000)]
Add check for BSD when setting LIB_NAMES for GNU ld

Patch by Koop Mast and Alex Arslan!

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

llvm-svn: 298798

7 years agoSort. NFC.
Rui Ueyama [Sun, 26 Mar 2017 04:10:43 +0000 (04:10 +0000)]
Sort. NFC.

llvm-svn: 298797

7 years agoRemove a redundant local variable.
Rui Ueyama [Sun, 26 Mar 2017 03:42:00 +0000 (03:42 +0000)]
Remove a redundant local variable.

llvm-svn: 298796

7 years agoAdd a comment.
Rui Ueyama [Sun, 26 Mar 2017 03:41:41 +0000 (03:41 +0000)]
Add a comment.

llvm-svn: 298795

7 years agoInline a function that is used only once.
Rui Ueyama [Sun, 26 Mar 2017 03:21:08 +0000 (03:21 +0000)]
Inline a function that is used only once.

llvm-svn: 298794

7 years agoDe-template a few functions in which ELFT is not needed.
Rui Ueyama [Sun, 26 Mar 2017 03:20:49 +0000 (03:20 +0000)]
De-template a few functions in which ELFT is not needed.

llvm-svn: 298793

7 years agoAdd comments and return early.
Rui Ueyama [Sun, 26 Mar 2017 03:20:30 +0000 (03:20 +0000)]
Add comments and return early.

llvm-svn: 298792

7 years ago[IR] Make SwitchInst::CaseIt almost a normal iterator.
Chandler Carruth [Sun, 26 Mar 2017 02:49:23 +0000 (02:49 +0000)]
[IR] Make SwitchInst::CaseIt almost a normal iterator.

This moves it to the iterator facade utilities giving it full random
access semantics, etc. It can also now be used with standard algorithms
like std::all_of and std::any_of and range adaptors like llvm::reverse.

Also make the semantics of iterating match what every other iterator
uses and forbid decrementing past the begin iterator. This was used as
a hacky way to work around iterator invalidation. However, every
instance trying to do this failed to actually avoid touching invalid
iterators despite the clear documentation that the removed and all
subsequent iterators become invalid including the end iterator. So I've
added a return of the next iterator to removeCase and rewritten the
loops that were doing this to correctly follow the iterator pattern of
either incremneting or removing and assigning fresh values to the
iterator and the end.

In one case we were trying to go backwards to make this cleaner but it
doesn't actually work. I've made that code match the code we use
everywhere else to remove cases as we iterate. This changes the order of
cases in one test output and I moved that test to CHECK-DAG so it
wouldn't care -- the order isn't semantically meaningful anyways.

llvm-svn: 298791

7 years agoRemove unused parameter.
Rui Ueyama [Sun, 26 Mar 2017 02:28:09 +0000 (02:28 +0000)]
Remove unused parameter.

llvm-svn: 298790

7 years agoRemove redundant local variables.
Rui Ueyama [Sun, 26 Mar 2017 02:27:50 +0000 (02:27 +0000)]
Remove redundant local variables.

llvm-svn: 298789

7 years agoRemove a parameter from adjustExpr. NFC.
Rui Ueyama [Sun, 26 Mar 2017 02:27:30 +0000 (02:27 +0000)]
Remove a parameter from adjustExpr. NFC.

llvm-svn: 298788

7 years agoInline a small lambda.
Rui Ueyama [Sun, 26 Mar 2017 02:27:11 +0000 (02:27 +0000)]
Inline a small lambda.

llvm-svn: 298787

7 years agoRename C -> Sec and RI -> Rel.
Rui Ueyama [Sun, 26 Mar 2017 02:26:52 +0000 (02:26 +0000)]
Rename C -> Sec and RI -> Rel.

C is short for Chunk, but we are no longer using that term.
RI is probably short for relocation iterator, but this is not an interator.

llvm-svn: 298786

7 years agoSimplify relocation offset adjustment.
Rui Ueyama [Sun, 26 Mar 2017 02:26:33 +0000 (02:26 +0000)]
Simplify relocation offset adjustment.

Previously, relocation offsets are recalculated for .eh_frame sections
inside the main loop, and that messed up the main loop. This patch
separates that logic into a dedicated class.

llvm-svn: 298785

7 years ago[coroutines] Add codegen for await and yield expressions
Gor Nishanov [Sun, 26 Mar 2017 02:18:05 +0000 (02:18 +0000)]
[coroutines] Add codegen for await and yield expressions

Details:

Emit suspend expression which roughly looks like:

auto && x = CommonExpr();
if (!x.await_ready()) {
   llvm_coro_save();
   x.await_suspend(...);     (*)
   llvm_coro_suspend(); (**)
}
x.await_resume();
where the result of the entire expression is the result of x.await_resume()

(*) If x.await_suspend return type is bool, it allows to veto a suspend:
if (x.await_suspend(...))
   llvm_coro_suspend();
(**) llvm_coro_suspend() encodes three possible continuations as a switch instruction:

%where-to = call i8 @llvm.coro.suspend(...)
switch i8 %where-to, label %coro.ret [ ; jump to epilogue to suspend
  i8 0, label %yield.ready   ; go here when resumed
  i8 1, label %yield.cleanup ; go here when destroyed
]

llvm-svn: 298784

7 years ago[X86] Pull out repeated ScalarValueSizeInBits code. NFCI.
Simon Pilgrim [Sat, 25 Mar 2017 21:22:12 +0000 (21:22 +0000)]
[X86] Pull out repeated ScalarValueSizeInBits code. NFCI.

llvm-svn: 298783

7 years ago[X86][SSE] Combine (VSRLI (VSRAI X, Y), (NumSignBits-1)) -> (VSRLI X, (NumSignBits-1))
Simon Pilgrim [Sat, 25 Mar 2017 20:43:01 +0000 (20:43 +0000)]
[X86][SSE] Combine (VSRLI (VSRAI X, Y), (NumSignBits-1)) -> (VSRLI X, (NumSignBits-1))

Part 3 of 3.

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

llvm-svn: 298782

7 years agoChange the default attributes for llvm.prefetch to inaccessiblemem_or_argmemonly
Eric Christopher [Sat, 25 Mar 2017 20:20:23 +0000 (20:20 +0000)]
Change the default attributes for llvm.prefetch to inaccessiblemem_or_argmemonly
so that we can perform some optimizations across it.

Fixes PR32365

llvm-svn: 298781

7 years ago[X86][SSE] Added ComputeNumSignBitsForTargetNode support for (V)PSRAI
Simon Pilgrim [Sat, 25 Mar 2017 19:58:36 +0000 (19:58 +0000)]
[X86][SSE] Added ComputeNumSignBitsForTargetNode support for (V)PSRAI

Part 2 of 3.

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

llvm-svn: 298780

7 years ago[X86][SSE] Generalised CMP+AND1 combine to ZERO/ALLBITS+MASK
Simon Pilgrim [Sat, 25 Mar 2017 19:50:14 +0000 (19:50 +0000)]
[X86][SSE] Generalised CMP+AND1 combine to ZERO/ALLBITS+MASK

Patch to generalize combinePCMPAnd1 (for handling SETCC + ZEXT cases) to work for any input that has zero/all bits set masked with an 'all low bits' mask.

Replaced the implicit assumption of shift availability with a call to SupportedVectorShiftWithImm.

Part 1 of 3.

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

llvm-svn: 298779

7 years ago_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Eric Christopher [Sat, 25 Mar 2017 19:26:04 +0000 (19:26 +0000)]
_CALL_LINUX is only defined on 64-bit ppc linux platforms, not 32-bit.
Adjust and add a test for the 32-bit side.

llvm-svn: 298778

7 years agoPluginUnwindAssemblyX86: add missing linkage to MCDisasm
Michal Gorny [Sat, 25 Mar 2017 18:51:37 +0000 (18:51 +0000)]
PluginUnwindAssemblyX86: add missing linkage to MCDisasm

Add missing linkage of the lldbPluginUnwindAssemblyX86 to LLVMMCDisasm
library. This fixes the following build failure when linking against
shared libraries:

    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::instruction_length(unsigned char*, int&): error: undefined reference to 'LLVMDisasmInstruction'
    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::~x86AssemblyInspectionEngine(): error: undefined reference to 'LLVMDisasmDispose'
    lib64/liblldbPluginUnwindAssemblyX86.a(x86AssemblyInspectionEngine.cpp.o):x86AssemblyInspectionEngine.cpp:function lldb_private::x86AssemblyInspectionEngine::x86AssemblyInspectionEngine(lldb_private::ArchSpec const&): error: undefined reference to 'LLVMCreateDisasm'

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

llvm-svn: 298777

7 years agoExpression: add missing linkage to RuntimeDyld component
Michal Gorny [Sat, 25 Mar 2017 18:51:29 +0000 (18:51 +0000)]
Expression: add missing linkage to RuntimeDyld component

Add missing linkage from lldbExpression library to LLVMRuntimeDyld.
Otherwise the build against shared LLVM libraries fails with:

    lib64/liblldbExpression.a(IRExecutionUnit.cpp.o):IRExecutionUnit.cpp:function llvm::RTDyldMemoryManager::deregisterEHFrames(unsigned char*, unsigned long, unsigned long): error: undefined reference to 'llvm::RTDyldMemoryManager::deregisterEHFramesInProcess(unsigned char*, unsigned long)'

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

llvm-svn: 298776

7 years ago[x86] use PMOVMSK to replace memcmp libcalls for 16-byte equality
Sanjay Patel [Sat, 25 Mar 2017 16:05:33 +0000 (16:05 +0000)]
[x86] use PMOVMSK to replace memcmp libcalls for 16-byte equality

This is the payoff for D31156 - if a target has efficient comparison instructions for vector-sized equality,
we can replace memcmp calls with inline code that is both smaller and faster.

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

llvm-svn: 298775

7 years ago[X86][SSE] Add extra computeNumSignBits test case for D31311.
Simon Pilgrim [Sat, 25 Mar 2017 15:43:36 +0000 (15:43 +0000)]
[X86][SSE] Add extra computeNumSignBits test case for D31311.

llvm-svn: 298774

7 years ago[AMDGPU] Make AMDGPUTargetInfo::AS private
Yaxun Liu [Sat, 25 Mar 2017 11:34:41 +0000 (11:34 +0000)]
[AMDGPU] Make AMDGPUTargetInfo::AS private

llvm-svn: 298773

7 years ago[InstCombine] Change the interface of SimplifyDemandedBits so that it takes the instr...
Craig Topper [Sat, 25 Mar 2017 06:52:52 +0000 (06:52 +0000)]
[InstCombine] Change the interface of SimplifyDemandedBits so that it takes the instruction and operand instead of the Use.

The first thing it did was get the User for the Use to get the instruction back. This requires looking through the Uses for the User using the waymarking walk. That's pretty fast, but its probably still better to just pass the Instruction we already had.

llvm-svn: 298772

7 years agoUpdate the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.
Eric Christopher [Sat, 25 Mar 2017 06:38:57 +0000 (06:38 +0000)]
Update the comment on not yet generated preprocessor defines to remove __LONGDOUBLE128.

llvm-svn: 298771

7 years agoAdd the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.
Eric Christopher [Sat, 25 Mar 2017 06:37:23 +0000 (06:37 +0000)]
Add the __LONGDOUBLE128 define for ppc targets that have 128 bit long doubles.

llvm-svn: 298770

7 years agoDefine __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.
Eric Christopher [Sat, 25 Mar 2017 05:40:13 +0000 (05:40 +0000)]
Define __HAVE_BSWAP__ on ppc to match gcc since we support both builtins as well.

llvm-svn: 298769

7 years ago[AArch64] Refine Falkor Machine Model - Part1
Balaram Makam [Sat, 25 Mar 2017 04:02:39 +0000 (04:02 +0000)]
[AArch64] Refine Falkor Machine Model - Part1

llvm-svn: 298768

7 years ago[AMDGPU] Switch address space mapping by triple environment amdgiz
Yaxun Liu [Sat, 25 Mar 2017 03:46:25 +0000 (03:46 +0000)]
[AMDGPU] Switch address space mapping by triple environment amdgiz

For target environment amdgiz and amdgizcl (giz means Generic Is Zero), AMDGPU will use new address space mapping where generic address space is 0 and private address space is 5. The data layout is also changed correspondingly.

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

llvm-svn: 298767

7 years ago[libc++] Fix some comment typos
Shoaib Meenai [Sat, 25 Mar 2017 03:42:20 +0000 (03:42 +0000)]
[libc++] Fix some comment typos

Remove a stray letter, add a missing letter. No functional change.

llvm-svn: 298766

7 years agoAdd the _CALL_LINUX preprocessor define for ppc linux platforms.
Eric Christopher [Sat, 25 Mar 2017 03:33:59 +0000 (03:33 +0000)]
Add the _CALL_LINUX preprocessor define for ppc linux platforms.

This typically is only for a new enough linker (bfd >= 2.16.2 or gold), but
our ppc suppport post-dates this and it should work on all linux platforms. It
is guaranteed to work on all elfv2 platforms.

llvm-svn: 298765

7 years ago[libc++] Fix word transposition in comment
Shoaib Meenai [Sat, 25 Mar 2017 03:29:51 +0000 (03:29 +0000)]
[libc++] Fix word transposition in comment

"to due" -> "due to". No functional change.

llvm-svn: 298764

7 years ago[libc++] Fix capitalization in comment
Shoaib Meenai [Sat, 25 Mar 2017 03:22:35 +0000 (03:22 +0000)]
[libc++] Fix capitalization in comment

Fix a stray capital letter in the middle of a sentence. No functional
change.

llvm-svn: 298763

7 years ago[libc++] Update package version
Shoaib Meenai [Sat, 25 Mar 2017 03:12:37 +0000 (03:12 +0000)]
[libc++] Update package version

Make it consistent with the rest of LLVM.

llvm-svn: 298762

7 years ago__BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
Eric Christopher [Sat, 25 Mar 2017 02:55:21 +0000 (02:55 +0000)]
__BIGGEST_ALIGNMENT__ has always been 16 on all power platforms rather
than the default of 8 in clang, fix and update tests accordingly.

llvm-svn: 298761

7 years ago[NewGVN] Adjust NDEBUG markers.
Davide Italiano [Sat, 25 Mar 2017 02:40:02 +0000 (02:40 +0000)]
[NewGVN] Adjust NDEBUG markers.

This avoids 'used but not defined' warnings in Release builds
with GCC.

llvm-svn: 298760

7 years agoAdd preprocessor defines for a bare powerpc64le triple/cpu.
Eric Christopher [Sat, 25 Mar 2017 02:29:18 +0000 (02:29 +0000)]
Add preprocessor defines for a bare powerpc64le triple/cpu.
The le triple didn't exist until power8, so use that as a default (this
also matches what gcc does).

llvm-svn: 298759

7 years ago[AMDGPU] Switch data layout by triple environment amdgiz
Yaxun Liu [Sat, 25 Mar 2017 02:05:44 +0000 (02:05 +0000)]
[AMDGPU] Switch data layout by triple environment amdgiz

Switch data layout by target triple environment amdgiz and amdgizcl indicating using of an address space mapping in which generic address space is 0.

amdgiz is for non-OpenCL environment where generic address space is 0.

amdgizcl is for OpenCL environment where generic address space is 0.

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

llvm-svn: 298758

7 years ago[libFuzzer] Fix test on Windows.
Vitaly Buka [Sat, 25 Mar 2017 01:19:45 +0000 (01:19 +0000)]
[libFuzzer] Fix test on Windows.

llvm-svn: 298757

7 years ago[asan] Put ctor/dtor in comdat.
Evgeniy Stepanov [Sat, 25 Mar 2017 01:01:11 +0000 (01:01 +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.

llvm-svn: 298756

7 years ago[libFuzzer] read asan's dedup_token while minimizing a crash and stop minimization...
Kostya Serebryany [Sat, 25 Mar 2017 00:56:08 +0000 (00:56 +0000)]
[libFuzzer] read asan's dedup_token while minimizing a crash and stop minimization if another bug was found during minimization (https://github.com/google/oss-fuzz/issues/452)

llvm-svn: 298755

7 years ago[ODRHash] Add support for array and decayed types.
Richard Trieu [Sat, 25 Mar 2017 00:48:52 +0000 (00:48 +0000)]
[ODRHash] Add support for array and decayed types.

llvm-svn: 298754

7 years agoFix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.
Evgeniy Stepanov [Sat, 25 Mar 2017 00:42:25 +0000 (00:42 +0000)]
Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.

Only depend on LLD if it is going to be built.

Re-land of r298174 which got reverted in r298287.

llvm-svn: 298753

7 years ago[ARM] Fix mixup between Lo and Hi in SMLALBB formation.
Eli Friedman [Sat, 25 Mar 2017 00:13:24 +0000 (00:13 +0000)]
[ARM] Fix mixup between Lo and Hi in SMLALBB formation.

llvm-svn: 298752

7 years agoApply clang-format as commented in D31311. NFCI.
Simon Pilgrim [Fri, 24 Mar 2017 23:47:41 +0000 (23:47 +0000)]
Apply clang-format as commented in D31311. NFCI.

llvm-svn: 298751

7 years ago[codeview] Don't assert when the user violates the ODR
Reid Kleckner [Fri, 24 Mar 2017 23:28:42 +0000 (23:28 +0000)]
[codeview] Don't assert when the user violates the ODR

If we have an array of a user-defined aggregates for which there was an
ODR violation, then the array size will not necessarily match the number
of elements times the size of the element.

Fixes PR32383

llvm-svn: 298750

7 years agoUse raw_fd_ostream::has_colors instead of StandardErrHasColors().
Rui Ueyama [Fri, 24 Mar 2017 23:21:34 +0000 (23:21 +0000)]
Use raw_fd_ostream::has_colors instead of StandardErrHasColors().

I just didn't know that raw_fd_ostream has has_colors() function.

llvm-svn: 298749

7 years agoUpdate comment.
Rui Ueyama [Fri, 24 Mar 2017 23:21:14 +0000 (23:21 +0000)]
Update comment.

llvm-svn: 298748

7 years ago[Outliner] Revert r298734.
Jessica Paquette [Fri, 24 Mar 2017 23:00:21 +0000 (23:00 +0000)]
[Outliner] Revert r298734.

When I tested r298734, I thought that red zones were enabled by default like in
X86. Since red zones are behind a flag on AArch64 the testing wasn't true.

llvm-svn: 298747

7 years ago[libFuzzer] be more careful when calling strlen of strcmp parameters, PR32357
Kostya Serebryany [Fri, 24 Mar 2017 22:19:52 +0000 (22:19 +0000)]
[libFuzzer] be more careful when calling strlen of strcmp parameters, PR32357

llvm-svn: 298746

7 years agoRevert r298711 "[InstCombine] Provide a way to calculate KnownZero/One for Add/Sub...
Craig Topper [Fri, 24 Mar 2017 22:12:10 +0000 (22:12 +0000)]
Revert r298711 "[InstCombine] Provide a way to calculate KnownZero/One for Add/Sub in SimplifyDemandedUseBits without recursing into ComputeKnownBits"

Tsan bot is failing.

llvm-svn: 298745

7 years ago[x86] add 32-bit RUN for better memcmp coverage; NFC
Sanjay Patel [Fri, 24 Mar 2017 22:09:48 +0000 (22:09 +0000)]
[x86] add 32-bit RUN for better memcmp coverage; NFC

llvm-svn: 298744

7 years agoFix flaky strtok.c test.
Alex Shlyapnikov [Fri, 24 Mar 2017 21:43:56 +0000 (21:43 +0000)]
Fix flaky strtok.c test.

Asserting the result of strtok when we expect delimiter overflow is
flaky, the result depends on the random state of memory right after the
delimiters.

llvm-svn: 298743

7 years ago[ODRHash] Add error messages for mismatched parameters in methods.
Richard Trieu [Fri, 24 Mar 2017 21:17:48 +0000 (21:17 +0000)]
[ODRHash] Add error messages for mismatched parameters in methods.

llvm-svn: 298742

7 years agoFollow-up for r298738: Use "0" instead of "false" because the variable is uptr.
Kuba Mracek [Fri, 24 Mar 2017 21:12:24 +0000 (21:12 +0000)]
Follow-up for r298738: Use "0" instead of "false" because the variable is uptr.

llvm-svn: 298741

7 years ago[libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimi...
Kostya Serebryany [Fri, 24 Mar 2017 21:09:16 +0000 (21:09 +0000)]
[libFuzzer] honor -exact_artifact_path for all intermediate files during crash minimization (https://github.com/google/oss-fuzz/issues/250)

llvm-svn: 298740

7 years agoMove spill size and alignment info from MC to TargetRegisterInfo
Krzysztof Parzyszek [Fri, 24 Mar 2017 21:01:16 +0000 (21:01 +0000)]
Move spill size and alignment info from MC to TargetRegisterInfo

This is another step towards implementing register classes with
parametrized register/spill sizes and value types.

This is an updated version of r298652. The difference is that MCRegister-
Class still contains register size, available as getPhysRegSize(). The
old function getSize was retained as a temporary measure to avoid build
breakage for out-of-tree targets.

llvm-svn: 298739

7 years agoFix an uninitialized field in tsan_block_context_t/AllocContext in tsan_libdispatch_m...
Kuba Mracek [Fri, 24 Mar 2017 20:57:33 +0000 (20:57 +0000)]
Fix an uninitialized field in tsan_block_context_t/AllocContext in tsan_libdispatch_mac.cc.

llvm-svn: 298738

7 years agoAMDGPU: Fix annotating loops with nested loop conditions
Matt Arsenault [Fri, 24 Mar 2017 20:57:10 +0000 (20:57 +0000)]
AMDGPU: Fix annotating loops with nested loop conditions

If the branch condition for a loop was a phi which itself
was fed from a phi from a loop, it isn't safe to try
to delete the phi until after the loop is handled.

llvm-svn: 298737

7 years ago[MachineScheduler] Add missing machine pass dependency.
Davide Italiano [Fri, 24 Mar 2017 20:52:56 +0000 (20:52 +0000)]
[MachineScheduler] Add missing machine pass dependency.

llvm-svn: 298736

7 years agoRevert r298620: [LV] Vectorize GEPs
Ivan Krasin [Fri, 24 Mar 2017 20:49:43 +0000 (20:49 +0000)]
Revert r298620: [LV] Vectorize GEPs

Reason: breaks linking Chromium with LLD + ThinLTO (a pass crashes)
LLVM bug: https://bugs.llvm.org//show_bug.cgi?id=32413

Original change description:

[LV] Vectorize GEPs

This patch adds support for vectorizing GEPs. Previously, we only generated
vector GEPs on-demand when creating gather or scatter operations. All GEPs from
the original loop were scalarized by default, and if a pointer was to be stored
to memory, we would have to build up the pointer vector with insertelement
instructions.

With this patch, we will vectorize all GEPs that haven't already been marked
for scalarization.

The patch refines collectLoopScalars to more exactly identify the scalar GEPs.
The function now more closely resembles collectLoopUniforms. And the patch
moves vector GEP creation out of vectorizeMemoryInstruction and into the main
vectorization loop. The vector GEPs needed for gather and scatter operations
will have already been generated before vectoring the memory accesses.

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

llvm-svn: 298735

7 years ago[Outliner] Remove no red zone requirment for AArch64
Jessica Paquette [Fri, 24 Mar 2017 20:47:59 +0000 (20:47 +0000)]
[Outliner] Remove no red zone requirment for AArch64

AArch64 doesn't require -mno-red-zone; stack fixups are sufficient here. This was
unnecessarily copied over from the X86 target.

(You can now outline with red zones! Yay!)

Removing the requirement passes all Single/MultiSource tests.

llvm-svn: 298734

7 years agoDocument how to fetch monorepo SVN revision notes
Reid Kleckner [Fri, 24 Mar 2017 20:47:41 +0000 (20:47 +0000)]
Document how to fetch monorepo SVN revision notes

llvm-svn: 298733

7 years ago[asan] Delay creation of asan ctor.
Evgeniy Stepanov [Fri, 24 Mar 2017 20:42:15 +0000 (20:42 +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.

llvm-svn: 298731

7 years agoAMDGPU: Implement f16 fround
Matt Arsenault [Fri, 24 Mar 2017 20:04:18 +0000 (20:04 +0000)]
AMDGPU: Implement f16 fround

llvm-svn: 298730

7 years agoAMDGPU: Unify divergent function exits.
Matt Arsenault [Fri, 24 Mar 2017 19:52:05 +0000 (19:52 +0000)]
AMDGPU: Unify divergent function exits.

StructurizeCFG can't handle cases with multiple
returns creating regions with multiple exits.
Create a copy of UnifyFunctionExitNodes that only
unifies exit nodes that skips exit nodes
with uniform branch sources.

llvm-svn: 298729

7 years agoFix a test so that it actually checks the output.
Peter Collingbourne [Fri, 24 Mar 2017 19:32:20 +0000 (19:32 +0000)]
Fix a test so that it actually checks the output.

llvm-svn: 298728

7 years agoRevert r298652 on Quentin's request
Krzysztof Parzyszek [Fri, 24 Mar 2017 19:18:29 +0000 (19:18 +0000)]
Revert r298652 on Quentin's request

llvm-svn: 298727

7 years agoMake testcase less nonsensical while still exercising the same code paths.
Adrian Prantl [Fri, 24 Mar 2017 19:11:31 +0000 (19:11 +0000)]
Make testcase less nonsensical while still exercising the same code paths.

llvm-svn: 298726

7 years agoAMDGPU: Fold rcp/rsq of undef to undef
Matt Arsenault [Fri, 24 Mar 2017 19:04:57 +0000 (19:04 +0000)]
AMDGPU: Fold rcp/rsq of undef to undef

llvm-svn: 298725

7 years agoTTI: Split IsSimple in MemIntrinsicInfo
Matt Arsenault [Fri, 24 Mar 2017 18:56:43 +0000 (18:56 +0000)]
TTI: Split IsSimple in MemIntrinsicInfo

All this did before was assert in EarlyCSE.

llvm-svn: 298724

7 years ago[AMDGPU] Fold V_CNDMASK with identical source operands
Stanislav Mekhanoshin [Fri, 24 Mar 2017 18:55:20 +0000 (18:55 +0000)]
[AMDGPU] Fold V_CNDMASK with identical source operands

Such instructions sometimes appear after lowering and folding.

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

llvm-svn: 298723

7 years ago[AMDGPU] Rename Kind to ValueKind in metadata to be consistent
Konstantin Zhuravlyov [Fri, 24 Mar 2017 18:43:15 +0000 (18:43 +0000)]
[AMDGPU] Rename Kind to ValueKind in metadata to be consistent

llvm-svn: 298722

7 years ago[AMDGPU] Add AMDGPUAliasAnalysis to opt pipeline
Stanislav Mekhanoshin [Fri, 24 Mar 2017 18:01:14 +0000 (18:01 +0000)]
[AMDGPU] Add AMDGPUAliasAnalysis to opt pipeline

Previously it was added only to the BE.

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

llvm-svn: 298721

7 years ago[ThinLTO] Correct counting of functions in inliner stats
Teresa Johnson [Fri, 24 Mar 2017 17:59:06 +0000 (17:59 +0000)]
[ThinLTO] Correct counting of functions in inliner stats

Summary: Declarations need to be filtered out when counting functions.

Reviewers: eraman

Subscribers: Prazek, llvm-commits

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

llvm-svn: 298720

7 years ago[AMDGPU] Don't enforce constexpr, there are still old standard libraries around that...
Benjamin Kramer [Fri, 24 Mar 2017 17:53:06 +0000 (17:53 +0000)]
[AMDGPU] Don't enforce constexpr, there are still old standard libraries around that don't have a constexpr std::pair.

llvm-svn: 298719

7 years ago[AMDGPU] Remove double map lookups in SI scheduler
Valery Pykhtin [Fri, 24 Mar 2017 17:49:05 +0000 (17:49 +0000)]
[AMDGPU] Remove double map lookups in SI scheduler

Patch by Axel Davy (axel.davy@normalesup.org)

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

llvm-svn: 298718

7 years ago[PDB] Split item and type records when merging type streams
Reid Kleckner [Fri, 24 Mar 2017 17:26:38 +0000 (17:26 +0000)]
[PDB] Split item and type records when merging type streams

Summary: MSVC does this when producing a PDB.

Reviewers: ruiu

Subscribers: llvm-commits

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

llvm-svn: 298717

7 years ago[X86][SSE] Add ashr + mask test cases.
Simon Pilgrim [Fri, 24 Mar 2017 17:25:47 +0000 (17:25 +0000)]
[X86][SSE] Add ashr + mask test cases.

Test cases showing cases where we're missing an opportunity to lshr a value with an extended sign to avoid loading a mask

llvm-svn: 298716

7 years agoRevert "builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM...
Weiming Zhao [Fri, 24 Mar 2017 17:08:35 +0000 (17:08 +0000)]
Revert "builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA."

This reverts commit c3709191b6d36c4c936173f4a9a29a734b12cb15.
(commit by mistake)

llvm-svn: 298715

7 years ago[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)
Weiming Zhao [Fri, 24 Mar 2017 17:06:05 +0000 (17:06 +0000)]
[Compiler-rt][Builtins] Implement lit-test support (part 2 of 2)

Summary:
Original r297566 (https://reviews.llvm.org/D30802) is splitted into two parts.
This part adds CMakefile/lit.cfg support.

Reviewers: rengolin, compnerd, jroelofs, erik.pilkington

Subscribers: srhines, dberris, mgorny

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

llvm-svn: 298714

7 years agobuiltins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.
Weiming Zhao [Fri, 24 Mar 2017 17:06:00 +0000 (17:06 +0000)]
builtins: Select correct code fragments when compiling for Thumb1/Thum2/ARM ISA.

Summary:
Value of __ARM_ARCH_ISA_THUMB isn't based on the actual compilation
mode (-mthumb, -marm), it reflect's capability of given CPU.

Due to this:
 - use  __tbumb__ and __thumb2__ insteand of __ARM_ARCH_ISA_THUMB
 - use '.thumb' directive consistently  in all affected files
 - decorate all thumb functions using
   DEFINE_COMPILERRT_THUMB_FUNCTION()

---------
Note: This patch doesn't fix broken Thumb1 variant of __udivsi3 !

Reviewers: weimingz, rengolin, compnerd

Subscribers: aemerson, dim

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

llvm-svn: 298713

7 years agoFix MSVC 'not all control paths return a value' warning.
Simon Pilgrim [Fri, 24 Mar 2017 16:59:14 +0000 (16:59 +0000)]
Fix MSVC 'not all control paths return a value' warning.

llvm-svn: 298712

7 years ago[InstCombine] Provide a way to calculate KnownZero/One for Add/Sub in SimplifyDemande...
Craig Topper [Fri, 24 Mar 2017 16:56:51 +0000 (16:56 +0000)]
[InstCombine] Provide a way to calculate KnownZero/One for Add/Sub in SimplifyDemandedUseBits without recursing into ComputeKnownBits

SimplifyDemandedUseBits for Add/Sub already recursed down LHS and RHS for simplifying bits. If that didn't provide any simplifications we fall back to calling computeKnownBits which will recurse again. Instead just take the known bits for LHS and RHS we already have and call into a new function in ValueTracking that can calculate the known bits given the LHS/RHS bits.

llvm-svn: 298711