platform/upstream/llvm.git
7 years agoDisable trivial pair copy/move tests when unsupported
Dimitry Andric [Wed, 12 Oct 2016 20:26:47 +0000 (20:26 +0000)]
Disable trivial pair copy/move tests when unsupported

Summary:
On FreeBSD, for ABI compatibility reasons, the pair trivial copy
constructor is disabled, using the aptly-named
`_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR` define.

Disable the related tests when this define is on, so they don't fail
unexpectedly.

Reviewers: emaste, rsmith, theraven, EricWF

Subscribers: cfe-commits

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

llvm-svn: 284047

7 years ago[CMake] Cleanup check-lldb targets
Chris Bieneman [Wed, 12 Oct 2016 20:26:13 +0000 (20:26 +0000)]
[CMake] Cleanup check-lldb targets

Summary:
This patch adds the following fixes to the check-lldb targets:

* Adds missing dependencies on lldb tools so they get built before tests execute
* Adds Ninja USES_TERMINAL to the target so that the output streams to stdout as it executes
* Uses a generator expression to find the lldb executable, this is more robust than constructing the path manually

Reviewers: tfiala, zturner

Subscribers: mgorny, lldb-commits

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

llvm-svn: 284046

7 years agoUse LLDB_SRC for relative paths
Chris Bieneman [Wed, 12 Oct 2016 20:24:42 +0000 (20:24 +0000)]
Use LLDB_SRC for relative paths

Summary:
Going from LLDB_SRC instead of the file path is safer when looking for compiler-rt. Also need to add support for looking inside the LLVM runtimes subdirectory.

Eventually we should just get CMake to provide these paths during configuration.

Reviewers: tfiala, zturner

Subscribers: lldb-commits

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

llvm-svn: 284045

7 years ago[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop
Haicheng Wu [Wed, 12 Oct 2016 20:24:32 +0000 (20:24 +0000)]
[LoopUnroll] Use the upper bound of the loop trip count to fullly unroll a loop

This patch tries to fully unroll loops having break statement like this

for (int i = 0; i < 8; i++) {
    if (a[i] == value) {
        found = true;
        break;
    }
}

GCC can fully unroll such loops, but currently LLVM cannot because LLVM only
supports loops having exact constant trip counts.

The upper bound of the trip count can be obtained from calling
ScalarEvolution::getMaxBackedgeTakenCount(). Part of the patch is the
refactoring work in SCEV to prevent duplicating code.

The feature of using the upper bound is enabled under the same circumstance
when runtime unrolling is enabled since both are used to unroll loops without
knowing the exact constant trip count.

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

llvm-svn: 284044

7 years agoFix test suite lookup path for LLDB.h
Chris Bieneman [Wed, 12 Oct 2016 20:22:02 +0000 (20:22 +0000)]
Fix test suite lookup path for LLDB.h

Summary:
When running on Darwin, the test suite assumes a specific directory structure for the build directory. This works for the Xcode project builds, but fails for CMake builds regardless of whether or not you are generating the LLDB framework.

This patch allows the Darwin code path to fall back to the more generic code path used by other platforms in the event that LLDB.h isn't where the test suite expects it.

This allows API tests to run on Darwin when building with CMake with the framework build enabled or disabled.

Reviewers: tfiala, zturner

Subscribers: labath, lldb-commits

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

llvm-svn: 284043

7 years agoFix building tests without system headers on Darwin
Chris Bieneman [Wed, 12 Oct 2016 20:19:19 +0000 (20:19 +0000)]
Fix building tests without system headers on Darwin

Summary: Default installations of OS X do not have system headers installed at /usr/include. This patch allows the LLDB test executables to properly compile when built on a system without headers at /usr/include by specifying a default value for the apple-sdk flag as "macosx".

Reviewers: tfiala, zturner

Subscribers: lldb-commits

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

llvm-svn: 284042

7 years agoFix lookup path for lldb-mi
Chris Bieneman [Wed, 12 Oct 2016 20:15:46 +0000 (20:15 +0000)]
Fix lookup path for lldb-mi

Summary:
The test suite calls realpath on the lldb executable then append "-mi" to it to find the path of the lldb-mi executable. This does not work when using CMake builds on *nix platforms. On *nix platforms when a version number is set on executables CMake generates the binary as ${name}-${version} with a symlink named ${name} pointing to it.

This results in the lldb executable being named lldb-4.0.0, and since lldb-4.0.0-mi doesn't ever match the lldb-mi executable these tests are always disabled.

This patch looks for lldb-mi in the same directory as lldb.

Reviewers: zturner, tfiala

Subscribers: ki.stfu, enlight, lldb-commits

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

llvm-svn: 284041

7 years agoLTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions().
Peter Collingbourne [Wed, 12 Oct 2016 20:12:19 +0000 (20:12 +0000)]
LTO: Use the correct mangler function in LTOCodeGenerator::applyScopeRestrictions().

We need to use the overload of Mangler::getNameWithPrefix that takes a
GlobalValue in order to mangle in the stdcall stack byte count for Windows
targets.

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

llvm-svn: 284040

7 years ago[ThinLTO] Fix bot failure due to unused variable with NDEBUG
Teresa Johnson [Wed, 12 Oct 2016 20:06:02 +0000 (20:06 +0000)]
[ThinLTO] Fix bot failure due to unused variable with NDEBUG

Put variable only used in assert under #ifndef NDEBUG.

This should fix bot failure at
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/28537

llvm-svn: 284039

7 years agoRevert "[ADT] Zip range adapter"
Mehdi Amini [Wed, 12 Oct 2016 19:54:08 +0000 (19:54 +0000)]
Revert "[ADT] Zip range adapter"

This reverts commit r284035, which breaks with MSVC 2013.

llvm-svn: 284037

7 years agoDo not remove implicit defs in BranchFolder
Krzysztof Parzyszek [Wed, 12 Oct 2016 19:50:57 +0000 (19:50 +0000)]
Do not remove implicit defs in BranchFolder

Branch folder removes implicit defs if they are the only non-branching
instructions in a block, and the branches do not use the defined registers.
The problem is that in some cases these implicit defs are required for
the liveness information to be correct.

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

llvm-svn: 284036

7 years ago[ADT] Zip range adapter
Mehdi Amini [Wed, 12 Oct 2016 19:43:02 +0000 (19:43 +0000)]
[ADT] Zip range adapter

This augments the STLExtras toolset with a zip iterator and range
adapter. Zip comes in two varieties: `zip`, which will zip to the
shortest of the input ranges, and `zip_first`, which limits its
`begin() == end()` checks to just the first krange.

Patch by: Bryant Wong <github.com/bryant>

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

llvm-svn: 284035

7 years ago[ThinLTO] Avoid archive member collisions.
Davide Italiano [Wed, 12 Oct 2016 19:35:54 +0000 (19:35 +0000)]
[ThinLTO] Avoid archive member collisions.

This fixes PR30665.

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

llvm-svn: 284034

7 years ago[NFC] Trial change to remove a redundant blank line.
Yunzhong Gao [Wed, 12 Oct 2016 19:33:33 +0000 (19:33 +0000)]
[NFC] Trial change to remove a redundant blank line.

llvm-svn: 284033

7 years agoDeclare WinX86_64ABIInfo to satisfy SwiftABI info
Arnold Schwaighofer [Wed, 12 Oct 2016 18:59:24 +0000 (18:59 +0000)]
Declare WinX86_64ABIInfo to satisfy SwiftABI info

This is minimal support that allows swift's test cases on non windows platforms
to pass.

rdar://28738985

llvm-svn: 284032

7 years agoAMDGPU: Initial implementation of VGPR indexing mode
Matt Arsenault [Wed, 12 Oct 2016 18:49:05 +0000 (18:49 +0000)]
AMDGPU: Initial implementation of VGPR indexing mode

This is the most basic handling of the indirect access
pseudos using GPR indexing mode. This currently only enables
the mode for a single v_mov_b32 and then disables it.
This is much more complicated to use than the movrel instructions,
so a new optimization pass is probably needed to fold the access
into the uses and keep the mode enabled for them.

llvm-svn: 284031

7 years ago[ThinLTO] Don't link module level assembly when importing
Teresa Johnson [Wed, 12 Oct 2016 18:39:29 +0000 (18:39 +0000)]
[ThinLTO] Don't link module level assembly when importing

Module inline asm was always being linked/concatenated
when running the IRLinker. This is correct for full LTO but not when
we are importing for ThinLTO, as it can result in multiply defined
symbols when the module asm defines a global symbol.

In order to test with llvm-lto2, I had to work around PR30396,
where a symbol that is defined in module assembly but defined in the
LLVM IR appears twice. Added workaround to llvm-lto2 with a FIXME.

Fixes PR30610.

Reviewers: mehdi_amini

Subscribers: llvm-commits

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

llvm-svn: 284030

7 years agoDocument potential implementation of CFI in hardware.
Kostya Serebryany [Wed, 12 Oct 2016 18:33:54 +0000 (18:33 +0000)]
Document potential implementation of CFI in hardware.

Summary: Document potential implementation of CFI in hardware.

Reviewers: eugenis, pcc

Subscribers: llvm-commits

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

llvm-svn: 284029

7 years ago[SimplifyCFG] Don't create PHI nodes for constant bundle operands
Sanjoy Das [Wed, 12 Oct 2016 18:15:33 +0000 (18:15 +0000)]
[SimplifyCFG] Don't create PHI nodes for constant bundle operands

Summary:
Constant bundle operands may need to retain their constant-ness for
correctness.  I'll admit that this is slightly odd, but it looks like
SimplifyCFG already does this for things like @llvm.frameaddress and
@llvm.stackmap, so I suppose adding one more case is not a big deal.

It is possible to add a mechanism to denote bundle operands that need to
remain constants, but that's probably too complicated for the time
being.

Reviewers: jmolloy

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 284028

7 years agoAMDGPU: Add instruction definitions for VGPR indexing
Matt Arsenault [Wed, 12 Oct 2016 18:00:51 +0000 (18:00 +0000)]
AMDGPU: Add instruction definitions for VGPR indexing

VI added a second method of indexing into VGPRs
besides using v_movrel*

llvm-svn: 284027

7 years agoMove x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def
Albert Gutowski [Wed, 12 Oct 2016 17:28:44 +0000 (17:28 +0000)]
Move x86-64 builtins from SemaChecking.cpp to BuiltinsX86_64.def

Summary: Follow-up to https://reviews.llvm.org/D24598 (separating builtins for x84-64 and i386).

Reviewers: hans, thakis, rnk

Subscribers: cfe-commits

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

llvm-svn: 284026

7 years ago[X86] Add the v4i32 flavor test-case for pr30371
Zvi Rackover [Wed, 12 Oct 2016 17:06:30 +0000 (17:06 +0000)]
[X86] Add the v4i32 flavor test-case for pr30371

llvm-svn: 284025

7 years agoAMDGPU/SI: Change mimg intrinsic signatures
Tom Stellard [Wed, 12 Oct 2016 16:35:29 +0000 (16:35 +0000)]
AMDGPU/SI: Change mimg intrinsic signatures

This makes more fields overridable and removes redundant bits.

Patch by: Changpeng Fang

llvm-svn: 284024

7 years ago[ScopInfo/CodeGen] ExitPHI reads are implicit.
Michael Kruse [Wed, 12 Oct 2016 16:31:09 +0000 (16:31 +0000)]
[ScopInfo/CodeGen] ExitPHI reads are implicit.

Under some conditions MK_Value read accessed where converted to MK_ExitPHI read
accessed. This is unexpected because MK_ExitPHI read accesses are implicit after
the scop execution. This behaviour was introduced in r265261, which fixed a
failed assertion/crash in CodeGen.

Instead, we fix this failure in CodeGen itself. createExitPHINodeMerges(),
despite its name, also handles accesses of kind MK_Value, only to skip them
because they access values that are usually not PHI nodes in the SCoP region's
exit block. Except in the situation observed in r265261.

Do not convert value accessed to ExitPHI accesses and do not handle
value accesses like ExitPHI accessed in CodeGen anymore.

llvm-svn: 284023

7 years ago[ValueTracking] An improvement to IR ValueTracking on Non-negative Integers
Artur Pilipenko [Wed, 12 Oct 2016 16:18:43 +0000 (16:18 +0000)]
[ValueTracking] An improvement to IR ValueTracking on Non-negative Integers

Since this change is known to cause performance degradations in some cases it's commited under a temporary flag which is turned off by default.

Patch by Li Huang

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

llvm-svn: 284022

7 years agoMark ostream_iterator's constructors as noexcept.
Marshall Clow [Wed, 12 Oct 2016 16:13:48 +0000 (16:13 +0000)]
Mark ostream_iterator's constructors as noexcept.

llvm-svn: 284021

7 years ago[clang-move] Compare with real paths of symlinks
Haojian Wu [Wed, 12 Oct 2016 15:50:30 +0000 (15:50 +0000)]
[clang-move] Compare with real paths of symlinks

Summary: MakeAbsolutePath does wrong things with symlinks previously. When comparing with a symlink, we need to compare with the real path of it. This fixes issues when the build directory is a symlink.

Reviewers: ioeric

Subscribers: beanz, mgorny, cfe-commits, bkramer

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

llvm-svn: 284020

7 years agoNFC: CodeCompletionResult's constructor should take const NamedDecl
Alex Lorenz [Wed, 12 Oct 2016 15:33:35 +0000 (15:33 +0000)]
NFC: CodeCompletionResult's constructor should take const NamedDecl

CodeCompletionResult's Declaration field is a const pointer to the
NamedDecl, and thus the constructor should take a const pointer as well.

llvm-svn: 284019

7 years agoBranchRelaxation: Unique live ins when creating block
Matt Arsenault [Wed, 12 Oct 2016 15:32:04 +0000 (15:32 +0000)]
BranchRelaxation: Unique live ins when creating block

llvm-svn: 284018

7 years ago[MC] Fix Error Location for ParseIdentifier
Nirav Dave [Wed, 12 Oct 2016 13:58:07 +0000 (13:58 +0000)]
[MC] Fix Error Location for ParseIdentifier

Prevent partial parsing of '$' or '@' of invalid identifiers and fixup
workaround points. NFC Intended.

llvm-svn: 284017

7 years ago[libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS
Shoaib Meenai [Wed, 12 Oct 2016 13:48:14 +0000 (13:48 +0000)]
[libc++] Correct explanation of _LIBCPP_NEW_DELETE_VIS

The behavior of this macro actually needs to apply universally on
Windows and not just when using the Microsoft CRT. Update the macro
definition and documentation accordingly.

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

llvm-svn: 284016

7 years ago[DAGCombiner] Update most ADD combines to support general vector combines
Simon Pilgrim [Wed, 12 Oct 2016 13:48:10 +0000 (13:48 +0000)]
[DAGCombiner] Update most ADD combines to support general vector combines

Add a number of helper functions to match scalar or vector equivalent constant/splat values to allow most of the combine patterns to be used by vectors.

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

llvm-svn: 284015

7 years ago[DAGCombiner] Do not remove the load of stored values when optimizations are disabled
Konstantin Zhuravlyov [Wed, 12 Oct 2016 13:44:24 +0000 (13:44 +0000)]
[DAGCombiner] Do not remove the load of stored values when optimizations are disabled

This combiner breaks debug experience and should not be run when optimizations are disabled.

For example:
  int main() {
    int j = 0;
    j += 2;
    if (j == 2)
      return 0;
    return 5;
  }
When debugging this code compiled in /O0, it should be valid to break at line "j+=2;" and edit the value of j. It should change the return value of the function.

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

llvm-svn: 284014

7 years ago[CVP] Convert an AShr to a LShr if 1st operand is known to be nonnegative.
Chad Rosier [Wed, 12 Oct 2016 13:41:38 +0000 (13:41 +0000)]
[CVP] Convert an AShr to a LShr if 1st operand is known to be nonnegative.

An arithmetic shift can be safely changed to a logical shift if the first
operand is known positive. This allows ComputeKnownBits (and similar analysis)
to determine the sign bit of the shifted value in some cases. In turn, this
allows InstCombine to canonicalize a signed comparison (a > 0) into an equality
check (a != 0).

PR30577

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

llvm-svn: 284013

7 years agoNFC: The Cost Model specialization, by Andrey Tischenko
Alexey Bataev [Wed, 12 Oct 2016 13:24:13 +0000 (13:24 +0000)]
NFC: The Cost Model specialization, by Andrey Tischenko

The current Cost Model implementation is very inaccurate and has to be
updated, improved, re-implemented to be able to take into account the
concrete CPU models and the concrete targets where this Cost Model is
being used. For example, the Latency Cost Model should be differ from
Code Size Cost Model, etc.
This patch is the first step to launch the developing and implementation
of a new Cost Model generation.

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

llvm-svn: 284012

7 years ago[change-namespace] don't miss comments in the beginning of a namespace block.
Eric Liu [Wed, 12 Oct 2016 12:34:18 +0000 (12:34 +0000)]
[change-namespace] don't miss comments in the beginning of a namespace block.

Reviewers: hokein

Subscribers: cfe-commits

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

llvm-svn: 284011

7 years agoAlternative fix for reloc tareting discarded section
Eugene Leviant [Wed, 12 Oct 2016 12:31:34 +0000 (12:31 +0000)]
Alternative fix for reloc tareting discarded section

r283984 introduced a problem of too many warning messages being shown
when -ffunction-sections and -fdata-sections were used in conjunction
with --gc-sections linker flag and debugging information present. This
happens because lot of relocations from .debug_line section may become
invalid in such case. The newer fix doesn't show any warning message but
zeroes OutSec pointer in createInputSectionList() to avoid crash, when
relocations are written

llvm-svn: 284010

7 years ago[ARM] Fix - missing target-cpu in test
Javed Absar [Wed, 12 Oct 2016 12:13:55 +0000 (12:13 +0000)]
[ARM] Fix - missing target-cpu in test

Fixes an incomplete test, wherein the target-cpu name (cortex-r52) was missing.

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

llvm-svn: 284009

7 years agoReinstate r283887 and r283882.
Vassil Vassilev [Wed, 12 Oct 2016 11:57:08 +0000 (11:57 +0000)]
Reinstate r283887 and r283882.

Original message:
"[modules] PR28752: Do not instantiate variable declarations which are not visible.

https://reviews.llvm.org/D24508

Patch developed in collaboration with Richard Smith!"

llvm-svn: 284008

7 years ago[CodeCompletion] Show protocol properties that are accessed through qualified id
Alex Lorenz [Wed, 12 Oct 2016 11:40:15 +0000 (11:40 +0000)]
[CodeCompletion] Show protocol properties that are accessed through qualified id

This commit improves code completion for properties that are declared in
Objective-C protocols by making sure that properties show up in completions
when they are accessed through a qualified id.

rdar://24426041

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

llvm-svn: 284007

7 years agoCorrectly grant rebound limited_allocators friendship.
Eric Fiselier [Wed, 12 Oct 2016 11:35:37 +0000 (11:35 +0000)]
Correctly grant rebound limited_allocators friendship.

llvm-svn: 284006

7 years agoRemove incorrect XFAILS
Eric Fiselier [Wed, 12 Oct 2016 11:29:18 +0000 (11:29 +0000)]
Remove incorrect XFAILS

llvm-svn: 284005

7 years agoUnbreak C++03 build
Eric Fiselier [Wed, 12 Oct 2016 11:20:27 +0000 (11:20 +0000)]
Unbreak C++03 build

llvm-svn: 284004

7 years ago[LLDB][MIPS] fix Floating point register read/write for big endian
Nitesh Jain [Wed, 12 Oct 2016 10:53:57 +0000 (10:53 +0000)]
[LLDB][MIPS] fix Floating point register read/write for big endian

Reviewers: clayborg, labath, jaydeep

Subscribers: bhushan, slthakur, lldb-commits

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

llvm-svn: 284003

7 years agoRemove usages of _LIBCPP_CONSTEXPR under test/std
Eric Fiselier [Wed, 12 Oct 2016 10:28:09 +0000 (10:28 +0000)]
Remove usages of _LIBCPP_CONSTEXPR under test/std

llvm-svn: 284002

7 years ago[LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABI
Nitesh Jain [Wed, 12 Oct 2016 10:21:09 +0000 (10:21 +0000)]
[LLDB][MIPS] Fix qProcessInfo to return correct pointer size based on ELF ABI

Reviewers: clayborg, labath

Subscribers: jaydeep, bhushan, slthakur, lldb-commits

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

llvm-svn: 284001

7 years ago[InstCombine] Fix constexpr issue in select combining
Simon Pilgrim [Wed, 12 Oct 2016 10:20:15 +0000 (10:20 +0000)]
[InstCombine] Fix constexpr issue in select combining

As discussed by Andrea on PR30486, we have an unsafe cast to an Instruction type in the select combine which doesn't take into account that it could be a ConstantExpr instead.

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

llvm-svn: 284000

7 years agoRemove usages of _ALIGNAS_TYPE
Eric Fiselier [Wed, 12 Oct 2016 10:19:48 +0000 (10:19 +0000)]
Remove usages of _ALIGNAS_TYPE

llvm-svn: 283999

7 years ago[Support][CommandLine] Display subcommands in help when there are less than 3
Alex Lorenz [Wed, 12 Oct 2016 10:04:35 +0000 (10:04 +0000)]
[Support][CommandLine] Display subcommands in help when there are less than 3
subcommands

This commit fixes a bug where the help output doesn't display subcommands when
a tool has less than 3 subcommands.

This change doesn't include a corresponding unittest as there is no viable way
to provide a unittest for it.

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

llvm-svn: 283998

7 years agosupport --param=std=gnu++XX
Eric Fiselier [Wed, 12 Oct 2016 09:53:35 +0000 (09:53 +0000)]
support --param=std=gnu++XX

llvm-svn: 283997

7 years agoFix more C++11 constexpr issues in the tests
Eric Fiselier [Wed, 12 Oct 2016 09:48:44 +0000 (09:48 +0000)]
Fix more C++11 constexpr issues in the tests

llvm-svn: 283996

7 years ago[Sema] Handle transparent_union attributes in C mode only
Alex Lorenz [Wed, 12 Oct 2016 09:36:35 +0000 (09:36 +0000)]
[Sema] Handle transparent_union attributes in C mode only

This commit marks the transparent_union attributes as C only because clang
doesn't support them in C++ mode. Prior to this commit, clang still tried to
verify these attributes in C++, leading to crashes when analyzing templated
transparent_union unions that have dependent field types. This commit ensures
that such crashes won't happen again.

As a result of this commit clang now displays a warning every time it encounters
a transparent_union attribute in C++ mode.

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

llvm-svn: 283995

7 years agoFix nasty_containers.hpp for other stdlibs
Eric Fiselier [Wed, 12 Oct 2016 09:31:26 +0000 (09:31 +0000)]
Fix nasty_containers.hpp for other stdlibs

llvm-svn: 283994

7 years agoFix use of C++14 constexpr in C++11
Eric Fiselier [Wed, 12 Oct 2016 09:20:58 +0000 (09:20 +0000)]
Fix use of C++14 constexpr in C++11

llvm-svn: 283993

7 years ago[Support/ELF] - Sort PT_OPENBSD_* added previously. NFC.
George Rimar [Wed, 12 Oct 2016 09:20:28 +0000 (09:20 +0000)]
[Support/ELF] - Sort PT_OPENBSD_* added previously. NFC.

llvm-svn: 283992

7 years agoRemove use of _VSTD::__invoke in the not_fn tests
Eric Fiselier [Wed, 12 Oct 2016 09:06:12 +0000 (09:06 +0000)]
Remove use of _VSTD::__invoke in the not_fn tests

llvm-svn: 283991

7 years agoAdd AArch64 unit tests
Diana Picus [Wed, 12 Oct 2016 09:00:44 +0000 (09:00 +0000)]
Add AArch64 unit tests

Add unit tests for checking a few tricky instruction sizes. Also remove the old
tests for the instruction sizes, which were clunky and brittle.

Since this is the first set of target-specific unit tests, we need to add some
CMake plumbing. In the future, adding unit tests for a given target will be as
simple as creating a directory with the same name as the target under
unittests/Target. The tests are only run if the target is enabled in
LLVM_TARGETS_TO_BUILD.

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

llvm-svn: 283990

7 years agoLTO: Don't follow lazy references when seeing new definitions in the combined LTO...
Hans Wennborg [Wed, 12 Oct 2016 09:00:06 +0000 (09:00 +0000)]
LTO: Don't follow lazy references when seeing new definitions in the combined LTO object

Following the lazy reference might bring in an object file that depends
on bitcode files that weren't part of the LTO step.

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

llvm-svn: 283989

7 years agoProvide a fallback __cxa_thread_atexit() implementation. Patch from Tavian Barnes
Eric Fiselier [Wed, 12 Oct 2016 08:54:10 +0000 (08:54 +0000)]
Provide a fallback __cxa_thread_atexit() implementation. Patch from Tavian Barnes

llvm-svn: 283988

7 years ago[LCG] Cleanup various places where comments said `SCC` but meant
Chandler Carruth [Wed, 12 Oct 2016 08:40:51 +0000 (08:40 +0000)]
[LCG] Cleanup various places where comments said `SCC` but meant
`RefSCC`.

Also improve the comments surrounding the lazy post-order iterator as
they had grown stale since the RefSCC/SCC split.

I'm sure there are more comments that need updating here, but I saw and
fixed these and didn't want to lose them. I've not gotten to doing
a really complete audit of every comment yet.

llvm-svn: 283987

7 years ago[clang-tidy-vs] Fix ClangTidy extension name in the manifest.
Marek Kurdej [Wed, 12 Oct 2016 08:32:59 +0000 (08:32 +0000)]
[clang-tidy-vs] Fix ClangTidy extension name in the manifest.

llvm-svn: 283986

7 years agoRevert "[ClangTidy] Add UsingInserter and NamespaceAliaser"
Haojian Wu [Wed, 12 Oct 2016 08:19:44 +0000 (08:19 +0000)]
Revert "[ClangTidy] Add UsingInserter and NamespaceAliaser"

This reverts commit r283981. This patch breaks the buildbot.

llvm-svn: 283985

7 years agoDon't crash if reloc targets discarded section
Eugene Leviant [Wed, 12 Oct 2016 08:19:30 +0000 (08:19 +0000)]
Don't crash if reloc targets discarded section

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

llvm-svn: 283984

7 years agoProtect special members of NullBase archetype to avoid exposing them
Eric Fiselier [Wed, 12 Oct 2016 08:09:22 +0000 (08:09 +0000)]
Protect special members of NullBase archetype to avoid exposing them

llvm-svn: 283983

7 years ago[LCG] Add the necessary functionality to the LazyCallGraph to support inlining.
Chandler Carruth [Wed, 12 Oct 2016 07:59:56 +0000 (07:59 +0000)]
[LCG] Add the necessary functionality to the LazyCallGraph to support inlining.

The basic inlining operation makes the following changes to the call graph:
1) Add edges that were previously transitive edges. This is always trivial and
   this patch gives the LCG helper methods to make this more convenient.
2) Remove the inlined edge. We had existing support for this, but it contained
   bugs that needed to be fixed. Testing in the same pattern as the inliner
   exposes these bugs very nicely.
3) Delete a function when it becomes dead because it is internal and all calls
   have been inlined. The LCG had no support at all for this operation, so this
   adds that support.

Two unittests have been added that exercise this specific mutation pattern to
the call graph. They were extremely effective in uncovering bugs. Sadly,
a large fraction of the code here is just to implement those unit tests, but
I think they're paying for themselves. =]

This was split out of a patch that actually uses the routines to
implement inlining in the new pass manager in order to isolate (with
unit tests) the logic that was entirely within the LCG.

Many thanks for the careful review from folks! There will be a few minor
follow-up patches based on the comments in the review as well.

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

llvm-svn: 283982

7 years ago[ClangTidy] Add UsingInserter and NamespaceAliaser
Haojian Wu [Wed, 12 Oct 2016 07:59:54 +0000 (07:59 +0000)]
[ClangTidy] Add UsingInserter and NamespaceAliaser

Summary: This adds helper classes to add using declaractions and namespace aliases to function bodies. These help making function calls to deeply nested functions concise (e.g. when calling helpers in a refactoring)

Patch by Julian Bangert!

Reviewers: alexfh, hokein

Subscribers: cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 283981

7 years agoImplement N4606 optional
Eric Fiselier [Wed, 12 Oct 2016 07:46:20 +0000 (07:46 +0000)]
Implement N4606 optional

Summary:
Adapt implementation of Library Fundamentals TS optional into an implementation of N4606 optional.

  - Update relational operators per http://wg21.link/P0307
  - Update to requirements of http://wg21.link/P0032
  - Extension: Implement trivial copy/move construction/assignment for `optional<T>` when `T` is trivially copyable.

Audit P/Rs for optional LWG issues:
  - 2756 "C++ WP optional<T> should 'forward' T's implicit conversions" Implemented, which also resolves 2753 "Optional's constructors and assignments need constraints" (modulo my refusal to explicitly delete the move operations, which is a design error that I'm working on correcting in the 2756 P/R).
  - 2736 "nullopt_t insufficiently constrained" Already conforming. I've added a test ensuring that `nullopt_t` is not copy-initializable from an empty braced-init-list, which I believe is the root intent of the issue, to avoid regression.
  - 2740 "constexpr optional<T>::operator->" Already conforming.
  - 2746 "Inconsistency between requirements for emplace between optional and variant" No P/R, but note that the author's '"suggested resolution" is already implemented.
  - 2748 "swappable traits for optionals" Already conforming.
  - 2753 "Optional's constructors and assignments need constraints" Implemented.

Most of the work for this patch was done by Casey Carter @ Microsoft. Thank you Casey!

Reviewers: mclow.lists, CaseyCarter, EricWF

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

llvm-svn: 283980

7 years agoRevert "[libFuzzer] refactoring to speed things up, NFC"
Daniel Jasper [Wed, 12 Oct 2016 07:26:46 +0000 (07:26 +0000)]
Revert "[libFuzzer] refactoring to speed things up, NFC"

This reverts commit r283946.

This breaks when build with GCC:
lib/Fuzzer/FuzzerTracePC.cpp:169:6: error: always_inline function might not be inlinable [-Werror=attributes]
lib/Fuzzer/FuzzerTracePC.cpp:169:6: error: inlining failed in call to always_inline 'void fuzzer::TracePC::HandleCmp(void*, T, T) [with T = long unsigned int]': target specific option mismatch
lib/Fuzzer/FuzzerTracePC.cpp:198:65: error: called from here

llvm-svn: 283979

7 years agoRevert Add <optional>. Will recommit with better commit message
Eric Fiselier [Wed, 12 Oct 2016 06:48:31 +0000 (06:48 +0000)]
Revert Add <optional>. Will recommit with better commit message

llvm-svn: 283978

7 years agoAdd <optional> header.
Eric Fiselier [Wed, 12 Oct 2016 06:45:11 +0000 (06:45 +0000)]
Add <optional> header.

This patch is largely thanks to Casey Carter @ Microsoft. He did the initial
work of porting our experimental implementation and tests over to namespace
std.

llvm-svn: 283977

7 years agoFix two more tests that hang when testing against libstdc++
Eric Fiselier [Wed, 12 Oct 2016 04:56:23 +0000 (04:56 +0000)]
Fix two more tests that hang when testing against libstdc++

llvm-svn: 283976

7 years agoPrevent the test suite from hanging when run against libstdc++
Eric Fiselier [Wed, 12 Oct 2016 04:29:50 +0000 (04:29 +0000)]
Prevent the test suite from hanging when run against libstdc++

llvm-svn: 283975

7 years ago[AArch64][InstructionSelector] Fix unintended test changes in r283973.
Quentin Colombet [Wed, 12 Oct 2016 04:12:44 +0000 (04:12 +0000)]
[AArch64][InstructionSelector] Fix unintended test changes in r283973.

I screwed up my merge conflict and lost some of the CHECK lines.

llvm-svn: 283974

7 years ago[AArch64][InstrustionSelector] Teach the selector about G_BITCAST.
Quentin Colombet [Wed, 12 Oct 2016 03:57:52 +0000 (03:57 +0000)]
[AArch64][InstrustionSelector] Teach the selector about G_BITCAST.

llvm-svn: 283973

7 years ago[AArch64][InstructionSelector] Refactor the handling of copies.
Quentin Colombet [Wed, 12 Oct 2016 03:57:49 +0000 (03:57 +0000)]
[AArch64][InstructionSelector] Refactor the handling of copies.

Although Copies are not specific to preISel, we still have to assign them
a proper register class. However, given they are not constrained to
anything we do not have to handle the source register at the copy. It
will be properly mapped when reaching the related definition.

In the process, the handlong of G_ANYEXT is slightly modified as those
end up being selected as copy. The difference is that when register size
do not match on both sides, we need to insert SUBREG_TO_REG operation,
otherwise the post RA copy expansion will not be happy!

llvm-svn: 283972

7 years ago[AArch64][InstructionSelector] Fix typos in the related mir file. NFC.
Quentin Colombet [Wed, 12 Oct 2016 03:57:46 +0000 (03:57 +0000)]
[AArch64][InstructionSelector] Fix typos in the related mir file. NFC.

llvm-svn: 283971

7 years ago[AArch64][MachineLegalizer] Mark more bitcasts as legal.
Quentin Colombet [Wed, 12 Oct 2016 03:57:43 +0000 (03:57 +0000)]
[AArch64][MachineLegalizer] Mark more bitcasts as legal.

Those are copies, we do not have to do any legalization action for them.

llvm-svn: 283970

7 years agoAdd an arm64 unit test where the function saves x20 in the
Jason Molenda [Wed, 12 Oct 2016 03:53:01 +0000 (03:53 +0000)]
Add an arm64 unit test where the function saves x20 in the
prologue, then loads & stores x20 on the stack from a different
location in the middle of the function, and then restores the
reg in the epilogue.  The saving/restoring of x20 in the middle
of the function should be ignored.

llvm-svn: 283969

7 years ago[lit] Run unit tests as part of lit test suite
Brian Gesiak [Wed, 12 Oct 2016 03:35:04 +0000 (03:35 +0000)]
[lit] Run unit tests as part of lit test suite

Summary:
The Python file `utils/lit/lit/ShUtil.py` contains:

1. Logic used by lit itself
2. A set of unit tests for that logic, which can be run by invoking
  `python utils/lit/lit/ShUtil.py`

Move these unit tests to a `tests/unit` subdirectory of lit, and run
the tests as part of lit's test suite. This ensures that, should the
lit test suite be included in LLVM's own regression test suite, these
unit tests will also be run.

(Instructions on how to run lit's test suite can be found in
`utils/lit/README.txt`.)

Reviewers: ddunbar, echristo, delcypher, beanz

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 283968

7 years agoMemory-SSA cleanup of clobbers interface, NFC
Sebastian Pop [Wed, 12 Oct 2016 03:08:40 +0000 (03:08 +0000)]
Memory-SSA cleanup of clobbers interface, NFC

This implements the cleanup that Danny asked to commit separately from the
previous fix to GVN-hoist in https://reviews.llvm.org/D25476#inline-219818

Tested with ninja check on x86_64-linux.

llvm-svn: 283967

7 years agoAdd a simple frameless function test case to the arm64 unwind unit tests
Jason Molenda [Wed, 12 Oct 2016 02:46:22 +0000 (02:46 +0000)]
Add a simple frameless function test case to the arm64 unwind unit tests
with return statements in the body of the function.

llvm-svn: 283966

7 years agoGVN-hoist: fix store past load dependence analysis (PR30216, PR30499)
Sebastian Pop [Wed, 12 Oct 2016 02:23:39 +0000 (02:23 +0000)]
GVN-hoist: fix store past load dependence analysis (PR30216, PR30499)

This is a refreshed version of a patch that was reverted: it fixes
the problems reported in both PR30216 and PR30499, and
contains all the test-cases from both bugs.

To hoist stores past loads, we used to search for potential
conflicting loads on the hoisting path by following a MemorySSA
def-def link from the store to be hoisted to the previous
defining memory access, and from there we followed the def-use
chains to all the uses that occur on the hoisting path. The
problem is that the def-def link may point to a store that does
not alias with the store to be hoisted, and so the loads that are
walked may not alias with the store to be hoisted, and even as in
the testcase of PR30216, the loads that may alias with the store
to be hoisted are not visited.

The current patch visits all loads on the path from the store to
be hoisted to the hoisting position and uses the alias analysis
to ask whether the store may alias the load. I was not able to
use the MemorySSA functionality to ask for whether load and
store are clobbered: I'm not sure which function to call, so I
used a call to AA->isNoAlias().

Store past store is still working as before using a MemorySSA
query: I added an extra test to pr30216.ll to make sure store
past store does not regress.

Tested on x86_64-linux with check and a test-suite run.

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

llvm-svn: 283965

7 years agoAdded REQUIRED triples to the test that fails on some ARM buildbots.
Artem Belevich [Wed, 12 Oct 2016 02:08:08 +0000 (02:08 +0000)]
Added REQUIRED triples to the test that fails on some ARM buildbots.

llvm-svn: 283964

7 years ago[CUDA] Make touching a kernel from a __host__ __device__ function a deferred error.
Justin Lebar [Wed, 12 Oct 2016 01:30:08 +0000 (01:30 +0000)]
[CUDA] Make touching a kernel from a __host__ __device__ function a deferred error.

Previously, this was an immediate, don't pass go, don't collect $200
error.  But this precludes us from writing code like

  __host__ __device__ void launch_kernel() {
    kernel<<<...>>>();
  }

Such code isn't wrong, following our notions of right and wrong in CUDA,
unless it's codegen'ed.

llvm-svn: 283963

7 years agoFix libc++abi test config after recent libc++ changes
Eric Fiselier [Wed, 12 Oct 2016 01:19:16 +0000 (01:19 +0000)]
Fix libc++abi test config after recent libc++ changes

llvm-svn: 283962

7 years ago[PPCMIPeephole] Fix splat elimination
Tim Shen [Wed, 12 Oct 2016 00:48:25 +0000 (00:48 +0000)]
[PPCMIPeephole] Fix splat elimination

Summary:
In PPCMIPeephole, when we see two splat instructions, we can't simply do the following transformation:
  B = Splat A
  C = Splat B
=>
  C = Splat A
because B may still be used between these two instructions. Instead, we should make the second Splat a PPC::COPY and let later passes decide whether to remove it or not:
  B = Splat A
  C = Splat B
=>
  B = Splat A
  C = COPY B

Fixes PR30663.

Reviewers: echristo, iteratee, kbarton, nemanjai

Subscribers: mehdi_amini, llvm-commits

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

llvm-svn: 283961

7 years agoAdd mork workarounds for running the test suite against libstdc++
Eric Fiselier [Wed, 12 Oct 2016 00:28:14 +0000 (00:28 +0000)]
Add mork workarounds for running the test suite against libstdc++

llvm-svn: 283960

7 years agoThis test now passes.
Jim Ingham [Wed, 12 Oct 2016 00:05:36 +0000 (00:05 +0000)]
This test now passes.

llvm-svn: 283959

7 years agoMake it easier to run the libc++ test suite against libstdc++
Eric Fiselier [Wed, 12 Oct 2016 00:00:37 +0000 (00:00 +0000)]
Make it easier to run the libc++ test suite against libstdc++

llvm-svn: 283958

7 years agoThis was skipped due to a clang PR that has been fixed.
Jim Ingham [Tue, 11 Oct 2016 23:55:13 +0000 (23:55 +0000)]
This was skipped due to a clang PR that has been fixed.

llvm-svn: 283957

7 years agoAdded a radar on our end for this test's failure.
Jim Ingham [Tue, 11 Oct 2016 23:30:38 +0000 (23:30 +0000)]
Added a radar on our end for this test's failure.

llvm-svn: 283956

7 years agoFix _recalloc redefinition link error in ASan RTL
Reid Kleckner [Tue, 11 Oct 2016 23:13:13 +0000 (23:13 +0000)]
Fix _recalloc redefinition link error in ASan RTL

Fixes PR30329

Patch by Hans-Bernhard Broeker!

llvm-svn: 283955

7 years agoFix the stage2 MSVC 2013 build with less constexpr in RNG
Reid Kleckner [Tue, 11 Oct 2016 23:02:21 +0000 (23:02 +0000)]
Fix the stage2 MSVC 2013 build with less constexpr in RNG

llvm-svn: 283954

7 years ago[DAG] Fix crash in build_vector -> vector_shuffle combine
Michael Kuperstein [Tue, 11 Oct 2016 22:44:31 +0000 (22:44 +0000)]
[DAG] Fix crash in build_vector -> vector_shuffle combine

Fixes a crash in the build_vector -> vector_shuffle combine
when the first vector input is twice as wide as the output,
and the second input vector is even wider.

llvm-svn: 283953

7 years agoGlobalISel: support same-size casts on AArch64.
Tim Northover [Tue, 11 Oct 2016 22:29:23 +0000 (22:29 +0000)]
GlobalISel: support same-size casts on AArch64.

Mostly Ahmed's work again, I'm just sprucing things up slightly before
committing.

llvm-svn: 283952

7 years agoFix LWG2683 - filesystem::copy() should always clear the user-provided error_code
Eric Fiselier [Tue, 11 Oct 2016 22:18:09 +0000 (22:18 +0000)]
Fix LWG2683 - filesystem::copy() should always clear the user-provided error_code

llvm-svn: 283951

7 years agoRevert - When optimizing for size, enable loop rerolling by default
Mike Edwards [Tue, 11 Oct 2016 22:09:13 +0000 (22:09 +0000)]
Revert - When optimizing for size, enable loop rerolling by default

This reverts r283685 as it is causing test failures on Green Dragon.

llvm-svn: 283950

7 years ago[Profile] Update testcase for r283948 (NFC)
Vedant Kumar [Tue, 11 Oct 2016 21:56:05 +0000 (21:56 +0000)]
[Profile] Update testcase for r283948 (NFC)

Old: "__DATA,__llvm_prf_data"
New: "__DATA,__llvm_prf_data,regular,live_support"

This should fix the following bot failure:

  http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55158

llvm-svn: 283949

7 years ago[profile] Add test for dead_strip+live_support functionality
Vedant Kumar [Tue, 11 Oct 2016 21:48:48 +0000 (21:48 +0000)]
[profile] Add test for dead_strip+live_support functionality

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

llvm-svn: 283948

7 years ago[InstrProf] Add support for dead_strip+live_support functionality
Vedant Kumar [Tue, 11 Oct 2016 21:48:16 +0000 (21:48 +0000)]
[InstrProf] Add support for dead_strip+live_support functionality

On Darwin, marking a section as "regular,live_support" means that a
symbol in the section should only be kept live if it has a reference to
something that is live. Otherwise, the linker is free to dead-strip it.

Turn this functionality on for the __llvm_prf_data section.

This means that counters and data associated with dead functions will be
removed from dead-stripped binaries. This will result in smaller
profiles and binaries, and should speed up profile collection.

Tested with check-profile, llvm-lit test/tools/llvm-{cov,profdata}, and
check-llvm.

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

llvm-svn: 283947