platform/upstream/llvm.git
8 years ago[X86] AVX512 fallback for floating-point scalar selects
Zvi Rackover [Wed, 26 Oct 2016 14:12:46 +0000 (14:12 +0000)]
[X86] AVX512 fallback for floating-point scalar selects

Summary:
In the case where of 'select i1 , f32, f32' or select i1, f64, f64 prefer lowering to masked-moves over branches.

Fixes pr30561

Reviewers: igorb, aymanmus, delena

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

llvm-svn: 285196

8 years ago[InstCombine] consolidate zext tests and auto-generate checks; NFC
Sanjay Patel [Wed, 26 Oct 2016 14:08:49 +0000 (14:08 +0000)]
[InstCombine] consolidate zext tests and auto-generate checks; NFC

llvm-svn: 285195

8 years ago[InstCombine] auto-generate better checks; NFC
Sanjay Patel [Wed, 26 Oct 2016 13:58:22 +0000 (13:58 +0000)]
[InstCombine] auto-generate better checks; NFC

llvm-svn: 285194

8 years ago[PP] Replace some index based for loops with range based ones
Erik Verbruggen [Wed, 26 Oct 2016 13:06:13 +0000 (13:06 +0000)]
[PP] Replace some index based for loops with range based ones

While in the area, also change some unsigned variables to size_t, and
introduce an LLVM_FALLTHROUGH instead of a comment stating that.

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

llvm-svn: 285193

8 years agoFix use-after-scope in ASTContext.
Benjamin Kramer [Wed, 26 Oct 2016 12:51:45 +0000 (12:51 +0000)]
Fix use-after-scope in ASTContext.

Extend lifetime of ExceptionTypeStorage, as it is referenced by
CanonicalEPI and used outside the block (ExceptionSpec.Exceptions is an
ArrayRef)

Patch by Sam McCall!

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

llvm-svn: 285192

8 years ago[AliasSetTracker] Make AST smarter about intrinsics that don't actually affect memory.
Chad Rosier [Wed, 26 Oct 2016 12:42:11 +0000 (12:42 +0000)]
[AliasSetTracker] Make AST smarter about intrinsics that don't actually affect memory.

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

llvm-svn: 285191

8 years agoDelete trivial getters. NFC.
Rafael Espindola [Wed, 26 Oct 2016 12:36:56 +0000 (12:36 +0000)]
Delete trivial getters. NFC.

llvm-svn: 285190

8 years agoDebugInfo: support for DWARFv5 DW_AT_alignment attribute
Victor Leschuk [Wed, 26 Oct 2016 11:59:03 +0000 (11:59 +0000)]
DebugInfo: support for DWARFv5 DW_AT_alignment attribute

* Assume that clang passes non-zero alignment value to DIBuilder
only in case when it was forced by C++11 'alignas', C11 '_Alignas'
or compiler attribute '__attribute__((aligned (N)))'.

* Emit DW_AT_alignment if alignment is specified for type/object.

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

llvm-svn: 285189

8 years ago[PP] Remove another unused parameter
Erik Verbruggen [Wed, 26 Oct 2016 11:46:10 +0000 (11:46 +0000)]
[PP] Remove another unused parameter

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

llvm-svn: 285188

8 years agoDon't set a software stepping breakpoint at 0 on arm or mips.
Pavel Labath [Wed, 26 Oct 2016 11:13:56 +0000 (11:13 +0000)]
Don't set a software stepping breakpoint at 0 on arm or mips.

Summary:
Check whether the setting the breakpoint failed during instruction emulation. If
it did, the next pc is likely in unmapped memory, and the inferior will crash
anyway after the next instruction. Do not return an error in this case, but just
continue stepping.
Reenabled the crash during step test for android/linux.

Reviewers: labath

Subscribers: aemerson, rengolin, tberghammer, danalbert, srhines, lldb-commits

Differential Revision: https://reviews.llvm.org/D25926
Author: Jason Majors <jmajors@google.com>

llvm-svn: 285187

8 years ago[ELF] Better error reporting for undefined symbols
Eugene Leviant [Wed, 26 Oct 2016 11:07:09 +0000 (11:07 +0000)]
[ELF] Better error reporting for undefined symbols

This patch make lld show following details for undefined symbol errors:
- file (line)
- file (function name)
- file (section name + offset)

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

llvm-svn: 285186

8 years ago[IndVarSimplify][DebugLoc] When widening the exit loop condition, correctly reuse...
Andrea Di Biagio [Wed, 26 Oct 2016 10:28:32 +0000 (10:28 +0000)]
[IndVarSimplify][DebugLoc] When widening the exit loop condition, correctly reuse the debug location of the original comparison.

When the loop exit condition is canonicalized as a != compaison, reuse the
debug location of the original (non canonical) comparison.

Before this patch, the debug location of the new icmp was obtained from the
loop latch terminator. This patch fixes the issue by correctly setting the
IRBuilder's "current debug location" to the location of the original compare.

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

llvm-svn: 285185

8 years ago[modules] PR28812: Modules can return duplicate field decls.
Vassil Vassilev [Wed, 26 Oct 2016 10:24:29 +0000 (10:24 +0000)]
[modules] PR28812: Modules can return duplicate field decls.

If two modules contain duplicate class definitions the lookup result can contain
more than 2 elements. Sift the lookup results until we find a field decl.

It is not necessary to do ODR checks in place as they done elsewhere.

This should fix issues when compiling with libstdc++ 5.2 and 6.2.

Patch developed in collaboration with Richard Smith!

llvm-svn: 285184

8 years agoRevert r285181 "DebugInfo: support for DWARFv5 DW_AT_alignment attribute".
Vassil Vassilev [Wed, 26 Oct 2016 10:13:47 +0000 (10:13 +0000)]
Revert r285181 "DebugInfo: support for DWARFv5 DW_AT_alignment attribute".

The commit broke the builds.

llvm-svn: 285183

8 years ago[PP] Replace some uses of unsigned with size_t
Erik Verbruggen [Wed, 26 Oct 2016 09:58:31 +0000 (09:58 +0000)]
[PP] Replace some uses of unsigned with size_t

All values are returned by a method as size_t, and subsequently passed
to functions taking a size_t, or used where a size_t is also valid.
Better still, two loops (which had an unsigned), can be replaced by
a range-based for loop.

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

llvm-svn: 285182

8 years agoDebugInfo: support for DWARFv5 DW_AT_alignment attribute
Victor Leschuk [Wed, 26 Oct 2016 08:55:27 +0000 (08:55 +0000)]
DebugInfo: support for DWARFv5 DW_AT_alignment attribute

* Assume that clang passes non-zero alignment value to DIBuilder
only in case when it was forced by C++11 'alignas', C11 '_Alignas'
or compiler attribute '__attribute__((aligned (N)))'.

* Emit DW_AT_alignment if alignment is specified for type/object.

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

llvm-svn: 285181

8 years agoPP: Remove unused parameters from methods
Erik Verbruggen [Wed, 26 Oct 2016 08:52:41 +0000 (08:52 +0000)]
PP: Remove unused parameters from methods

NFC

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

llvm-svn: 285180

8 years agoDebugInfo: add bitcode upgrade test for alignment
Victor Leschuk [Wed, 26 Oct 2016 08:34:19 +0000 (08:34 +0000)]
DebugInfo: add bitcode upgrade test for alignment

Bitcode format was changed in D25073, this adds bitcode upgrade test.

llvm-svn: 285179

8 years agoBug 28065 - clang-format incorrectly aligns backslash.
Andi-Bogdan Postelnicu [Wed, 26 Oct 2016 07:44:51 +0000 (07:44 +0000)]
Bug 28065 - clang-format incorrectly aligns backslash.

llvm-svn: 285178

8 years ago[lsan] Relax check for allocator_end in ProcessGlobalRegionsCallback.
Maxim Ostapenko [Wed, 26 Oct 2016 06:56:51 +0000 (06:56 +0000)]
[lsan] Relax check for allocator_end in ProcessGlobalRegionsCallback.

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

llvm-svn: 285177

8 years ago[CodeGen] Don't emit lifetime intrinsics for some local variables
Vitaly Buka [Wed, 26 Oct 2016 05:42:30 +0000 (05:42 +0000)]
[CodeGen] Don't emit lifetime intrinsics for some local variables

Summary:
Current generation of lifetime intrinsics does not handle cases like:

```
  {
    char x;
  l1:
    bar(&x, 1);
  }
  goto l1;

```
We will get code like this:

```
  %x = alloca i8, align 1
  call void @llvm.lifetime.start(i64 1, i8* nonnull %x)
  br label %l1
l1:
  %call = call i32 @bar(i8* nonnull %x, i32 1)
  call void @llvm.lifetime.end(i64 1, i8* nonnull %x)
  br label %l1
```

So the second time bar was called for x which is marked as dead.
Lifetime markers here are misleading so it's better to remove them at all.
This type of bypasses are rare, e.g. code detects just 8 functions building
clang (2329 targets).

PR28267

Reviewers: eugenis

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 285176

8 years ago[AVX-512] Fix the operand order for all calls to __builtin_ia32_vfmaddss3_mask.
Craig Topper [Wed, 26 Oct 2016 05:35:38 +0000 (05:35 +0000)]
[AVX-512] Fix the operand order for all calls to __builtin_ia32_vfmaddss3_mask.

Summary: The preserved input should be the first argument and the vector inputs should be in the same order as the intrinsics it is used to implement.

Reviewers: igorb, delena

Subscribers: cfe-commits

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

llvm-svn: 285175

8 years ago[XRay] Be case-insensitive for error strings
Dean Michael Berris [Wed, 26 Oct 2016 05:10:39 +0000 (05:10 +0000)]
[XRay] Be case-insensitive for error strings

On Windows, "no such file or directory" is the default error translation
as opposed to the capitalized form on Linux.

llvm-svn: 285174

8 years ago[AVX-512] Add scalar vfmsub/vfnmsub mask3 intrinsics
Craig Topper [Wed, 26 Oct 2016 04:59:58 +0000 (04:59 +0000)]
[AVX-512] Add scalar vfmsub/vfnmsub mask3 intrinsics

Summary: Clang's intrinsic header currently tries to negate the third operand of a vfmadd mask3 in order to create vfmsub, but this fails isel. This patch adds scalar vfmsub and vfnmsub mask3 that we can use instead to avoid the negate. This is consistent with the packed instructions.

Reviewers: igorb, delena

Subscribers: llvm-commits

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

llvm-svn: 285173

8 years agoEnable the use of the new dyld SPI on the current
Jason Molenda [Wed, 26 Oct 2016 04:48:41 +0000 (04:48 +0000)]
Enable the use of the new dyld SPI on the current
generation macosx/ios/tvos/watchos.

llvm-svn: 285172

8 years ago[XRay] Remove unnecessary include of <unistd.h>
Dean Michael Berris [Wed, 26 Oct 2016 04:46:50 +0000 (04:46 +0000)]
[XRay] Remove unnecessary include of <unistd.h>

llvm-svn: 285171

8 years ago[XRay] Remove unnecessary include of <unistd.h>
Dean Michael Berris [Wed, 26 Oct 2016 04:36:31 +0000 (04:36 +0000)]
[XRay] Remove unnecessary include of <unistd.h>

llvm-svn: 285170

8 years agoSplit LinkerDriver::link. NFC.
Rui Ueyama [Wed, 26 Oct 2016 04:34:16 +0000 (04:34 +0000)]
Split LinkerDriver::link. NFC.

llvm-svn: 285169

8 years ago[XRay] Move specialisations into correct namespace
Dean Michael Berris [Wed, 26 Oct 2016 04:26:53 +0000 (04:26 +0000)]
[XRay] Move specialisations into correct namespace

llvm-svn: 285168

8 years ago[XRay] Remove extra `;` to make -wpedantic happy
Dean Michael Berris [Wed, 26 Oct 2016 04:21:17 +0000 (04:21 +0000)]
[XRay] Remove extra `;` to make -wpedantic happy

llvm-svn: 285167

8 years ago[XRay] Add llvm-xray as a dependency to test/CMakeLists.txt
Dean Michael Berris [Wed, 26 Oct 2016 04:16:05 +0000 (04:16 +0000)]
[XRay] Add llvm-xray as a dependency to test/CMakeLists.txt

llvm-svn: 285166

8 years ago[XRay] Implement `llvm-xray extract`, start of the llvm-xray tool
Dean Michael Berris [Wed, 26 Oct 2016 04:14:34 +0000 (04:14 +0000)]
[XRay] Implement `llvm-xray extract`, start of the llvm-xray tool

Usage:

  llvm-xray extract <object file> [-o <filename or '-'>]

The tool gets the XRay instrumentation map from an object file and turns
it into YAML.  We first support ELF64 sleds on x86_64 binaries, with
provision for supporting other supported platforms and formats later.

This is the first of a many-part change to fully implement the
`llvm-xray` tool.

We also define a subcommand registration and dispatch mechanism to be
used by other further subcommand implementations for llvm-xray.

Diffusion Revision: https://reviews.llvm.org/D21987

llvm-svn: 285165

8 years agoRename variable to be more consistent.
Rui Ueyama [Wed, 26 Oct 2016 04:01:07 +0000 (04:01 +0000)]
Rename variable to be more consistent.

llvm-svn: 285164

8 years agoTruncate a SVN path part from --version output.
Rui Ueyama [Wed, 26 Oct 2016 03:52:06 +0000 (03:52 +0000)]
Truncate a SVN path part from --version output.

This is in sync with what clang does.

llvm-svn: 285163

8 years agoUse printf instead of "echo -ne".
Rui Ueyama [Wed, 26 Oct 2016 03:38:48 +0000 (03:38 +0000)]
Use printf instead of "echo -ne".

Not all echo commands support "-e".

llvm-svn: 285162

8 years agoCloning: Also clone global variable attached metadata.
Peter Collingbourne [Wed, 26 Oct 2016 02:57:33 +0000 (02:57 +0000)]
Cloning: Also clone global variable attached metadata.

llvm-svn: 285161

8 years ago[modules] Fix assert if multiple update records provide a definition for a
Richard Smith [Wed, 26 Oct 2016 02:31:56 +0000 (02:31 +0000)]
[modules] Fix assert if multiple update records provide a definition for a
class template specialization and that specialization has attributes.

llvm-svn: 285160

8 years ago[Sema] Handle CaseStmt and DefaultStmt as SwitchCase
Vitaly Buka [Wed, 26 Oct 2016 02:00:00 +0000 (02:00 +0000)]
[Sema] Handle CaseStmt and DefaultStmt as SwitchCase

Summary: rsmith

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

llvm-svn: 285159

8 years ago[CodeGen] Move shouldEmitLifetimeMarkers into more convenient place
Vitaly Buka [Wed, 26 Oct 2016 01:59:57 +0000 (01:59 +0000)]
[CodeGen] Move shouldEmitLifetimeMarkers into more convenient place

Summary: D24693 will need access to it from other places

Reviewers: eugenis

Subscribers: cfe-commits

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

llvm-svn: 285158

8 years ago[libFuzzer] refresh docs
Kostya Serebryany [Wed, 26 Oct 2016 01:55:17 +0000 (01:55 +0000)]
[libFuzzer] refresh docs

llvm-svn: 285157

8 years agoRevert "[XRay] Implement `llvm-xray extract`, start of the llvm-xray tool"
Dean Michael Berris [Wed, 26 Oct 2016 01:50:59 +0000 (01:50 +0000)]
Revert "[XRay] Implement `llvm-xray extract`, start of the llvm-xray tool"

Reverts r285155 -- misconfigured tests.

llvm-svn: 285156

8 years ago[XRay] Implement `llvm-xray extract`, start of the llvm-xray tool
Dean Michael Berris [Wed, 26 Oct 2016 01:42:59 +0000 (01:42 +0000)]
[XRay] Implement `llvm-xray extract`, start of the llvm-xray tool

Usage:

  llvm-xray extract <object file> [-o <filename or '-'>]

The tool gets the XRay instrumentation map from an object file and turns
it into YAML.  We first support ELF64 sleds on x86_64 binaries, with
provision for supporting other supported platforms and formats later.

This is the first of a many-part change to fully implement the
`llvm-xray` tool.

We also define a subcommand registration and dispatch mechanism to be
used by other further subcommand implementations for llvm-xray.

llvm-svn: 285155

8 years ago[cxx_status] update comment
Richard Smith [Wed, 26 Oct 2016 01:37:36 +0000 (01:37 +0000)]
[cxx_status] update comment

llvm-svn: 285154

8 years agoSBWatchpoint::Disable doesn't actually work. Add a test that shows this.
Jim Ingham [Wed, 26 Oct 2016 01:09:21 +0000 (01:09 +0000)]
SBWatchpoint::Disable doesn't actually work.  Add a test that shows this.

Next to fix it!

llvm-svn: 285153

8 years agoTreat module headers wrapped by our builtin headers as implicitly being textual
Richard Smith [Wed, 26 Oct 2016 01:08:55 +0000 (01:08 +0000)]
Treat module headers wrapped by our builtin headers as implicitly being textual
headers. We previously got this check backwards and treated the wrapper header
as being textual.

This is important because our wrapper headers sometimes inject macros into the
system headers that they #include_next, and sometimes replace them entirely.

llvm-svn: 285152

8 years agoUse printf instead of "echo -e" or "echo -n".
Rui Ueyama [Wed, 26 Oct 2016 01:07:26 +0000 (01:07 +0000)]
Use printf instead of "echo -e" or "echo -n".

Not all echo commands support "-e". On the other hand, printf
command is in POSIX, so it's more portable than "echo -e".

llvm-svn: 285151

8 years agoImplement name mangling proposal for exception specifications from cxx-abi-dev 2016...
Richard Smith [Wed, 26 Oct 2016 01:05:54 +0000 (01:05 +0000)]
Implement name mangling proposal for exception specifications from cxx-abi-dev 2016-10-11.

This has the following ABI impact:

 1) Functions whose parameter or return types are non-throwing function pointer
    types have different manglings in c++1z mode from prior modes. This is
    necessary because c++1z permits overloading on the noexceptness of function
    pointer parameter types. A warning is issued for cases that will change
    manglings in c++1z mode.

 2) Functions whose parameter or return types contain instantiation-dependent
    exception specifications change manglings in all modes. This is necessary
    to support overloading on / SFINAE in these exception specifications, which
    a careful reading of the standard indicates has essentially always been
    permitted.

Note that, in order to be affected by these changes, the code in question must
specify an exception specification on a function pointer/reference type that is
written syntactically within the declaration of another function. Such
declarations are very rare, and I have so far been unable to find any code
that would be affected by this. (Note that such things will probably become
more common in C++17, since it's a lot easier to get a noexcept function type
as a function parameter / return type there.)

This change does not affect the set of symbols produced by a build of clang,
libc++, or libc++abi.

llvm-svn: 285150

8 years agoUse uint32_t for consistency.
Rafael Espindola [Wed, 26 Oct 2016 00:58:23 +0000 (00:58 +0000)]
Use uint32_t for consistency.

llvm-svn: 285149

8 years agoRead section headers upfront.
Rafael Espindola [Wed, 26 Oct 2016 00:54:03 +0000 (00:54 +0000)]
Read section headers upfront.

Instead of storing a pointer, store the members we need.

The reason for doing this is that it makes it far easier to create
synthetic sections. It also avoids reading data from files multiple
times., which might help with cross endian linking and host
architectures with slow unaligned access.

There are obvious compacting opportunities, but this already has mixed
results even on native x86_64 linking.

There is also the possibility of better refactoring the code for
handling common symbols, but this already shows that a custom class is
not necessary.

llvm-svn: 285148

8 years ago[libFuzzer] simplify the code in TracePC::HandleTrace a bit more
Kostya Serebryany [Wed, 26 Oct 2016 00:42:52 +0000 (00:42 +0000)]
[libFuzzer] simplify the code in TracePC::HandleTrace a bit more

llvm-svn: 285147

8 years ago[libFuzzer] simplify the code to print new PCs
Kostya Serebryany [Wed, 26 Oct 2016 00:20:51 +0000 (00:20 +0000)]
[libFuzzer] simplify the code to print new PCs

llvm-svn: 285145

8 years ago[Myriad] add empty file to simulated bin dir
Douglas Katzman [Tue, 25 Oct 2016 23:59:11 +0000 (23:59 +0000)]
[Myriad] add empty file to simulated bin dir

llvm-svn: 285144

8 years agoUtility functions for appending to llvm.used/llvm.compiler.used.
Evgeniy Stepanov [Tue, 25 Oct 2016 23:53:31 +0000 (23:53 +0000)]
Utility functions for appending to llvm.used/llvm.compiler.used.

llvm-svn: 285143

8 years ago[libFuzzer] simplify the code in TracePC::HandleTrace
Kostya Serebryany [Tue, 25 Oct 2016 23:52:25 +0000 (23:52 +0000)]
[libFuzzer] simplify the code in TracePC::HandleTrace

llvm-svn: 285142

8 years ago[docs] Avoid repetition of 'considerable' in Error docs.
Lang Hames [Tue, 25 Oct 2016 23:08:32 +0000 (23:08 +0000)]
[docs] Avoid repetition of 'considerable' in Error docs.

llvm-svn: 285141

8 years ago[Myriad] Find libc++ adjacent to libstdc++
Douglas Katzman [Tue, 25 Oct 2016 23:02:30 +0000 (23:02 +0000)]
[Myriad] Find libc++ adjacent to libstdc++

llvm-svn: 285140

8 years ago[docs] Use consistent style for "do more stuff" in Error docs examples.
Lang Hames [Tue, 25 Oct 2016 22:41:54 +0000 (22:41 +0000)]
[docs] Use consistent style for "do more stuff" in Error docs examples.

llvm-svn: 285138

8 years ago[docs] Fix yet another Error docs formatting issue...
Lang Hames [Tue, 25 Oct 2016 22:38:50 +0000 (22:38 +0000)]
[docs] Fix yet another Error docs formatting issue...

llvm-svn: 285137

8 years ago[docs] Fix a few more Error docs formatting issues.
Lang Hames [Tue, 25 Oct 2016 22:35:55 +0000 (22:35 +0000)]
[docs] Fix a few more Error docs formatting issues.

Thanks to Pete Cooper for the review.

llvm-svn: 285136

8 years ago[libFuzzer] add StandaloneFuzzTargetMain.c and a test for it
Kostya Serebryany [Tue, 25 Oct 2016 22:30:34 +0000 (22:30 +0000)]
[libFuzzer] add StandaloneFuzzTargetMain.c and a test for it

llvm-svn: 285135

8 years ago[docs] Fix a missing code-block in the new Error docs.
Lang Hames [Tue, 25 Oct 2016 22:25:07 +0000 (22:25 +0000)]
[docs] Fix a missing code-block in the new Error docs.

llvm-svn: 285134

8 years ago[docs] Fix a couple of typos in the new Error docs.
Lang Hames [Tue, 25 Oct 2016 22:22:48 +0000 (22:22 +0000)]
[docs] Fix a couple of typos in the new Error docs.

llvm-svn: 285133

8 years ago[codeview] emit debug info for indirect virtual base classes
Bob Haarman [Tue, 25 Oct 2016 22:19:32 +0000 (22:19 +0000)]
[codeview] emit debug info for indirect virtual base classes

Summary:
Fixes PR28281.

MSVC lists indirect virtual base classes in the field list of a class.
This change makes Clang emit the information necessary for LLVM to
emit such records.

Reviewers: rnk, ruiu, zturner

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

llvm-svn: 285132

8 years ago[Sparc] Don't overlap variable-sized allocas with other stack variables.
James Y Knight [Tue, 25 Oct 2016 22:13:28 +0000 (22:13 +0000)]
[Sparc] Don't overlap variable-sized allocas with other stack variables.

On SparcV8, it was previously the case that a variable-sized alloca
might overlap by 4-bytes the last fixed stack variable, effectively
because 92 (the number of bytes reserved for the register spill area) !=
96 (the offset added to SP for where to start a DYNAMIC_STACKALLOC).

It's not as simple as changing 96 to 92, because variables that should
be 8-byte aligned would then be misaligned.

For now, simply increase the allocation size by 8 bytes for each dynamic
allocation -- wastes space, but at least doesn't overlap. As the large
comment says, doing this more efficiently will require larger changes in
llvm.

Also adds some test cases showing that we continue to not support
dynamic stack allocation and over-alignment in the same function.

llvm-svn: 285131

8 years ago[codeview] support emitting indirect virtual base class information
Bob Haarman [Tue, 25 Oct 2016 22:11:52 +0000 (22:11 +0000)]
[codeview] support emitting indirect virtual base class information

Summary:
Fixes PR28281.

MSVC lists indirect virtual base classes in the field list of a class,
using LF_IVBCLASS records. This change makes LLVM emit such records
when processing DW_TAG_inheritance tags with the DIFlagVirtual and
(newly introduced) DIFlagIndirect tags.

Reviewers: rnk, ruiu, zturner

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

llvm-svn: 285130

8 years ago[DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1))...
Simon Pilgrim [Tue, 25 Oct 2016 22:01:09 +0000 (22:01 +0000)]
[DAGCombiner] Enable (urem x, (shl pow2, y)) -> (and x, (add (shl pow2, y), -1)) combine for splatted vectors

llvm-svn: 285129

8 years ago[PGO] Fix select instruction annotation
Rong Xu [Tue, 25 Oct 2016 21:47:24 +0000 (21:47 +0000)]
[PGO] Fix select instruction annotation

Summary:
Select instruction annotation in IR PGO uses the edge count to infer the
branch count. It's currently placed in setInstrumentedCounts() where
no all the BB counts have been computed. This leads to wrong branch weights.
Move the annotation after all BB counts are populated.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 285128

8 years agoUse linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.
Stephen Hines [Tue, 25 Oct 2016 21:44:35 +0000 (21:44 +0000)]
Use linker flag --fix-cortex-a53-843419 on Android ARM64 compilation.

Summary:
This is only forced on if there is no non-Cortex-A53 CPU specified as
well. Android's platform and NDK builds need to assume that the code can
be run on Cortex-A53 devices, so we always enable the fix unless we know
specifically that the code is only running on a different kind of CPU.

Reviewers: cfe-commits

Subscribers: aemerson, rengolin, tberghammer, pirama, danalbert

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

llvm-svn: 285127

8 years agoCodeGen: be more conservative about setting section
Saleem Abdulrasool [Tue, 25 Oct 2016 21:43:28 +0000 (21:43 +0000)]
CodeGen: be more conservative about setting section

The section names currently are MachO specific.  Only set the section on the
variables if the file format is MachO.

llvm-svn: 285126

8 years ago[OpenCL] Add missing atom_xor for 64 bit to opencl-c.h
Yaxun Liu [Tue, 25 Oct 2016 21:37:05 +0000 (21:37 +0000)]
[OpenCL] Add missing atom_xor for 64 bit to opencl-c.h

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

llvm-svn: 285125

8 years ago[X86][SSE] Regenerated known-bits test with srem->urem fix
Simon Pilgrim [Tue, 25 Oct 2016 21:24:33 +0000 (21:24 +0000)]
[X86][SSE] Regenerated known-bits test with srem->urem fix

llvm-svn: 285124

8 years ago[DAGCombiner] Enable srem(x.y) -> urem(x,y) combine for vectors
Simon Pilgrim [Tue, 25 Oct 2016 21:20:18 +0000 (21:20 +0000)]
[DAGCombiner] Enable srem(x.y) -> urem(x,y) combine for vectors

SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

llvm-svn: 285123

8 years ago[docs] Add more Error documentation to the Programmer's Manual.
Lang Hames [Tue, 25 Oct 2016 21:19:30 +0000 (21:19 +0000)]
[docs] Add more Error documentation to the Programmer's Manual.

This patch updates some of the existing Error examples, expands on the
documentation for handleErrors, and includes new sections that cover
a number of helpful utilities and common error usage idioms.

llvm-svn: 285122

8 years ago[X86][SSE] Added vector srem combine tests
Simon Pilgrim [Tue, 25 Oct 2016 21:14:11 +0000 (21:14 +0000)]
[X86][SSE] Added vector srem combine tests

llvm-svn: 285121

8 years ago[index] Fixes for locations and relations in Objective C categories and getters/setters
Argyrios Kyrtzidis [Tue, 25 Oct 2016 21:11:22 +0000 (21:11 +0000)]
[index] Fixes for locations and relations in Objective C categories and getters/setters

- Add entries for protocols on categories
- Add relation between categories and class they extend
- Add relation between getters/setters and their corresponding property
- Use category name location as the location of category decls/defs if it has one

llvm-svn: 285120

8 years ago[X86][SSE] Added vector urem combine tests
Simon Pilgrim [Tue, 25 Oct 2016 21:10:12 +0000 (21:10 +0000)]
[X86][SSE] Added vector urem combine tests

llvm-svn: 285119

8 years ago[DAGCombiner] Enable sdiv(x.y) -> udiv(x,y) combine for vectors
Simon Pilgrim [Tue, 25 Oct 2016 20:56:42 +0000 (20:56 +0000)]
[DAGCombiner] Enable sdiv(x.y) -> udiv(x,y) combine for vectors

SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

llvm-svn: 285118

8 years agoFix nullptr tests
Eric Fiselier [Tue, 25 Oct 2016 20:45:17 +0000 (20:45 +0000)]
Fix nullptr tests

llvm-svn: 285117

8 years ago[InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996
Guozhi Wei [Tue, 25 Oct 2016 20:43:42 +0000 (20:43 +0000)]
[InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996

The original patch of the A->B->A BitCast optimization was reverted by r274094 because it may cause infinite loop inside compiler https://llvm.org/bugs/show_bug.cgi?id=27996.

The problem is with following code

xB = load (type B);
xA = load (type A);
+yA = (A)xB; B -> A
+zAn = PHI[yA, xA]; PHI
+zBn = (B)zAn; // A -> B
store zAn;
store zBn;

optimizeBitCastFromPhi generates

+zBn = (B)zAn; // A -> B

and expects it will be combined with the following store instruction to another

store zAn

Unfortunately before combineStoreToValueType is called on the store instruction, optimizeBitCastFromPhi is called on the new BitCast again, and this pattern repeats indefinitely.

optimizeBitCastFromPhi only generates BitCast for load/store instructions, only the BitCast before store can cause the reexecution of optimizeBitCastFromPhi, and BitCast before store can easily be handled by InstCombineLoadStoreAlloca.cpp. So the solution to the problem is if all users of a CI are store instructions, we should not do optimizeBitCastFromPhi on it. Then optimizeBitCastFromPhi will not be called on the new BitCast instructions.

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

llvm-svn: 285116

8 years ago[SE] Remove StreamExecutor
Jason Henline [Tue, 25 Oct 2016 20:38:08 +0000 (20:38 +0000)]
[SE] Remove StreamExecutor

Summary:
The project has been renamed to Acxxel, so this old directory needs to
be deleted.

Reviewers: jlebar, jprice

Subscribers: beanz, mgorny, parallel_libs-commits, modocache

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

llvm-svn: 285115

8 years agoFix a race condition between the "ephemeral watchpoint disabling" and commands the...
Jim Ingham [Tue, 25 Oct 2016 20:34:32 +0000 (20:34 +0000)]
Fix a race condition between the "ephemeral watchpoint disabling" and commands the continue the process.

This closes https://reviews.llvm.org/D25875.

llvm-svn: 285114

8 years agoFixing up the project file for the removal of LibStdcppSmartPointer.cpp.
Jim Ingham [Tue, 25 Oct 2016 20:32:26 +0000 (20:32 +0000)]
Fixing up the project file for the removal of LibStdcppSmartPointer.cpp.

llvm-svn: 285113

8 years ago[X86][SSE] Added vector sdiv combine tests
Simon Pilgrim [Tue, 25 Oct 2016 20:25:47 +0000 (20:25 +0000)]
[X86][SSE] Added vector sdiv combine tests

llvm-svn: 285112

8 years agoInitial check-in of Acxxel (StreamExecutor renamed)
Jason Henline [Tue, 25 Oct 2016 20:18:56 +0000 (20:18 +0000)]
Initial check-in of Acxxel (StreamExecutor renamed)

Summary:
Acxxel is basically a simplified redesign of StreamExecutor.

Here are the major points where Acxxel differs from the current
StreamExecutor design:

* Acxxel doesn't support the kernel and kernel loader types designed for
  emission by the compiler to support type-safe kernel launches. For
  CUDA, kernels in Acxxel can be seamlessly launched using the standard
  CUDA triple-chevron kernel launch syntax that is available with clang
  and nvcc. For CUDA and OpenCL, kernel arguments can be passed in the
  old-fashioned way, as one array of pointers to arguments and another
  array of argument sizes. Although OpenCL doesn't get a type-safe
  kernel launch method, it does still get the benefit of all the memory
  management wrappers. In the future, clang may add support for
  triple-chevron OpenCL kernel launchs, or some other type-safe OpenCL
  kernel launch method.
* Acxxel does not depend on any other code in LLVM, so it builds
  completely independently from LLVM.

The goal will be to check in Acxxel and remove StreamExecutor, or
perhaps to remove the old StreamExecutor and rename Acxxel to
StreamExecutor, so I think Acxxel should be thought of as a new version
of StreamExecutor, not as a separate project.

Reviewers: jlebar, jprice

Subscribers: beanz, mgorny, modocache, parallel_libs-commits

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

llvm-svn: 285111

8 years agorevert: "Remove debug location from common tail when tail-merging"
Robert Lougher [Tue, 25 Oct 2016 20:17:58 +0000 (20:17 +0000)]
revert: "Remove debug location from common tail when tail-merging"

This reverts r285093, as it caused unexpected buildbot failures on
clang-ppc64le-linux, clang-ppc64be-linux, clang-ppc64be-linux-multistage
and clang-ppc64be-linux-lnt.  Failing test ubsan/TestCases/TypeCheck/vptr.cpp.

llvm-svn: 285110

8 years ago[libFuzzer] when mutating based on CMP traces also try adding +/- 1 to the desired...
Kostya Serebryany [Tue, 25 Oct 2016 20:15:15 +0000 (20:15 +0000)]
[libFuzzer] when mutating based on CMP traces also try adding +/- 1 to the desired bytes. Add another test for use_cmp

llvm-svn: 285109

8 years ago[InstCombine] Ensure that truncated int types are legal.
Sanjay Patel [Tue, 25 Oct 2016 20:11:47 +0000 (20:11 +0000)]
[InstCombine] Ensure that truncated int types are legal.

Fixes the FIXMEs in D25952 and rL285075.

Patch by bryant!

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

llvm-svn: 285108

8 years agoGet libc++abi building with LLVM_ENABLE_MODULES
Eric Fiselier [Tue, 25 Oct 2016 20:07:49 +0000 (20:07 +0000)]
Get libc++abi building with LLVM_ENABLE_MODULES

llvm-svn: 285107

8 years ago[AArch64] Adjust the cost model for Exynos M1.
Evandro Menezes [Tue, 25 Oct 2016 20:05:42 +0000 (20:05 +0000)]
[AArch64] Adjust the cost model for Exynos M1.

Modify the maximum jump table size.

llvm-svn: 285106

8 years ago[APFloat] Make APFloat an interface class to the internal IEEEFloat. NFC.
Tim Shen [Tue, 25 Oct 2016 19:55:59 +0000 (19:55 +0000)]
[APFloat] Make APFloat an interface class to the internal IEEEFloat. NFC.

Summary:
The intention is to make APFloat an interface class, so that later I can add a second implementation class DoubleAPFloat to correctly implement PPCDoubleDouble semantic. The interface of IEEEFloat is not public, and can be simplified (currently it's exactly the same as the old APFloat), but that belongs to a separate patch.

DoubleAPFloat should look like:
class DoubleAPFloat {
  const fltSemantics *Semantics;
  std::unique_ptr<APFloat> APFloats;  // Two heap-allocated APFloats.
};

There is no functional change, nor public interface change.

Reviewers: hfinkel, chandlerc, iteratee, echristo, kbarton

Subscribers: llvm-commits, mehdi_amini

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

llvm-svn: 285105

8 years agoAdd option to specify minimum number of entries for jump tables
Evandro Menezes [Tue, 25 Oct 2016 19:53:51 +0000 (19:53 +0000)]
Add option to specify minimum number of entries for jump tables

Add an option to allow easier experimentation by target maintainers with the
minimum number of entries to create jump tables.  Also clarify the name of
the other existing option governing the creation of jump tables.

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

llvm-svn: 285104

8 years ago[llvm-cov] Don't use colored output until we know it's supported
Vedant Kumar [Tue, 25 Oct 2016 19:52:57 +0000 (19:52 +0000)]
[llvm-cov] Don't use colored output until we know it's supported

CodeCoverageTool::error() depends on CoverageViewOptions::Colors being
initialized. Should fix:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/56

llvm-svn: 285103

8 years agoUpdate revision number in CHANGELOG.TXT
Eric Fiselier [Tue, 25 Oct 2016 19:44:38 +0000 (19:44 +0000)]
Update revision number in CHANGELOG.TXT

llvm-svn: 285102

8 years ago[libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from...
Eric Fiselier [Tue, 25 Oct 2016 19:43:44 +0000 (19:43 +0000)]
[libcxx] Build with -fvisibility-inlines-hidden -- Remove 20 inline definitions from the dylib

Summary:
This patch turns on `-fvisibility-inlines-hidden` when building  the dylib. This is important so that libc++.dylib doesn't accidentally export inline-functions which are ODR used somewhere in the dylib.

On OS X this change has no effect on the current ABI of the dylib. Unfortunately on Linux there are already ~20 inline functions which are unintentionally exported by the dylib. Almost all of these are implicitly generated destructors. I believe removing these function definitions is safe because every "linkage unit" which uses these functions has its own definition, and therefore shouldn't be dependent on libc++.dylib to provide them.

Also could a FreeBSD maintainer comment on the ABI compatibility of this patch?

Reviewers: mclow.lists, emaste, dexonsmith, joker-eph-DISABLED, jroelofs, danalbert, mehdi_amini, compnerd, dim

Subscribers: beanz, mgorny, cfe-commits, modocache

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

llvm-svn: 285101

8 years ago[libc++] Fix modules build - Rework __refstring definition
Eric Fiselier [Tue, 25 Oct 2016 19:33:14 +0000 (19:33 +0000)]
[libc++] Fix modules build - Rework __refstring definition

Summary:
`__libcpp_refstring` currently has two different definitions. First there is the complete definition in `<__refstring>` but there is also a second in  `<stdexcept>`.  The historical reason for this split is because both libc++ and libc++abi need to see the inline definitions of __libcpp_refstrings methods, but the `<stdexcept>` header doesn't.  However this is an ODR violation and breaks the modules build.

This patch fixes the issue by creating a single class definition in `<stdexcept>` and changing `<__refstring>` to contain only the inline method definitions. This way both `libcxx/src/stdexcept.cpp` and `libcxxabi/src/stdexcept.cpp` see the same declaration in `<stdexcept>` and definitions in `<__refstring>`

Reviewers: mclow.lists, EricWF

Subscribers: cfe-commits

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

llvm-svn: 285100

8 years agoSwitch lowering: improve partitioning of jump tables
Evandro Menezes [Tue, 25 Oct 2016 19:11:43 +0000 (19:11 +0000)]
Switch lowering: improve partitioning of jump tables

When there's a tie between partitionings of jump tables, consider also cases
that result in no jump tables, but in one or a few cases.  The motivation is
that many contemporary processors typically perform case switches fairly
quickly.

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

llvm-svn: 285099

8 years agoReapply r284265: "[Sema] Refactor context checking for availability diagnostics"
Erik Pilkington [Tue, 25 Oct 2016 19:05:50 +0000 (19:05 +0000)]
Reapply r284265: "[Sema] Refactor context checking for availability diagnostics"

The problem with the original commit was that some of Apple's headers depended
on an incorrect behaviour, this commit adds a temporary workaround until those
headers are fixed.

llvm-svn: 285098

8 years ago[LV] Sink scalar operands of predicated instructions
Matthew Simpson [Tue, 25 Oct 2016 18:59:45 +0000 (18:59 +0000)]
[LV] Sink scalar operands of predicated instructions

When we predicate an instruction (div, rem, store) we place the instruction in
its own basic block within the vectorized loop. If a predicated instruction has
scalar operands, it's possible to recursively sink these scalar expressions
into the predicated block so that they might avoid execution. This patch sinks
as much scalar computation as possible into predicated blocks. We previously
were able to sink such operands only if they were extractelement instructions.

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

llvm-svn: 285097

8 years agoRemove a VS 2012 workaround, we require 2015 now.
Nico Weber [Tue, 25 Oct 2016 18:48:43 +0000 (18:48 +0000)]
Remove a VS 2012 workaround, we require 2015 now.

llvm-svn: 285096

8 years ago[InstCombine] add tests for missing icmp + shl nuw fold
Sanjay Patel [Tue, 25 Oct 2016 18:47:56 +0000 (18:47 +0000)]
[InstCombine] add tests for missing icmp + shl nuw fold

Patch by bryant!

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

llvm-svn: 285095