platform/upstream/llvm.git
7 years ago[SelectionDAG] Rename fextend -> fpextend, fround -> fpround, frnd -> fround
Michael Kuperstein [Thu, 18 Aug 2016 20:08:15 +0000 (20:08 +0000)]
[SelectionDAG] Rename fextend -> fpextend, fround -> fpround, frnd -> fround

The names of the tablegen defs now match the names of the ISD nodes.
This makes the world a slightly saner place, as previously "fround" matched
ISD::FP_ROUND and not ISD::FROUND.

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

llvm-svn: 279129

7 years agoRevert [OpenCL] AMDGCN: Fix size_t type
Yaxun Liu [Thu, 18 Aug 2016 20:01:06 +0000 (20:01 +0000)]
Revert [OpenCL] AMDGCN: Fix size_t type

due to regressions in test/CodeGen/exprs.c on certain platforms.

llvm-svn: 279127

7 years agoAMDGPU : Fix QSAD and MQSAD instructions' incorrect data type.
Wei Ding [Thu, 18 Aug 2016 19:51:14 +0000 (19:51 +0000)]
AMDGPU : Fix QSAD and MQSAD instructions' incorrect data type.

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

llvm-svn: 279126

7 years ago[SLP] Initialize VectorizedValue when gathering
Matthew Simpson [Thu, 18 Aug 2016 19:50:32 +0000 (19:50 +0000)]
[SLP] Initialize VectorizedValue when gathering

We abort building vectorizable trees in some cases (e.g., if the maximum
recursion depth is reached, if the region size is too large, etc.). If this
happens for a reduction, we can be left with a root entry that needs to be
gathered. For these cases, we need make sure we actually set VectorizedValue to
the resulting vector.

This patch ensures we properly set VectorizedValue, and it also ensures the
insertelement sequence generated for the gathers is inserted at the correct
location.

Reference: https://llvm.org/bugs/show_bug.cgi?id=28330
Differential Revison: https://reviews.llvm.org/D23410

llvm-svn: 279125

7 years agoRegScavenging: Add scavengeRegisterBackwards()
Matthias Braun [Thu, 18 Aug 2016 19:47:59 +0000 (19:47 +0000)]
RegScavenging: Add scavengeRegisterBackwards()

Re-apply r276044 with off-by-1 instruction fix for the reload placement.

This is a variant of scavengeRegister() that works for
enterBasicBlockEnd()/backward(). The benefit of the backward mode is
that it is not affected by incomplete kill flags.

This patch also changes
PrologEpilogInserter::doScavengeFrameVirtualRegs() to use the register
scavenger in backwards mode.

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

llvm-svn: 279124

7 years agoFix json compilation database syntax on non-Windows.
Zachary Turner [Thu, 18 Aug 2016 19:42:00 +0000 (19:42 +0000)]
Fix json compilation database syntax on non-Windows.

llvm-svn: 279122

7 years ago[OpenCL] AMDGCN: Fix size_t type
Yaxun Liu [Thu, 18 Aug 2016 19:34:04 +0000 (19:34 +0000)]
[OpenCL] AMDGCN: Fix size_t type

Pointers of certain GPUs in AMDGCN target in private address space is 32 bit but pointers in other address spaces are 64 bit. size_t type should be defined as 64 bit for these GPUs so that it could hold pointers in all address spaces. Also fixed issues in pointer arithmetic codegen by using pointer specific intptr type.

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

llvm-svn: 279121

7 years agoResubmit "[Tooling] Parse compilation database command lines on Windows."
Zachary Turner [Thu, 18 Aug 2016 19:31:48 +0000 (19:31 +0000)]
Resubmit "[Tooling] Parse compilation database command lines on Windows."

This patch introduced the ability to decide at runtime whether to parse
JSON compilation database command lines using Gnu syntax or Windows
syntax.  However, there were many existing unit tests written that
hardcoded Gnu-specific paths.  These tests were now failing because
the auto-detection logic was choosing to parse them using Windows
rules.

This resubmission of the patch fixes this by introducing an enum
which defines the syntax mode, which defaults to auto-detect, but
for which the unit tests force Gnu style parsing.

Reviewed By: alexfh
Differential Revision: https://reviews.llvm.org/D23628

llvm-svn: 279120

7 years ago[ELF][MIPS] Support R_MIPS_GOT_HI16 / R_MIPS_GOT_LO16 relocations calculation
Simon Atanasyan [Thu, 18 Aug 2016 19:08:41 +0000 (19:08 +0000)]
[ELF][MIPS] Support R_MIPS_GOT_HI16 / R_MIPS_GOT_LO16 relocations calculation

llvm-svn: 279119

7 years ago[ELF][MIPS] Support R_MIPS_CALL_HI16 / R_MIPS_CALL_LO16 relocations calculation
Simon Atanasyan [Thu, 18 Aug 2016 19:08:36 +0000 (19:08 +0000)]
[ELF][MIPS] Support R_MIPS_CALL_HI16 / R_MIPS_CALL_LO16 relocations calculation

llvm-svn: 279118

7 years agoBranch Folding: Accept explicit threshold for tail merge size.
Kyle Butt [Thu, 18 Aug 2016 18:57:29 +0000 (18:57 +0000)]
Branch Folding: Accept explicit threshold for tail merge size.

This is prep work for allowing the threshold to be different during layout,
and to enforce a single threshold between merging and duplicating during
layout. No observable change intended.

llvm-svn: 279117

7 years ago[MS] Silence -Wextern-init on const selectany variables
Reid Kleckner [Thu, 18 Aug 2016 18:45:07 +0000 (18:45 +0000)]
[MS] Silence -Wextern-init on const selectany variables

In C, 'extern' is typically used to avoid tentative definitions when
declaring variables in headers, but adding an intializer makes it a
defintion. This is somewhat confusing, so GCC and Clang both warn on it.
In C++, 'extern' is often used to give implictly static 'const'
variables external linkage, so don't warn in that case. If selectany is
present, this might be header code intended for C and C++ inclusion, so
apply the C++ rules.

llvm-svn: 279116

7 years ago[clang-tidy docs] Move option descriptions to the Options section
Alexander Kornienko [Thu, 18 Aug 2016 18:43:47 +0000 (18:43 +0000)]
[clang-tidy docs] Move option descriptions to the Options section

+ random fixes

llvm-svn: 279115

7 years agoRemoved use of 'emplace' on std::map, since not all buildbot slaves support it
Cameron Desrochers [Thu, 18 Aug 2016 18:41:41 +0000 (18:41 +0000)]
Removed use of 'emplace' on std::map, since not all buildbot slaves support it

llvm-svn: 279114

7 years agoAdd a version of Intrinsic::getName which is more efficient when there are no overloads.
Pete Cooper [Thu, 18 Aug 2016 18:30:54 +0000 (18:30 +0000)]
Add a version of Intrinsic::getName which is more efficient when there are no overloads.

When running 'opt -O2 verify-uselistorder-nodbg.lto.bc', there are 33m allocations.  8.2m
come from std::string allocations in Intrinsic::getName().  Turns out this method only
returns a std::string because it needs to handle overloads, but that is not the common case.

This adds an overload of getName which just returns a StringRef when there are no overloads
and so saves on the allocations.

llvm-svn: 279113

7 years agoUse __has_include rather than a configure-time macro to determine if
Richard Smith [Thu, 18 Aug 2016 18:22:22 +0000 (18:22 +0000)]
Use __has_include rather than a configure-time macro to determine if
<sys/resource.h> is available. This should fix out-of-tree builds, at the cost
of not providing the higher rlimits to stage 1 clang when built with an old
host compiler not implementing this feature yet (bootstrap builds should be
fine, though).

llvm-svn: 279112

7 years ago[X86][SSE] Missed insertps shuffle patterns
Simon Pilgrim [Thu, 18 Aug 2016 18:19:28 +0000 (18:19 +0000)]
[X86][SSE] Missed insertps shuffle patterns

llvm-svn: 279111

7 years ago[CMake] Silence message on multi-configuration generators
Chris Bieneman [Thu, 18 Aug 2016 18:17:28 +0000 (18:17 +0000)]
[CMake] Silence message on multi-configuration generators

The Xcode and Visual Studio generators always log "-- No build type selected, default to Debug". This is because CMake doesn't initialize "CMAKE_CONFIGURATION_TYPES" until the generator's EnableLanguage call gets hit.

The first place EnableLanguage gets hit in our configuration is in the project() call. Since CMAKE_BUILD_TYPE isn't used until after we call project() it is safe to just move this check down a bit.

llvm-svn: 279110

7 years ago[asan] Extend test
Vitaly Buka [Thu, 18 Aug 2016 18:17:19 +0000 (18:17 +0000)]
[asan] Extend test

Summary: PR27453

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 279109

7 years ago[asan] Add one more test for __asan_set_shadow_*
Vitaly Buka [Thu, 18 Aug 2016 18:15:15 +0000 (18:15 +0000)]
[asan] Add one more test for __asan_set_shadow_*

Reviewers: eugenis, filcab

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 279108

7 years ago[AMDGPU] add s_incperflevel/s_decperflevel intrinsics.
Valery Pykhtin [Thu, 18 Aug 2016 18:06:20 +0000 (18:06 +0000)]
[AMDGPU] add s_incperflevel/s_decperflevel intrinsics.

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

llvm-svn: 279106

7 years agoFix SystemZ compilation abort caused by negative AND mask
Elliot Colp [Thu, 18 Aug 2016 18:04:26 +0000 (18:04 +0000)]
Fix SystemZ compilation abort caused by negative AND mask

Normally, when an AND with a constant is lowered to NILL, the constant value is truncated to 16 bits. However, since r274066, ANDs whose results are used in a shift are caught by a different pattern that does not truncate. The instruction printer expects a 16-bit unsigned immediate operand for NILL, so this results in an abort.

This patch adds code to manually truncate the constant in this situation. The rest of the bits are then set, so we will detect a case for NILL "naturally" rather than using peephole optimizations.

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

llvm-svn: 279105

7 years agoAArch64: Don't call getIterator() on iterators
Duncan P. N. Exon Smith [Thu, 18 Aug 2016 17:58:09 +0000 (17:58 +0000)]
AArch64: Don't call getIterator() on iterators

Remove an unnecessary round-trip:

    iterator => operator->() => getIterator()

In some cases, the iterator is end(), so the dereference of operator->
is invalid (UB).

The testcase only crashes with r278974 (currently reverted to
investigate this), which adds an assertion for invalid dereferences of
ilist nodes.

Fixes PR29035.

llvm-svn: 279104

7 years ago[LLVM] Fix some Clang-tidy modernize-use-using and Include What You Use warnings
Eugene Zelenko [Thu, 18 Aug 2016 17:56:27 +0000 (17:56 +0000)]
[LLVM] Fix some Clang-tidy modernize-use-using and Include What You Use warnings

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

llvm-svn: 279102

7 years ago[InstCombine] use m_APInt to allow icmp (udiv X, Y), C folds for splat constant vectors
Sanjay Patel [Thu, 18 Aug 2016 17:55:59 +0000 (17:55 +0000)]
[InstCombine] use m_APInt to allow icmp (udiv X, Y), C folds for splat constant vectors

This is a sibling of:
https://reviews.llvm.org/rL278859
https://reviews.llvm.org/rL278935
https://reviews.llvm.org/rL278945
https://reviews.llvm.org/rL279066
https://reviews.llvm.org/rL279077

llvm-svn: 279101

7 years ago[WebAssembly] Disable the store-results optimization.
Dan Gohman [Thu, 18 Aug 2016 17:51:27 +0000 (17:51 +0000)]
[WebAssembly] Disable the store-results optimization.

The WebAssemly spec removing the return value from store instructions, so
remove the associated optimization from LLVM.

This patch leaves the store instruction operands in place for now, so stores
now always write to "$drop"; these will be removed in a seperate patch.

llvm-svn: 279100

7 years ago[Assumptions] Make collecting ephemeral values not quadratic in the
Chandler Carruth [Thu, 18 Aug 2016 17:51:24 +0000 (17:51 +0000)]
[Assumptions] Make collecting ephemeral values not quadratic in the
number of assume intrinsics.

The classical way to have a cache-friendly vector style container when
we need queue semantics for BFS instead of stack semantics for DFS is to
use an ever-growing vector and an index. Erasing from the front requires
O(size) work, and unless we expect the worklist to grow *very* large,
its probably cheaper to just grow and race down the list.

But that makes it more bad that we're putting the assume intrinsics in
this at all. We end up looking at the (by definition empty) use list to
see if they're ephemeral (when we've already put them in that set), etc.

Instead, directly populate the worklist with the operands when we mark
the assume intrinsics as ephemeral. Also, test the visited set *before*
putting things into the worklist so we don't accumulate the same value
in the list 100s of times.

It would be nice to use a set-vector for this but I think its useful to
test the set earlier to avoid repeatedly querying whether the same
instruction is safe to speculate.

Hopefully with these changes the number of values pushed onto the
worklist is smaller, and we avoid quadratic work by letting it grow as
necessary.

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

llvm-svn: 279099

7 years agoFixed a problem where we failed to get the size of an Objective-C type.
Sean Callanan [Thu, 18 Aug 2016 17:45:50 +0000 (17:45 +0000)]
Fixed a problem where we failed to get the size of an Objective-C type.

<rdar://problem/27897056>

llvm-svn: 279098

7 years agoRevert "[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds"
Vedant Kumar [Thu, 18 Aug 2016 17:43:02 +0000 (17:43 +0000)]
Revert "[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds"

This reverts commit r279035. According to Richard Smith, llvm-config.h
does not contain the right definitions.

llvm-svn: 279097

7 years agoModule: add -fprebuilt-module-path to support loading prebuilt modules.
Manman Ren [Thu, 18 Aug 2016 17:42:15 +0000 (17:42 +0000)]
Module: add -fprebuilt-module-path to support loading prebuilt modules.

In this mode, there is no need to load any module map and the programmer can
simply use "@import" syntax to load the module directly from a prebuilt
module path. When loading from prebuilt module path, we don't support
rebuilding of the module files and we ignore compatible configuration
mismatches.

rdar://27290316
Differential Revision: http://reviews.llvm.org/D23125

llvm-svn: 279096

7 years agoFix -Wpessimizing-move error, NFC
Vedant Kumar [Thu, 18 Aug 2016 17:39:53 +0000 (17:39 +0000)]
Fix -Wpessimizing-move error, NFC

llvm-svn: 279095

7 years ago[InstCombine] clean up foldICmpUDivConstant; NFC
Sanjay Patel [Thu, 18 Aug 2016 17:37:26 +0000 (17:37 +0000)]
[InstCombine] clean up foldICmpUDivConstant; NFC

1. Better variable names
2. Remove unnecessary check of ConstantInt

llvm-svn: 279094

7 years ago[libclang] Added missing entry for newly introduced 'clang_getAllSkippedRanges' to...
Cameron Desrochers [Thu, 18 Aug 2016 17:18:03 +0000 (17:18 +0000)]
[libclang] Added missing entry for newly introduced 'clang_getAllSkippedRanges' to libclang.exports

llvm-svn: 279092

7 years agoReapply "ADT: Remove references in has_rbegin for reverse()"
Duncan P. N. Exon Smith [Thu, 18 Aug 2016 17:15:25 +0000 (17:15 +0000)]
Reapply "ADT: Remove references in has_rbegin for reverse()"

This reverts commit r279086, reapplying r279084.  I'm not sure what I
ran before, because the compile failure for ADTTests reproduced locally.

The problem is that TestRev is calling BidirectionalVector::rbegin()
when the BidirectionalVector is const, but rbegin() is always non-const.
I've updated BidirectionalVector::rbegin() to be callable from const.

Original commit message follows.

--

As a follow-up to r278991, add some tests that check that
decltype(reverse(R).begin()) == decltype(R.rbegin()), and get them
passing by adding std::remove_reference to has_rbegin.

I'm using static_assert instead of EXPECT_TRUE (and updated the other
has_rbegin check from r278991 in the same way) since I figure that's
more helpful.

llvm-svn: 279091

7 years ago[CMake] Stop building eprintf library on Darwin
Chris Bieneman [Thu, 18 Aug 2016 17:10:55 +0000 (17:10 +0000)]
[CMake] Stop building eprintf library on Darwin

In r278988 clang stopped using the eprintf library, so we should stop generating it too.

llvm-svn: 279090

7 years agoResubmit "Write the TPI stream from a PDB to Yaml."
Zachary Turner [Thu, 18 Aug 2016 16:49:29 +0000 (16:49 +0000)]
Resubmit "Write the TPI stream from a PDB to Yaml."

The original patch was breaking some buildbots due to an
incorrect ordering of function definitions which caused some
compilers to recognize a definition but others to not.

llvm-svn: 279089

7 years agollvm-objdump: add coff import library symbol listing support
Saleem Abdulrasool [Thu, 18 Aug 2016 16:39:19 +0000 (16:39 +0000)]
llvm-objdump: add coff import library symbol listing support

This adds behaviour similar to binutils' objdump which can show symbols in an
import library.  Differences from that stem around the fact that we do not
create section symbols nor the all import import descriptor symbol reference.
However, this does mean that the tool can serve as a possible replacement for
the existing tool.

llvm-svn: 279088

7 years ago[SCEVValidator] Don't reorder multiplies in extractConstantFactor.
Eli Friedman [Thu, 18 Aug 2016 16:30:42 +0000 (16:30 +0000)]
[SCEVValidator] Don't reorder multiplies in extractConstantFactor.

The existing code would add the operands in the wrong order, and eventually
crash because the SCEV expression doesn't exactly match the parameter SCEV
expression in SCEVAffinator::visit. (SCEV doesn't sort the operands to
getMulExpr in general.)

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

llvm-svn: 279087

7 years agoRevert "ADT: Remove references in has_rbegin for reverse()"
Duncan P. N. Exon Smith [Thu, 18 Aug 2016 16:27:41 +0000 (16:27 +0000)]
Revert "ADT: Remove references in has_rbegin for reverse()"

This reverts commit r279084, since it failed on a bot:
  http://bb.pgr.jp/builders/cmake-llvm-x86_64-linux/builds/41733

llvm-svn: 279086

7 years ago[libclang] Fixed signed/unsigned comparison warning introduced in my revision r279076
Cameron Desrochers [Thu, 18 Aug 2016 16:25:42 +0000 (16:25 +0000)]
[libclang] Fixed signed/unsigned comparison warning introduced in my revision r279076

llvm-svn: 279085

7 years agoADT: Remove references in has_rbegin for reverse()
Duncan P. N. Exon Smith [Thu, 18 Aug 2016 16:22:54 +0000 (16:22 +0000)]
ADT: Remove references in has_rbegin for reverse()

As a follow-up to r278991, add some tests that check that
decltype(reverse(R).begin()) == decltype(R.rbegin()), and get them
passing by adding std::remove_reference to has_rbegin.

I'm using static_assert instead of EXPECT_TRUE (and updated the other
has_rbegin check from r278991 in the same way) since I figure that's
more helpful.

llvm-svn: 279084

7 years agoCVP. Turn marking adds as no wrap (introduced by r278107) off by default
Artur Pilipenko [Thu, 18 Aug 2016 16:08:35 +0000 (16:08 +0000)]
CVP. Turn marking adds as no wrap (introduced by r278107) off by default

It causes a regression on our internal benchmark. Introduce cvp-dont-process flag and set it off by default while investigating the regression.

llvm-svn: 279082

7 years ago[AArch64][GlobalISel] Select floating-point binary ops.
Ahmed Bougacha [Thu, 18 Aug 2016 16:05:11 +0000 (16:05 +0000)]
[AArch64][GlobalISel] Select floating-point binary ops.

There is no FREM instruction, but the others are straightforward.

llvm-svn: 279081

7 years ago[GlobalISel] Add floating-point binary ops.
Ahmed Bougacha [Thu, 18 Aug 2016 16:05:06 +0000 (16:05 +0000)]
[GlobalISel] Add floating-point binary ops.

llvm-svn: 279080

7 years ago[IRCE] Switch over to LLVM_DUMP_METHOD. NFCI.
Davide Italiano [Thu, 18 Aug 2016 15:55:49 +0000 (15:55 +0000)]
[IRCE] Switch over to LLVM_DUMP_METHOD. NFCI.

llvm-svn: 279079

7 years ago[ARM] Correct ARMv8*-A optional extension definitions in TargetParser
Richard Barton [Thu, 18 Aug 2016 15:50:11 +0000 (15:50 +0000)]
[ARM] Correct ARMv8*-A optional extension definitions in TargetParser

The ARMv8*-A descriptions in the ARM and AArch64 TargetParsers are incorrect
architecturally and mismatched to the backend descriptions.

RAS is an optional extension to ARMv8-A and ARMv8.1-A and mandatory in
ARMv8.2-A. Correct the ARMTargetParser descriptions which had this as enabled
by default in the earlier versions.

The FP16 and SPE extensions are optional in ARMv8.2-A and the backend defaults
them as off. They are not available as extensions to earlier ARMv8-A versions.
Correct the AArch64TargetParser which had these as enabled by default in all
ARMv8-A definitions.

These macros are only used to define preprocessor macros. There are no macros
yet as ACLE has not caught up with ARMv8.2-A so not possible to add a test.

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

llvm-svn: 279078

7 years ago[InstCombine] use m_APInt to allow icmp (mul X, Y), C folds for splat constant vectors
Sanjay Patel [Thu, 18 Aug 2016 15:44:44 +0000 (15:44 +0000)]
[InstCombine] use m_APInt to allow icmp (mul X, Y), C folds for splat constant vectors

This is a sibling of:
https://reviews.llvm.org/rL278859
https://reviews.llvm.org/rL278935
https://reviews.llvm.org/rL278945
https://reviews.llvm.org/rL279066

llvm-svn: 279077

7 years ago[libclang] Add clang_getAllSkippedRanges function
Cameron Desrochers [Thu, 18 Aug 2016 15:43:55 +0000 (15:43 +0000)]
[libclang] Add clang_getAllSkippedRanges function

This complements the clang_getSkippedRanges function which returns skipped ranges filtered by a specific file.

This function is useful when all the ranges are desired (and a lot more efficient than the equivalent of asking for the ranges file by file, since the implementation of clang_getSkippedRanges iterates over all ranges anyway).

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

llvm-svn: 279076

7 years ago[WebAssembly] Refactor WebAssemblyLowerEmscriptenException pass for setjmp/longjmp
Derek Schuff [Thu, 18 Aug 2016 15:27:25 +0000 (15:27 +0000)]
[WebAssembly] Refactor WebAssemblyLowerEmscriptenException pass for setjmp/longjmp

This patch changes the code structure of
WebAssemblyLowerEmscriptenException pass to support both exception
handling and setjmp/longjmp. It also changes the name of the pass and
the source file.

1. Change the file/pass name to WebAssemblyLowerEmscriptenExceptions ->
WebAssemblyLowerEmscriptenEHSjLj to make it clear that it supports both
EH and SjLj
2. List function / global variable names at the top so they
can be changed easily
3. Some cosmetic changes

Patch by Heejin Ahn

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

llvm-svn: 279075

7 years ago[AArch64][GlobalISel] Select G_SDIV/G_UDIV.
Ahmed Bougacha [Thu, 18 Aug 2016 15:17:13 +0000 (15:17 +0000)]
[AArch64][GlobalISel] Select G_SDIV/G_UDIV.

There is no REM instruction; that will require an expansion.
It's not obvious that should be done in select, rather than as a
(custom?) legalization.

llvm-svn: 279074

7 years ago[GlobalISel] Add support for DIV/REM.
Ahmed Bougacha [Thu, 18 Aug 2016 15:17:01 +0000 (15:17 +0000)]
[GlobalISel] Add support for DIV/REM.

llvm-svn: 279073

7 years ago[InstCombine] use APInt in isSignTest instead of ConstantInt; NFC
Sanjay Patel [Thu, 18 Aug 2016 14:59:14 +0000 (14:59 +0000)]
[InstCombine] use APInt in isSignTest instead of ConstantInt; NFC

This will enable vector splat folding, but NFC until the callers
have their ConstantInt restrictions removed.

llvm-svn: 279072

7 years ago[compiler-rt][tests] cpu_model_test.c test fails to compile if X86 is not clang's...
Oleg Ranevskyy [Thu, 18 Aug 2016 14:39:39 +0000 (14:39 +0000)]
[compiler-rt][tests] cpu_model_test.c test fails to compile if X86 is not clang's default target

Summary:
test/builtins/Unit/cpu_model_test.c tests the X86 specific builtin `__builtin_cpu_supports`.
It fails if the clang's default target is not X86.

The proposed patch adds an additional requirement for the X86 target to the test, making lit ignore the test if the target is different.

Reviewers: asbirlea

Subscribers: dberris, llvm-commits

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

llvm-svn: 279071

7 years agogdb-remote: Remove manual locking from GetShlibInfoAddr
Pavel Labath [Thu, 18 Aug 2016 14:33:55 +0000 (14:33 +0000)]
gdb-remote: Remove manual locking from GetShlibInfoAddr

The function can simply call the non-NoLock version of the SendPacket function and let it do the
locking.

llvm-svn: 279070

7 years agollvm-readobj: handle import libraries with -coff-exports
Saleem Abdulrasool [Thu, 18 Aug 2016 14:32:11 +0000 (14:32 +0000)]
llvm-readobj: handle import libraries with -coff-exports

`link -dump -exports` lists exported symbols from import libraries as well as
normal dlls.  Ensure that we can handle import libraries as well in
llvm-readobj.

llvm-svn: 279069

7 years agofix typo; NFC
Sanjay Patel [Thu, 18 Aug 2016 14:17:34 +0000 (14:17 +0000)]
fix typo; NFC

llvm-svn: 279068

7 years ago[Hexagon] Create vcombine in HexagonCopyToCombine
Krzysztof Parzyszek [Thu, 18 Aug 2016 14:12:34 +0000 (14:12 +0000)]
[Hexagon] Create vcombine in HexagonCopyToCombine

llvm-svn: 279067

7 years ago[InstCombine] use m_APInt to allow icmp (xor X, Y), C folds for splat constant vectors
Sanjay Patel [Thu, 18 Aug 2016 14:10:48 +0000 (14:10 +0000)]
[InstCombine] use m_APInt to allow icmp (xor X, Y), C folds for splat constant vectors

This is a sibling of:
https://reviews.llvm.org/rL278859
https://reviews.llvm.org/rL278935
https://reviews.llvm.org/rL278945

llvm-svn: 279066

7 years ago[X86][SSE] Add SSE1 tests to make sure we don't merge loads on illegal types
Simon Pilgrim [Thu, 18 Aug 2016 13:41:26 +0000 (13:41 +0000)]
[X86][SSE] Add SSE1 tests to make sure we don't merge loads on illegal types

llvm-svn: 279065

7 years ago[mips] Correct tail call encoding for MIPSR6
Simon Dardis [Thu, 18 Aug 2016 13:22:43 +0000 (13:22 +0000)]
[mips] Correct tail call encoding for MIPSR6

r277708 enabled tails calls for MIPS but used the 'jr' instruction when the
jump target was held in a register. For MIPSR6, 'jalr $zero, $reg' should
have been used. Additionally, add missing patterns for external and global
symbols for tail calls.

Reviewers: dsanders, vkalintiris

Differential Review: https://reviews.llvm.org/D23301

llvm-svn: 279064

7 years ago[Reassociate] Add test for PR28367.
Chad Rosier [Thu, 18 Aug 2016 13:22:37 +0000 (13:22 +0000)]
[Reassociate] Add test for PR28367.

llvm-svn: 279063

7 years agoAdd header guards to asan_descriptions.h
Filipe Cabecinhas [Thu, 18 Aug 2016 13:22:00 +0000 (13:22 +0000)]
Add header guards to asan_descriptions.h

llvm-svn: 279062

7 years ago(Trivial) TargetPassConfig: assert when TargetMachine has no MCAsmInfo
Alex Bradbury [Thu, 18 Aug 2016 13:08:58 +0000 (13:08 +0000)]
(Trivial) TargetPassConfig: assert when TargetMachine has no MCAsmInfo

Summary:
This is a pretty trivial, but I thought it was worth just checking that nobody feels it's completely the wrong thing to be doing.

The motivation is that when starting a new backend, you often start with a minimal stub, pretty much just FooTargetMachine and FooTargetInfo. Once that's built, you might naturally try `llc -march=foo myinput.ll` and it seems more developer-friendly if this ends up asserting due to the lack of MCAsmInfo with an informative message rather than just segfaulting.

Reviewers: MatzeB, chandlerc

Subscribers: bogner, llvm-commits

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

llvm-svn: 279061

7 years ago[ELF] - Linkerscript: removed duplicate forward declarations, regrouped. NFC.
George Rimar [Thu, 18 Aug 2016 13:00:49 +0000 (13:00 +0000)]
[ELF] - Linkerscript: removed duplicate forward declarations, regrouped. NFC.

llvm-svn: 279060

7 years ago[ELF] - Inline defineSymbolVersion(). NFC.
George Rimar [Thu, 18 Aug 2016 12:53:57 +0000 (12:53 +0000)]
[ELF] - Inline defineSymbolVersion(). NFC.

llvm-svn: 279059

7 years agoELF: ignore -EB and -EL options
Ed Maste [Thu, 18 Aug 2016 12:44:45 +0000 (12:44 +0000)]
ELF: ignore -EB and -EL options

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

llvm-svn: 279058

7 years agoMove QSyncThreadState packet generation to the gdb-remote client
Pavel Labath [Thu, 18 Aug 2016 12:32:41 +0000 (12:32 +0000)]
Move QSyncThreadState packet generation to the gdb-remote client

llvm-svn: 279057

7 years ago[analyzer] Teach CloneDetector to find clones that look like copy-paste errors.
Artem Dergachev [Thu, 18 Aug 2016 12:29:41 +0000 (12:29 +0000)]
[analyzer] Teach CloneDetector to find clones that look like copy-paste errors.

The original clone checker tries to find copy-pasted code that is exactly
identical to the original code, up to minor details.

As an example, if the copy-pasted code has all references to variable 'a'
replaced with references to variable 'b', it is still considered to be
an exact clone.

The new check finds copy-pasted code in which exactly one variable seems
out of place compared to the original code, which likely indicates
a copy-paste error (a variable was forgotten to be renamed in one place).

Patch by Raphael Isemann!

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

llvm-svn: 279056

7 years agoCorrect the documentation for isSignedInteger() and isUnsignedInteger().
Aaron Ballman [Thu, 18 Aug 2016 12:26:17 +0000 (12:26 +0000)]
Correct the documentation for isSignedInteger() and isUnsignedInteger().

Patch by Visoiu Mistrih Francis

llvm-svn: 279055

7 years agoRemove trailing whitespace
Simon Pilgrim [Thu, 18 Aug 2016 11:22:22 +0000 (11:22 +0000)]
Remove trailing whitespace

llvm-svn: 279054

7 years agoRevert "ADT: Remove UB in ilist (and use a circular linked list)"
Diana Picus [Thu, 18 Aug 2016 11:17:53 +0000 (11:17 +0000)]
Revert "ADT: Remove UB in ilist (and use a circular linked list)"

This reverts commit r278974 which broke some of our bots (e.g.
clang-cmake-aarch64-42vma, clang-cmake-aarch64-full).

llvm-svn: 279053

7 years agoRevert "ADT: Tidy up ilist_traits static asserts, NFC"
Diana Picus [Thu, 18 Aug 2016 11:17:47 +0000 (11:17 +0000)]
Revert "ADT: Tidy up ilist_traits static asserts, NFC"

This reverts commit r279012.
r278974 broke some bots, I have to revert this to get to it.

llvm-svn: 279052

7 years ago[clang-tidy docs] Minor fix
Alexander Kornienko [Thu, 18 Aug 2016 11:12:03 +0000 (11:12 +0000)]
[clang-tidy docs] Minor fix

llvm-svn: 279051

7 years ago[clang-tidy docs] Fix formatting.
Alexander Kornienko [Thu, 18 Aug 2016 11:10:52 +0000 (11:10 +0000)]
[clang-tidy docs] Fix formatting.

llvm-svn: 279050

7 years ago[clang-tidy docs] Fix build errors on Sphinx 1.4.5
Alexander Kornienko [Thu, 18 Aug 2016 11:06:09 +0000 (11:06 +0000)]
[clang-tidy docs] Fix build errors on Sphinx 1.4.5

llvm-svn: 279049

7 years ago[mips][msan] Fix all the XPASSes following r278793 and r278795
Daniel Sanders [Thu, 18 Aug 2016 10:50:46 +0000 (10:50 +0000)]
[mips][msan] Fix all the XPASSes following r278793 and r278795

All msan tests are now passing for mipsel and mips64el except for
allocator_mapping.cc which is marked unsupported.

llvm-svn: 279048

7 years ago[BlockGenerator] Invalidate SCEV values for instructions in scop
Tobias Grosser [Thu, 18 Aug 2016 10:45:57 +0000 (10:45 +0000)]
[BlockGenerator] Invalidate SCEV values for instructions in scop

We already invalidated a couple of critical values earlier on, but we now
invalidate all instructions contained in a scop after the scop has been code
generated. This is necessary as later scops may otherwise obtain SCEV
expressions that reference values in the earlier scop that before dominated
the later scop, but which had been moved into the conditional branch and
consequently do not dominate the later scop any more. If these very values are
then used during code generation of the later scop, we generate used that are
dominated by the values they use.

This fixes: http://llvm.org/PR28984

llvm-svn: 279047

7 years agoConvert AsanLocateAddress to Get*AddressInformation functions.
Filipe Cabecinhas [Thu, 18 Aug 2016 10:31:19 +0000 (10:31 +0000)]
Convert AsanLocateAddress to Get*AddressInformation functions.

llvm-svn: 279046

7 years agoRevert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"
Diana Picus [Thu, 18 Aug 2016 09:25:07 +0000 (09:25 +0000)]
Revert "[OpenMP] Sema and parsing for 'teams distribute simd’ pragma"

This reverts commit r279003 as it breaks some of our buildbots (e.g.
clang-cmake-aarch64-quick, clang-x86_64-linux-selfhost-modules).

The error is in OpenMP/teams_distribute_simd_ast_print.cpp:
clang: /home/buildslave/buildslave/clang-cmake-aarch64-quick/llvm/include/llvm/ADT/DenseMap.h:527:
bool llvm::DenseMapBase<DerivedT, KeyT, ValueT, KeyInfoT, BucketT>::LookupBucketFor(const LookupKeyT&, const BucketT*&) const
[with LookupKeyT = clang::Stmt*; DerivedT = llvm::DenseMap<clang::Stmt*, long unsigned int>;
      KeyT = clang::Stmt*; ValueT = long unsigned int;
      KeyInfoT = llvm::DenseMapInfo<clang::Stmt*>;
      BucketT = llvm::detail::DenseMapPair<clang::Stmt*, long unsigned int>]:
Assertion `!KeyInfoT::isEqual(Val, EmptyKey) && !KeyInfoT::isEqual(Val, TombstoneKey) &&
"Empty/Tombstone value shouldn't be inserted into map!"' failed.

llvm-svn: 279045

7 years agorevert [analyzer] Added valist related checkers.
Gabor Horvath [Thu, 18 Aug 2016 09:13:37 +0000 (09:13 +0000)]
revert [analyzer] Added valist related checkers.

llvm-svn: 279043

7 years agotest commit
Guy Blank [Thu, 18 Aug 2016 08:44:33 +0000 (08:44 +0000)]
test commit

llvm-svn: 279042

7 years ago[analyzer] Added valist related checkers.
Gabor Horvath [Thu, 18 Aug 2016 08:43:26 +0000 (08:43 +0000)]
[analyzer] Added valist related checkers.

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

llvm-svn: 279041

7 years agogdb-remote: Centralize thread specific packet handling
Pavel Labath [Thu, 18 Aug 2016 08:30:03 +0000 (08:30 +0000)]
gdb-remote: Centralize thread specific packet handling

Summary:
Before this, each function had a copy of the code which handled appending of the thread suffix to
the packet (or using $Hg instead). I have moved that code into a single function and made
everyone else use that. The function takes the partial packet as a StreamString rvalue reference,
to avoid a copy and to remind the users that the packet will have undeterminate contents after
the call.

This also fixes the incorrect formatting of the QRestoreRegisterState packet in case thread
suffix is not supported.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 279040

7 years agoFix tests for the gdb-remote memory read packets
Pavel Labath [Thu, 18 Aug 2016 08:21:42 +0000 (08:21 +0000)]
Fix tests for the gdb-remote memory read packets

Part of TestGDBRemoteMemoryRead has been disabled since r259379 because it was incompatible with
python3. This changes the test to use the lldb-server test framework, which is a more appropriate
method of testing raw stub behaviour anyway (and should avoid the whole python 3 issue).

llvm-svn: 279039

7 years agoFix parsing of complicated C++ names
Pavel Labath [Thu, 18 Aug 2016 08:21:38 +0000 (08:21 +0000)]
Fix parsing of complicated C++ names

Summary:
CPlusPlusLanguage::MethodName was not correctly parsing templated functions whose demangled name
included the return type -- the space before the function name was included in the "context" and
the context itself was not terminated correctly due to a misuse of the substr function (second
argument is length, not the end position). Fix that and add a regression test.

Reviewers: clayborg

Subscribers: lldb-commits

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

llvm-svn: 279038

7 years ago[analyzer] Small cleanups when checkers retrieving statements from exploded
Gabor Horvath [Thu, 18 Aug 2016 07:54:50 +0000 (07:54 +0000)]
[analyzer] Small cleanups when checkers retrieving statements from exploded
nodes.

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

llvm-svn: 279037

7 years ago[ELF] Don't add input sections twice when linker script is used
Eugene Leviant [Thu, 18 Aug 2016 07:27:37 +0000 (07:27 +0000)]
[ELF] Don't add input sections twice when linker script is used

llvm-svn: 279036

7 years ago[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds
Vedant Kumar [Thu, 18 Aug 2016 06:43:07 +0000 (06:43 +0000)]
[Driver] Use llvm-config.h, not config.h to unbreak out-of-tree builds

llvm/Config/config.h has intentionally been excluded from llvm
installations (see: llvm/CMakeLists.txt). Un-break out-of-tree builds
post-r278882 by switching to llvm-config.h, which is exported.

Suggested by Will Dietz!

llvm-svn: 279035

7 years agoRemove debugging aids from this test and fix its expectations.
Richard Smith [Thu, 18 Aug 2016 06:15:19 +0000 (06:15 +0000)]
Remove debugging aids from this test and fix its expectations.

llvm-svn: 279034

7 years ago[ELF] Linkerscript: support assignment outside SECTIONS
Petr Hosek [Thu, 18 Aug 2016 04:34:27 +0000 (04:34 +0000)]
[ELF] Linkerscript: support assignment outside SECTIONS

We only support assignments inside SECTIONS, but this does not match
the behavior of GNU linker which also allows them outside SECTIONS.
The only restriction on assignments outside SECTIONS is that they
cannot reference . (they have to be absolute expressions).

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

llvm-svn: 279033

7 years ago[Docs] More MemorySSA doc updates!
George Burgess IV [Thu, 18 Aug 2016 02:56:05 +0000 (02:56 +0000)]
[Docs] More MemorySSA doc updates!

Thanks again to Michael Kuperstein for the feedback.

llvm-svn: 279032

7 years agoTestcase for r279022
Matthias Braun [Thu, 18 Aug 2016 02:21:54 +0000 (02:21 +0000)]
Testcase for r279022

llvm-svn: 279031

7 years ago[asan] trying to fix the windows bot
Kostya Serebryany [Thu, 18 Aug 2016 02:04:03 +0000 (02:04 +0000)]
[asan] trying to fix the windows bot

llvm-svn: 279030

7 years agoRevert r279016 -- it breaks win32-elf JIT tests.
Lang Hames [Thu, 18 Aug 2016 01:33:28 +0000 (01:33 +0000)]
Revert r279016 -- it breaks win32-elf JIT tests.

llvm-svn: 279029

7 years ago[sanitizer-coverag] update the docs in __sanitizer_cov_trace_cmp
Kostya Serebryany [Thu, 18 Aug 2016 01:26:36 +0000 (01:26 +0000)]
[sanitizer-coverag] update the docs in __sanitizer_cov_trace_cmp

llvm-svn: 279028

7 years ago[sanitizer-coverage/libFuzzer] instrument comparisons with __sanitizer_cov_trace_cmp...
Kostya Serebryany [Thu, 18 Aug 2016 01:25:28 +0000 (01:25 +0000)]
[sanitizer-coverage/libFuzzer] instrument comparisons with  __sanitizer_cov_trace_cmp[1248] instead of  __sanitizer_cov_trace_cmp, don't pass the comparison type to save a bit performance. Use these new callbacks in libFuzzer

llvm-svn: 279027

7 years ago[sanitizer-coverage] add __sanitizer_cov_trace_cmp[1248] to the sanitizer-coverage...
Kostya Serebryany [Thu, 18 Aug 2016 01:23:27 +0000 (01:23 +0000)]
[sanitizer-coverage] add __sanitizer_cov_trace_cmp[1248] to the sanitizer-coverage interface

llvm-svn: 279026

7 years agoFix bot failure due to new test
Teresa Johnson [Thu, 18 Aug 2016 01:18:15 +0000 (01:18 +0000)]
Fix bot failure due to new test

I had updated the output file name but not the corresponding nm based check
before submitting as r279023. This should fix the bot failures

llvm-svn: 279025

7 years agoPR28438: Update the information on an identifier with local definitions before
Richard Smith [Thu, 18 Aug 2016 01:16:55 +0000 (01:16 +0000)]
PR28438: Update the information on an identifier with local definitions before
trying to write out its macro graph, in case we imported a module that added
another module macro between the most recent local definition and the end of
the module.

llvm-svn: 279024

7 years ago[ThinLTO] Keep common symbols in ThinLTO modules
Teresa Johnson [Thu, 18 Aug 2016 01:08:50 +0000 (01:08 +0000)]
[ThinLTO] Keep common symbols in ThinLTO modules

Summary:
Skip the merging of common symbols for ThinLTO modules, they will be
merged by the final native object link. Trying to merge the symbols and
add to a combined module will incorrectly enable the common symbol to be
internalized in the ThinLTO module. Additionally, we will not want to
create a combined module for ThinLTO distributed builds.

This fixes failures in 7 cpu2006 benchmarks from the new LTO API in
ThinLTO mode.

Reviewers: mehdi_amini

Subscribers: pcc, llvm-commits, mehdi_amini

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

llvm-svn: 279023