platform/upstream/llvm.git
7 years agoInline MergeInputSection::getData().
Rui Ueyama [Tue, 6 Dec 2016 02:19:30 +0000 (02:19 +0000)]
Inline MergeInputSection::getData().

This change seems to make LLD 0.6% faster when linking Clang with
debug info. I don't want us to have lots of local optimizations,
but this function is very hot, and the improvement is small but
not negligible, so I think it's worth doing.

llvm-svn: 288757

7 years agoClean up some Sema checking code. NFC
Richard Trieu [Tue, 6 Dec 2016 01:42:28 +0000 (01:42 +0000)]
Clean up some Sema checking code.  NFC

- Rename CheckMinZero to CheckMaxUnsignedZero to reflect its actual purpose.
- Remove unused parameters from CheckAbsoluteValueFunction and
  CheckMaxUnsignedZero functions.
- Refactor the function name check so both functions can use the same one.

llvm-svn: 288756

7 years agoFix C++03 modules build
Eric Fiselier [Tue, 6 Dec 2016 01:34:24 +0000 (01:34 +0000)]
Fix C++03 modules build

llvm-svn: 288755

7 years agoIntroduces cmake option `LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING`
Mehdi Amini [Tue, 6 Dec 2016 01:23:04 +0000 (01:23 +0000)]
Introduces cmake option `LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING`

Summary:
We recently introduced a feature that enforce at link-time that the
LLVM headers used by a clients are matching the ABI setting of the
LLVM library linked to.

However for clients that are using only headers from ADT and promise
they won't call into LLVM, this is forcing to link libSupport. This
new flag is intended to provide a way to configure LLVM with this
promise for such client.

Reviewers: bob.wilson, compnerd

Subscribers: mgorny, llvm-commits

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

llvm-svn: 288754

7 years ago[libcxx] [test] D27269: Fix MSVC x64 warning C4267 "conversion from 'size_t' to ...
Stephan T. Lavavej [Tue, 6 Dec 2016 01:14:51 +0000 (01:14 +0000)]
[libcxx] [test] D27269: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 3/4.

test/std/containers/sequences/vector.bool/copy.pass.cpp
test/std/containers/sequences/vector.bool/copy_alloc.pass.cpp
test/std/containers/sequences/vector/vector.cons/copy.pass.cpp
test/std/containers/sequences/vector/vector.cons/copy_alloc.pass.cpp
Change "unsigned s = x.size();" to "typename C::size_type s = x.size();"
because that's what it returns.

test/std/strings/basic.string/string.cons/pointer_alloc.pass.cpp
Include <cstddef>, then change "unsigned n = T::length(s);"
to "std::size_t n = T::length(s);" because that's what char_traits returns.

test/std/strings/basic.string/string.cons/substr.pass.cpp
Change unsigned to typename S::size_type because that's what str.size() returns.

test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
This was needlessly truncating std::size_t to unsigned.
It's being used to compare and initialize std::size_t.

llvm-svn: 288753

7 years ago[libcxx] [test] D27268: Fix MSVC x64 warning C4267 "conversion from 'size_t' to ...
Stephan T. Lavavej [Tue, 6 Dec 2016 01:14:43 +0000 (01:14 +0000)]
[libcxx] [test] D27268: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 2/4.

Use static_cast<int> when storing size_t in int (or passing size_t to int).

Also, remove a spurious semicolon in test/support/archetypes.hpp.

test/support/count_new.hpp
Additionally, change data members (and parameters) to size_t.

llvm-svn: 288752

7 years ago[libcxx] [test] D27267: Fix MSVC x64 warning C4267 "conversion from 'size_t' to ...
Stephan T. Lavavej [Tue, 6 Dec 2016 01:14:29 +0000 (01:14 +0000)]
[libcxx] [test] D27267: Fix MSVC x64 warning C4267 "conversion from 'size_t' to 'int' [or 'unsigned int'], possible loss of data", part 1/4.

Replace "int n = str_.size();" with "int n = static_cast<int>(str_.size());".

int is the correct type to use, because we're eventually calling
"base::pbump(n+1);" where base is std::basic_streambuf.
N4606 27.6.3.3.3 [streambuf.put.area]/4 declares: "void pbump(int n);"

llvm-svn: 288751

7 years ago[libcxx] [test] D27266: Remove spurious semicolons.
Stephan T. Lavavej [Tue, 6 Dec 2016 01:14:06 +0000 (01:14 +0000)]
[libcxx] [test] D27266: Remove spurious semicolons.

llvm-svn: 288750

7 years ago[libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", part 12/12.
Stephan T. Lavavej [Tue, 6 Dec 2016 01:13:51 +0000 (01:13 +0000)]
[libcxx] [test] D27025: Fix MSVC warning C4389 "signed/unsigned mismatch", part 12/12.

Various changes:

test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp
This is comparing value_type to unsigned. value_type is sometimes int and sometimes struct S (implicitly constructible from int).
static_cast<value_type>(unsigned) silences the warning and doesn't do anything bad (as the values in question are small).

test/std/algorithms/alg.sorting/alg.nth.element/nth_element_comp.pass.cpp
This is comparing an int remote-element to size_t. The values in question are small and non-negative,
so either type is fine. I think that converting int to size_t is marginally better here than the reverse.

test/std/containers/sequences/deque/deque.cons/size.pass.cpp
DefaultOnly::count is int (and non-negative). When comparing to unsigned, use static_cast<unsigned>.

test/std/strings/basic.string/string.access/index.pass.cpp
We're comparing char to '0' through '9', but formed with the type size_t. Add static_cast<char>.

test/std/utilities/template.bitset/bitset.cons/ull_ctor.pass.cpp
Include <cstddef> for pedantic correctness (this test was already mentioning std::size_t).

"v[i] == (i & 1)" was comparing bool to size_t. Saying "v[i] == ((i & 1) != 0)" smashes the RHS to bool.

llvm-svn: 288749

7 years ago[libcxx] [test] D27024: Fix MSVC warning C4389 "signed/unsigned mismatch", part 11/12.
Stephan T. Lavavej [Tue, 6 Dec 2016 01:13:40 +0000 (01:13 +0000)]
[libcxx] [test] D27024: Fix MSVC warning C4389 "signed/unsigned mismatch", part 11/12.

Change "unsigned n = 0;" to "int n = 0;". It's being compared to int elements and ptrdiff_t distances.

test/std/containers/sequences/forwardlist/forwardlist.cons/move.pass.cpp
This one's a little special, but not really. "*i == n" is comparing MoveOnly to n.
MoveOnly is implicitly constructible from int, so int is the correct type to use here.

llvm-svn: 288748

7 years ago[libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", part 10/12.
Stephan T. Lavavej [Tue, 6 Dec 2016 01:13:29 +0000 (01:13 +0000)]
[libcxx] [test] D27023: Fix MSVC warning C4389 "signed/unsigned mismatch", part 10/12.

Add static_cast<int>. In these cases, the values are guaranteed to be small-ish,
and they're being compared to int elements.

test/std/containers/sequences/deque/deque.capacity/access.pass.cpp
Use int instead of unsigned to iterate from 0 to 10.

llvm-svn: 288747

7 years ago[libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", part 9/12.
Stephan T. Lavavej [Tue, 6 Dec 2016 01:13:14 +0000 (01:13 +0000)]
[libcxx] [test] D27022: Fix MSVC warning C4389 "signed/unsigned mismatch", part 9/12.

Add static_cast<std::size_t> to more comparisons. (Performed manually, unlike part 8/12.)

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 288746

7 years ago[libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", part 8/12.
Stephan T. Lavavej [Tue, 6 Dec 2016 01:12:34 +0000 (01:12 +0000)]
[libcxx] [test] D27021: Fix MSVC warning C4389 "signed/unsigned mismatch", part 8/12.

Add static_cast<std::size_t> when comparing distance() to size().

These replacements were performed programmatically with regex_replace():

const vector<pair<regex, string>> reg_fmt = {
    { regex(R"(assert\((\w+)\.size\(\) == std::distance\((\w+, \w+)\)\))"),
        "assert($1.size() == static_cast<std::size_t>(std::distance($2)))" },
    { regex(R"(assert\(distance\((\w+\.begin\(\), \w+\.end\(\))\) == (\w+)\.size\(\)\))"),
        "assert(static_cast<std::size_t>(distance($1)) == $2.size())" },
    { regex(R"(assert\(std::distance\((\w+\.\w*begin\(\), \w+\.\w*end\(\))\) == (\w+)\.size\(\)\))"),
        "assert(static_cast<std::size_t>(std::distance($1)) == $2.size())" },
};

Also, include <cstddef> when it wasn't already being included.

llvm-svn: 288745

7 years agoAMDGPU: Don't required structured CFG
Matt Arsenault [Tue, 6 Dec 2016 01:02:51 +0000 (01:02 +0000)]
AMDGPU: Don't required structured CFG

The structured CFG is just an aid to inserting exec
mask modification instructions, once that is done
we don't really need it anymore. We also
do not analyze blocks with terminators that
modify exec, so this should only be impacting
true branches.

llvm-svn: 288744

7 years agoAdd support for writing -verify shell tests
Eric Fiselier [Tue, 6 Dec 2016 01:02:15 +0000 (01:02 +0000)]
Add support for writing -verify shell tests

llvm-svn: 288743

7 years agorevert inadvertedly introduced build break
Bob Haarman [Tue, 6 Dec 2016 00:55:55 +0000 (00:55 +0000)]
revert inadvertedly introduced build break

Summary:
r288722 introduced a build break due some code that should
not have been part of the commit. This change removes the offending
code.

Reviewers: davide, ruiu

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

llvm-svn: 288742

7 years agoRevert r288626, which reverts r288449. Original commit message:
Richard Smith [Tue, 6 Dec 2016 00:40:17 +0000 (00:40 +0000)]
Revert r288626, which reverts r288449. Original commit message:

Recover better from an incompatible .pcm file being provided by -fmodule-file=. We try to include the headers of the module textually in this case, still enforcing the modules semantic rules. In order to make that work, we need to still track that we're entering and leaving the module. Also, if the module was also marked as unavailable (perhaps because it was missing a file), we shouldn't mark the module unavailable -- we don't need the module to be complete if we're going to enter it textually.

llvm-svn: 288741

7 years agoAdd test for r288732, warn on unsigned zero in std::max
Richard Trieu [Tue, 6 Dec 2016 00:27:21 +0000 (00:27 +0000)]
Add test for r288732, warn on unsigned zero in std::max

llvm-svn: 288740

7 years agoAdditional test file missed from r288737.
Richard Smith [Tue, 6 Dec 2016 00:14:22 +0000 (00:14 +0000)]
Additional test file missed from r288737.

llvm-svn: 288738

7 years ago[modules] Use the "redundant #include" diagnostic rather than the "module
Richard Smith [Tue, 6 Dec 2016 00:12:39 +0000 (00:12 +0000)]
[modules] Use the "redundant #include" diagnostic rather than the "module
import can't appear here" diagnostic if an already-visible module is textually
entered (because we have the module map but not the AST file) within a
function/namespace scope.

llvm-svn: 288737

7 years agoAllow enabling/disabling testing with module using env LIBCXX_USE_MODULES=1
Eric Fiselier [Tue, 6 Dec 2016 00:01:04 +0000 (00:01 +0000)]
Allow enabling/disabling testing with module using env LIBCXX_USE_MODULES=1

The Clang modules implementation breaks enough that libc++ needs an easy way
to enable/disable using modules on the Zorg builders. Editing Zorg itself
requires a buildmaster restart which only happens weekly. This patch
allows LIBCXX_USE_MODULES to be used to enable/disable the feature,
allowing the buildslave to disable it as need be.

llvm-svn: 288736

7 years agoAdd module definitions for <experimental/foo> headers
Eric Fiselier [Mon, 5 Dec 2016 23:55:34 +0000 (23:55 +0000)]
Add module definitions for <experimental/foo> headers

llvm-svn: 288735

7 years agoSummary: Currently there is no way to disable deprecated warning from asm like this
Weiming Zhao [Mon, 5 Dec 2016 23:55:13 +0000 (23:55 +0000)]
Summary: Currently there is no way to disable deprecated warning from asm like this

clang  -target arm deprecated-asm.s -c
  deprecated-asm.s:30:9: warning: use of SP or PC in the list is deprecated
       stmia   r4!, {r12-r14}

We have to have an option what can disable it.

Patched by Yin Ma!

Reviewers: joey, echristo, weimingz

Subscribers: llvm-commits, aemerson

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

llvm-svn: 288734

7 years agoAdd module definitions for string_view
Eric Fiselier [Mon, 5 Dec 2016 23:53:23 +0000 (23:53 +0000)]
Add module definitions for string_view

llvm-svn: 288733

7 years agoWarn on unsigned zero in call to std::max
Richard Trieu [Mon, 5 Dec 2016 23:41:46 +0000 (23:41 +0000)]
Warn on unsigned zero in call to std::max

New default warning that triggers when an unsigned zero is used in a call to
std::max.  For unsigned values, zero is the minimum value, so any call to
std::max is always equal to the other value.  A common pattern was to take
the max of zero and the difference of two unsigned values, not taking into
account that unsigned values wrap around below zero.  This warning also emits
a note with a fixit hint to remove the zero and call to std::max.

llvm-svn: 288732

7 years ago[libFuzzer] refactor the code to allow collecting features in different ways. Also...
Kostya Serebryany [Mon, 5 Dec 2016 23:35:22 +0000 (23:35 +0000)]
[libFuzzer] refactor the code to allow collecting features in different ways. Also initialize a couple of Fuzzer:: members that might have been used uninitialized :(

llvm-svn: 288731

7 years agoAdd modules for any/optional/variant
Eric Fiselier [Mon, 5 Dec 2016 23:33:19 +0000 (23:33 +0000)]
Add modules for any/optional/variant

llvm-svn: 288730

7 years ago[XRay][AArch64] Attempt to fix unstable test XRay-aarch64-linux::patching-unpatching.cc
Serge Rogatch [Mon, 5 Dec 2016 23:29:56 +0000 (23:29 +0000)]
[XRay][AArch64] Attempt to fix unstable test XRay-aarch64-linux::patching-unpatching.cc

Summary: Currently test XRay-aarch64-linux::patching-unpatching.cc sometimes passes, sometimes fails. This is an attempt to fix it by handling better the situations when both `__arm__` and `__aarch64__` are defined.

Reviewers: dberris, rengolin

Subscribers: llvm-commits, iid_iunknown, aemerson, rengolin, dberris

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

llvm-svn: 288729

7 years agoAdjust libc++ test infastructure to fully support modules
Eric Fiselier [Mon, 5 Dec 2016 23:16:07 +0000 (23:16 +0000)]
Adjust libc++ test infastructure to fully support modules

This patch overhalls the libc++ test format/configuration in order to fully support modules. By "fully support" I mean get almost all of the tests passing. The main hurdle for doing this is handling tests that `#define _LIBCPP_FOO` macros to test a different configuration. This patch deals with these tests in the following ways:

1. For tests that define single `_LIBCPP_ABI_FOO` macros have been annotated with `// MODULES_DEFINES: _LIBCPP_ABI_FOO`. This allows the test suite to define the macro on the command line so it uses a different set of modules.
2. Tests for libc++'s debug mode (which define custom `_LIBCPP_ASSERT`) are automatically detected by the test suite and are compiled and run with modules disabled.

This patch also cleans up how the `CXXCompiler` helper class handles enabling/disabling language features.

NOTE: This patch uses `LIT` features which were only committed to LLVM today. If this patch breaks running the libc++ tests you probably need to update LLVM.
llvm-svn: 288728

7 years agoGlobalISel: avoid looking too closely at PHIs when we bail.
Tim Northover [Mon, 5 Dec 2016 23:10:19 +0000 (23:10 +0000)]
GlobalISel: avoid looking too closely at PHIs when we bail.

The function used to finish off PHIs by adding the relevant basic blocks can
fail if we're aborting and still don't actually have the needed
MachineBasicBlocks. So avoid trying in that case.

llvm-svn: 288727

7 years ago[sanitizers] mac prints null differently
Mike Aizatsky [Mon, 5 Dec 2016 23:06:07 +0000 (23:06 +0000)]
[sanitizers] mac prints null differently

llvm-svn: 288726

7 years ago[SCCP] Remove manual folding of terminator instructions.
Davide Italiano [Mon, 5 Dec 2016 23:04:21 +0000 (23:04 +0000)]
[SCCP] Remove manual folding of terminator instructions.

There are two cases handled here:
1) a branch on undef
2) a switch with an undef condition.

Both cases are currently handled by ResolvedUndefsIn. If we have
a branch on undef, we force its value to false (which is trivially
foldable). If we have a switch on undef, we force to the first
constant (which is also foldable).

llvm-svn: 288725

7 years ago[TableGen] Centralize/Unify error handling.
Davide Italiano [Mon, 5 Dec 2016 22:58:01 +0000 (22:58 +0000)]
[TableGen] Centralize/Unify error handling.

llvm-svn: 288724

7 years ago[docs] Use x86_64 and i386 instead of x86 as arch for triples.
Florian Hahn [Mon, 5 Dec 2016 22:52:20 +0000 (22:52 +0000)]
[docs] Use x86_64 and i386 instead of x86 as arch for triples.

Summary: x86 is not a valid arch for target triples, but x86_64 and i386 are.

Reviewers: rengolin, silvas

Subscribers: cfe-commits

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

llvm-svn: 288723

7 years ago[pdb] handle missing pdb streams more gracefully
Bob Haarman [Mon, 5 Dec 2016 22:44:00 +0000 (22:44 +0000)]
[pdb] handle missing pdb streams more gracefully

Summary: The code we use to read PDBs assumed that streams we ask it to read exist, and would read memory outside a vector and crash if this wasn't the case. This would, for example, cause llvm-pdbdump to crash on PDBs generated by lld. This patch handles such cases more gracefully: the PDB reading code in LLVM now reports errors when asked to get a stream that is not present, and llvm-pdbdump will report missing streams and continue processing streams that are present.

Reviewers: ruiu, zturner

Subscribers: thakis, amccarth

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

llvm-svn: 288722

7 years agoCodeGen: fix windows itanium RTTI in EH mode
Saleem Abdulrasool [Mon, 5 Dec 2016 22:40:20 +0000 (22:40 +0000)]
CodeGen: fix windows itanium RTTI in EH mode

When emitting RTTI for EH only, we would mark the locally defined (LinkOnceODR)
RTTI definition as dllimport, which is incorrect.  Ensure that if we are
generating the type information for EH only, it is marked as LinkOnceODR and we
do not make it dllimport.

llvm-svn: 288721

7 years agoGlobalISel: place constants correctly in the entry block.
Tim Northover [Mon, 5 Dec 2016 22:40:13 +0000 (22:40 +0000)]
GlobalISel: place constants correctly in the entry block.

When the entry block was empty after arg lowering, we were always placing
constants at the end. This is probably hamrless while translating the same
block, but horribly wrong once its terminator has been translated. So switch to
inserting at the beginning.

llvm-svn: 288720

7 years agoTest only the relevant bits.
Rafael Espindola [Mon, 5 Dec 2016 22:27:21 +0000 (22:27 +0000)]
Test only the relevant bits.

This test only needs to test the Type (SharedObject), the address of
the first PT_LOAD and the presence of PT_DYNAMIC.

llvm-svn: 288719

7 years agoAMDGPU: Consolidate inline immediate predicate functions
Matt Arsenault [Mon, 5 Dec 2016 22:26:17 +0000 (22:26 +0000)]
AMDGPU: Consolidate inline immediate predicate functions

llvm-svn: 288718

7 years agoGlobalISel: handle pointer arguments that get assigned to the stack.
Tim Northover [Mon, 5 Dec 2016 22:20:32 +0000 (22:20 +0000)]
GlobalISel: handle pointer arguments that get assigned to the stack.

llvm-svn: 288717

7 years agoDon't check the symbol values is this test.
Rafael Espindola [Mon, 5 Dec 2016 22:16:32 +0000 (22:16 +0000)]
Don't check the symbol values is this test.

It only needs to find how many are local.

llvm-svn: 288716

7 years agoAMDGPU: Minor assembler refactoring
Matt Arsenault [Mon, 5 Dec 2016 22:07:21 +0000 (22:07 +0000)]
AMDGPU: Minor assembler refactoring

Fix return before else, check types for selecting
fltSemantics, refactor immediate checks.

llvm-svn: 288715

7 years ago[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warning...
Eugene Zelenko [Mon, 5 Dec 2016 21:55:02 +0000 (21:55 +0000)]
[IR] Fix some Clang-tidy modernize-use-equals-delete and Include What You Use warnings; other minor fixes (NFC).

Also remove obsolete comment from CommandLine.h spotted by Malcolm Parsons.

llvm-svn: 288714

7 years agoGlobalISel: translate constants larger than 64 bits.
Tim Northover [Mon, 5 Dec 2016 21:54:17 +0000 (21:54 +0000)]
GlobalISel: translate constants larger than 64 bits.

llvm-svn: 288713

7 years agoGlobalISel: make G_CONSTANT take a ConstantInt rather than int64_t.
Tim Northover [Mon, 5 Dec 2016 21:47:07 +0000 (21:47 +0000)]
GlobalISel: make G_CONSTANT take a ConstantInt rather than int64_t.

This makes it more similar to the floating-point constant, and also allows for
larger constants to be translated later. There's no real functional change in
this patch though, just syntax updates.

llvm-svn: 288712

7 years ago[sanitizers] __sanitizer_get_module_and_offset_for_pc interface function
Mike Aizatsky [Mon, 5 Dec 2016 21:45:14 +0000 (21:45 +0000)]
[sanitizers] __sanitizer_get_module_and_offset_for_pc interface function

Summary: The function computes full module name and coverts pc into offset.

Reviewers: kcc

Subscribers: kubabrecka

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

llvm-svn: 288711

7 years agobuiltins: Add ARM Thumb1 implementation for uidiv and uidivmod
Weiming Zhao [Mon, 5 Dec 2016 21:40:36 +0000 (21:40 +0000)]
builtins: Add ARM Thumb1 implementation for uidiv and uidivmod

Summary:
The current uidiv supports archs without clz. However, the asm is for thumb2/arm.
For uidivmod, the existing code calls the C version of uidivmodsi4, which then calls uidiv. The extra push/pop/bl makes it less efficient.

Reviewers: jmolloy, jroelofs, joerg, compnerd, rengolin

Subscribers: llvm-commits, aemerson

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

llvm-svn: 288710

7 years agoGlobalISel: improve translation fallback for constants.
Tim Northover [Mon, 5 Dec 2016 21:40:33 +0000 (21:40 +0000)]
GlobalISel: improve translation fallback for constants.

Returning 0 (NoReg) from getOrCreateVReg leads to unexpected situations later
in the translation. It's better to return a valid (if undefined) register and
let the rest of the instruction carry on as planned.

llvm-svn: 288709

7 years agoRevert r288707: Split removeUnusedSyntheticSections into two functions.
Rui Ueyama [Mon, 5 Dec 2016 21:39:35 +0000 (21:39 +0000)]
Revert r288707: Split removeUnusedSyntheticSections into two functions.

That patch broke build.

llvm-svn: 288708

7 years agoSplit removeUnusedSyntheticSections into two functions.
Rui Ueyama [Mon, 5 Dec 2016 21:37:16 +0000 (21:37 +0000)]
Split removeUnusedSyntheticSections into two functions.

llvm-svn: 288707

7 years agoGlobalISel: handle 1-element aggregates during ABI lowering.
Tim Northover [Mon, 5 Dec 2016 21:25:33 +0000 (21:25 +0000)]
GlobalISel: handle 1-element aggregates during ABI lowering.

llvm-svn: 288706

7 years ago[LAA] Prevent invalid IR for loop-invariant bound in loop body
Keno Fischer [Mon, 5 Dec 2016 21:25:03 +0000 (21:25 +0000)]
[LAA] Prevent invalid IR for loop-invariant bound in loop body

Summary:
If LAA expands a bound that is loop invariant, but not hoisted out
of the loop body, it used to use that value anyway, causing a
non-domination error, because the memcheck block is of course not
dominated by the scalar loop body. Detect this situation and expand
the SCEV expression instead.

Fixes PR31251

Reviewers: anemet
Subscribers: mzolotukhin, llvm-commits

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

llvm-svn: 288705

7 years agoDon't check symbol value in this test.
Rafael Espindola [Mon, 5 Dec 2016 21:02:45 +0000 (21:02 +0000)]
Don't check symbol value in this test.

llvm-svn: 288704

7 years ago[X86] Fix non-intrinsic roundss/roundsd to not read the destination register
Michael Kuperstein [Mon, 5 Dec 2016 20:57:37 +0000 (20:57 +0000)]
[X86] Fix non-intrinsic roundss/roundsd to not read the destination register

This changes the scalar non-intrinsic non-avx roundss/sd instruction
definitions not to read their destination register - allowing partial dependency
breaking.

This fixes PR31143.

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

llvm-svn: 288703

7 years agoDon't check the symbol value in this test.
Rafael Espindola [Mon, 5 Dec 2016 20:56:40 +0000 (20:56 +0000)]
Don't check the symbol value in this test.

llvm-svn: 288702

7 years agoDon't check the symbol values.
Rafael Espindola [Mon, 5 Dec 2016 20:53:11 +0000 (20:53 +0000)]
Don't check the symbol values.

This test is just about which symbols are in which table.

llvm-svn: 288701

7 years agoSimplify test. NFC.
Rafael Espindola [Mon, 5 Dec 2016 20:49:16 +0000 (20:49 +0000)]
Simplify test. NFC.

llvm-svn: 288700

7 years agoMake test test what it should be testing.
Rafael Espindola [Mon, 5 Dec 2016 20:42:58 +0000 (20:42 +0000)]
Make test test what it should be testing.

Looks like the second section in this test was lost along the way.

llvm-svn: 288699

7 years agoAMDGPU: Assembler support for exp
Matt Arsenault [Mon, 5 Dec 2016 20:42:41 +0000 (20:42 +0000)]
AMDGPU: Assembler support for exp

compr is not currently parsed (or printed) correctly,
but that should probably be fixed along with
intrinsic changes.

llvm-svn: 288698

7 years agoAMDGPU: Change how exp is printed
Matt Arsenault [Mon, 5 Dec 2016 20:31:49 +0000 (20:31 +0000)]
AMDGPU: Change how exp is printed

This is an improvement over a long list of unreadable numbers.
A follow up patch will try to match how sc formats these.

llvm-svn: 288697

7 years ago[analyzer] Print type for SymbolRegionValues when dumping to stream
Dominic Chen [Mon, 5 Dec 2016 20:30:11 +0000 (20:30 +0000)]
[analyzer] Print type for SymbolRegionValues when dumping to stream

Reviewers: NoQ, dcoughlin, zaks.anna

Subscribers: cfe-commits

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

llvm-svn: 288696

7 years agoAMDGPU: Refactor exp instructions
Matt Arsenault [Mon, 5 Dec 2016 20:23:10 +0000 (20:23 +0000)]
AMDGPU: Refactor exp instructions

Structure the definitions a bit more like the other classes.

The main change here is to split EXP with the done bit set
to a separate opcode, so we can set mayLoad = 1 so that it won't
be reordered before the other exp stores, since this has the special
constraint that if the done bit is set then this should be the last
exp in she shader.

Previously all exp instructions were inferred to have unmodeled
side effects.

llvm-svn: 288695

7 years ago[lit] Support custom parsers in parseIntegratedTestScript
Eric Fiselier [Mon, 5 Dec 2016 20:21:21 +0000 (20:21 +0000)]
[lit] Support custom parsers in parseIntegratedTestScript

Summary:
Libc++ frequently has the need to parse more than just the builtin *test keywords* (`RUN`, `REQUIRES`, `XFAIL`, ect). For example libc++ currently needs a new keyword `MODULES-DEFINES: macro list...`. Instead of re-implementing the script parsing in libc++ this patch allows `parseIntegratedTestScript` to take custom parsers.

This patch introduces a new class `IntegratedTestKeywordParser` which implements the logic to parse/process a test keyword. Parsing of various keyword "kinds" are supported out of the box, including 'TAG', 'COMMAND', and 'LIST', which parse keywords such as `END.`, `RUN:` and `XFAIL:` respectively.

As an example after this change libc++ can implement the `MODULES-DEFINES` simply using:
```
mparser = IntegratedTestKeywordParser('MODULES-DEFINES:', ParserKind.LIST)
parseIntegratedTestScript(test, additional_parsers=[mparser])
macro_list = mparser.getValue()
```

Reviewers: ddunbar, modocache, rnk, danalbert, jroelofs

Subscribers: mgrang, llvm-commits, cfe-commits

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

llvm-svn: 288694

7 years agoTableGen/AsmMatcherEmitter: Bring sorting check back under EXPENSIVE_CHECKS
Matthias Braun [Mon, 5 Dec 2016 19:44:31 +0000 (19:44 +0000)]
TableGen/AsmMatcherEmitter: Bring sorting check back under EXPENSIVE_CHECKS

Bring the sorting check back that I removed in r288655 but put it under
EXPENSIVE_CHECKS this time. Also document that this the check isn't
purely about having a sorted list but also about operator < having the
correct transitive behavior.

Apply the same to the other check in the file.

llvm-svn: 288693

7 years ago[libc++abi] Add _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS
Shoaib Meenai [Mon, 5 Dec 2016 19:42:11 +0000 (19:42 +0000)]
[libc++abi] Add _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS

It's useful to be able to disable visibility annotations entirely; for
example, if we're building libc++abi static to include in another library,
and we don't want any libc++abi functions getting exported out of that
library. This is a generalization of _LIBCXXABI_DISABLE_DLL_IMPORT_EXPORT.

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

llvm-svn: 288692

7 years ago[CMake] Don't add gtest if it is already there
Chris Bieneman [Mon, 5 Dec 2016 19:40:34 +0000 (19:40 +0000)]
[CMake] Don't add gtest if it is already there

LLVM build trees export the gtest library through a special export set. If you're building against a build tree you shouldn't need to re-add gtest, but if you're building against an installed LLVM you do.

llvm-svn: 288691

7 years ago[libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
Shoaib Meenai [Mon, 5 Dec 2016 19:40:12 +0000 (19:40 +0000)]
[libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS

It's useful to be able to disable visibility annotations entirely; for
example, if we're building libc++ static to include in another library,
and we don't want any libc++ functions getting exported out of that
library. This is a generalization of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT.

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

llvm-svn: 288690

7 years agoFix stack-use-after-scope in CheckExplicitlyDefaultedMemberExceptionSpec
Vitaly Buka [Mon, 5 Dec 2016 19:25:00 +0000 (19:25 +0000)]
Fix stack-use-after-scope in CheckExplicitlyDefaultedMemberExceptionSpec

Summary:
Similar to r288685.
getExceptionSpec returned structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

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

llvm-svn: 288689

7 years ago[AArch64][RegisterBankInfo] Fix typo in the logic used in assert.
Quentin Colombet [Mon, 5 Dec 2016 19:02:37 +0000 (19:02 +0000)]
[AArch64][RegisterBankInfo] Fix typo in the logic used in assert.

Thanks to David Binderman <dcb314@hotmail.com> for bringing it to my
attention.

llvm-svn: 288688

7 years ago[lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions
Alexander Shaposhnikov [Mon, 5 Dec 2016 18:42:21 +0000 (18:42 +0000)]
[lldb] Update the check for Linux or FreeBSD in SymbolFileDWARF::FindFunctions

This diff
1. Adds a comment to ObjectFileELF.cpp about the current
approach to determining the OS.
2. Replaces the check in SymbolFileDWARF.cpp with a more robust one.

Test plan:
Built (on Linux) a test binary linked to a c++ shared library
which contains just an implementation of a function TestFunction,
the library (the binary itself) doesn't contain ELF notes
and EI_OSABI is set to System V.
Checked in lldb that now "p TestFunction()" works fine
(and doesn't work without this patch).

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

llvm-svn: 288687

7 years agoInclude object file name to an error message.
Rui Ueyama [Mon, 5 Dec 2016 18:40:14 +0000 (18:40 +0000)]
Include object file name to an error message.

llvm-svn: 288686

7 years agoFix stack-use-after-scope in EvaluateImplicitExceptionSpec
Vitaly Buka [Mon, 5 Dec 2016 18:30:22 +0000 (18:30 +0000)]
Fix stack-use-after-scope in EvaluateImplicitExceptionSpec

Summary:
getExceptionSpec returns structure with pointers to temporarily object created
by computeImplicitExceptionSpec.

Reviewers: rsmith

Subscribers: aizatsky, cfe-commits

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

llvm-svn: 288685

7 years agoUse "equivalence class" instead of "color" to describe the concept in ICF.
Rui Ueyama [Mon, 5 Dec 2016 18:11:35 +0000 (18:11 +0000)]
Use "equivalence class" instead of "color" to describe the concept in ICF.

Also add a citation to GNU gold safe ICF paper.

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

llvm-svn: 288684

7 years ago[DIExpression] Introduce a dedicated DW_OP_LLVM_fragment operation
Adrian Prantl [Mon, 5 Dec 2016 18:04:47 +0000 (18:04 +0000)]
[DIExpression] Introduce a dedicated DW_OP_LLVM_fragment operation
so we can stop using DW_OP_bit_piece with the wrong semantics.

The entire back story can be found here:
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20161114/405934.html

The gist is that in LLVM we've been misinterpreting DW_OP_bit_piece's
offset field to mean the offset into the source variable rather than
the offset into the location at the top the DWARF expression stack. In
order to be able to fix this in a subsequent patch, this patch
introduces a dedicated DW_OP_LLVM_fragment operation with the
semantics that we used to apply to DW_OP_bit_piece, which is what we
actually need while inside of LLVM. This patch is complete with a
bitcode upgrade for expressions using the old format. It does not yet
fix the DWARF backend to use DW_OP_bit_piece correctly.

Implementation note: We discussed several options for implementing
this, including reserving a dedicated field in DIExpression for the
fragment size and offset, but using an custom operator at the end of
the expression works just fine and is more efficient because we then
only pay for it when we need it.

Differential Revision: https://reviews.llvm.org/D27361
rdar://problem/29335809

llvm-svn: 288683

7 years ago[Sema] Respect DLL attributes more faithfully
Shoaib Meenai [Mon, 5 Dec 2016 18:01:35 +0000 (18:01 +0000)]
[Sema] Respect DLL attributes more faithfully

On MSVC, if an implicit instantiation already exists and an explicit
instantiation definition with a DLL attribute is created, the DLL
attribute still takes effect. Make clang match this behavior for
exporting.

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

llvm-svn: 288682

7 years ago[compiler-rt] Remove duplicates from COMPILER_RT_SUPPORTED_ARCH
Kuba Mracek [Mon, 5 Dec 2016 17:52:45 +0000 (17:52 +0000)]
[compiler-rt] Remove duplicates from COMPILER_RT_SUPPORTED_ARCH

Since we’re adding an entry into COMPILER_RT_SUPPORTED_ARCH for all architectures of all Darwin platforms, COMPILER_RT_SUPPORTED_ARCH often ends up having duplicate items. Let’s remove them.

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

llvm-svn: 288681

7 years agoRemove existing file in a separate thread asynchronously.
Rui Ueyama [Mon, 5 Dec 2016 17:40:37 +0000 (17:40 +0000)]
Remove existing file in a separate thread asynchronously.

On Linux (and probably on other Unix-like systems), unlink(2) is
noticeably slow. It takes 250 milliseconds to remove a 1 GB file
on ext4 filesystem on my machine, whether the file is on SSD or
on a spinning disk.

To create a new result file, we remove existing file first. So, if
you repeatedly link a 1 GB program in a regular compile-link-debug
cycle, every cycle wastes 250 milliseconds only to remove a file.

Since LLD can link a 1 GB in about 5 seconds, that waste actually
matters.

This patch defines `unlinkAsync` function. The function spawns a
background thread to call unlink. The calling thread returns
almost immediately.

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

llvm-svn: 288680

7 years ago[CMake] Fix symlink refactor for multi-configuration generators
Chris Bieneman [Mon, 5 Dec 2016 17:02:11 +0000 (17:02 +0000)]
[CMake] Fix symlink refactor for multi-configuration generators

This fix, while a bit complicated, preserves the reusability while fixing the issues reported on llvm-commits with visual studio generators.

llvm-svn: 288679

7 years ago[ELF] Print file:line for unknown PHDR error
Eugene Leviant [Mon, 5 Dec 2016 16:38:32 +0000 (16:38 +0000)]
[ELF] Print file:line for unknown PHDR error

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

llvm-svn: 288678

7 years ago[analyzer] ObjCGenerics: Warn only on mismatch for invariant type parameters
Devin Coughlin [Mon, 5 Dec 2016 16:28:47 +0000 (16:28 +0000)]
[analyzer] ObjCGenerics: Warn only on mismatch for invariant type parameters

On a method call, the ObjCGenerics checker uses the type tracked by
DynamicTypePropagation for the receiver to to infer substituted parmeter types
for the called methods and warns when the argument type does not match the
parameter.

Unfortunately, using the tracked type can result in false positives when the
receiver has a non-invariant type parameter and has been intentionally upcast.
For example, becaue NSArray's type parameter is covaraint, the following code
is perfectly safe:

NSArray<NSString *> *allStrings = ...
NSDate *date = ...;
NSArray<NSObject *> *allObjects = allStrings;
NSArray<NSObject *> *moreObjects = [allObjects arrayByAddingObject:date];

but the checker currently warns that the date parameter is not an NSString *.

To avoid this kind of false positive, the checker will now only warn when
the class defining the called method has only invariant type parameters.

rdar://problem/28803951

llvm-svn: 288677

7 years ago[TargetLowering] add special-case for demanded bits analysis of 'not'
Sanjay Patel [Mon, 5 Dec 2016 15:58:21 +0000 (15:58 +0000)]
[TargetLowering] add special-case for demanded bits analysis of 'not'

We treat bitwise 'not' as a special operation and try not to reduce its all-ones mask.
Presumably, this is because a 'not' may be cheaper than a generic 'xor' or it may get
folded into another logic op if the target has those. However, if we can remove a logic
instruction by changing the xor's constant mask value, that should always be a win.

Note that the IR version of SimplifyDemandedBits() does not treat 'not' as a special-case
currently (although that's marked with a FIXME). So if you run this IR through -instcombine,
you should get the same end result. I'm hoping to add a different backend transform that
will expose this problem though, so I need to solve this first.

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

llvm-svn: 288676

7 years ago[x86] fold fand (fxor X, -1) Y --> fandn X, Y
Sanjay Patel [Mon, 5 Dec 2016 15:45:27 +0000 (15:45 +0000)]
[x86] fold fand (fxor X, -1) Y --> fandn X, Y

I noticed this gap in the scalar FP-logic matching with:
D26712
and:
rL287171

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

llvm-svn: 288675

7 years agoRemove superfluous android include
Pavel Labath [Mon, 5 Dec 2016 14:57:23 +0000 (14:57 +0000)]
Remove superfluous android include

This file is not in the include path when building with a non-standalone
toolchain. In does not seem to be necessary anyway.

llvm-svn: 288674

7 years agoRemove one more if(__ANDROID_NDK__) I missed
Pavel Labath [Mon, 5 Dec 2016 14:57:19 +0000 (14:57 +0000)]
Remove one more if(__ANDROID_NDK__) I missed

llvm-svn: 288673

7 years agoRemove a couple of memset usages from TSan, introduced in r288624.
Daniel Jasper [Mon, 5 Dec 2016 14:37:42 +0000 (14:37 +0000)]
Remove a couple of memset usages from TSan, introduced in r288624.

TSan runtime shouldn't contain memset, so internal_memset is used
instead and syntax that emits memset is avoided.

This doesn't fail in-tree due to TSan being build with -03, but it fails
when TSan is built with -O0, and is (I think) a true positive.

Patch by Sam McCall, review: https://reviews.llvm.org/D27407

llvm-svn: 288672

7 years agoUse range based for loop. NFCI.
Simon Pilgrim [Mon, 5 Dec 2016 14:25:04 +0000 (14:25 +0000)]
Use range based for loop. NFCI.

llvm-svn: 288671

7 years agoELF/AArch64: Fix R_AARCH64_LDST16_ABS_LO12_NC mask
Adhemerval Zanella [Mon, 5 Dec 2016 14:15:44 +0000 (14:15 +0000)]
ELF/AArch64: Fix R_AARCH64_LDST16_ABS_LO12_NC mask

The relocation R_AARCH64_LDST16_ABS_LO12_NC should set a ld/st
immediate value to bits [11:1] not [11:2].  This patches fixes it
and adds a testcase for regression.

With this fix all the faulty tests on test-suite (clavm, lencod,
and trimaran) pass.

llvm-svn: 288670

7 years agoELF/AArch64: Simplify R_AARCH64_ADD_ABS_LO12_NC relocation
Adhemerval Zanella [Mon, 5 Dec 2016 14:15:03 +0000 (14:15 +0000)]
ELF/AArch64: Simplify R_AARCH64_ADD_ABS_LO12_NC relocation

This patch uses the updateAArch64Add on relocation apply and remove
the comment.

llvm-svn: 288669

7 years agoELF/AArch64: consolidate getAArch64Page implementation
Adhemerval Zanella [Mon, 5 Dec 2016 14:14:26 +0000 (14:14 +0000)]
ELF/AArch64: consolidate getAArch64Page implementation

This patch avoid getAArch64Page code duplication by removing the
implementation at InputSection.

llvm-svn: 288668

7 years ago[PPC] Slightly Improve Assembly Parsing errors and add EOL comment
Nirav Dave [Mon, 5 Dec 2016 14:11:03 +0000 (14:11 +0000)]
[PPC] Slightly Improve Assembly Parsing errors and add EOL comment
parsing tests.

NFC intended.

llvm-svn: 288667

7 years ago[mips][ias] N32/N64 must not sort the relocation table.
Simon Dardis [Mon, 5 Dec 2016 12:55:19 +0000 (12:55 +0000)]
[mips][ias] N32/N64 must not sort the relocation table.

Doing so changes the evaluation order for relocation composition.

Patch By: Daniel Sanders

Reviewers: vkalintiris, atanasyan

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

llvm-svn: 288666

7 years agoCFGBuilder: Fix crash when visiting delete expression on dependent type
Martin Bohme [Mon, 5 Dec 2016 11:33:19 +0000 (11:33 +0000)]
CFGBuilder: Fix crash when visiting delete expression on dependent type

Summary:
CXXDeleteExpr::getDestroyedType() can return a null QualType if the destroyed
type is a dependent type. This patch protects against this.

Reviewers: klimek

Subscribers: cfe-commits

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

llvm-svn: 288665

7 years agoClean out unused diagnostics. NFC.
Benjamin Kramer [Mon, 5 Dec 2016 11:30:24 +0000 (11:30 +0000)]
Clean out unused diagnostics. NFC.

llvm-svn: 288664

7 years ago[X86][SSE] Add support for combining target shuffles to UNPCKL/UNPCKH.
Simon Pilgrim [Mon, 5 Dec 2016 11:25:13 +0000 (11:25 +0000)]
[X86][SSE] Add support for combining target shuffles to UNPCKL/UNPCKH.

llvm-svn: 288663

7 years ago[change-namespace] get changing namespace to global correct.
Eric Liu [Mon, 5 Dec 2016 11:17:04 +0000 (11:17 +0000)]
[change-namespace] get changing namespace to global correct.

llvm-svn: 288662

7 years agoClean up some use of __ANDROID_NDK__ in the cmake files
Pavel Labath [Mon, 5 Dec 2016 11:15:36 +0000 (11:15 +0000)]
Clean up some use of __ANDROID_NDK__ in the cmake files

Rationale:
scripts/Python/modules: android is excluded at a higher level, so no point in
  checking here
tools/lldb-mi: lldb-mi builds fine (with some cosmetic tweaks) on android, and
  there is no reason it shouldn't.
tools/lldb-server: LLDB_DISABLE_LIBEDIT/CURSES already take the platform into
  account, so there is no point in checking again.

I am reasonably confident this should not break the build on any platform, but
I'll keep an eye out on the bots.

llvm-svn: 288661

7 years agoHandle tests for noexcept that expect a false value
Roger Ferrer Ibanez [Mon, 5 Dec 2016 11:05:09 +0000 (11:05 +0000)]
Handle tests for noexcept that expect a false value

Under libcpp-no-exceptions, noexcept is trivially true. Some tests expect in
the usual setting to return false, so adjust them to expect true under
libcpp-no-exceptions.

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

llvm-svn: 288660

7 years ago[X86][SSE] Add helper function to create UNPCKL/UNPCKH shuffle masks. NFCI.
Simon Pilgrim [Mon, 5 Dec 2016 11:00:25 +0000 (11:00 +0000)]
[X86][SSE] Add helper function to create UNPCKL/UNPCKH shuffle masks. NFCI.

llvm-svn: 288659

7 years ago[GlobalISel] Extract handleAssignments out of AArch64CallLowering
Diana Picus [Mon, 5 Dec 2016 10:40:33 +0000 (10:40 +0000)]
[GlobalISel] Extract handleAssignments out of AArch64CallLowering

This function seems target-independent so far: all the target-specific behaviour
is isolated in the CCAssignFn and the ValueHandler (which we're also extracting
into the generic CallLowering).

The intention is to use this in the ARM backend.

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

llvm-svn: 288658

7 years ago[AMDGPU] Disassembler: fix s_buffer_store_dword instructions
Sam Kolton [Mon, 5 Dec 2016 09:58:51 +0000 (09:58 +0000)]
[AMDGPU] Disassembler: fix s_buffer_store_dword instructions

Summary: s_buffer_store_dword instructions sdata operand was called sdst in encoding. This caused disassembler to fail.

Reviewers: tstellarAMD, vpykhtin, artem.tamazov

Subscribers: arsenm, nhaehnle, rampitec

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

llvm-svn: 288657