platform/upstream/llvm.git
8 years agoRemove unnecessary explicit
Adam Nemet [Thu, 29 Sep 2016 16:01:34 +0000 (16:01 +0000)]
Remove unnecessary explicit

llvm-svn: 282722

8 years ago[libFuzzer] initialize ValueBitMap::NumBits
Kostya Serebryany [Thu, 29 Sep 2016 15:51:28 +0000 (15:51 +0000)]
[libFuzzer] initialize ValueBitMap::NumBits

llvm-svn: 282721

8 years ago[X86][SSE] Added common helper for shuffle mask constant pool decodes.
Simon Pilgrim [Thu, 29 Sep 2016 15:25:48 +0000 (15:25 +0000)]
[X86][SSE] Added common helper for shuffle mask constant pool decodes.

The shuffle mask decodes have a large amount of repeated code extracting/splitting mask values from Constant data.

This patch pulls all of this duplicated code into a single helper function to identify undef elements and combine/split constant integer data into the requested shuffle mask elements.

Updated PSHUFB/VPERMIL/VPERMIL2/VPPERM decoders to use it (VPERMV/VPERMV3 could be converted as well in the future).

llvm-svn: 282720

8 years ago[X86] Add explicit test triple to make windows/msvc builds happier
Simon Pilgrim [Thu, 29 Sep 2016 15:10:09 +0000 (15:10 +0000)]
[X86] Add explicit test triple to make windows/msvc builds happier

llvm-svn: 282719

8 years ago[docs] Fix a broken URL in 'HowToAddABuilder'
Dylan McKay [Thu, 29 Sep 2016 13:29:49 +0000 (13:29 +0000)]
[docs] Fix a broken URL in 'HowToAddABuilder'

llvm-svn: 282718

8 years agoTest commit. NFC.
Volkan Keles [Thu, 29 Sep 2016 13:04:37 +0000 (13:04 +0000)]
Test commit. NFC.

llvm-svn: 282717

8 years ago[ELF][MIPS] Set GP0 value to zero in case of relocatable object generation
Simon Atanasyan [Thu, 29 Sep 2016 12:58:48 +0000 (12:58 +0000)]
[ELF][MIPS] Set GP0 value to zero in case of relocatable object generation

LLD does not update relocations addends when generate a relocatable
object. That is why we should not write a non-zero GP0 value into
the .reginfo and .MIPS.options sections. And we should not accept input
object files with non-zero GP0 value because we cannot handle them
properly.

llvm-svn: 282716

8 years ago[ELF][MIPS] Do not use a binary input file in the test case. NFC
Simon Atanasyan [Thu, 29 Sep 2016 12:58:42 +0000 (12:58 +0000)]
[ELF][MIPS] Do not use a binary input file in the test case. NFC

llvm-svn: 282715

8 years ago[ELF][MIPS] Setup STO_MIPS_PIC flag for PIC symbols when generate a relocatable object
Simon Atanasyan [Thu, 29 Sep 2016 12:58:36 +0000 (12:58 +0000)]
[ELF][MIPS] Setup STO_MIPS_PIC flag for PIC symbols when generate a relocatable object

In case of linking PIC and non-PIC code together and generation of a
relocatable object, all PIC symbols should have STO_MIPS_PIC flag in the
symbol table of the ouput file.

llvm-svn: 282714

8 years ago[docs] Fix typo in 'How to add a builder'
Dylan McKay [Thu, 29 Sep 2016 12:51:26 +0000 (12:51 +0000)]
[docs] Fix typo in 'How to add a builder'

llvm-svn: 282713

8 years agoRevert "[AVR] Add instruction selection lowering code"
Dylan McKay [Thu, 29 Sep 2016 12:49:18 +0000 (12:49 +0000)]
Revert "[AVR] Add instruction selection lowering code"

I accidentally comitted it.

llvm-svn: 282712

8 years ago[AVR] Add instruction selection lowering code
Dylan McKay [Thu, 29 Sep 2016 12:44:38 +0000 (12:44 +0000)]
[AVR] Add instruction selection lowering code

Summary: This adds AVRISelLowering.cpp

Reviewers: kparzysz, arsenm

Subscribers: wdng, beanz, mgorny

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

llvm-svn: 282711

8 years agoRevert "[PR30341] Alias must point to a definition"
Aditya Kumar [Thu, 29 Sep 2016 11:37:23 +0000 (11:37 +0000)]
Revert "[PR30341] Alias must point to a definition"

This reverts commit r282679.

Ninja check fails, reverting to debug the issue.

llvm-svn: 282710

8 years ago[ELF] - Fixed crash on invalid input.
George Rimar [Thu, 29 Sep 2016 11:10:40 +0000 (11:10 +0000)]
[ELF] - Fixed crash on invalid input.

I took the input from https://llvm.org/bugs/show_bug.cgi?id=30540, it was
"id_000000,sig_11,src_000000,op_flip1,pos_98"

File contains invalid symbol name offset (too large) and lld just crashes,
patch fixes the issue.

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

llvm-svn: 282709

8 years agoDon't GC non-alloc mergeable section pieces
Eugene Leviant [Thu, 29 Sep 2016 10:27:10 +0000 (10:27 +0000)]
Don't GC non-alloc mergeable section pieces

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

llvm-svn: 282708

8 years ago[ELF] - Testcases: remove "invalid-" prefix from inputs located in "invalid" subfolde...
George Rimar [Thu, 29 Sep 2016 09:39:06 +0000 (09:39 +0000)]
[ELF] - Testcases: remove "invalid-" prefix from inputs located in "invalid" subfolder. NFC.

llvm-svn: 282707

8 years ago[ELF] - Rename testcase folder from "Invalid" to "invalid". NFC.
George Rimar [Thu, 29 Sep 2016 09:30:01 +0000 (09:30 +0000)]
[ELF] - Rename testcase folder from "Invalid" to "invalid". NFC.

llvm-svn: 282706

8 years ago[ELF] Change the way we compute file offsets
Eugene Leviant [Thu, 29 Sep 2016 09:20:33 +0000 (09:20 +0000)]
[ELF] Change the way we compute file offsets

If we two sections reside in the same PT_LOAD segment,
we compute second section using the following formula:
Off2 = Off1 + VA2 - VA1. This allows OS kernel allocating
sections correctly when loading an image.

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

llvm-svn: 282705

8 years ago[modules] Centralize the module cache.
Vassil Vassilev [Thu, 29 Sep 2016 08:14:06 +0000 (08:14 +0000)]
[modules] Centralize the module cache.

This reduces the build size from 17G to 1.9G on my machine.

llvm-svn: 282704

8 years agoRevert r282692: Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic...
Igor Kudrin [Thu, 29 Sep 2016 08:11:57 +0000 (08:11 +0000)]
Revert r282692: Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

The test breaks build bots.

llvm-svn: 282703

8 years agoXFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set
Jonas Hahnfeld [Thu, 29 Sep 2016 07:43:08 +0000 (07:43 +0000)]
XFAIL Driver/darwin-stdlib.cpp if CLANG_DEFAULT_CXX_STDLIB is set

Until someone rewrites the stdlib logic for Darwin so that we don't need
to pass down the -stdlib argument to cc1.
(see https://llvm.org/bugs/show_bug.cgi?id=30548)

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

llvm-svn: 282701

8 years agoAdd symbols introduced with -m32 build
Vitaly Buka [Thu, 29 Sep 2016 07:08:42 +0000 (07:08 +0000)]
Add symbols introduced with -m32 build

llvm-svn: 282695

8 years agoLimit script to sanitizers as SCUDO does not pass tests if we add symbolizer
Vitaly Buka [Thu, 29 Sep 2016 07:08:40 +0000 (07:08 +0000)]
Limit script to sanitizers as SCUDO does not pass tests if we add symbolizer

llvm-svn: 282694

8 years ago[X86] Really fix the FileCheck line from r282690.
Craig Topper [Thu, 29 Sep 2016 06:49:21 +0000 (06:49 +0000)]
[X86] Really fix the FileCheck line from r282690.

Why does Folded Spill comments print with a different number of # characters on different systems?

llvm-svn: 282693

8 years ago[libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memor...
Igor Kudrin [Thu, 29 Sep 2016 06:38:06 +0000 (06:38 +0000)]
[libc++abi] Use fallback_malloc to allocate __cxa_eh_globals in case of dynamic memory exhaustion.

Throwing an exception for the first time may lead to call calloc to
allocate memory for __cxa_eh_globals. If the memory pool is exhausted
at that moment, it results in abnormal termination of the program.

This patch addresses the issue by using fallback_malloc in that case.

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

llvm-svn: 282692

8 years ago[AVX-512] Fix a check line from r282690.
Craig Topper [Thu, 29 Sep 2016 06:37:21 +0000 (06:37 +0000)]
[AVX-512] Fix a check line from r282690.

llvm-svn: 282691

8 years ago[AVX-512] Support spills of XMM16-31 and YMM16-31 when VLX isn't available.
Craig Topper [Thu, 29 Sep 2016 06:07:09 +0000 (06:07 +0000)]
[AVX-512] Support spills of XMM16-31 and YMM16-31 when VLX isn't available.

This adds new pseudo instructions that can be selected during register allocation to represent loads and stores of XMM/YMM registers when AVX512F is available, but VLX isn't. They will be converted to VEX encoded moves if the register turns out to be XMM0-15/YMM0-15. Otherwise either an EVEX VEXTRACT(store) or VBROADCAST(load) will be used.

Fixes one of the cases from PR29112.

llvm-svn: 282690

8 years ago[X86] Remove extra FileCheck lines that got left behind in r282688.
Craig Topper [Thu, 29 Sep 2016 06:07:07 +0000 (06:07 +0000)]
[X86] Remove extra FileCheck lines that got left behind in r282688.

llvm-svn: 282689

8 years ago[AVX-512] Replicate pattern from AVX to select VMOVDDUP for (v2f64 (X86VBroadcast...
Craig Topper [Thu, 29 Sep 2016 05:54:43 +0000 (05:54 +0000)]
[AVX-512] Replicate pattern from AVX to select VMOVDDUP for (v2f64 (X86VBroadcast f64:)). Add AVX512VL to command line of existing AVX2 test that hits this condition.

llvm-svn: 282688

8 years ago[X86] Add EVEX encoded VBROADCASTSS/SD and VPBROADCASTD/Q to execution domain fixing...
Craig Topper [Thu, 29 Sep 2016 05:54:39 +0000 (05:54 +0000)]
[X86] Add EVEX encoded VBROADCASTSS/SD and VPBROADCASTD/Q to execution domain fixing table.

llvm-svn: 282687

8 years ago[X86] Remove AddedComplexity adjustments that don't seem to be needed.
Craig Topper [Thu, 29 Sep 2016 05:54:34 +0000 (05:54 +0000)]
[X86] Remove AddedComplexity adjustments that don't seem to be needed.

llvm-svn: 282686

8 years ago[X86] Add 512-bit VPBROADCASTB and VPBROADCASTW tests.
Craig Topper [Thu, 29 Sep 2016 05:54:32 +0000 (05:54 +0000)]
[X86] Add 512-bit VPBROADCASTB and VPBROADCASTW tests.

llvm-svn: 282685

8 years ago[X86] Add VBROADCASTF128/VBROADCASTI128 to execution domain fixing tables.
Craig Topper [Thu, 29 Sep 2016 05:54:28 +0000 (05:54 +0000)]
[X86] Add VBROADCASTF128/VBROADCASTI128 to execution domain fixing tables.

llvm-svn: 282684

8 years agoAdd a unit test for an x86_64 assembly inspection of
Jason Molenda [Thu, 29 Sep 2016 04:01:43 +0000 (04:01 +0000)]
Add a unit test for an x86_64 assembly inspection of
a large stack frame with lots of spilled registers.

While writing the i386 version of this test, it looks
like I found a bug in the 32-bit instruction profiler
code.  I may ned to fix the assembly inspection engine
before I can finish writing that test, so I'm only
committing the 64-bit one tonight.

<rdar://problem/28509178>

llvm-svn: 282683

8 years agoMove verbose clang binaries detection
Vitaly Buka [Thu, 29 Sep 2016 03:53:20 +0000 (03:53 +0000)]
Move verbose clang binaries detection

llvm-svn: 282682

8 years ago[libc++] Add missing locale aliases
Shoaib Meenai [Thu, 29 Sep 2016 03:35:41 +0000 (03:35 +0000)]
[libc++] Add missing locale aliases

Add underscore aliases for strtof_l and strtod_l. _strtold_l exists in
VS 2013 and above, so fix that definition as a drive-by fix.

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

llvm-svn: 282681

8 years agoIR: Rename the tablegen'd Attributes file to .gen
Justin Bogner [Thu, 29 Sep 2016 03:35:19 +0000 (03:35 +0000)]
IR: Rename the tablegen'd Attributes file to .gen

All of the other tablegen'd include files are named .gen, so it's best
to be consistent.

llvm-svn: 282680

8 years ago[PR30341] Alias must point to a definition
Aditya Kumar [Thu, 29 Sep 2016 03:32:04 +0000 (03:32 +0000)]
[PR30341] Alias must point to a definition

Inlining the destructor caused the compiler to generate bad IR which failed the Verifier in the backend.
https://llvm.org/bugs/show_bug.cgi?id=30341

This patch disables alias to available_externally definitions.

Reviewers: eugenis, rsmith

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

llvm-svn: 282679

8 years agoAdd explanatory comment.
Peter Collingbourne [Thu, 29 Sep 2016 03:29:28 +0000 (03:29 +0000)]
Add explanatory comment.

llvm-svn: 282678

8 years agoRemove an unnecessary duplicate initialization of TLOF from the Mips
Eric Christopher [Thu, 29 Sep 2016 02:03:52 +0000 (02:03 +0000)]
Remove an unnecessary duplicate initialization of TLOF from the Mips
AsmPrinter. This was reinitializing the Mangler after we moved the
Mangler down to TLOF and causing us to have two different unnamed
global values accessed with the same name.

This should fix the problems on the ubsan tests here:
http://lab.llvm.org:8011/builders/clang-cmake-mips/builds/15307

llvm-svn: 282675

8 years agoRemove the default constructor and count variable from the Mangler since
Eric Christopher [Thu, 29 Sep 2016 02:03:50 +0000 (02:03 +0000)]
Remove the default constructor and count variable from the Mangler since
we can just use the size of the DenseMap as a unique counter.

llvm-svn: 282674

8 years agoUpdate comment about initializing TLOF with a pointer at the previous
Eric Christopher [Thu, 29 Sep 2016 02:03:47 +0000 (02:03 +0000)]
Update comment about initializing TLOF with a pointer at the previous
line or the other commented out place.

llvm-svn: 282673

8 years agoTidy spelling and grammar.
Eric Christopher [Thu, 29 Sep 2016 02:03:44 +0000 (02:03 +0000)]
Tidy spelling and grammar.

llvm-svn: 282672

8 years ago[AArch64] Fix test case ELF/aarch64-tls-le.s
Lei Liu [Thu, 29 Sep 2016 02:01:27 +0000 (02:01 +0000)]
[AArch64] Fix test case ELF/aarch64-tls-le.s

The add instruction should be generated with shift bit (lsl #12).
Update the test case.

llvm-svn: 282671

8 years agoAttempt to fix Windows buildbots.
Rui Ueyama [Thu, 29 Sep 2016 01:59:03 +0000 (01:59 +0000)]
Attempt to fix Windows buildbots.

llvm-svn: 282670

8 years agoMachineFunction: Add missing newline in debug print()
Matthias Braun [Thu, 29 Sep 2016 01:47:42 +0000 (01:47 +0000)]
MachineFunction: Add missing newline in debug print()

Should not be a functional but an aesthetic change.

llvm-svn: 282669

8 years agoRemove unused #includes.
Rui Ueyama [Thu, 29 Sep 2016 01:45:22 +0000 (01:45 +0000)]
Remove unused #includes.

llvm-svn: 282668

8 years agoAMDGPU: Partially fix control flow at -O0
Matt Arsenault [Thu, 29 Sep 2016 01:44:16 +0000 (01:44 +0000)]
AMDGPU: Partially fix control flow at -O0

Fixes to allow spilling all registers at the end of the block
work with exec modifications. Don't emit s_and_saveexec_b64 for
if lowering, and instead emit copies. Mark control flow mask
instructions as terminators to get correct spill code placement
with fast regalloc, and then have a separate optimization pass
form the saveexec.

This should work if SGPRs are spilled to VGPRs, but
will likely fail in the case that an SGPR spills to memory
and no workitem takes a divergent branch.

llvm-svn: 282667

8 years agoScheduleDAGInstrs: There is no need to set OrigNode for MI SUnits; NFC
Matthias Braun [Thu, 29 Sep 2016 01:32:31 +0000 (01:32 +0000)]
ScheduleDAGInstrs: There is no need to set OrigNode for MI SUnits; NFC

llvm-svn: 282666

8 years agoLTO: Fix use-after-scope error.
Peter Collingbourne [Thu, 29 Sep 2016 01:28:36 +0000 (01:28 +0000)]
LTO: Fix use-after-scope error.

llvm-svn: 282665

8 years agoAdd comments.
Rui Ueyama [Thu, 29 Sep 2016 01:26:48 +0000 (01:26 +0000)]
Add comments.

llvm-svn: 282664

8 years agoRead addend from the correct location.
Rafael Espindola [Thu, 29 Sep 2016 01:20:40 +0000 (01:20 +0000)]
Read addend from the correct location.

llvm-svn: 282663

8 years ago[LTO] Fully qualify make_unique to make MSVC happy.
Davide Italiano [Thu, 29 Sep 2016 01:13:32 +0000 (01:13 +0000)]
[LTO] Fully qualify make_unique to make MSVC happy.

llvm-svn: 282662

8 years agoAArch64: Set shift bit of TLSLE HI12 add instruction
Lei Liu [Thu, 29 Sep 2016 01:05:48 +0000 (01:05 +0000)]
AArch64: Set shift bit of TLSLE HI12 add instruction

Summary: AArch64 LLVM assembler emits add instruction without shift bit to calculate the higher 12-bit address of TLS variables in local exec model.  This generates wrong code sequence to access TLS variables with thread offset larger than 0x1000.

Reviewers: t.p.northover, peter.smith, rovka

Subscribers: salim.nasser, aemerson, llvm-commits, rengolin

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

llvm-svn: 282661

8 years agoPartially revert overflow checking in last_write_time
Eric Fiselier [Thu, 29 Sep 2016 01:01:26 +0000 (01:01 +0000)]
Partially revert overflow checking in last_write_time

llvm-svn: 282660

8 years agoRe-commit the changes from r282565 that I had to back out because of
Jason Molenda [Thu, 29 Sep 2016 01:00:16 +0000 (01:00 +0000)]
Re-commit the changes from r282565 that I had to back out because of
a linux bot test failure.  That one is fixed; hopefully there won't
be any others turned up this time.

The eh_frame augmentation code wasn't working right after the
reorg/rewrite of the classes.  It works correctly now for the one
test that was failing - but we'll see what the test bots come up
with.

<rdar://problem/28509178>

llvm-svn: 282659

8 years agoUse InputFile::Symbol instead of auto for consistency.
Rui Ueyama [Thu, 29 Sep 2016 00:58:10 +0000 (00:58 +0000)]
Use InputFile::Symbol instead of auto for consistency.

llvm-svn: 282658

8 years agoFixed TestObjCStructArgument/i386; expressions can now call ObjC class methods.
Sean Callanan [Thu, 29 Sep 2016 00:45:33 +0000 (00:45 +0000)]
Fixed TestObjCStructArgument/i386; expressions can now call ObjC class methods.

<rdar://problem/28502241>

llvm-svn: 282657

8 years ago[ELF/LTO] Switch to the new resolution-based API.
Davide Italiano [Thu, 29 Sep 2016 00:40:08 +0000 (00:40 +0000)]
[ELF/LTO] Switch to the new resolution-based API.

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

llvm-svn: 282656

8 years ago[LTO] Add a FIXME, we shouldn't expose getComdat().
Davide Italiano [Thu, 29 Sep 2016 00:31:45 +0000 (00:31 +0000)]
[LTO] Add a FIXME, we shouldn't expose getComdat().

Thanks to Peter for the suggestion.

llvm-svn: 282655

8 years ago[LTO] Expose getComdatSymbolTable() to linkers.
Davide Italiano [Thu, 29 Sep 2016 00:29:33 +0000 (00:29 +0000)]
[LTO] Expose getComdatSymbolTable() to linkers.

llvm-svn: 282654

8 years agoIntroduced a null check to avoid a crash in a test on i386.
Sean Callanan [Thu, 29 Sep 2016 00:16:37 +0000 (00:16 +0000)]
Introduced a null check to avoid a crash in a test on i386.

llvm-svn: 282653

8 years agoMark P0127R3 as done, and replace its __has_feature check with the corresponding...
Richard Smith [Thu, 29 Sep 2016 00:08:05 +0000 (00:08 +0000)]
Mark P0127R3 as done, and replace its __has_feature check with the corresponding SD-6 macro.

llvm-svn: 282652

8 years agoP0127R2: Support type deduction for types of non-type template parameters in
Richard Smith [Wed, 28 Sep 2016 23:55:27 +0000 (23:55 +0000)]
P0127R2: Support type deduction for types of non-type template parameters in
C++1z.

Patch by James Touton! Some bugfixes and rebasing by me.

llvm-svn: 282651

8 years agoWisely choose sext or zext when widening IV.
Evgeny Stupachenko [Wed, 28 Sep 2016 23:39:39 +0000 (23:39 +0000)]
Wisely choose sext or zext when widening IV.

Summary:
The patch fixes regression caused by two earlier patches D18777 and D18867.

Reviewers: reames, sanjoy

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

From: Li Huang
llvm-svn: 282650

8 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Wed, 28 Sep 2016 23:16:01 +0000 (23:16 +0000)]
Next set of additional error checks for invalid Mach-O files for the
load command that uses the Mach::rpath_command type
but not used in llvm libObject code but used in llvm tool code.

This includes just the LC_RPATH load command.

llvm-svn: 282649

8 years agoFix an issue where libc++ changed the type information we get for std::map::iterator...
Enrico Granata [Wed, 28 Sep 2016 22:53:16 +0000 (22:53 +0000)]
Fix an issue where libc++ changed the type information we get for std::map::iterator, rendering LLDB unable to display elements vended by an iterator

Fixes <rdar://problem/28237521>

llvm-svn: 282648

8 years ago[CUDA] Disallow variable-length arrays in CUDA device code.
Justin Lebar [Wed, 28 Sep 2016 22:45:58 +0000 (22:45 +0000)]
[CUDA] Disallow variable-length arrays in CUDA device code.

Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 282647

8 years ago[CUDA] Disallow exceptions in device code.
Justin Lebar [Wed, 28 Sep 2016 22:45:54 +0000 (22:45 +0000)]
[CUDA] Disallow exceptions in device code.

Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 282646

8 years ago[Coroutines] Add proper mangling for operator co_await for MicrosoftABI
Gor Nishanov [Wed, 28 Sep 2016 22:37:17 +0000 (22:37 +0000)]
[Coroutines] Add proper mangling for operator co_await for MicrosoftABI

Reviewers: rnk, rsmith

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 282645

8 years ago[libc++] Clarify _LIBCPP_NEW_DELETE_VIS for Windows
Shoaib Meenai [Wed, 28 Sep 2016 22:28:51 +0000 (22:28 +0000)]
[libc++] Clarify _LIBCPP_NEW_DELETE_VIS for Windows

Replace a stale reference to cxx_EXPORTS with _LIBCPP_BUILDING_LIBRARY,
and clarify why the operator new and delete family of functions are
marked dllexport when building but *not* dllimport when including the
header externally.

The new code is identical to the intent of the old code (and would be
functionally equivalent were cxx_EXPORTS still defined when building
libc++). The overall behavior is not ideal, since Microsoft's operator
new and delete functions will get called instead of libc++'s, but I
think consistently calling msvcrt's functions is better than either
calling msvcrt's or libc++'s functions depending on header inclusion.

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

llvm-svn: 282644

8 years ago[RegisterBankInfo] Uniquely generate OperandsMapping.
Quentin Colombet [Wed, 28 Sep 2016 22:20:49 +0000 (22:20 +0000)]
[RegisterBankInfo] Uniquely generate OperandsMapping.

This is a step toward statically allocate InstructionMapping. Like the
previous few commits, the goal is to move toward a TableGen'ed like
structure with no dynamic allocation at all.

This should already improve compile time by getting rid of a bunch of
memmove of SmallVectors.

llvm-svn: 282643

8 years ago[RegisterBankInfo] Rework the APIs of ValueMapping.
Quentin Colombet [Wed, 28 Sep 2016 22:20:24 +0000 (22:20 +0000)]
[RegisterBankInfo] Rework the APIs of ValueMapping.

This is a preparatory commit for more TableGen-like structure.
NFC

llvm-svn: 282642

8 years agoFix bug where template argument deduction of a non-type template parameter used
Richard Smith [Wed, 28 Sep 2016 22:08:38 +0000 (22:08 +0000)]
Fix bug where template argument deduction of a non-type template parameter used
as a template argument in a template-id, from a null non-type template
argument, failed.

Extracted from a patch by James Touton!

llvm-svn: 282641

8 years agoMark libc++ internal globals with _LIBCPP_SAFE_STATIC.
Eric Fiselier [Wed, 28 Sep 2016 22:08:13 +0000 (22:08 +0000)]
Mark libc++ internal globals with _LIBCPP_SAFE_STATIC.

This patch applies the _LIBCPP_SAFE_STATIC attribute to internal globals,
most of which are locking primitives, in order to ensure that they can
safely be used during program startup.

This patch also fixes an unsafe static init issue with the global locks
used to implement atomic operations on shared pointers. Previously the
locks were initialized using a dynamically initialized pointer, so it was
possible that the pointer was uninitialized.

llvm-svn: 282640

8 years ago[sancov] introducing symbolized coverage files (.symcov)
Mike Aizatsky [Wed, 28 Sep 2016 21:39:28 +0000 (21:39 +0000)]
[sancov] introducing symbolized coverage files (.symcov)

Summary:
Answering any meaningful questions about .sancov files requires
accessing symbol information from the corresponding binary.

This change introduces a separate intermediate data structure and
format: symbolized coverage. It contains all symbol information that
is required to answer common queries:
- merging
- coverd/uncovered files and functions
- line status.

Also removing the html report functionality from sancov: generated
HTML files are too huge, and a different approach is required.
Maintaining this half-working approach in the C++ is painful.

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

llvm-svn: 282639

8 years agoRemove dead code from LiveDebugVariables.cpp (NFC)
Adrian Prantl [Wed, 28 Sep 2016 21:34:23 +0000 (21:34 +0000)]
Remove dead code from LiveDebugVariables.cpp (NFC)

LiveDebugVariables doesn't propagate DBG_VALUEs accross basic block
boundaries any more; this functionality was split into LiveDebugValues.
We can thus drop the now dead references to LexicalScopes from LiveDebugVariables.

llvm-svn: 282638

8 years ago[sancov] a simple .symcov coverage report server
Mike Aizatsky [Wed, 28 Sep 2016 21:27:58 +0000 (21:27 +0000)]
[sancov] a simple .symcov coverage report server

Coverage reports for gigabyte-sized binaries are huge. There's no
practical reason to generate them statically.

Implementing an experiment http coverage report server. The server
loads .symcov file and serves interactive coverage pages.

llvm-svn: 282637

8 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Wed, 28 Sep 2016 21:20:45 +0000 (21:20 +0000)]
Next set of additional error checks for invalid Mach-O files for the
other load commands that use the Mach::version_min_command type
but not used in llvm libObject code but used in llvm tool code.

This includes LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS,
LC_VERSION_MIN_TVOS and LC_VERSION_MIN_WATCHOS load commands.

llvm-svn: 282635

8 years agoImprove 'last_write_time(...)' accuracy and detect overflow errors.
Eric Fiselier [Wed, 28 Sep 2016 21:16:58 +0000 (21:16 +0000)]
Improve 'last_write_time(...)' accuracy and detect overflow errors.

The ::stat struct on Linux, FreeBSD, and OS X  provides the access and
modification times as an instance of 'timespec', which has a nanosecond
resolution. The 'st_mtime' and 'st_atime' members simply reference the 'tv_sec'
value of the timespec struct. This patch changes 'last_write_time(...)' so that
it extracts both the seconds and nanoseconds values of the last modification
time, providing a more accurate implementation of 'last_write_time(...)'.

Additionally this patch fixes a possible signed integer overflow bug. The
'file_time_type' type cannot represent all possible values returned by
the filesystem. Attempting to construct a 'file_time_type' from one of these
values is undefined behavior. This patch avoids that UB by detecting possible
overflows before the conversion.

llvm-svn: 282634

8 years agoWarn on empty archive files.
Rui Ueyama [Wed, 28 Sep 2016 21:10:54 +0000 (21:10 +0000)]
Warn on empty archive files.

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

llvm-svn: 282633

8 years agoAdd the ability for the task port to change when a process execs.
Greg Clayton [Wed, 28 Sep 2016 21:07:34 +0000 (21:07 +0000)]
Add the ability for the task port to change when a process execs.

<rdar://problem/28476369>

llvm-svn: 282632

8 years agocxx_status: use HTML5 details/summary elements to hide implementation status
Richard Smith [Wed, 28 Sep 2016 21:01:37 +0000 (21:01 +0000)]
cxx_status: use HTML5 details/summary elements to hide implementation status
tables for fully-implemented language modes by default. Also add some missing
elements to TS support table.

llvm-svn: 282631

8 years agoRefactor the ProfileSummaryInfo to use doInitialization and doFinalization to handle...
Dehao Chen [Wed, 28 Sep 2016 21:00:58 +0000 (21:00 +0000)]
Refactor the ProfileSummaryInfo to use doInitialization and doFinalization to handle Module update.

Summary: This refactors the change in r282616

Reviewers: davidxl, eraman, mehdi_amini

Subscribers: mehdi_amini, davide, llvm-commits

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

llvm-svn: 282630

8 years agoAdd a couple more tentative names for upcoming SD-6 feature checks. These might
Richard Smith [Wed, 28 Sep 2016 20:42:56 +0000 (20:42 +0000)]
Add a couple more tentative names for upcoming SD-6 feature checks. These might
not reflect the final chosen names, but supporting them now seems to have
little downside.

llvm-svn: 282629

8 years agouse assertEquals in TestSBTypeClassMembers
Todd Fiala [Wed, 28 Sep 2016 20:39:50 +0000 (20:39 +0000)]
use assertEquals in TestSBTypeClassMembers

This change replaces the self.assertTrue() calls with
self.assertEquals() so that test failures get more context on failure
values.

llvm-svn: 282628

8 years agoP0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).
Richard Smith [Wed, 28 Sep 2016 20:26:06 +0000 (20:26 +0000)]
P0095R3: Implement the latest published revision of SD-6 (C++ feature test macros).

llvm-svn: 282627

8 years agoIfConversion: Add implicit uses for redefined regs with live subregisters
Krzysztof Parzyszek [Wed, 28 Sep 2016 20:07:41 +0000 (20:07 +0000)]
IfConversion: Add implicit uses for redefined regs with live subregisters

Normally, if conversion would add implicit uses for redefined registers,
e.g. R0<def> = add_if ..., R0<imp-use>. However, if only subregisters of
R0 are known to be live but not R0 itself, such implicit uses will not be
added, causing prior definitions of such subregisters and R0 itself to
become dead.

llvm-svn: 282626

8 years ago[clang-tidy] fix false-positive for cppcoreguidelines-pro-type-member-init with in...
Matthias Gehre [Wed, 28 Sep 2016 20:06:18 +0000 (20:06 +0000)]
[clang-tidy] fix false-positive for cppcoreguidelines-pro-type-member-init with in-class initializers

Summary:
This fixes https://llvm.org/bugs/show_bug.cgi?id=30487 where
```
warning: uninitialized record type: 's' [cppcoreguidelines-pro-type-member-init]
```
is emitted on
```
struct MyStruct
{
    int a = 5;
    int b = 7;
};

int main()
{
    MyStruct s;
}
```

Reviewers: alexfh, aaron.ballman

Subscribers: nemanjai, cfe-commits

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

llvm-svn: 282625

8 years ago[AMDGPU] Promote uniform i16 ops to i32 ops for targets that have 16 bit instructions
Konstantin Zhuravlyov [Wed, 28 Sep 2016 20:05:39 +0000 (20:05 +0000)]
[AMDGPU] Promote uniform i16 ops to i32 ops for targets that have 16 bit instructions

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

llvm-svn: 282624

8 years agoP0096R2: Implement more recent revision of SD-6 (C++ feature test macros).
Richard Smith [Wed, 28 Sep 2016 19:44:50 +0000 (19:44 +0000)]
P0096R2: Implement more recent revision of SD-6 (C++ feature test macros).

llvm-svn: 282622

8 years agoLong-overdue update to cxx_status: C++14 is no longer "upcoming".
Richard Smith [Wed, 28 Sep 2016 19:22:36 +0000 (19:22 +0000)]
Long-overdue update to cxx_status: C++14 is no longer "upcoming".

llvm-svn: 282621

8 years ago[InstCombine] update to use FileCheck
Sanjay Patel [Wed, 28 Sep 2016 19:10:16 +0000 (19:10 +0000)]
[InstCombine] update to use FileCheck

Also, remove unnecessary function attributes, parameters, and comments.
It looks like at least some of these tests are not minimal though...

llvm-svn: 282620

8 years agoRe-commit r282556, reverted in r282564, with a fix to CallArgList::addFrom to
Richard Smith [Wed, 28 Sep 2016 19:09:10 +0000 (19:09 +0000)]
Re-commit r282556, reverted in r282564, with a fix to CallArgList::addFrom to
function correctly when targeting MS ABIs (this appears to have never mattered
prior to this change).

Update test case to always cover both 32-bit and 64-bit Windows ABIs, since
they behave somewhat differently from each other here.

Update test case to also cover operators , && and ||, which it appears are also
affected by P0145R3 (they're not explicitly called out by the design document,
but this is the emergent behavior of the existing wording).

Original commit message:

P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of
assignment and compound-assignment operators before the left-hand side. (Even
if it's an overloaded operator.)

This completes the implementation of P0145R3 + P0400R0 for all targets except
Windows, where the evaluation order guarantees for <<, >>, and ->* are
unimplementable as the ABI requires the function arguments are evaluated from
right to left (because parameter destructors are run from left to right in the
callee).

llvm-svn: 282619

8 years agoFix the bug introduced in r282616.
Dehao Chen [Wed, 28 Sep 2016 18:54:36 +0000 (18:54 +0000)]
Fix the bug introduced in r282616.

llvm-svn: 282618

8 years agoAdd build script for symbolizer which can be linked into instrumented process.
Vitaly Buka [Wed, 28 Sep 2016 18:46:52 +0000 (18:46 +0000)]
Add build script for symbolizer which can be linked into instrumented process.

Reviewers: eugenis

Subscribers: llvm-commits, kubabrecka

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

llvm-svn: 282617

8 years agoFix the bug when -compile-twice is specified, the PSI will be invalidated.
Dehao Chen [Wed, 28 Sep 2016 18:41:14 +0000 (18:41 +0000)]
Fix the bug when -compile-twice is specified, the PSI will be invalidated.

Summary:
When using llc with -compile-twice, module is generated twice, but getAnalysis<ProfileSummaryInfoWrapperPass>().getPSI will still get the old PSI with the original (invalidated) Module. This patch checks if the module has changed when calling getPSI, if yes, update the module and invalidate the Summary.
The bug does not show up in the current llc because PSI is not used in CodeGen yet. But with https://reviews.llvm.org/D24989, the bug will be exposed by test/CodeGen/PowerPC/pr26378.ll

Reviewers: eraman, davidxl

Subscribers: llvm-commits

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

llvm-svn: 282616

8 years ago[compiler-rt] Fix interception of multiple defined symbols.
Etienne Bergeron [Wed, 28 Sep 2016 18:04:07 +0000 (18:04 +0000)]
[compiler-rt] Fix interception of multiple defined symbols.

Summary:
The MSVC compiler is generating multiple instance of the exception handler
when compiling on win64 with /MD.

see: https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

Two tests were failing when running:
```
ninja check-asan-dynamic.
```

The tests were failing because only the first occurence of the function was patched.
The function `__C_specific_handler` is defined in `ntdll` and `vcruntime140`.

After this patch, there is still two remaining tests failing.
```
********************
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 87.81s
********************
Failing Tests (2):
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memchr.cc
    AddressSanitizer-x86_64-windows-dynamic :: TestCases/Windows/dll_intercept_memcpy_indirect.cc

  Expected Passes    : 342
  Passes With Retry  : 2
  Expected Failures  : 16
  Unsupported Tests  : 152
  Unexpected Failures: 2
```

Reviewers: rnk, vitalybuka

Subscribers: vitalybuka, llvm-commits, chrisha, dberris

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

llvm-svn: 282614

8 years ago[X86][AVX] Add test showing that VBROADCAST loads don't correctly respect dependencies
Simon Pilgrim [Wed, 28 Sep 2016 17:59:30 +0000 (17:59 +0000)]
[X86][AVX] Add test showing that VBROADCAST loads don't correctly respect dependencies

llvm-svn: 282613

8 years agoDon't look through addrspacecast in GetPointerBaseWithConstantOffset
Artur Pilipenko [Wed, 28 Sep 2016 17:57:16 +0000 (17:57 +0000)]
Don't look through addrspacecast in GetPointerBaseWithConstantOffset

Pointers in different addrspaces can have different sizes, so it's not valid to look through addrspace cast calculating base and offset for a value.

This is similar to D13008.

Reviewed By: reames

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

llvm-svn: 282612