platform/upstream/llvm.git
8 years ago[DAG] avoid creating illegal node when transforming negated shifted sign bit
Sanjay Patel [Fri, 14 Oct 2016 19:46:31 +0000 (19:46 +0000)]
[DAG] avoid creating illegal node when transforming negated shifted sign bit

Eli noted this potential bug in the post-commit thread for:
https://reviews.llvm.org/rL284239
...but I'm not sure how to trigger it, so there's no test case yet.

llvm-svn: 284268

8 years agoAMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations
Tom Stellard [Fri, 14 Oct 2016 19:14:29 +0000 (19:14 +0000)]
AMDGPU/SI: Use new SimplifyDemandedBits helper for multi-use operations

Summary:
We are using this helper for our 24-bit arithmetic combines, so we are now able to eliminate multi-use operations that mask the high-bits of 24-bit inputs (e.g. and x, 0xffffff)

Reviewers: arsenm, nhaehnle

Subscribers: tony-tye, arsenm, kzhuravl, wdng, nhaehnle, llvm-commits, yaxunl

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

llvm-svn: 284267

8 years agoTargetLowering: Add SimplifyDemandedBits() helper to TargetLoweringOpt
Tom Stellard [Fri, 14 Oct 2016 19:14:26 +0000 (19:14 +0000)]
TargetLowering: Add SimplifyDemandedBits() helper to TargetLoweringOpt

Summary:
The main purpose of this new helper is to enable simplifying operations that
have multiple uses.  SimplifyDemandedBits does not handle multiple uses
currently, and this new function makes it possible to optimize:

and v1, v0, 0xffffff
mul24 v2, v1, v1      ; Multiply ignoring high 8-bits.

To:

mul24 v2, v0, v0

Where before this would not be optimized, because v1 has multiple uses.

Reviewers: bogner, arsenm

Subscribers: nhaehnle, wdng, llvm-commits

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

llvm-svn: 284266

8 years ago[Sema] Refactor context checking for availability diagnostics
Erik Pilkington [Fri, 14 Oct 2016 19:08:01 +0000 (19:08 +0000)]
[Sema] Refactor context checking for availability diagnostics

This commit combines a couple of redundant functions that do availability
attribute context checking into a more correct/simpler one.

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

llvm-svn: 284265

8 years agoThe real fix for post-r284255 failures
Krzysztof Parzyszek [Fri, 14 Oct 2016 19:06:25 +0000 (19:06 +0000)]
The real fix for post-r284255 failures

llvm-svn: 284264

8 years agoModule: emit initializers in submodules when importing the parent module.
Manman Ren [Fri, 14 Oct 2016 18:55:44 +0000 (18:55 +0000)]
Module: emit initializers in submodules when importing the parent module.

When importing the parent module, module initializers in submodules should
be emitted.

rdar://28740482

llvm-svn: 284263

8 years agoWorkaround to eliminate check-llvm failures after r284255
Krzysztof Parzyszek [Fri, 14 Oct 2016 18:36:42 +0000 (18:36 +0000)]
Workaround to eliminate check-llvm failures after r284255

llvm-svn: 284262

8 years agoAdd a pass to optimize patterns of vectorized interleaved memory accesses for
David L Kreitzer [Fri, 14 Oct 2016 18:20:41 +0000 (18:20 +0000)]
Add a pass to optimize patterns of vectorized interleaved memory accesses for
X86. The pass optimizes as a unit the entire wide load + shuffles pattern
produced by interleaved vectorization. This initial patch optimizes one pattern
(64-bit elements interleaved by a factor of 4). Future patches will generalize
to additional patterns.

Patch by Farhana Aleen

Differential revision: http://reviews.llvm.org/D24681

llvm-svn: 284260

8 years agoRevert r284256 due to test failure
Ed Maste [Fri, 14 Oct 2016 18:20:12 +0000 (18:20 +0000)]
Revert r284256 due to test failure

llvm-svn: 284259

8 years ago[sanitizers] -Wno-macro-redefined for libc++ build
Vitaly Buka [Fri, 14 Oct 2016 18:19:02 +0000 (18:19 +0000)]
[sanitizers] -Wno-macro-redefined for libc++ build

llvm-svn: 284258

8 years agoAMDGPU/SI: Don't allow unaligned scratch access
Tom Stellard [Fri, 14 Oct 2016 18:10:39 +0000 (18:10 +0000)]
AMDGPU/SI: Don't allow unaligned scratch access

Summary: The hardware doesn't support this.

Reviewers: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 284257

8 years agoLink static PIE programs against rcrt0.o on OpenBSD
Ed Maste [Fri, 14 Oct 2016 17:59:53 +0000 (17:59 +0000)]
Link static PIE programs against rcrt0.o on OpenBSD

Patch by Stefan Kempf.

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

llvm-svn: 284256

8 years ago[RDF] Switch RegisterRef to be a pair (Register, LaneMask)
Krzysztof Parzyszek [Fri, 14 Oct 2016 17:57:55 +0000 (17:57 +0000)]
[RDF] Switch RegisterRef to be a pair (Register, LaneMask)

Use PackedRegisterRef to store the register information in the graph nodes.

This commit also removes support for virtual registers. It has never been
tested or used. It will be possible to add it back if there is a need.

llvm-svn: 284255

8 years ago[safestack] Use non-thread-local unsafe stack pointer for Contiki OS
David L Kreitzer [Fri, 14 Oct 2016 17:56:00 +0000 (17:56 +0000)]
[safestack] Use non-thread-local unsafe stack pointer for Contiki OS

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D19852

llvm-svn: 284254

8 years agoImplement __stosb intrinsic as a volatile memset
Albert Gutowski [Fri, 14 Oct 2016 17:33:05 +0000 (17:33 +0000)]
Implement __stosb intrinsic as a volatile memset

Summary: We need `__stosb` to be an intrinsic, because SecureZeroMemory function uses it without including intrin.h. Implementing it as a volatile memset is not consistent with MSDN specification, but it gives us target-independent IR while keeping the most important properties of `__stosb`.

Reviewers: rnk, hans, thakis, majnemer

Subscribers: cfe-commits

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

llvm-svn: 284253

8 years agoRevert "In preparation for removing getNameWithPrefix off of
Eric Christopher [Fri, 14 Oct 2016 17:28:23 +0000 (17:28 +0000)]
Revert "In preparation for removing getNameWithPrefix off of
TargetMachine," as it's causing sanitizer/memory issues until I
can track down this set.

This reverts commit r284203

llvm-svn: 284252

8 years ago[Coverage] Support loading multiple binaries into a CoverageMapping
Vedant Kumar [Fri, 14 Oct 2016 17:16:53 +0000 (17:16 +0000)]
[Coverage] Support loading multiple binaries into a CoverageMapping

Add support for loading multiple coverage readers into a single
CoverageMapping instance. This should make it easier to prepare a
unified coverage report for multiple binaries.

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

llvm-svn: 284251

8 years ago[CMake] Populate LLDB.framework's headers directory
Chris Bieneman [Fri, 14 Oct 2016 17:09:55 +0000 (17:09 +0000)]
[CMake] Populate LLDB.framework's headers directory

Summary:
This patch adds support for installing public headers in LLDB.framework, and symlinking the headers into the build directory.

While writing the patch I discovered a bug in CMake that prevents applying POST_BUILD steps to framework targets (https://gitlab.kitware.com/cmake/cmake/issues/16363).

I've implemented the support using POST_BUILD steps wrapped under a CMake version check with a TODO so that we can track the fix.

Reviewers: tfiala, zturner, spyffe

Subscribers: lldb-commits, mgorny

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

llvm-svn: 284250

8 years agoMove alignTo computation inside the if.
Rafael Espindola [Fri, 14 Oct 2016 17:01:39 +0000 (17:01 +0000)]
Move alignTo computation inside the if.

This is an improvement when compiling with llvm. llvm doesn't inline
the call to insert, so the align is always executed and shows up in
the profile.

With gcc the call to insert is inlined and the align computation moved
and done only if needed.

With this patch we explicitly only compute it if it is needed.

In the two tests with debug info, the speedup was

scylla
  master 3.008959365
  patch  2.932080942 1.02621974786x faster

firefox
  master 6.709823604
  patch  6.592387227 1.01781393795x faster

In all others the difference was in the noise.

llvm-svn: 284249

8 years ago[X86] Take advantage of the lzcnt instruction on btver2 architectures when ORing...
Pierre Gousseau [Fri, 14 Oct 2016 16:41:38 +0000 (16:41 +0000)]
[X86] Take advantage of the lzcnt instruction on btver2 architectures when ORing comparisons to zero.

This change adds transformations such as:
  zext(or(setcc(eq, (cmp x, 0)), setcc(eq, (cmp y, 0))))
  To:
  srl(or(ctlz(x), ctlz(y)), log2(bitsize(x))
This optimisation is beneficial on Jaguar architecture only, where lzcnt has a good reciprocal throughput.
Other architectures such as Intel's Haswell/Broadwell or AMD's Bulldozer/PileDriver do not benefit from it.
For this reason the change also adds a "HasFastLZCNT" feature which gets enabled for Jaguar.

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

llvm-svn: 284248

8 years ago[InstCombine] use m_APInt to allow sub with constant folds for splat vectors
Sanjay Patel [Fri, 14 Oct 2016 16:31:54 +0000 (16:31 +0000)]
[InstCombine] use m_APInt to allow sub with constant folds for splat vectors

llvm-svn: 284247

8 years ago[docs] Update some obsolete information in BitCodeFormat docs.
Mehdi Amini [Fri, 14 Oct 2016 16:23:09 +0000 (16:23 +0000)]
[docs] Update some obsolete information in BitCodeFormat docs.

Summary:
* Describe new (3.3) parameter attribute group encoding, leaving old encoding there with a note about legacy
* Bring TYPE_BLOCK docs up to date
* Remove docs about obsolete (pre 3.0) TYPE_SYMTAB_BLOCK, TST_CODE_ENTRY
* Fix a couple of incorrect comments and remove one unused enum definition along the way

This addresses https://llvm.org/bugs/show_bug.cgi?id=28941.

Patch by: Ismail Badawi <ibadawi@cisco.com>

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

llvm-svn: 284246

8 years ago[InstCombine] add tests for missing vector folds
Sanjay Patel [Fri, 14 Oct 2016 15:55:34 +0000 (15:55 +0000)]
[InstCombine] add tests for missing vector folds

llvm-svn: 284245

8 years ago[InstCombine] auto-generate checks
Sanjay Patel [Fri, 14 Oct 2016 15:41:25 +0000 (15:41 +0000)]
[InstCombine] auto-generate checks

llvm-svn: 284244

8 years ago[InstCombine] remove redundant test
Sanjay Patel [Fri, 14 Oct 2016 15:36:28 +0000 (15:36 +0000)]
[InstCombine] remove redundant test

This test was apparently checking for 2 independent folds, but we have
plenty of tests for those individual folds already. We are lacking
vector tests, however, because we don't have the shift folds for vectors.

llvm-svn: 284243

8 years ago[InstCombine] update test to use FileCheck and auto-generate checks
Sanjay Patel [Fri, 14 Oct 2016 15:30:31 +0000 (15:30 +0000)]
[InstCombine] update test to use FileCheck and auto-generate checks

llvm-svn: 284242

8 years ago[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)
Sanjay Patel [Fri, 14 Oct 2016 15:24:31 +0000 (15:24 +0000)]
[InstCombine] sub X, sext(bool Y) -> add X, zext(bool Y)

Prefer add/zext because they are better supported in terms of value-tracking.

Note that the backend should be prepared for this IR canonicalization
(including vector types) after:
https://reviews.llvm.org/rL284015

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

llvm-svn: 284241

8 years agoDefine "contiki" OS specifier.
David L Kreitzer [Fri, 14 Oct 2016 14:41:46 +0000 (14:41 +0000)]
Define "contiki" OS specifier.

Patch by Michael LeMay

Differential revision: http://reviews.llvm.org/D24897

llvm-svn: 284240

8 years ago[DAG] add folds for negated shifted sign bit
Sanjay Patel [Fri, 14 Oct 2016 14:26:47 +0000 (14:26 +0000)]
[DAG] add folds for negated shifted sign bit

The same folds exist in InstCombine already.

This came up as part of:
https://reviews.llvm.org/D25485

llvm-svn: 284239

8 years ago[x86] add tests to show missing folds for negated shifted sign bit
Sanjay Patel [Fri, 14 Oct 2016 14:14:40 +0000 (14:14 +0000)]
[x86] add tests to show missing folds for negated shifted sign bit

llvm-svn: 284238

8 years ago[libcxx] Improve the gcc workaround for the missing __has_include macro.
Asiri Rathnayake [Fri, 14 Oct 2016 13:56:58 +0000 (13:56 +0000)]
[libcxx] Improve the gcc workaround for the missing __has_include macro.

NFC.

llvm-svn: 284237

8 years ago[clang-move] Don't overuse Replacements::add.
Haojian Wu [Fri, 14 Oct 2016 13:43:49 +0000 (13:43 +0000)]
[clang-move] Don't overuse Replacements::add.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 284236

8 years ago[clang-tidy] Add additional diagnostic to misc-use-after-move
Martin Bohme [Fri, 14 Oct 2016 13:23:39 +0000 (13:23 +0000)]
[clang-tidy] Add additional diagnostic to misc-use-after-move

Summary:
This adds a diagnostic to the misc-use-after-move check that is output when the
use happens on a later loop iteration than the move, for example:

    A a;
    for (int i = 0; i < 10; ++i) {
      a.foo();
      std::move(a);
    }

This situation can be confusing to users because, in terms of source code
location, the use is above the move. This can make it look as if the warning
is a false positive, particularly if the loop is long but the use and move are
close together.

In cases like these, misc-use-after-move will now output an additional
diagnostic:

  a.cpp:393:7: note: the use happens in a later loop iteration than the move

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 284235

8 years ago[ELF] - Added support of PT_OPENBSD_RANDOMIZE
George Rimar [Fri, 14 Oct 2016 13:02:22 +0000 (13:02 +0000)]
[ELF] - Added support of PT_OPENBSD_RANDOMIZE

This is 30646.

PT_OPENBSD_RANDOMIZE
The array element specifies the location and size of a part of the memory image of the program that must be filled with random data before any code in the object is executed. The memory region specified by a segment of this type may overlap the region specified by a PT_GNU_RELRO segment, in which case the intersection will be filled with random data before being marked read-only.

Reference links:
http://man.openbsd.org/OpenBSD-current/man5/elf.5
https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461

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

llvm-svn: 284234

8 years ago[clang-move] Add header guard for the new header.
Haojian Wu [Fri, 14 Oct 2016 13:01:36 +0000 (13:01 +0000)]
[clang-move] Add header guard for the new header.

Summary:
The header guard generated by clang-move isn't always a perfect
style, just avoid getting the header included multiple times during
compiling period.

Also, we can use llvm-Header-guard clang-tidy check to correct the guard
automatically.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 284233

8 years ago[libcxx] Do not declare the thread api when __external_threading is present
Asiri Rathnayake [Fri, 14 Oct 2016 13:00:07 +0000 (13:00 +0000)]
[libcxx] Do not declare the thread api when __external_threading is present

This fixes a small omission where even when __external_threading is provided,
we attempt to declare a pthread based threading API. Instead, we should leave
out everything for the __external_threading header to take care of.

The __threading_support header provides a proof-of-concept externally threaded
libc++ variant when _LIBCPP_HAS_THREAD_API_EXTERNAL is defined. But if the
__external_threading header is present, we should exclude all of that POC stuff.

Reviewers: EricWF

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

llvm-svn: 284232

8 years ago[LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class
Vadim Macagon [Fri, 14 Oct 2016 12:58:02 +0000 (12:58 +0000)]
[LLDB-MI] Minor cleanup of CMICmnLLDBUtilSBValue class

Summary:
Placeholder c-strings don't need to be instance variables.

Reviewers: ki.stfu, abidh

Subscribers: lldb-commits

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

llvm-svn: 284231

8 years agoDisable Modules when building the libc++ sources.
Eric Fiselier [Fri, 14 Oct 2016 12:56:52 +0000 (12:56 +0000)]
Disable Modules when building the libc++ sources.

Libc++ will not build with modules enabled. In order to support an in-tree
libc++ when LLVM_ENABLE_MODULES is ON we need to explicitly disable the feature.

Unfortunately the libc++ sources are fundamentally non-modular. For example
iostream.cpp defines cout, cerr, wout, ... as char buffers instead of streams
in order to better control initialization/destruction. Not shockingly Clang
diagnoses this. Many other sources files define _LIBCPP_BUILDING_FOO macros to
provide definitions for normally inline symbols (See bind.cpp). Finally The
current module.map prohibits using <strstream> in C++11 so we can't build
strstream.cpp.

I think I can fix most of these issues but until then just disable modules.

llvm-svn: 284230

8 years agoFix for PR30632: Name mangling issue.
Alexey Bataev [Fri, 14 Oct 2016 12:43:59 +0000 (12:43 +0000)]
Fix for PR30632: Name mangling issue.

There was a bug in the implementation of captured statements. If it has
a lambda expression in it and the same lambda expression is used outside
the captured region, clang produced an error:
```
error: definition with same mangled name as another definition
```
Here is an example:
```
struct A {
 template <typename L>
 void g(const L&) { }
};

template<typename T>
void f() {
  {
    A().g([](){});
  }
  A().g([](){});
}

int main() {
  f<void>();
}
```

Error report:
```
main.cpp:3:10: error: definition with same mangled name as another
definition
    void g(const L&) { }
             ^
main.cpp:3:10: note: previous definition is here
```
Patch fixes this bug.

llvm-svn: 284229

8 years agoRemoved duplicate header include
Eric Liu [Fri, 14 Oct 2016 11:48:10 +0000 (11:48 +0000)]
Removed duplicate header include

Reviewers: ioeric

Subscribers: klimek

Patch by Krasimir Georgiev!

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

llvm-svn: 284228

8 years ago[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS
George Rimar [Fri, 14 Oct 2016 11:10:36 +0000 (11:10 +0000)]
[ELF] - Do not crash when object has multiple SHT_MIPS_OPTIONS

Issue was revealed by AFl and I was able to generate such object using yaml2obj.

When object has more than one SHT_MIPS_OPTIONS,
each except the last one is destroyed after placing into Sections array.
Sections array contains dead pointers finally. LLD may crash then.

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

llvm-svn: 284227

8 years ago[ELF] - Implemented -z wxneeded.
George Rimar [Fri, 14 Oct 2016 10:34:36 +0000 (10:34 +0000)]
[ELF] - Implemented -z wxneeded.

-z wxneeded creates a PHDR PT_OPENBSD_WXNEEDED.

PT_OPENBSD_WXNEEDED
The array element specifies that a process executing this file may need to be able to map or protect memory regions as simultaneously executable and writable. If the system is unable or unwilling to permit that for this executable then it may fail immediately. This segment type is meaningful only for executable files and is ignored in other objects.

http://man.openbsd.org/OpenBSD-current/man5/elf.5

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

llvm-svn: 284226

8 years agoWork around Clang driver segfault when --coverage is used with -c and /dev/null
Eric Fiselier [Fri, 14 Oct 2016 10:30:33 +0000 (10:30 +0000)]
Work around Clang driver segfault when --coverage is used with -c and /dev/null

llvm-svn: 284225

8 years agoAMDGPU: Select 64-bit {ADD,SUB}{C,E} nodes
Nicolai Haehnle [Fri, 14 Oct 2016 10:30:00 +0000 (10:30 +0000)]
AMDGPU: Select 64-bit {ADD,SUB}{C,E} nodes

Summary:
This will be used for 64-bit MULHU, which is in turn used for the 64-bit
divide-by-constant optimization (see D24822).

Reviewers: arsenm, tstellarAMD

Subscribers: kzhuravl, wdng, yaxunl, llvm-commits, tony-tye

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

llvm-svn: 284224

8 years ago[GlobalISel] Get the AArch64 tests to work on Linux
Diana Picus [Fri, 14 Oct 2016 10:19:40 +0000 (10:19 +0000)]
[GlobalISel] Get the AArch64 tests to work on Linux

Mostly this just means changing the triple from aarch64-apple-ios to the generic
aarch64--. Only one test needs more significant changes, but GlobalISel already
does the right thing so it's ok to just change the checks.

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

llvm-svn: 284223

8 years agoTry to fix windows bot file path style failure caused by r284219.
Eric Liu [Fri, 14 Oct 2016 10:10:26 +0000 (10:10 +0000)]
Try to fix windows bot file path style failure caused by r284219.

llvm-svn: 284222

8 years ago[clang-move] Matching static class member more correctly.
Haojian Wu [Fri, 14 Oct 2016 10:07:58 +0000 (10:07 +0000)]
[clang-move] Matching static class member more correctly.

Reviewers: ioeric

Subscribers: cfe-commits

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

llvm-svn: 284221

8 years agoFix use-after-frees
Nicolai Haehnle [Fri, 14 Oct 2016 09:49:51 +0000 (09:49 +0000)]
Fix use-after-frees

Extracted from D25313, as suggested by Justin Bogner.

llvm-svn: 284220

8 years agoDeduplicate sets of replacements by file names.
Eric Liu [Fri, 14 Oct 2016 09:32:06 +0000 (09:32 +0000)]
Deduplicate sets of replacements by file names.

Summary:
If there are multiple <File, Replacements> pairs with the same file
path after removing dots, we only keep one pair (with path after dots being
removed) and discard the rest.

Reviewers: djasper

Subscribers: klimek, hokein, bkramer, cfe-commits

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

llvm-svn: 284219

8 years ago[mips] Fix aui/daui/dahi/dati for MIPSR6
Simon Dardis [Fri, 14 Oct 2016 09:31:42 +0000 (09:31 +0000)]
[mips] Fix aui/daui/dahi/dati for MIPSR6

For compatiblity with binutils, define these instructions to take
two registers with a 16bit unsigned immediate. Both of the registers
have to be same for dahi and dati.

Reviewers: dsanders, zoran.jovanovic

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

llvm-svn: 284218

8 years agoMark test as unsupported without threads
Eric Fiselier [Fri, 14 Oct 2016 09:12:53 +0000 (09:12 +0000)]
Mark test as unsupported without threads

llvm-svn: 284217

8 years agoRemove dead CMake target
Eric Fiselier [Fri, 14 Oct 2016 09:06:38 +0000 (09:06 +0000)]
Remove dead CMake target

llvm-svn: 284216

8 years agoAMDGPU: Fix use-after-frees
Nicolai Haehnle [Fri, 14 Oct 2016 09:03:04 +0000 (09:03 +0000)]
AMDGPU: Fix use-after-frees

Reviewers: arsenm, tstellarAMD

Subscribers: kzhuravl, wdng, yaxunl, tony-tye, llvm-commits

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

llvm-svn: 284215

8 years agoXFAIL aligned allocation tests for older Clang versions
Eric Fiselier [Fri, 14 Oct 2016 08:47:09 +0000 (08:47 +0000)]
XFAIL aligned allocation tests for older Clang versions

llvm-svn: 284214

8 years ago[x86][ms-inline-asm] use of "jmp short" in asm is not supported
Michael Zuckerman [Fri, 14 Oct 2016 08:13:27 +0000 (08:13 +0000)]
[x86][ms-inline-asm] use of "jmp short" in asm is not supported

Test linked to: https://reviews.llvm.org/D24957

Committing in the name of Ziv Izhar: After check-all and LGTM .

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

llvm-svn: 284213

8 years ago[clang-tidy] Fix readability-braces-around-statements false positive
Marek Kurdej [Fri, 14 Oct 2016 08:10:08 +0000 (08:10 +0000)]
[clang-tidy] Fix readability-braces-around-statements false positive

Summary:
This fixes a false-positive e.g. when string literals are returned from if statement.

This patch includes as well a small fix to includes and renames of the test suite that collided with the name of the check.

Reviewers: alexfh, hokein

Subscribers: hokein

Tags: #clang-tools-extra

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

llvm-svn: 284212

8 years ago[x86][ms-inline-asm] use of "jmp short" in asm is not supported
Michael Zuckerman [Fri, 14 Oct 2016 08:09:40 +0000 (08:09 +0000)]
[x86][ms-inline-asm] use of "jmp short" in asm is not supported

Committing in the name of Ziv Izhar: After check-all and LGTM .

The following patch is for compatability with Microsoft.
Microsoft ignores the keyword "short" when used after a jmp, for example:
__asm {
      jmp short label
      label:
      }

A test for that patch will be added in another patch, since it's located in clang's codegen tests. Link will be added shortly.
link to test: https://reviews.llvm.org/D24958

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

llvm-svn: 284211

8 years agoXFAIL aligned allocation test failures with UBSAN
Eric Fiselier [Fri, 14 Oct 2016 07:49:15 +0000 (07:49 +0000)]
XFAIL  aligned allocation test failures with UBSAN

llvm-svn: 284210

8 years agoAdd void_t and invoke feature test macros
Eric Fiselier [Fri, 14 Oct 2016 07:19:52 +0000 (07:19 +0000)]
Add void_t and invoke feature test macros

llvm-svn: 284209

8 years agoUpdate OS X ABI list
Eric Fiselier [Fri, 14 Oct 2016 06:49:30 +0000 (06:49 +0000)]
Update OS X ABI list

llvm-svn: 284208

8 years agoCorrect ABI changelog revision number
Eric Fiselier [Fri, 14 Oct 2016 06:47:37 +0000 (06:47 +0000)]
Correct ABI changelog revision number

llvm-svn: 284207

8 years agoImplement P0035R4 -- Add C++17 aligned allocation functions
Eric Fiselier [Fri, 14 Oct 2016 06:46:30 +0000 (06:46 +0000)]
Implement P0035R4 -- Add C++17 aligned allocation functions

Summary:
This patch implements the library side of P0035R4. The implementation is thanks to @rsmith.

In addition to the C++17 implementation, the library implementation can be explicitly turned on using `-faligned-allocation` in all dialects.

Reviewers: mclow.lists, rsmith

Subscribers: rsmith, cfe-commits

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

llvm-svn: 284206

8 years agoCleanup LIT testing doc
Eric Fiselier [Fri, 14 Oct 2016 06:15:27 +0000 (06:15 +0000)]
Cleanup LIT testing doc

llvm-svn: 284205

8 years ago[DAGCombiner] Teach createBuildVecShuffle to handle cases where input vectors are...
Craig Topper [Fri, 14 Oct 2016 06:00:42 +0000 (06:00 +0000)]
[DAGCombiner] Teach createBuildVecShuffle to handle cases where input vectors are less than half of the output vector size.

This will be needed by a future commit to support sign/zero extending from v8i8 to v8i64 which requires a sign/zero_extend_vector_inreg to be created which requires v8i8 to be concatenated upto v64i8 and goes through this code.

llvm-svn: 284204

8 years agoIn preparation for removing getNameWithPrefix off of TargetMachine,
Eric Christopher [Fri, 14 Oct 2016 05:47:41 +0000 (05:47 +0000)]
In preparation for removing getNameWithPrefix off of TargetMachine,
sink the current behavior into the callers and sink
TargetMachine::getNameWithPrefix into TargetMachine::getSymbol.

llvm-svn: 284203

8 years agoTidy the calls to getCurrentSection().first -> getCurrentSectionOnly to help
Eric Christopher [Fri, 14 Oct 2016 05:47:37 +0000 (05:47 +0000)]
Tidy the calls to getCurrentSection().first -> getCurrentSectionOnly to help
readability a bit.

llvm-svn: 284202

8 years agoTidy up example of getting the pointer size.
Eric Christopher [Fri, 14 Oct 2016 05:45:46 +0000 (05:45 +0000)]
Tidy up example of getting the pointer size.

llvm-svn: 284201

8 years agoRemove two ABI symbols added after the 3.9 release
Eric Fiselier [Fri, 14 Oct 2016 05:29:46 +0000 (05:29 +0000)]
Remove two ABI symbols added after the 3.9 release

llvm-svn: 284200

8 years agoAdd ABI changelog entry for <any>
Eric Fiselier [Fri, 14 Oct 2016 05:10:06 +0000 (05:10 +0000)]
Add ABI changelog entry for <any>

llvm-svn: 284199

8 years agoSort ABI lists by name so that changes don't generate big diffs
Eric Fiselier [Fri, 14 Oct 2016 05:04:00 +0000 (05:04 +0000)]
Sort ABI lists by name so that changes don't generate big diffs

llvm-svn: 284198

8 years ago[ELF/AMDGPU]: Add support for new relocations
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:51:43 +0000 (04:51 +0000)]
[ELF/AMDGPU]: Add support for new relocations

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

llvm-svn: 284197

8 years ago[AMDGPU] Emit 32-bit lo/hi got and pc relative variant kinds for external and global...
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:37:34 +0000 (04:37 +0000)]
[AMDGPU] Emit 32-bit lo/hi got and pc relative variant kinds for external and global address space variables

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

llvm-svn: 284196

8 years ago[AMDGPU] Add 32-bit lo/hi got and pc relative variant kinds and emit appropriate...
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:21:32 +0000 (04:21 +0000)]
[AMDGPU] Add 32-bit lo/hi got and pc relative variant kinds and emit appropriate relocations

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

llvm-svn: 284195

8 years agoRevert r284193 - it is not correct on OS X
Eric Fiselier [Fri, 14 Oct 2016 04:21:24 +0000 (04:21 +0000)]
Revert r284193 - it is not correct on OS X

llvm-svn: 284194

8 years agoRe-export two previously exported std::string functions.
Eric Fiselier [Fri, 14 Oct 2016 04:14:24 +0000 (04:14 +0000)]
Re-export two previously exported std::string functions.

These functions were removed from the dylib sometime between the 3.9 release
and now. This patch manually exports them to re-gain ABI compatibility.

llvm-svn: 284193

8 years agoAdd ABI list for 3.9 linux
Eric Fiselier [Fri, 14 Oct 2016 04:06:19 +0000 (04:06 +0000)]
Add ABI list for 3.9 linux

llvm-svn: 284192

8 years ago[Support/ELF/AMDGPU] Add 32-bit lo/hi got and pc relative relocations
Konstantin Zhuravlyov [Fri, 14 Oct 2016 04:03:49 +0000 (04:03 +0000)]
[Support/ELF/AMDGPU] Add 32-bit lo/hi got and pc relative relocations

Added relocation names:
  - R_AMDGPU_GOTPCREL32_LO
  - R_AMDGPU_GOTPCREL32_HI
  - R_AMDGPU_REL32_LO
  - R_AMDGPU_REL32_HI

AMDGPU isa only supports 32-bit immediates. In order to access 64-bit address we need to generate 32-bit lo/hi relocations, and do the right math (separate patch). Currently we only generate one 32 bit relocation for lower bits for each access, losing higher bits. Hence we need relocations listed above.

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

llvm-svn: 284191

8 years agoAdd `llvm::` in clEnumVal macro (NFC)
Mehdi Amini [Fri, 14 Oct 2016 03:54:46 +0000 (03:54 +0000)]
Add `llvm::` in clEnumVal macro (NFC)

This allows to use llvm:cl::opt without `using namespace llvm;`

llvm-svn: 284190

8 years agoAdd 3.9 symbol list for OS X
Eric Fiselier [Fri, 14 Oct 2016 02:55:43 +0000 (02:55 +0000)]
Add 3.9 symbol list for OS X

llvm-svn: 284189

8 years agoFix CMake configuration error and add ABI lists for OS X.
Eric Fiselier [Fri, 14 Oct 2016 02:55:19 +0000 (02:55 +0000)]
Fix CMake configuration error and add ABI lists for OS X.

The primary reason for this patch is to add the OS X ABI lists for 3.9 and
ToT.

However while working on that I discovered that we incorrectly
exported the libc++abi symbols. Previously we had chosen the wrong CMake
configuration path and that caused us to re-export the c++abi binary instead
of using the symbol lists.

llvm-svn: 284188

8 years agoFix bogus assert breaking modules self-host.
Richard Smith [Fri, 14 Oct 2016 02:35:11 +0000 (02:35 +0000)]
Fix bogus assert breaking modules self-host.

llvm-svn: 284187

8 years agoAdd OS X abi list
Eric Fiselier [Fri, 14 Oct 2016 02:32:54 +0000 (02:32 +0000)]
Add OS X abi list

llvm-svn: 284186

8 years agoAdd ABI Changelog and current symbol list for Linux
Eric Fiselier [Fri, 14 Oct 2016 02:27:44 +0000 (02:27 +0000)]
Add ABI Changelog and current symbol list for Linux

llvm-svn: 284185

8 years agoUse SubstInitializer instead of SubstExpr when instantiating a default
Richard Smith [Fri, 14 Oct 2016 01:12:20 +0000 (01:12 +0000)]
Use SubstInitializer instead of SubstExpr when instantiating a default
argument, in order to correctly instantiate the initializer.

llvm-svn: 284184

8 years agoThis test passes on i386 now.
Jim Ingham [Fri, 14 Oct 2016 01:11:19 +0000 (01:11 +0000)]
This test passes on i386 now.

llvm-svn: 284183

8 years agoThis test is passing on i386 now.
Jim Ingham [Fri, 14 Oct 2016 01:03:03 +0000 (01:03 +0000)]
This test is passing on i386 now.

llvm-svn: 284182

8 years agoTimer: Fix doxygen comments, use member initializer; NFC
Matthias Braun [Fri, 14 Oct 2016 00:17:19 +0000 (00:17 +0000)]
Timer: Fix doxygen comments, use member initializer; NFC

llvm-svn: 284181

8 years agoAdd interface for querying physical hardware concurrency
Teresa Johnson [Fri, 14 Oct 2016 00:13:59 +0000 (00:13 +0000)]
Add interface for querying physical hardware concurrency

Summary:
This will be used by ThinLTO to set the amount of backend
parallelism, which performs better when restricted to the number
of physical cores (on X86 at least, where getHostNumPhysicalCores is
currently defined). If not available this falls back to
thread::hardware_concurrency.

Note I didn't add to the thread class since that is a typedef to
std::thread where available.

Reviewers: mehdi_amini

Subscribers: beanz, llvm-commits, mgorny

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

llvm-svn: 284180

8 years agoremove warnings from google-benchmarks in libcxx
Sebastian Pop [Fri, 14 Oct 2016 00:07:57 +0000 (00:07 +0000)]
remove warnings from google-benchmarks in libcxx

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

Patch written by Aditya Kumar.

llvm-svn: 284179

8 years ago[compiler-rt][XRay] Support tail call sleds
Dean Michael Berris [Thu, 13 Oct 2016 23:56:54 +0000 (23:56 +0000)]
[compiler-rt][XRay] Support tail call sleds

Summary:
This change depends on D23986 which adds tail call-specific sleds. For
now we treat them first as normal exits, and in the future leave room
for implementing this as a different kind of log entry.

The reason for deferring the change is so that we can keep the naive
logging implementation more accurate without additional complexity for
reading the log. The accuracy is gained in effectively interpreting call
stacks like:

  A()
    B()
      C()

Which when tail-call merged will end up not having any exit entries for
A() nor B(), but effectively in turn can be reasoned about as:

  A()
  B()
  C()

Although we lose the fact that A() had called B() then had called C()
with the naive approach, a later iteration that adds the explicit tail
call entries would be a change in the log format and thus necessitate a
version change for the header. We can do this later to have a chance at
releasing some tools (in D21987) that are able to handle the naive log
format, then support higher version numbers of the log format too.

Reviewers: echristo, kcc, rSerge, majnemer

Subscribers: mehdi_amini, llvm-commits, dberris

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

llvm-svn: 284178

8 years agoImprove comments.
Rui Ueyama [Thu, 13 Oct 2016 23:08:33 +0000 (23:08 +0000)]
Improve comments.

llvm-svn: 284177

8 years agoReinstate r281429, reverted in r281452, with a fix for its mishandling of
Richard Smith [Thu, 13 Oct 2016 23:04:14 +0000 (23:04 +0000)]
Reinstate r281429, reverted in r281452, with a fix for its mishandling of
compiles without -fmodules-local-submodule-visibility. Original commit message:

[modules] When merging one definition into another, propagate the list of
re-exporting modules from the discarded definition to the retained definition.

llvm-svn: 284176

8 years agoCodeGen: use MSVC division on windows itanium
Saleem Abdulrasool [Thu, 13 Oct 2016 23:00:11 +0000 (23:00 +0000)]
CodeGen: use MSVC division on windows itanium

Windows itanium is identical to MSVC when dealing with everything but C++.
Lower the math routines into msvcrt rather than compiler-rt.

llvm-svn: 284175

8 years agoDisable swiftcall test on windows: More brutal way to appease windows bots
Arnold Schwaighofer [Thu, 13 Oct 2016 22:47:03 +0000 (22:47 +0000)]
Disable swiftcall test on windows: More brutal way to appease windows bots

The backtrace on the bot does not give me any indication what is wrong.
The test case interestingly passes in stage2 of the build.
I don't have a way of debugging this.

Disable the test on windows and hope if there is truly a bug in the code that
was causing we will eventually run into this on other platforms.

llvm-svn: 284174

8 years agoCodeGen: adjust floating point operations in Windows itanium
Saleem Abdulrasool [Thu, 13 Oct 2016 22:38:15 +0000 (22:38 +0000)]
CodeGen: adjust floating point operations in Windows itanium

Windows itanium is equivalent to MSVC except in C++ mode.  Ensure that the
promote the 32-bit floating point operations to their 64-bit equivalences.

llvm-svn: 284173

8 years agoAdd 64-bit MS _Interlocked functions as builtins again
Albert Gutowski [Thu, 13 Oct 2016 22:35:07 +0000 (22:35 +0000)]
Add 64-bit MS _Interlocked functions as builtins again

Summary: Previously global 64-bit versions of _Interlocked functions broke buildbots on i386, so now I'm adding them as builtins for x86-64 and ARM only (should they be also on AArch64? I had problems with testing it for AArch64, so I left it)

Reviewers: hans, majnemer, mstorsjo, rnk

Subscribers: cfe-commits, aemerson

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

llvm-svn: 284172

8 years agoMake lsan complain loudly when running under ptrace
Kostya Serebryany [Thu, 13 Oct 2016 22:34:13 +0000 (22:34 +0000)]
Make lsan complain loudly when running under ptrace

Summary:
LeakSanitizer does not work with ptrace but currently it
will print warnings (only under verbosity=1) and then proceed
to print tons of false reports.
This patch makes lsan fail hard under ptrace with a verbose message.

https://github.com/google/sanitizers/issues/728

Reviewers: eugenis, vitalybuka, aizatsky

Subscribers: kubabrecka, llvm-commits

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

llvm-svn: 284171

8 years ago[DAG] hoist DL(N) and fix formatting; NFC
Sanjay Patel [Thu, 13 Oct 2016 22:27:10 +0000 (22:27 +0000)]
[DAG] hoist DL(N) and fix formatting; NFC

llvm-svn: 284170

8 years ago[libFuzzer] more detailed message for disabled leak detection
Kostya Serebryany [Thu, 13 Oct 2016 22:24:10 +0000 (22:24 +0000)]
[libFuzzer] more detailed message for disabled leak detection

llvm-svn: 284169

8 years agoELF: Override DSO definitions when creating __start_* and __stop_* symbols.
Peter Collingbourne [Thu, 13 Oct 2016 22:20:18 +0000 (22:20 +0000)]
ELF: Override DSO definitions when creating __start_* and __stop_* symbols.

Previously we would fail to synthesise a __start_ or __stop_ symbol if
there existed a definition in a DSO. Instead, we would try to link against
the DSO definition. This became possible after D23552 when linking against
lld-produced DSOs but could in principle also occur when linking against
DSOs produced by other linkers.

Not only does it seem more likely that a user would expect the resolved
definition to be local to the executable, but if a __start_ or __stop_
symbol was synthesised by the linker, it is effectively impossible to link
against correctly from a non-PIC executable in a read-only section. Neither
a PLT nor a copy relocation would give us the right semantics here. The only
way the link could succeed is if the executable provided its own synthetic
definition of the symbol.

The fix is to also synthesise the definition if the only definition comes
from a DSO. Since this is what the addOptionalSynthetic function does,
switch to using that function.

Fixes PR30680.

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

llvm-svn: 284168