platform/upstream/llvm.git
7 years agoDelete the CommonSection class.
Rafael Espindola [Tue, 8 Nov 2016 14:42:34 +0000 (14:42 +0000)]
Delete the CommonSection class.

With the current infrastructure it can be just an ordinary
InputSection like the real .bss sections.

llvm-svn: 286234

7 years ago[VectorLegalizer] Expansion of CTLZ using CTPOP when possible
Simon Pilgrim [Tue, 8 Nov 2016 14:10:28 +0000 (14:10 +0000)]
[VectorLegalizer] Expansion of CTLZ using CTPOP when possible

This patch avoids scalarization of CTLZ by instead expanding to use CTPOP (ref: "Hacker's Delight") when the necessary operations are available.

This also adds the necessary cost models for X86 SSE2 targets (the main beneficiary) to ensure vectorization only happens when its useful.

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

llvm-svn: 286233

7 years agocleanup hashSysV a bit.
Rafael Espindola [Tue, 8 Nov 2016 14:04:16 +0000 (14:04 +0000)]
cleanup hashSysV a bit.

Don't pass a reference to a StringRef and use a range loop.

llvm-svn: 286232

7 years ago[AArch64] Fix incorrect CSEL node created
Roger Ferrer Ibanez [Tue, 8 Nov 2016 13:34:41 +0000 (13:34 +0000)]
[AArch64] Fix incorrect CSEL node created

Under -enable-unsafe-fp-math, SELECT_CC lowering in AArch64
transforms floating point comparisons of the form "a == 0.0 ? 0.0 : x" to
"a == 0.0 ? a : x". But it incorrectly assumes that 'x' and 'a' have
the same type which can lead to a wrong CSEL node that crashes later
due to nonsensical copies.

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

llvm-svn: 286231

7 years ago[mips] Renable small data section test.
Simon Dardis [Tue, 8 Nov 2016 13:03:45 +0000 (13:03 +0000)]
[mips] Renable small data section test.

llvm-svn: 286230

7 years ago[X86][AVX512][Clang] Add support for mask_{move|store|load}_s{s/d} and int2mask/mask2...
Ayman Musa [Tue, 8 Nov 2016 12:00:30 +0000 (12:00 +0000)]
[X86][AVX512][Clang] Add support for mask_{move|store|load}_s{s/d} and int2mask/mask2int intrinsics.

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

llvm-svn: 286229

7 years ago[clang-tidy] Improve rename_check.py.
Kirill Bobyrev [Tue, 8 Nov 2016 11:43:50 +0000 (11:43 +0000)]
[clang-tidy] Improve rename_check.py.

-Start using argparse instead of mimicking CLI parsing.
-PEPify the code.
-Decrease the number of imports by slightly cleaning up the script.

Reviewers: alexfh

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

llvm-svn: 286228

7 years agoAdds the loop end location to the loop metadata.
Amara Emerson [Tue, 8 Nov 2016 11:18:59 +0000 (11:18 +0000)]
Adds the loop end location to the loop metadata.

This additional information can be used to improve the locations when generating remarks for loops.

Patch by Florian Hahn.

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

llvm-svn: 286227

7 years ago[ELF] Test case update (orphan.s)
Eugene Leviant [Tue, 8 Nov 2016 11:11:23 +0000 (11:11 +0000)]
[ELF] Test case update (orphan.s)

llvm-svn: 286226

7 years ago[ELF] Heuristic for placing orphan section
Eugene Leviant [Tue, 8 Nov 2016 10:44:48 +0000 (10:44 +0000)]
[ELF] Heuristic for placing orphan section

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

llvm-svn: 286225

7 years agoTest commit of vbyakovl.
Vladimir Yakovlev [Tue, 8 Nov 2016 10:32:10 +0000 (10:32 +0000)]
Test commit of vbyakovl.

llvm-svn: 286224

7 years agoFix memory leaks (coverity issues 1365586 & 1365591)
Sylvestre Ledru [Tue, 8 Nov 2016 10:00:45 +0000 (10:00 +0000)]
Fix memory leaks (coverity issues 1365586 & 1365591)

Reviewers: hfinkel

Subscribers: george.burgess.iv, malcolm.parsons, boris.ulasevich, llvm-commits

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

llvm-svn: 286223

7 years ago[clang-tidy] clang-analyzer-alpha* checks are not registered, so there's no need...
Alexander Kornienko [Tue, 8 Nov 2016 08:28:19 +0000 (08:28 +0000)]
[clang-tidy] clang-analyzer-alpha* checks are not registered, so there's no need to disable them

llvm-svn: 286222

7 years ago[clang-tools-extra] Format sources with clang-format. NFC.
Mandeep Singh Grang [Tue, 8 Nov 2016 07:50:19 +0000 (07:50 +0000)]
[clang-tools-extra] Format sources with clang-format. NFC.

Summary:
Ran clang-format on all .c/.cpp/.h files in clang-tools-extra.
Excluded the test, unittests, clang-reorder-fields, include-fixer, modularize and pptrace directories.

Reviewers: klimek, alexfh

Subscribers: nemanjai

Tags: #clang-tools-extra

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

llvm-svn: 286221

7 years ago[ELF] - Fixed mistype. NFC.
George Rimar [Tue, 8 Nov 2016 07:46:52 +0000 (07:46 +0000)]
[ELF] - Fixed mistype. NFC.

llvm-svn: 286220

7 years agoUse AnalyzerOptions::getRegisteredCheckers() instead of clang/StaticAnalyzer/Checkers...
Alexander Kornienko [Tue, 8 Nov 2016 07:43:42 +0000 (07:43 +0000)]
Use AnalyzerOptions::getRegisteredCheckers() instead of clang/StaticAnalyzer/Checkers/Checkers.inc

Summary: Depends on D26310.

Reviewers: zaks.anna, hokein

Subscribers: cfe-commits

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

llvm-svn: 286219

7 years agoAdd a method to get the list of registered static analyzer checkers.
Alexander Kornienko [Tue, 8 Nov 2016 07:23:32 +0000 (07:23 +0000)]
Add a method to get the list of registered static analyzer checkers.

Summary:
This provides a better interface for clang-tidy and encapsulates the knowledge
about experimental checkers instead of leaving this to the clients.

Reviewers: zaks.anna

Subscribers: a.sidorin, NoQ, dcoughlin, cfe-commits

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

llvm-svn: 286218

7 years agoSCEVValidator: reduce indentation to increase readability [NFC]
Tobias Grosser [Tue, 8 Nov 2016 07:17:48 +0000 (07:17 +0000)]
SCEVValidator: reduce indentation to increase readability [NFC]

llvm-svn: 286217

7 years ago[AVX-512] Add an avx512f without avx512vl command line to vec_fp_to_int.ll and regene...
Craig Topper [Tue, 8 Nov 2016 06:58:53 +0000 (06:58 +0000)]
[AVX-512] Add an avx512f without avx512vl command line to vec_fp_to_int.ll and regenerate. This will make a change in a future patch easier to see. NFC

llvm-svn: 286216

7 years ago[lldb] Don't build unit tests for unsupported targets
Vedant Kumar [Tue, 8 Nov 2016 06:49:59 +0000 (06:49 +0000)]
[lldb] Don't build unit tests for unsupported targets

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

llvm-svn: 286215

7 years agoIR, Bitcode: Change bitcode reader to no longer own its memory buffer.
Peter Collingbourne [Tue, 8 Nov 2016 06:03:43 +0000 (06:03 +0000)]
IR, Bitcode: Change bitcode reader to no longer own its memory buffer.

Unique ownership is just one possible ownership pattern for the memory buffer
underlying the bitcode reader. In practice, as this patch shows, ownership can
often reside at a higher level. With the upcoming change to allow multiple
modules in a single bitcode file, it will no longer be appropriate for
modules to generally have unique ownership of their memory buffer.

The C API exposes the ownership relation via the LLVMGetBitcodeModuleInContext
and LLVMGetBitcodeModuleInContext2 functions, so we still need some way for
the module to own the memory buffer. This patch does so by adding an owned
memory buffer field to Module, and using it in a few other places where it
is convenient.

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

llvm-svn: 286214

7 years ago[clang-tidy] Simplify matchers
Alexander Kornienko [Tue, 8 Nov 2016 05:58:07 +0000 (05:58 +0000)]
[clang-tidy] Simplify matchers

llvm-svn: 286213

7 years agoclang-format: Use git-ls-tree to get file mode in diff mode
Stephen Hines [Tue, 8 Nov 2016 05:50:14 +0000 (05:50 +0000)]
clang-format: Use git-ls-tree to get file mode in diff mode

Summary:
If a file has been renamed/deleted from the filesystem and --diff mode
with two commits is active, attempting to get the file's mode will fail.
This change uses git-ls-tree instead to get the correct permissions for
the given revision.

Patch by Luis Hector Chavez!

Reviewers: djasper, lodato

Subscribers: srhines, cfe-commits

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

llvm-svn: 286212

7 years agotsan: more precise handling of atomic stores
Dmitry Vyukov [Tue, 8 Nov 2016 05:34:50 +0000 (05:34 +0000)]
tsan: more precise handling of atomic stores

Atomic stores terminate release sequences on the atomic variable,
and must use ReleaseStore primitive instead of Release.
This was broken in r192355 during a refactoring.
Restore correct behavior and add a test.

llvm-svn: 286211

7 years agocmake: Don't try to install exports if there aren't any
Justin Bogner [Tue, 8 Nov 2016 05:02:33 +0000 (05:02 +0000)]
cmake: Don't try to install exports if there aren't any

When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for clang's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

llvm-svn: 286210

7 years agocmake: Don't try to install exports if there aren't any
Justin Bogner [Tue, 8 Nov 2016 05:02:18 +0000 (05:02 +0000)]
cmake: Don't try to install exports if there aren't any

When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for LLVM's
export list to be empty. If this happens the install(EXPORTS) command
will fail, but since there isn't anything to install anyway we really
just want to skip it.

llvm-svn: 286209

7 years agoConvert some Expression parser functions to StringRef.
Zachary Turner [Tue, 8 Nov 2016 04:52:16 +0000 (04:52 +0000)]
Convert some Expression parser functions to StringRef.

llvm-svn: 286208

7 years agoBitcode: Decouple block info block state from reader.
Peter Collingbourne [Tue, 8 Nov 2016 04:17:11 +0000 (04:17 +0000)]
Bitcode: Decouple block info block state from reader.

As proposed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-October/106630.html

Move block info block state to a new class, BitstreamBlockInfo.
Clients may set the block info for a particular cursor with the
BitstreamCursor::setBlockInfo() method.

At this point BitstreamReader is not much more than a container for an
ArrayRef<uint8_t>, so remove it and replace all uses with direct uses
of memory buffers.

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

llvm-svn: 286207

7 years agoBitcode: Split out block info reading into a separate function.
Peter Collingbourne [Tue, 8 Nov 2016 04:16:57 +0000 (04:16 +0000)]
Bitcode: Split out block info reading into a separate function.

We're about to make this more complicated.

llvm-svn: 286206

7 years ago[PowerPC] Implement remaining vector comparison builtins.
Tony Jiang [Tue, 8 Nov 2016 04:15:45 +0000 (04:15 +0000)]
[PowerPC] Implement remaining vector comparison builtins.

vector bool char vec_cmpeq (vector bool char, vector bool char);
vector bool int vec_cmpeq (vector bool int, vector bool int);
vector bool long long vec_cmpeq (vector bool long long, vector bool long lon
vector bool short vec_cmpeq (vector bool short, vector bool short);

llvm-svn: 286205

7 years agoRewrite OutputFormattedHelpText in terms of StringRef.
Zachary Turner [Tue, 8 Nov 2016 04:12:42 +0000 (04:12 +0000)]
Rewrite OutputFormattedHelpText in terms of StringRef.

This makes the logic easier to follow and also propagates
StringRef up to the API boundary, which is necessary for
making higher up StringRef API changes.

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

llvm-svn: 286204

7 years agoAdd a missing break statement. NFC.
George Burgess IV [Tue, 8 Nov 2016 04:01:50 +0000 (04:01 +0000)]
Add a missing break statement. NFC.

llvm-svn: 286203

7 years ago[libc++] Remove unnecessary MSVCRT exclusions
Shoaib Meenai [Tue, 8 Nov 2016 03:31:42 +0000 (03:31 +0000)]
[libc++] Remove unnecessary MSVCRT exclusions

Visual Studio 2013 and up have these functions, and we don't need to
support older versions.

There are some remaining _LIBCPP_MSVCRT exclusions which are present on
Visual Studio 2015 but not 2013. Those will be addressed in a follow-up.

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

llvm-svn: 286202

7 years agoMake a const variable static. NFC.
George Burgess IV [Tue, 8 Nov 2016 03:30:49 +0000 (03:30 +0000)]
Make a const variable static. NFC.

llvm-svn: 286201

7 years ago[LTO] Don't leak BitcodeFiles. Found by the asan bot.
Davide Italiano [Tue, 8 Nov 2016 01:46:02 +0000 (01:46 +0000)]
[LTO] Don't leak BitcodeFiles. Found by the asan bot.

llvm-svn: 286194

7 years ago[ELF] Don't leak the ".data" section. Fixes an asan failure.
Davide Italiano [Tue, 8 Nov 2016 01:42:38 +0000 (01:42 +0000)]
[ELF] Don't leak the ".data" section. Fixes an asan failure.

llvm-svn: 286193

7 years ago[asan] Add missing header in a test.
Evgeniy Stepanov [Tue, 8 Nov 2016 01:17:58 +0000 (01:17 +0000)]
[asan] Add missing header in a test.

llvm-svn: 286191

7 years agoGlobalISel: improve error diagnostics when IRTranslation fails.
Tim Northover [Tue, 8 Nov 2016 01:12:17 +0000 (01:12 +0000)]
GlobalISel: improve error diagnostics when IRTranslation fails.

llvm-svn: 286190

7 years agoCorrectly ignore unnamed bit-fields when checking whether a union has fields.
Richard Smith [Tue, 8 Nov 2016 01:07:26 +0000 (01:07 +0000)]
Correctly ignore unnamed bit-fields when checking whether a union has fields.

llvm-svn: 286189

7 years ago[asan] Fix asan-rt bitness issues in asan_device_setup on Android.
Evgeniy Stepanov [Tue, 8 Nov 2016 00:59:58 +0000 (00:59 +0000)]
[asan] Fix asan-rt bitness issues in asan_device_setup on Android.

asan_device_setup script is using LD_PRELOAD to inject the ASan
runtime library into the Zygote process. This breaks when the Zygote
or any of its descendants spawn a process with different bitness due
to the fact that the ASan-RT library name includes the target
architecture.

The fix is to preload the library through a symlink which has the
same name in lib and lib64.

llvm-svn: 286188

7 years ago[asan] Fix one test on Android N.
Evgeniy Stepanov [Tue, 8 Nov 2016 00:59:54 +0000 (00:59 +0000)]
[asan] Fix one test on Android N.

A fake strtol interceptor should at least make forward progress.

llvm-svn: 286187

7 years ago[clang-tidy] Don't warn implicit variables in peformance-unnecessary-copy-initialization.
Haojian Wu [Tue, 8 Nov 2016 00:45:34 +0000 (00:45 +0000)]
[clang-tidy] Don't warn implicit variables in peformance-unnecessary-copy-initialization.

Summary:

This will prevent the check warning the variables which have been
implicitly added by compiler, like the following case (in for-range loop):

  the variable '__end' is copy-constructed from a const reference...

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 286186

7 years agoGlobalISel: support selecting G_SELECT on AArch64.
Tim Northover [Tue, 8 Nov 2016 00:45:29 +0000 (00:45 +0000)]
GlobalISel: support selecting G_SELECT on AArch64.

llvm-svn: 286185

7 years ago[CMake] Fix llvm_setup_rpath function
Mandeep Singh Grang [Tue, 8 Nov 2016 00:45:05 +0000 (00:45 +0000)]
[CMake] Fix llvm_setup_rpath function

Summary:
Set _install_rpath to CMAKE_INSTALL_RPATH if it is defined, so that eventually
INSTALL_RPATH is set to CMAKE_INSTALL_RPATH.
The "if(NOT DEFINED CMAKE_INSTALL_RPATH)" was missing a corresponding else
clause.
This also cleans up the fix made in r285908.

Patch by Azharuddin Mohammed

Reviewers: john.brawn, sgundapa, beanz

Subscribers: chapuni, mgorny, llvm-commits

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

llvm-svn: 286184

7 years agoGlobalISel: constrain PHI registers on AArch64.
Tim Northover [Tue, 8 Nov 2016 00:34:06 +0000 (00:34 +0000)]
GlobalISel: constrain PHI registers on AArch64.

Self-referencing PHI nodes need their destination operands to be constrained
because nothing else is likely to do so. For now we just pick a register class
naively.

Patch mostly by Ahmed again.

llvm-svn: 286183

7 years agocmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS
Justin Bogner [Mon, 7 Nov 2016 23:46:05 +0000 (23:46 +0000)]
cmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS

We need to apply the same export logic in clang as in llvm for
LLVM_DISTRIBUTION_COMPONENTS, or the clang exports will be invalid
when we use this config.

This makes using distribution components without setting
LLVM_TOOLCHAIN_ONLY=On work correctly.

llvm-svn: 286181

7 years ago[LTO] Add error message on IO error in compileOptimizedToFile.
Eli Friedman [Mon, 7 Nov 2016 23:43:07 +0000 (23:43 +0000)]
[LTO] Add error message on IO error in compileOptimizedToFile.

(No testcase because it's difficult to force an error here.)

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

llvm-svn: 286177

7 years agoSimplify the PrintableRepresentationSpecialCases code; we never used the ePrintableRe...
Enrico Granata [Mon, 7 Nov 2016 23:32:20 +0000 (23:32 +0000)]
Simplify the PrintableRepresentationSpecialCases code; we never used the ePrintableRepresentationSpecialCasesOnly value and with enum classes the names doesn't need to be that long

llvm-svn: 286176

7 years ago[AArch64] Remove dead check prefixes after r286110. NFC.
Chad Rosier [Mon, 7 Nov 2016 23:13:59 +0000 (23:13 +0000)]
[AArch64] Remove dead check prefixes after r286110. NFC.

llvm-svn: 286174

7 years ago[AArch64] Rename test to reflect changes after r286110. NFC.
Chad Rosier [Mon, 7 Nov 2016 23:13:55 +0000 (23:13 +0000)]
[AArch64] Rename test to reflect changes after r286110. NFC.

llvm-svn: 286173

7 years ago[opt-viewer] Avoid division by zero
Adam Nemet [Mon, 7 Nov 2016 23:12:13 +0000 (23:12 +0000)]
[opt-viewer] Avoid division by zero

llvm-svn: 286172

7 years ago[AMDGPU] Allow hoisting of comparisons out of a loop and eliminate condition copies
Stanislav Mekhanoshin [Mon, 7 Nov 2016 23:04:50 +0000 (23:04 +0000)]
[AMDGPU] Allow hoisting of comparisons out of a loop and eliminate condition copies

Codegen prepare sinks comparisons close to a user is we have only one register
for conditions. For AMDGPU we have many SGPRs capable to hold vector conditions.
Changed BE to report we have many condition registers. That way IR LICM pass
would hoist an invariant comparison out of a loop and codegen prepare will not
sink it.

With that done a condition is calculated in one block and used in another.
Current behavior is to store workitem's condition in a VGPR using v_cndmask
and then restore it with yet another v_cmp instruction from that v_cndmask's
result. To mitigate the issue a forward propagation of a v_cmp 64 bit result
to an user is implemented. Additional side effect of this is that we may
consume less VGPRs in a cost of more SGPRs in case if holding of multiple
conditions is needed, and that is a clear win in most cases.

llvm-svn: 286171

7 years agoUserExpression::Evaluate only returns a non-empty ValueObjectSP
Jim Ingham [Mon, 7 Nov 2016 22:47:01 +0000 (22:47 +0000)]
UserExpression::Evaluate only returns a non-empty ValueObjectSP
if it returns eExpressionCompleted.  Don't try to get the error
from the ValueObjectSP if that's not true.

I just have a report of this from the field, I don't know how
to make it fail yet.

<rdar://problem/29113004>

llvm-svn: 286170

7 years ago[OptDiag, opt-viewer] Save callee's location and display as link
Adam Nemet [Mon, 7 Nov 2016 22:41:13 +0000 (22:41 +0000)]
[OptDiag, opt-viewer] Save callee's location and display as link

With this we get a new field in the YAML record if the value being
streamed out has a debug location.  For examples, please see the changes
to the tests.

This is then used in opt-viewer to display a link for the callee
function in the inlining remarks.

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

llvm-svn: 286169

7 years ago[AArch64] Transfer memory operands when lowering vector load/store intrinsics
Sanjin Sijaric [Mon, 7 Nov 2016 22:39:02 +0000 (22:39 +0000)]
[AArch64] Transfer memory operands when lowering vector load/store intrinsics

Summary:
Some vector loads and stores generated from AArch64 intrinsics alias each other
unnecessarily, preventing better scheduling.  We just need to transfer memory
operands during lowering.

Reviewers: mcrosier, t.p.northover, jmolloy

Subscribers: aemerson, rengolin, llvm-commits

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

llvm-svn: 286168

7 years ago[docs] Add a pointer to ExitOnError to the discussion of handleErrors in the
Lang Hames [Mon, 7 Nov 2016 22:33:13 +0000 (22:33 +0000)]
[docs] Add a pointer to ExitOnError to the discussion of handleErrors in the
programmer's manual.

ExitOnError is often a better alternative to handleErrors for tool code. This
patch makes it easier to find the ExitOnError discussion when reading the
handleErrors section.

Thanks to Peter Collingbourne for the suggestion.

llvm-svn: 286167

7 years ago[tsan] Change nullptr to NULL in realloc-zero.cc test. Some environments don't have...
Kuba Brecka [Mon, 7 Nov 2016 22:26:13 +0000 (22:26 +0000)]
[tsan] Change nullptr to NULL in realloc-zero.cc test. Some environments don't have nullptr.

llvm-svn: 286166

7 years ago[TRE] Remove dead code
Sanjoy Das [Mon, 7 Nov 2016 22:17:37 +0000 (22:17 +0000)]
[TRE] Remove dead code

Address review by Eli Friedman on rL286147.

llvm-svn: 286165

7 years agoFix typo in CMakeLists.txt: provide the path to libcxx checkout and not the include...
Mehdi Amini [Mon, 7 Nov 2016 22:16:27 +0000 (22:16 +0000)]
Fix typo in CMakeLists.txt: provide the path to libcxx checkout and not the include subdir

llvm-svn: 286164

7 years ago[doc] Add documentation about how to use a monorepo
Mehdi Amini [Mon, 7 Nov 2016 22:14:09 +0000 (22:14 +0000)]
[doc] Add documentation about how to use a monorepo

llvm-svn: 286163

7 years agoAdd experimental support for unofficial monorepo-like directory layout
Mehdi Amini [Mon, 7 Nov 2016 22:13:38 +0000 (22:13 +0000)]
Add experimental support for unofficial monorepo-like directory layout

Summary:
This allows to have clang and llvm and the other subprojects
side-by-side instead of nested. This can be used with the monorepo or
multiple repos.

It will help having a single set of sources checked out but allows to
have a build directory with llvm and another one with llvm+clang.
Basically it abstracts LLVM_EXTERNAL_xxxx_SOURCE_DIR making it more
convenient by adopting a convention.

Reviewers: bogner, beanz, jlebar

Subscribers: mgorny, llvm-commits

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

llvm-svn: 286162

7 years agoFix libcxxabi CMake detection of libcxx path to handle LLVM_EXTERNAL_LIBCXX_SOURCE_DI...
Mehdi Amini [Mon, 7 Nov 2016 22:07:43 +0000 (22:07 +0000)]
Fix libcxxabi CMake detection of libcxx path to handle LLVM_EXTERNAL_LIBCXX_SOURCE_DIR flag

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

llvm-svn: 286161

7 years ago[WebAssembly] Emit a BasePointer when we have overly-aligned stack objects
Derek Schuff [Mon, 7 Nov 2016 22:00:48 +0000 (22:00 +0000)]
[WebAssembly] Emit a BasePointer when we have overly-aligned stack objects

Because we shift the stack pointer by an unknown amount, we need an
additional pointer. In the case where we have variable-size objects
as well, we can't reuse the frame pointer, thus three pointers.

Patch by Jacob Gravelle

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

llvm-svn: 286160

7 years agoReset debug loc to OldInduction in InnerLoopVectorizer::createInductionVariable....
Dehao Chen [Mon, 7 Nov 2016 21:59:40 +0000 (21:59 +0000)]
Reset debug loc to OldInduction in InnerLoopVectorizer::createInductionVariable. (NFC)

This is to prevent SetInsertionPoint from setting debug loc to Latch->getTerminator().

llvm-svn: 286159

7 years ago[ELF] Use the SystemV hash in libObject instead of rolling our own.
Davide Italiano [Mon, 7 Nov 2016 21:56:56 +0000 (21:56 +0000)]
[ELF] Use the SystemV hash in libObject instead of rolling our own.

llvm-svn: 286158

7 years ago[lib/Object] Rename elf_hash to hashSysV.
Davide Italiano [Mon, 7 Nov 2016 21:56:04 +0000 (21:56 +0000)]
[lib/Object] Rename elf_hash to hashSysV.

This is more clear, as we have also GNU hash these days..

llvm-svn: 286157

7 years ago[clang-tidy] Fix a regression issue introduced by r285239.
Haojian Wu [Mon, 7 Nov 2016 21:46:24 +0000 (21:46 +0000)]
[clang-tidy] Fix a regression issue introduced by r285239.

Summary:
r285239 changes the behavior of AST CXXDefaultArgExpr node.

Update `modernize-use-nullptr` to handle CXXDefaultArgExpr correctly.

Reviewers: alexfh

Subscribers: cfe-commits

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

llvm-svn: 286156

7 years ago[clang-tidy] Move incomplete type test into separate test file
Felix Berger [Mon, 7 Nov 2016 21:45:58 +0000 (21:45 +0000)]
[clang-tidy] Move incomplete type test into separate test file

Summary: Move in complete type test which does not compile into its own test file.

Reviewers: alexfh, sbenza, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 286155

7 years ago[index] Handle properly C++14's template variables.
Argyrios Kyrtzidis [Mon, 7 Nov 2016 21:20:15 +0000 (21:20 +0000)]
[index] Handle properly C++14's template variables.

- Infer the right symbol kind.
- Provide a templated USR, similar to how we handle class templates.

rdar://28980398

llvm-svn: 286154

7 years ago[index] Make sure to mark class template symbols as having 'generic' sub-kind.
Argyrios Kyrtzidis [Mon, 7 Nov 2016 21:20:08 +0000 (21:20 +0000)]
[index] Make sure to mark class template symbols as having 'generic' sub-kind.

llvm-svn: 286153

7 years agoName some anonymous structs to avoid using a (very common) extension.
John McCall [Mon, 7 Nov 2016 21:13:27 +0000 (21:13 +0000)]
Name some anonymous structs to avoid using a (very common) extension.

llvm-svn: 286152

7 years agoUpdated ASTMerge/macro.m to use _Nullable.
Sean Callanan [Mon, 7 Nov 2016 21:10:31 +0000 (21:10 +0000)]
Updated ASTMerge/macro.m to use _Nullable.

llvm-svn: 286151

7 years ago[lit] Print negative exit codes on Windows in hex
Reid Kleckner [Mon, 7 Nov 2016 21:06:20 +0000 (21:06 +0000)]
[lit] Print negative exit codes on Windows in hex

Negative exit codes are usually exceptions. They're easier to recognize
in hex. Compare -1073741502 to 0xc0000142.

llvm-svn: 286150

7 years agoUse -fsanitize-recover instead of -mllvm -msan-keep-going: tests.
Evgeniy Stepanov [Mon, 7 Nov 2016 21:02:56 +0000 (21:02 +0000)]
Use -fsanitize-recover instead of -mllvm -msan-keep-going: tests.

Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: unit tests.

Reviewers: eugenis

Subscribers: llvm-commits

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

Patch by Aleksey Shlyapnikov.

llvm-svn: 286149

7 years agoUse -fsanitize-recover instead of -mllvm -msan-keep-going: clang.
Evgeniy Stepanov [Mon, 7 Nov 2016 21:02:11 +0000 (21:02 +0000)]
Use -fsanitize-recover instead of -mllvm -msan-keep-going: clang.

Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going: pass -fsanitize-recover value to msan.

Reviewers: eugenis

Subscribers: cfe-commits

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

Patch by Aleksey Shlyapnikov.

llvm-svn: 286148

7 years agoAvoid tail recursion elimination across calls with operand bundles
Sanjoy Das [Mon, 7 Nov 2016 21:01:49 +0000 (21:01 +0000)]
Avoid tail recursion elimination across calls with operand bundles

Summary:
In some specific scenarios with well understood operand bundle types
(like `"deopt"`) it may be possible to go ahead and convert recursion to
iteration, but TailRecursionElimination does not have that logic today
so avoid doing the right thing for now.

I need some input on whether `"funclet"` operand bundles should also
block tail recursion elimination.  If not, I'll allow TRE across calls
with `"funclet"` operand bundles and add a test case.

Reviewers: rnk, majnemer, nlewycky, ahatanak

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 286147

7 years ago[lib/Object] Modernize. NFCI.
Davide Italiano [Mon, 7 Nov 2016 21:01:42 +0000 (21:01 +0000)]
[lib/Object] Modernize. NFCI.

llvm-svn: 286146

7 years agoUse -fsanitize-recover instead of -mllvm -msan-keep-going.
Evgeniy Stepanov [Mon, 7 Nov 2016 21:00:10 +0000 (21:00 +0000)]
Use -fsanitize-recover instead of -mllvm -msan-keep-going.

Summary: Use -fsanitize-recover instead of -mllvm -msan-keep-going.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 286145

7 years agoWhen the ASTImporter imports a source location, it avoids importing macro
Sean Callanan [Mon, 7 Nov 2016 20:42:25 +0000 (20:42 +0000)]
When the ASTImporter imports a source location, it avoids importing macro
expansions by calling getSpellingLoc(). That's great in most cases, but for
macros defined in the '<built-in>' source file, the source file is invalid
and does not import correctly, causing an assertion failure (the assertion
is Invalid SLocOffset or bad function choice).

A more reliable way to avoid this is to use getFileLoc(), which does not
return built-in locations. This avoids the crash but still preserves valid
source locations.

I've added a testcase that covers the previously crashing scenario.

https://reviews.llvm.org/D26054

llvm-svn: 286144

7 years agoAdd tests for r286139.
Jordan Rose [Mon, 7 Nov 2016 20:40:16 +0000 (20:40 +0000)]
Add tests for r286139.

llvm-svn: 286141

7 years agoFix `git-llvm` script to handle `git worktree` setups correctly
Mehdi Amini [Mon, 7 Nov 2016 20:35:02 +0000 (20:35 +0000)]
Fix `git-llvm` script to handle `git worktree` setups correctly

llvm-svn: 286140

7 years agoDisallow StringRef assignment from temporary std::strings.
Jordan Rose [Mon, 7 Nov 2016 20:34:16 +0000 (20:34 +0000)]
Disallow StringRef assignment from temporary std::strings.

Similar to r283798, this prevents accidentally referring to temporary
storage that goes out of scope by the end of the statement:

  someStringRef = getStringByValue();
  someStringRef = (Twine("-") + otherString).str();

Note that once again the constructor still has this problem:

  StringRef someStringRef = getStringByValue();

because once again we occasionally rely on this in calls:

  takesStringRef(getStringByValue());
  takesStringRef(Twine("-") + otherString);

Still, it's a step.

llvm-svn: 286139

7 years agoAdd some facilities to work with a git monorepo (experimental setup)
Mehdi Amini [Mon, 7 Nov 2016 20:00:47 +0000 (20:00 +0000)]
Add some facilities to work with a git monorepo (experimental setup)

Add a new script in llvm/utils/git-svn/. When present in the $PATH,
it enables a `git llvm` command. It is providing at this
point only the ability to push from the git monorepo: `git llvm push`.
It is intended to evolves with more features, for instance I plan on
features like `git llvm show r284955` to help working with sequential
revision numbers.
The push feature is taken from Justin Lebar's script available here:
https://github.com/jlebar/llvm-repo-tools/

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

llvm-svn: 286138

7 years ago[AArch64] Remove dead store. Found by gcc7.
Davide Italiano [Mon, 7 Nov 2016 19:11:25 +0000 (19:11 +0000)]
[AArch64] Remove dead store. Found by gcc7.

llvm-svn: 286137

7 years ago[tsan] Cast floating-point types correctly when instrumenting atomic accesses, compil...
Kuba Brecka [Mon, 7 Nov 2016 19:10:13 +0000 (19:10 +0000)]
[tsan] Cast floating-point types correctly when instrumenting atomic accesses, compiler-rt part

Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

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

llvm-svn: 286136

7 years ago[tsan] Cast floating-point types correctly when instrumenting atomic accesses, LLVM...
Kuba Brecka [Mon, 7 Nov 2016 19:09:56 +0000 (19:09 +0000)]
[tsan] Cast floating-point types correctly when instrumenting atomic accesses, LLVM part

Although rare, atomic accesses to floating-point types seem to be valid, i.e. `%a = load atomic float ...`. The TSan instrumentation pass however tries to emit inttoptr, which is incorrect, we should use a bitcast here. Anyway, IRBuilder already has a convenient helper function for this.

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

llvm-svn: 286135

7 years agoAMDGPU: Remove unnecessary and on conditional branch
Matt Arsenault [Mon, 7 Nov 2016 19:09:33 +0000 (19:09 +0000)]
AMDGPU: Remove unnecessary and on conditional branch

The comment explaining why this was necessary is incorrect
in its description of v_cmp's behavior for inactive workitems.

llvm-svn: 286134

7 years agoAMDGPU: Preserve vcc undef flags when inverting branch
Matt Arsenault [Mon, 7 Nov 2016 19:09:27 +0000 (19:09 +0000)]
AMDGPU: Preserve vcc undef flags when inverting branch

If the branch was on a read-undef of vcc, passes that used
analyzeBranch to invert the branch condition wouldn't preserve
the undef flag resulting in a verifier error.

Fixes verifier failures in a future commit.

Also fix verifier error when inserting copy for vccz
corruption bug.

llvm-svn: 286133

7 years agoFix memory leak caused by r286096.
Eric Liu [Mon, 7 Nov 2016 18:40:41 +0000 (18:40 +0000)]
Fix memory leak caused by r286096.

llvm-svn: 286132

7 years agoRemove Go Attribute type that was deleted from the C API in r286062.
David L. Jones [Mon, 7 Nov 2016 18:38:49 +0000 (18:38 +0000)]
Remove Go Attribute type that was deleted from the C API in r286062.

Summary:
The C++ side of the Go bindings were updated in r286085, r286086, and r286087,
but those did not remove this type.

Reviewers: djasper

Subscribers: axw

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

llvm-svn: 286131

7 years agoTest commit, deleted empty line at the end of README.txt
Stanislav Mekhanoshin [Mon, 7 Nov 2016 18:31:21 +0000 (18:31 +0000)]
Test commit, deleted empty line at the end of README.txt

llvm-svn: 286130

7 years ago[OPENMP] Fixed codegen for __real/__imag expressions in atomic
Alexey Bataev [Mon, 7 Nov 2016 18:15:02 +0000 (18:15 +0000)]
[OPENMP] Fixed codegen for __real/__imag expressions in atomic
constructs.

For __real/__imag unary expressions clang emits lvalue with the
associated type from the original complex expression, but not the
underlying builtin integer or float type. This causes crash in codegen
for atomic constructs, if __real/__imag expression are used in atomic
  constructs.

llvm-svn: 286129

7 years ago[X86] Fix test checks script to satisfy pyflakes
Zvi Rackover [Mon, 7 Nov 2016 18:08:19 +0000 (18:08 +0000)]
[X86] Fix test checks script to satisfy pyflakes

- Remove unused imports.
- Initialize the variable 'name' before its (static) uses, and rename it to a
  more descriptive name.

llvm-svn: 286128

7 years ago[MemCpyOpt] Don't emit IR in an unspecified order
Benjamin Kramer [Mon, 7 Nov 2016 17:47:28 +0000 (17:47 +0000)]
[MemCpyOpt] Don't emit IR in an unspecified order

Argument evaluation order is one of the edge cases where Clang differs
from GCC, yielding different IR depending on which compiler LLVM was
built with. Make the order deterministic and tune the test to actually
verify the order instead of trying to hide it.

llvm-svn: 286126

7 years ago[X86] Fix test checks script to handle run lines with no pipe checks
Zvi Rackover [Mon, 7 Nov 2016 17:47:21 +0000 (17:47 +0000)]
[X86] Fix test checks script to handle run lines with no pipe checks

Fixes crashes in tests such as test/CodeGen/X86/masked_gather_scatter.ll which
contains a RUN: with no pipe chain.

llvm-svn: 286125

7 years agoRevert "Add some facilities to work with a git monorepo (experimental setup)"
Mehdi Amini [Mon, 7 Nov 2016 17:43:08 +0000 (17:43 +0000)]
Revert "Add some facilities to work with a git monorepo (experimental setup)"

This reverts commit r286123, accidentally commited while testing itself...

llvm-svn: 286124

7 years agoAdd some facilities to work with a git monorepo (experimental setup)
Mehdi Amini [Mon, 7 Nov 2016 17:40:28 +0000 (17:40 +0000)]
Add some facilities to work with a git monorepo (experimental setup)

Summary:
Some changes are made to cmake, especially the addition of a new
LLVM_ENABLE_PROJECTS option that makes the build system aware of
the monorepo directory structure.

Also a new script is added in llvm/utils/git-svn/. When present in
the $PATH, it enables a `git llvm` command. It is providing at this
point only the ability to push from the git monorepo: `git llvm push`.
It is intended to evolves with more features, for instance I plan on
features like `git llvm show r284955` to help working with sequential
revision numbers.
The push feature is taken from Justin Lebar's script available here:
https://github.com/jlebar/llvm-repo-tools/

Reviewers: jlebar

Subscribers: mgorny, modocache, llvm-commits

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

llvm-svn: 286123

7 years agoFix use-of-temporary with StringRef in code coverage
Jordan Rose [Mon, 7 Nov 2016 17:28:04 +0000 (17:28 +0000)]
Fix use-of-temporary with StringRef in code coverage

The fixed code is basically identical to the same loop below, which
might indicate an opportunity for refactoring. I just wanted to fix
the use-of-temporary issue.

Caught by adding a similar check to StringRef as r283798 did for
ArrayRef. I'll be upstreaming that soon.

Reviewed by Vedant Kumar as https://reviews.llvm.org/D26317.

llvm-svn: 286122

7 years ago[www] Update the link to the 'include what you use' project
Alex Lorenz [Mon, 7 Nov 2016 16:56:19 +0000 (16:56 +0000)]
[www] Update the link to the 'include what you use' project

llvm-svn: 286121

7 years agoAMDGPU: Try to fix (non-clang?) bot builds
Matt Arsenault [Mon, 7 Nov 2016 16:52:50 +0000 (16:52 +0000)]
AMDGPU: Try to fix (non-clang?) bot builds

llvm-svn: 286120