platform/upstream/llvm.git
7 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

7 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

7 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

7 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

7 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

7 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

7 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

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

llvm-svn: 282668

7 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

7 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

7 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

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

llvm-svn: 282664

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 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

7 years agoTeach LiveDebugValues about lexical scopes.
Adrian Prantl [Wed, 28 Sep 2016 17:51:14 +0000 (17:51 +0000)]
Teach LiveDebugValues about lexical scopes.

This addresses PR26055 LiveDebugValues is very slow.

Contrary to the old LiveDebugVariables pass LiveDebugValues currently
doesn't look at the lexical scopes before inserting a DBG_VALUE
intrinsic. This means that we often propagate DBG_VALUEs much further
down than necessary. This is especially noticeable in large C++
functions with many inlined method calls that all use the same
"this"-pointer.

For example, in the following code it makes no sense to propagate the
inlined variable a from the first inlined call to f() into any of the
subsequent basic blocks, because the variable will always be out of
scope:

void sink(int a);
void __attribute((always_inline)) f(int a) { sink(a); }
void foo(int i) {
   f(i);
   if (i)
     f(i);
   f(i);
}

This patch reuses the LexicalScopes infrastructure we have for
LiveDebugVariables to take this into account.

The effect on compile time and memory consumption is quite noticeable:
I tested a benchmark that is a large C++ source with an enormous
amount of inlined "this"-pointers that would previously eat >24GiB
(most of them for DBG_VALUE intrinsics) and whose compile time was
dominated by LiveDebugValues. With this patch applied the memory
consumption is 1GiB and 1.7% of the time is spent in LiveDebugValues.

https://reviews.llvm.org/D24994
Thanks to Daniel Berlin and Keith Walker for reviewing!

llvm-svn: 282611

7 years ago[CUDA] Added support for CUDA-8
Artem Belevich [Wed, 28 Sep 2016 17:47:40 +0000 (17:47 +0000)]
[CUDA] Added support for CUDA-8

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

llvm-svn: 282610

7 years ago[CUDA] added __nvvm_atom_{sys|cta}_* builtins.
Artem Belevich [Wed, 28 Sep 2016 17:47:35 +0000 (17:47 +0000)]
[CUDA] added __nvvm_atom_{sys|cta}_* builtins.

These builtins are available on sm_60+ GPU only.

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

llvm-svn: 282609

7 years agoRewrite loops to use range-based for. (NFC)
Adrian Prantl [Wed, 28 Sep 2016 17:31:17 +0000 (17:31 +0000)]
Rewrite loops to use range-based for. (NFC)

llvm-svn: 282608

7 years ago[NVPTX] Added intrinsics for atom.gen.{sys|cta}.* instructions.
Artem Belevich [Wed, 28 Sep 2016 17:25:38 +0000 (17:25 +0000)]
[NVPTX] Added intrinsics for atom.gen.{sys|cta}.* instructions.

These are only available on sm_60+ GPUs.

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

llvm-svn: 282607

7 years ago[SCEV] Use a SmallPtrSet as a temporary union predicate; NFC
Sanjoy Das [Wed, 28 Sep 2016 17:14:58 +0000 (17:14 +0000)]
[SCEV] Use a SmallPtrSet as a temporary union predicate; NFC

Summary:
Instead of creating and destroying SCEVUnionPredicate instances (which
internally creates and destroys a DenseMap), use temporary SmallPtrSet
instances of remember the set of predicates that will get reified into a
SCEVUnionPredicate.

Reviewers: silviu.baranga, sbaranga

Subscribers: sanjoy, mcrosier, llvm-commits, mzolotukhin

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

llvm-svn: 282606

7 years agozorg Xcode python test suite target arch update
Todd Fiala [Wed, 28 Sep 2016 16:43:47 +0000 (16:43 +0000)]
zorg Xcode python test suite target arch update

This changes the Xcode target used by the Green Dragon Xcode CI.
When calling xcodebuild with LLDB_PYTHON_TESTSUITE_ARCH set, the
arch's xUnit XML output is now set to an arch-specific filename:

$(BUILD_DIR)/test-results-$(LLDB_PYTHON_TESTSUITE_ARCH).xml.

The change also ensures that the Python testsuite sees the Xcode
build settings passed in through environment variables.

llvm-svn: 282605

7 years agoRevert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is...
Nirav Dave [Wed, 28 Sep 2016 16:37:50 +0000 (16:37 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."

This reverts commit r282600 due to test failues with MCJIT

llvm-svn: 282604

7 years agoSort headers. NFC.
Rafael Espindola [Wed, 28 Sep 2016 16:31:05 +0000 (16:31 +0000)]
Sort headers. NFC.

llvm-svn: 282603

7 years ago[AVR] Rename the builtin calling convention names
Dylan McKay [Wed, 28 Sep 2016 16:04:40 +0000 (16:04 +0000)]
[AVR] Rename the builtin calling convention names

'BUILTIN' is clearer than 'RT' in this context.

llvm-svn: 282602

7 years ago[x86] Accept 'retn' as an alias to 'ret[lqw]'\'ret' (At&t\Intel)
Marina Yatsina [Wed, 28 Sep 2016 15:52:56 +0000 (15:52 +0000)]
[x86] Accept 'retn' as an alias to 'ret[lqw]'\'ret' (At&t\Intel)

Implement 'retn' simply by aliasing it to the relevant 'ret' instruction

Commit on behalf of coby

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

llvm-svn: 282601

7 years agoIn visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Nirav Dave [Wed, 28 Sep 2016 15:50:43 +0000 (15:50 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.

  Simplify Consecutive Merge Store Candidate Search

  Now that address aliasing is much less conservative, push through
  simplified store merging search which only checks for parallel stores
  through the chain subgraph. This is cleaner as the separation of
  non-interfering loads/stores from the store-merging logic.

  Whem merging stores, search up the chain through a single load, and
  finds all possible stores by looking down from through a load and a
  TokenFactor to all stores visited. This improves the quality of the
  output SelectionDAG and generally the output CodeGen (with some
  exceptions).

  Additional Minor Changes:

    1. Finishes removing unused AliasLoad code
    2. Unifies the the chain aggregation in the merged stores across
       code paths
    3. Re-add the Store node to the worklist after calling
       SimplifyDemandedBits.
    4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
       arbitrary, but seemed sufficient to not cause regressions in
       tests.

  This finishes the change Matt Arsenault started in r246307 and
  jyknight's original patch.

  Many tests required some changes as memory operations are now
  reorderable. Some tests relying on the order were changed to use
  volatile memory operations

  Noteworthy tests:

    CodeGen/AArch64/argument-blocks.ll -
      It's not entirely clear what the test_varargs_stackalign test is
      supposed to be asserting, but the new code looks right.

    CodeGen/AArch64/arm64-memset-inline.lli -
    CodeGen/AArch64/arm64-stur.ll -
    CodeGen/ARM/memset-inline.ll -
      The backend now generates *worse* code due to store merging
      succeeding, as we do do a 16-byte constant-zero store efficiently.

    CodeGen/AArch64/merge-store.ll -
      Improved, but there still seems to be an extraneous vector insert
      from an element to itself?

    CodeGen/PowerPC/ppc64-align-long-double.ll -
      Worse code emitted in this case, due to the improved store->load
      forwarding.

    CodeGen/X86/dag-merge-fast-accesses.ll -
    CodeGen/X86/MergeConsecutiveStores.ll -
    CodeGen/X86/stores-merging.ll -
    CodeGen/Mips/load-store-left-right.ll -
      Restored correct merging of non-aligned stores

    CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
      Improved. Correctly merges buffer_store_dword calls

    CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
      Improved. Sidesteps loading a stored value and merges two stores

    CodeGen/X86/pr18023.ll -
      This test has been removed, as it was asserting incorrect
      behavior. Non-volatile stores *CAN* be moved past volatile loads,
      and now are.

    CodeGen/X86/vector-idiv.ll -
    CodeGen/X86/vector-lzcnt-128.ll -
      It's basically impossible to tell what these tests are actually
      testing. But, looks like the code got better due to the memory
      operations being recognized as non-aliasing.

    CodeGen/X86/win32-eh.ll -
      Both loads of the securitycookie are now merged.

    CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot-compute.ll -
      This test appears to work but no longer exhibits the spill
      behavior.

Reviewers: arsenm, hfinkel, tstellarAMD, nhaehnle, jyknight

Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, resistor, tstellarAMD, t.p.northover, spatel

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

llvm-svn: 282600

7 years agolibunwind: Add OpenBSD case for _Unwind_Ptr typedef
Ed Maste [Wed, 28 Sep 2016 15:37:21 +0000 (15:37 +0000)]
libunwind: Add OpenBSD case for _Unwind_Ptr typedef

Patch by Mark Kettenis

llvm-svn: 282599

7 years ago[AVR] Import the LLVM namespace inside AVRMCTargetDesc.cpp
Dylan McKay [Wed, 28 Sep 2016 15:35:26 +0000 (15:35 +0000)]
[AVR] Import the LLVM namespace inside AVRMCTargetDesc.cpp

llvm-svn: 282598

7 years ago[AVR] Add AVRMCTargetDesc.cpp
Dylan McKay [Wed, 28 Sep 2016 15:31:12 +0000 (15:31 +0000)]
[AVR] Add AVRMCTargetDesc.cpp

Summary:
This adds the AVRMCTargetDesc file in tree. It allows creation of the
core classes used in the backend.

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny

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

llvm-svn: 282597

7 years ago[ELF] Support -z max-page-size option
Petr Hosek [Wed, 28 Sep 2016 15:20:47 +0000 (15:20 +0000)]
[ELF] Support -z max-page-size option

This options issupported by both BFD ld and gold and allows
overriding the max page size whose default values are defined by
the target.

https://llvm.org/bugs/show_bug.cgi?id=30541

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

llvm-svn: 282596

7 years ago[ELF] - Created new "Invalid" subfolder for testcases.
George Rimar [Wed, 28 Sep 2016 15:11:58 +0000 (15:11 +0000)]
[ELF] - Created new "Invalid" subfolder for testcases.

This subfolder just like "linkerscript" subfolder keeps
testcases with invalid input. According to PR30540 it seems
we might have many new ones soon, so it is seems reasonable to
separate them from regular testcases.

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

llvm-svn: 282595

7 years ago[AVR] Update the signature of createAVRAsmBackend
Dylan McKay [Wed, 28 Sep 2016 14:35:07 +0000 (14:35 +0000)]
[AVR] Update the signature of createAVRAsmBackend

It has been recently changed to also take a MCTargetOptions structure.

llvm-svn: 282594

7 years ago[AVR] Enable the assembly parser
Dylan McKay [Wed, 28 Sep 2016 14:34:42 +0000 (14:34 +0000)]
[AVR] Enable the assembly parser

We very recently landed the code. This commit enables the parser.

It also adds a missing include to AVRAsmParser.cpp

llvm-svn: 282593

7 years ago[InstSimplify] allow or-of-icmps folds with vector splat constants
Sanjay Patel [Wed, 28 Sep 2016 14:27:21 +0000 (14:27 +0000)]
[InstSimplify] allow or-of-icmps folds with vector splat constants

llvm-svn: 282592

7 years ago[InstSimplify] add vector splat tests for or-of-icmps
Sanjay Patel [Wed, 28 Sep 2016 14:17:35 +0000 (14:17 +0000)]
[InstSimplify] add vector splat tests for or-of-icmps

llvm-svn: 282591

7 years ago[InstSimplify] allow and-of-icmps folds with vector splat constants
Sanjay Patel [Wed, 28 Sep 2016 13:53:13 +0000 (13:53 +0000)]
[InstSimplify] allow and-of-icmps folds with vector splat constants

llvm-svn: 282590

7 years agoAlso use the proper register numbers on CloudABI.
Ed Schouten [Wed, 28 Sep 2016 13:51:23 +0000 (13:51 +0000)]
Also use the proper register numbers on CloudABI.

Without this change applied, unw_step() fails to obtain the next frame
properly.

llvm-svn: 282589

7 years ago[AVR] Merge most recent changes to AVRInstrInfo.td
Dylan McKay [Wed, 28 Sep 2016 13:44:02 +0000 (13:44 +0000)]
[AVR] Merge most recent changes to AVRInstrInfo.td

This adds two new things:

- Operand types per fixup
- Atomic pseudo operations

llvm-svn: 282588

7 years ago[AVR] Update the data layout
Dylan McKay [Wed, 28 Sep 2016 13:29:10 +0000 (13:29 +0000)]
[AVR] Update the data layout

The previous data layout caused issues when dealing with atomics.

Foe example, it is illegal to load a 16-bit value with less than 16-bits
of alignment.

This changes the data layout so that all types are aligned by at least
their own width.

Interestingly, this also _slightly_ decreased register pressure in some
cases.

llvm-svn: 282587

7 years ago[AVR] Handle AVR relocations when handling ELF files
Dylan McKay [Wed, 28 Sep 2016 13:23:42 +0000 (13:23 +0000)]
[AVR] Handle AVR relocations when handling ELF files

llvm-svn: 282586

7 years ago[AVR] Allow llvm-objdump to handle AVR ELF files
Dylan McKay [Wed, 28 Sep 2016 13:15:17 +0000 (13:15 +0000)]
[AVR] Allow llvm-objdump to handle AVR ELF files

llvm-svn: 282585

7 years ago[AVR] Add assembly parser
Dylan McKay [Wed, 28 Sep 2016 13:02:57 +0000 (13:02 +0000)]
[AVR] Add assembly parser

Summary: This patch adds the AVRAsmParser library.

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny, kparzysz, simoncook, jtbandes, llvm-commits

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

llvm-svn: 282584

7 years agoTrying to buildbot failures caused by r282577.
Eric Liu [Wed, 28 Sep 2016 12:49:14 +0000 (12:49 +0000)]
Trying to buildbot failures caused by r282577.

llvm-svn: 282583

7 years ago[ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber
Dmitry Vyukov [Wed, 28 Sep 2016 12:28:16 +0000 (12:28 +0000)]
[ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber

This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size.

This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it.

Author: Andrii Grynenko (andriigrynenko)
Reviewed in: https://reviews.llvm.org/D24628

llvm-svn: 282582

7 years ago[X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests
Elad Cohen [Wed, 28 Sep 2016 11:59:09 +0000 (11:59 +0000)]
[X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

The X86 clang/test/CodeGen/*builtins.c tests define the mm_malloc.h include
guard as a hack for avoiding its inclusion (mm_malloc.h requires a hosted
environment since it expects stdlib.h to be available - which is not the case
in these internal clang codegen tests).
This patch removes this hack and instead passes -ffreestanding to clang cc1.

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

llvm-svn: 282581

7 years ago[X86][FastISel] Use a COPY from K register to a GPR instead of a K operation
Guy Blank [Wed, 28 Sep 2016 11:22:17 +0000 (11:22 +0000)]
[X86][FastISel] Use a COPY from K register to a GPR instead of a K operation

The KORTEST was introduced due to a bug where a TEST instruction used a K register.
but, turns out that the opposite case of KORTEST using a GPR is now happening

The change removes the KORTEST flow and adds a COPY instruction from the K reg to a GPR.

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

llvm-svn: 282580

7 years agoStrip trailing whitespace
Simon Pilgrim [Wed, 28 Sep 2016 11:08:00 +0000 (11:08 +0000)]
Strip trailing whitespace

llvm-svn: 282579

7 years agoASTMerge: explicitly specify arch for GCCAsmStmt test to calm non-x86 buildbots
Aleksei Sidorin [Wed, 28 Sep 2016 11:04:42 +0000 (11:04 +0000)]
ASTMerge: explicitly specify arch for GCCAsmStmt test to calm non-x86 buildbots

This should fix r282572.

llvm-svn: 282578

7 years agoMerge conflicting replacements when they are order-independent.
Eric Liu [Wed, 28 Sep 2016 11:02:16 +0000 (11:02 +0000)]
Merge conflicting replacements when they are order-independent.

Summary:
Now two replacements are considered order-independent if applying them in
either order produces the same result. These include (but not restricted
to) replacements that:
  - don't overlap (being directly adjacent is fine) and
  - are overlapping deletions.
  - are insertions at the same offset and applying them in either order
    has the same effect, i.e. X + Y = Y + X if one inserts text X and the
    other inserts text Y.

Discussion about this design can be found in D24717

Reviewers: djasper, klimek

Subscribers: omtcyfz, cfe-commits

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

llvm-svn: 282577

7 years agoASTMerge: specify arch for GCCAsmStmt test explicitly to calm non-x86 buildbots
Aleksei Sidorin [Wed, 28 Sep 2016 10:57:36 +0000 (10:57 +0000)]
ASTMerge: specify arch for GCCAsmStmt test explicitly to calm non-x86 buildbots

llvm-svn: 282576

7 years ago[libunwind] Add support for a single-threaded libunwind build
Asiri Rathnayake [Wed, 28 Sep 2016 10:57:15 +0000 (10:57 +0000)]
[libunwind] Add support for a single-threaded libunwind build

The EHABI unwinder is thread-agnostic, SJLJ unwinder and the DWARF unwinder have
a couple of pthread dependencies.

This patch makes it possible to build the whole of libunwind for a
single-threaded environment.

Reviewers: compnerd

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

llvm-svn: 282575

7 years ago[StaticAnalyzer] Fix false positives for vardecls that are technically unreachable...
Daniel Marjamaki [Wed, 28 Sep 2016 10:39:53 +0000 (10:39 +0000)]
[StaticAnalyzer] Fix false positives for vardecls that are technically unreachable but they are needed.

Example:

    switch (x) {
      int a;  // <- This is unreachable but needed
    case 1:
      a = ...

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

llvm-svn: 282574

7 years agoFix warnings in clang-completion-mode.el.
Manuel Klimek [Wed, 28 Sep 2016 10:20:10 +0000 (10:20 +0000)]
Fix warnings in clang-completion-mode.el.

- Use defvar to declare variables
- Don't use delete-backward-char, which is for interactive use only

Patch by Philipp Stephani

llvm-svn: 282573