platform/upstream/llvm.git
7 years ago[SCEV] Clang format most of the SCEV header; NFC
Sanjoy Das [Sun, 25 Sep 2016 23:11:51 +0000 (23:11 +0000)]
[SCEV] Clang format most of the SCEV header; NFC

The indentation for the declared classes was not as per LLVM coding
style.

llvm-svn: 282362

7 years ago[X86] Remove what appears to be leftover MMX code involving (v1i64 scalar_to_vector).
Craig Topper [Sun, 25 Sep 2016 16:34:11 +0000 (16:34 +0000)]
[X86] Remove what appears to be leftover MMX code involving (v1i64 scalar_to_vector).

llvm-svn: 282361

7 years ago[X86] Remove patterns for scalar_to_vector from FR32/FR64 to 256-bit vectors. Lowerin...
Craig Topper [Sun, 25 Sep 2016 16:34:09 +0000 (16:34 +0000)]
[X86] Remove patterns for scalar_to_vector from FR32/FR64 to 256-bit vectors. Lowering explicitly avoids creating this pattern.

llvm-svn: 282360

7 years ago[AVX-512] Replace get512BitSuperRegister with calls to TargetRegisterInfo::getMatchin...
Craig Topper [Sun, 25 Sep 2016 16:34:06 +0000 (16:34 +0000)]
[AVX-512] Replace get512BitSuperRegister with calls to TargetRegisterInfo::getMatchingSuperReg.

llvm-svn: 282359

7 years ago[AVX-512] Fix some patterns predicates to properly enforce priority for various versi...
Craig Topper [Sun, 25 Sep 2016 16:34:02 +0000 (16:34 +0000)]
[AVX-512] Fix some patterns predicates to properly enforce priority for various versions of CVTDQ2PD instruction.

llvm-svn: 282358

7 years ago[AVX-512] Add rounding versions of instructions to hasUndefRegUpdate.
Craig Topper [Sun, 25 Sep 2016 16:33:59 +0000 (16:33 +0000)]
[AVX-512] Add rounding versions of instructions to hasUndefRegUpdate.

llvm-svn: 282357

7 years ago[AVX-512] Add the scalar unsigned integer to fp conversion instructions to hasUndefRe...
Craig Topper [Sun, 25 Sep 2016 16:33:57 +0000 (16:33 +0000)]
[AVX-512] Add the scalar unsigned integer to fp conversion instructions to hasUndefRegUpdate.

llvm-svn: 282356

7 years ago[AVX-512] Remove duplicate instructions for converting integer to scalar floating...
Craig Topper [Sun, 25 Sep 2016 16:33:53 +0000 (16:33 +0000)]
[AVX-512] Remove duplicate instructions for converting integer to scalar floating point. We can use patterns to point to the other instructions instead.

llvm-svn: 282355

7 years agoUpdate -verify test to use new static assert message
Eric Fiselier [Sun, 25 Sep 2016 08:30:05 +0000 (08:30 +0000)]
Update -verify test to use new static assert message

llvm-svn: 282352

7 years agowww: add new code coverage link to Polly website
Tobias Grosser [Sun, 25 Sep 2016 08:03:38 +0000 (08:03 +0000)]
www: add new code coverage link to Polly website

llvm-svn: 282351

7 years agoAdd a comment on StringRef::contains(char)
Zachary Turner [Sun, 25 Sep 2016 04:06:39 +0000 (04:06 +0000)]
Add a comment on StringRef::contains(char)

llvm-svn: 282350

7 years agoFix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function
Eric Fiselier [Sun, 25 Sep 2016 04:05:46 +0000 (04:05 +0000)]
Fix missing _LIBCPP_INLINE_VISIBILITY macro on C++03 specific __hash_table function

llvm-svn: 282349

7 years agoFix signed / unsigned comparison.
Zachary Turner [Sun, 25 Sep 2016 03:57:34 +0000 (03:57 +0000)]
Fix signed / unsigned comparison.

llvm-svn: 282348

7 years ago[libc++] Remove various C++03 feature test macros
Eric Fiselier [Sun, 25 Sep 2016 03:34:28 +0000 (03:34 +0000)]
[libc++] Remove various C++03 feature test macros

Summary:
Libc++ still uses per-feature configuration macros when configuring for C++11. However libc++ requires a feature-complete C++11 compiler so there is no reason to check individual features. This patch starts the process of removing the feature specific macros and replacing their usage with `_LIBCPP_CXX03_LANG`.

This patch removes the __config macros:

* _LIBCPP_HAS_NO_TRAILING_RETURN
* _LIBCPP_HAS_NO_TEMPLATE_ALIASES
* _LIBCPP_HAS_NO_ADVANCED_SFINAE
* _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
* _LIBCPP_HAS_NO_STATIC_ASSERT

As a drive I also changed our C++03 static_assert to use _Static_assert if available.

I plan to commit this without review if nobody voices an objection.

Reviewers: mclow.lists

Subscribers: cfe-commits

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

llvm-svn: 282347

7 years agoAdd some predicated searching functions to StringRef.
Zachary Turner [Sun, 25 Sep 2016 03:27:29 +0000 (03:27 +0000)]
Add some predicated searching functions to StringRef.

This adds 4 new functions to StringRef, which can be used to
take or drop characters while a certain condition is met, or
until a certain condition is met.  They are:

take_while - Return characters until a condition is not met.
take_until - Return characters until a condition is met.
drop_while - Remove characters until a condition is not met.
drop_until - Remove characters until a condition is met.

Internally, all of these functions delegate to two additional
helper functions which can be used to search for the position
of a character meeting or not meeting a condition, which are:

find_if - Find the first character matching a predicate.
find_if_not - Find the first character not matching a predicate.

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

llvm-svn: 282346

7 years agoUse __attribute__((internal_linkage)) when available.
Eric Fiselier [Sun, 25 Sep 2016 03:14:13 +0000 (03:14 +0000)]
Use __attribute__((internal_linkage)) when available.

Summary:
This patch has been a long time coming (Thanks @eugenis). It changes `_LIBCPP_INLINE_VISIBILITY` to use `__attribute__((internal_linkage))` instead of `__attribute__((visibility("hidden"), always_inline))`.

The point of `_LIBCPP_INLINE_VISIBILITY` is to prevent inline functions from being exported from both the libc++ library and from user libraries. This helps libc++ better manage it's ABI.
Previously this was done by forcing inlining and modifying the symbols visibility. However inlining isn't guaranteed and symbol visibility only affects shared libraries making this an imperfect solution.  `internal_linkage` improves this situation by making all symbols local to the TU they are emitted in, regardless of inlining or visibility. IIRC the effect of applying `__attribute__((internal_linkage))` to an inline function is the same as applying `static`.

For more information about the attribute see: http://lists.llvm.org/pipermail/cfe-dev/2015-October/045580.html

Most of the work for this patch was done by @eugenis.

Reviewers: mclow.lists, eugenis

Subscribers: eugenis, cfe-commits

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

llvm-svn: 282345

7 years ago[AVX-512] Don't use two opcodes for INTR_TYPE_SCALAR_MASK_RM. The handling was such...
Craig Topper [Sun, 25 Sep 2016 01:03:10 +0000 (01:03 +0000)]
[AVX-512] Don't use two opcodes for INTR_TYPE_SCALAR_MASK_RM. The handling was such that if the second opcode was present the first was ingored, so we can just have one opcode.

llvm-svn: 282344

7 years agoFix a few static_asserts that need extra parens on -03
Marshall Clow [Sat, 24 Sep 2016 23:52:21 +0000 (23:52 +0000)]
Fix a few static_asserts that need extra parens on -03

llvm-svn: 282343

7 years agoImplement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would...
Marshall Clow [Sat, 24 Sep 2016 22:45:42 +0000 (22:45 +0000)]
Implement proposed resolution for LWG#2758. Reviewed as D24446. Normally, I would wait for these to be voted upon at a committee meeting (November), but the current draft standard is broken, and this should fix it. (And if it doesn't, we want to know about it soonest)

llvm-svn: 282342

7 years ago[X86] Teach combineShuffle to avoid creating floating point operations with integer...
Craig Topper [Sat, 24 Sep 2016 21:42:49 +0000 (21:42 +0000)]
[X86] Teach combineShuffle to avoid creating floating point operations with integer types and integer operations with floating point types. Seems isOperationLegal lies for mismatched types and operations.

Fixes PR30511.

llvm-svn: 282341

7 years ago[AVX-512] Split scalar version of X86ISD::SELECT into a separate opcode because isel...
Craig Topper [Sat, 24 Sep 2016 21:42:47 +0000 (21:42 +0000)]
[AVX-512] Split scalar version of X86ISD::SELECT into a separate opcode because isel is not robust with multiple type profiles for the same opcode.

llvm-svn: 282340

7 years ago[AVX-512] Remove the patterns for selecting scalar VCOMI/VUCOMI instructions with...
Craig Topper [Sat, 24 Sep 2016 21:42:43 +0000 (21:42 +0000)]
[AVX-512] Remove the patterns for selecting scalar VCOMI/VUCOMI instructions with SAE as there is no way to create the pattern.

llvm-svn: 282339

7 years agoObjCARC: Don't look at users of ConstantData
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 21:01:20 +0000 (21:01 +0000)]
ObjCARC: Don't look at users of ConstantData

Stop looking at users of UndefValue and ConstantPointerNull in the
objective C ARC optimizers.  The other users aren't actually
interesting, since they're not pointing at a particular object.  I
imagine these calls could be optimized through -instcombine... maybe
they already are?

These early returns will be required at some point in the future, with a
WIP patch that asserts when someone accesses a use-list on ConstantData.

llvm-svn: 282338

7 years agoAnalysis: Return early for UndefValue in computeKnownBits
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 20:42:02 +0000 (20:42 +0000)]
Analysis: Return early for UndefValue in computeKnownBits

There is no benefit in looking through assumptions on UndefValue to
guess known bits.  Return early to avoid walking their use-lists, and
assert that all instances of ConstantData are handled here for similar
reasons (UndefValue was the only integer/pointer holdout).

llvm-svn: 282337

7 years ago[x86] don't try to create a vector integer inst for an SSE1 target (PR30512)
Sanjay Patel [Sat, 24 Sep 2016 20:24:06 +0000 (20:24 +0000)]
[x86] don't try to create a vector integer inst for an SSE1 target (PR30512)

This bug was introduced with:
http://reviews.llvm.org/rL272511

We need to restrict the lowering to v4f32 comparisons because that's all SSE1 can handle.

This should fix:
https://llvm.org/bugs/show_bug.cgi?id=28044

llvm-svn: 282336

7 years ago[LTO] Add a test for invalid alias analysis pipelines.
Davide Italiano [Sat, 24 Sep 2016 20:05:52 +0000 (20:05 +0000)]
[LTO] Add a test for invalid alias analysis pipelines.

I found out this wasn't tested when looking at Vedant's coverage bot
numbers, so, thanks to him. While I'm here, switch the error message
to be lld-compliant (first letter lowercase).

llvm-svn: 282335

7 years agoScalar: Ignore ConstantData in processAssumption
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 20:00:38 +0000 (20:00 +0000)]
Scalar: Ignore ConstantData in processAssumption

Assumptions on UndefValue and ConstantPointerNull aren't relevant to
other users.  Ignore them entirely to avoid wasting cycles walking
through their (possibly extremely extensive (cross-module)) use-lists.

It wasn't clear how to add a specific test for this, and it'll be
covered anyway by an eventual patch that asserts when trying to access
the use-list of an instance of ConstantData.

llvm-svn: 282334

7 years agoAnalysis: Return early in isKnownNonNullAt for ConstantData
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 19:39:47 +0000 (19:39 +0000)]
Analysis: Return early in isKnownNonNullAt for ConstantData

Check and return early for ConstantPointerNull and UndefValue
specifically in isKnownNonNullAt, and assert that ConstantData never
make it to isKnownNonNullFromDominatingCondition.

This confirms that isKnownNonNullFromDominatingCondition never walks
through the use-list of an instance of ConstantData.  Given that such
use-lists cross module boundaries, it never really made sense to do so,
and was potentially very expensive.

llvm-svn: 282333

7 years agoFix incorrect include in is_error_code_enum.pass.cpp
Marshall Clow [Sat, 24 Sep 2016 18:16:53 +0000 (18:16 +0000)]
Fix incorrect include in is_error_code_enum.pass.cpp

llvm-svn: 282332

7 years agoImplement is_error_code_v and is_error_condition_v for c++17. Rework the tests for...
Marshall Clow [Sat, 24 Sep 2016 17:36:14 +0000 (17:36 +0000)]
Implement is_error_code_v and is_error_condition_v for c++17. Rework the tests for is_error_code and is_error_condition, since they were really lacking. Thanks to Alisdair for the heads-up that we were missing these.

llvm-svn: 282331

7 years ago[clang-tidy] fix for NOLINT after macro expansion
Matthias Gehre [Sat, 24 Sep 2016 16:06:53 +0000 (16:06 +0000)]
[clang-tidy] fix for NOLINT after macro expansion

Summary:
When having
``` c++
    #define MACRO code-with-warning
    MACRO; // NOLINT
```
clang-tidy would still show the warning, because
it searched for "NOLINT" only in the first line,
not on the second.
This caused e.g. https://llvm.org/bugs/show_bug.cgi?id=29089
(where the macro was defined in a system header). See also
the added test cases.
Now clang-tidy looks at the line of macro invocation and every line
of macro definition for a NOLINT comment.

Reviewers: alexfh, aaron.ballman, hokein

Subscribers: cfe-commits

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

llvm-svn: 282330

7 years ago[AVR] Update signature of AVRTargetObjectFile::SelectSectionForGlobal
Dylan McKay [Sat, 24 Sep 2016 11:38:08 +0000 (11:38 +0000)]
[AVR] Update signature of AVRTargetObjectFile::SelectSectionForGlobal

It was changed recently, and was breaking compilation of the backend.

llvm-svn: 282329

7 years ago[libc++] Remove math_win32.h
Shoaib Meenai [Sat, 24 Sep 2016 06:27:28 +0000 (06:27 +0000)]
[libc++] Remove math_win32.h

Visual Studio 2013 and onward have all the required functions in their
CRT headers, and we don't support older versions anymore.

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

llvm-svn: 282328

7 years ago[RegisterBankInfo] Constify the member of the XXXMapping maps.
Quentin Colombet [Sat, 24 Sep 2016 04:54:03 +0000 (04:54 +0000)]
[RegisterBankInfo] Constify the member of the XXXMapping maps.

This makes it obvious that items in those maps behave like statically
created objects.

llvm-svn: 282327

7 years ago[RegisterBankInfo] Document the design choice for the BreakDown.
Quentin Colombet [Sat, 24 Sep 2016 04:53:58 +0000 (04:53 +0000)]
[RegisterBankInfo] Document the design choice for the BreakDown.

This adds a comment explaining why we will duplicate PartialMapping to
represent the breakdown for complex mappings (mappings with more than
one partial mapping), instead of using an array of pointer.

NFC

llvm-svn: 282326

7 years ago[RegisterBankInfo] Add statistics for dynamic value mappings.
Quentin Colombet [Sat, 24 Sep 2016 04:53:55 +0000 (04:53 +0000)]
[RegisterBankInfo] Add statistics for dynamic value mappings.

Like partial mappings, as we move toward TableGen'ed information, the
number should reach zero eventually.

llvm-svn: 282325

7 years ago[RegisterBankInfo] Uniquely generate ValueMapping.
Quentin Colombet [Sat, 24 Sep 2016 04:53:52 +0000 (04:53 +0000)]
[RegisterBankInfo] Uniquely generate ValueMapping.

This is a step toward statically allocate ValueMapping. Like the
previous few commits, the goal is to move toward a TableGen'ed like
structure with no dynamic allocation at all.

llvm-svn: 282324

7 years ago[RegisterBankInfo] Keep valid pointers for PartialMappings.
Quentin Colombet [Sat, 24 Sep 2016 04:53:48 +0000 (04:53 +0000)]
[RegisterBankInfo] Keep valid pointers for PartialMappings.

Previously we were using the address of the unique instance of a partial
mapping in the related map to access this instance. However, when the
map grows, the whole set of instances may be moved elsewhere and the
previous addresses are not valid anymore.

Instead, keep the address of the unique heap allocated instance of a
partial mapping.

Note: I did not see any actual bugs for that problem as the number of
partial mappings dynamically allocated is small (<= 4).

llvm-svn: 282323

7 years agoRemove excessive padding from RedeclarableResult
Alexander Shaposhnikov [Sat, 24 Sep 2016 04:21:53 +0000 (04:21 +0000)]
Remove excessive padding from RedeclarableResult

This diff reorders the fields of the class RedeclarableResult
to remove excessive padding.

Test plan: make -j8 check-clang

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

llvm-svn: 282322

7 years ago[libFuzzer] add a standalone build script
Kostya Serebryany [Sat, 24 Sep 2016 04:00:00 +0000 (04:00 +0000)]
[libFuzzer] add a standalone build script

llvm-svn: 282321

7 years agoGlobalStatus: Don't walk use-lists of ConstantData
Duncan P. N. Exon Smith [Sat, 24 Sep 2016 02:30:11 +0000 (02:30 +0000)]
GlobalStatus: Don't walk use-lists of ConstantData

Return early from llvm::isSafeToDestroyConstant() whenever the value
`isa<ConstantData>()`.  These constants are shared across the
LLVMContext.  We never really want to delete them here, and walking
their use-lists can be very expensive.

(This is motivated by an eventual goal of removing use-lists entirely
from ConstantData.)

llvm-svn: 282320

7 years ago[clang-tidy] Cleaning up language options.
Gabor Horvath [Sat, 24 Sep 2016 02:13:45 +0000 (02:13 +0000)]
[clang-tidy] Cleaning up language options.

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

llvm-svn: 282319

7 years agoRemove excessive padding from ObjCCategoriesVisitor
Alexander Shaposhnikov [Sat, 24 Sep 2016 02:07:19 +0000 (02:07 +0000)]
Remove excessive padding from ObjCCategoriesVisitor

This diff reorders the fields of ObjCCategoriesVisitor
to remove excessive padding.

Test plan: make -j8 check-clang

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

llvm-svn: 282318

7 years ago[analyzer][scan-build-py] subprocess output handling reviewed in clang module
Laszlo Nagy [Sat, 24 Sep 2016 00:20:59 +0000 (00:20 +0000)]
[analyzer][scan-build-py] subprocess output handling reviewed in clang module

llvm-svn: 282317

7 years ago[libFuzzer] simplify HandleTrace again, start re-running interesting units and collec...
Kostya Serebryany [Fri, 23 Sep 2016 23:51:58 +0000 (23:51 +0000)]
[libFuzzer] simplify HandleTrace again, start re-running interesting units and collecting their features.

llvm-svn: 282316

7 years ago[msan] Disable flaky fork.cc on PPC64.
Evgeniy Stepanov [Fri, 23 Sep 2016 23:41:44 +0000 (23:41 +0000)]
[msan] Disable flaky fork.cc on PPC64.

This test is very flaky on PPC64 (both BE and LE), but not on other platforms.

llvm-svn: 282315

7 years ago[CMake] Generate LLDB_REVISION at build time
Chris Bieneman [Fri, 23 Sep 2016 23:33:52 +0000 (23:33 +0000)]
[CMake] Generate LLDB_REVISION at build time

Summary:
This alters the generation of LLDB_REVISION to be heavily based on how clang generates its version header. There are two benefits of this aproach.

(1) The LLDB_REVISION is generated at build time, so it will be updated after an SCM pull/update even if CMake doesn't re-run
(2) This works on Windows

As noted this code is a simplified implementation of the code from clang.

Reviewers: tfiala, zturner

Subscribers: beanz, mgorny, lldb-commits

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

llvm-svn: 282314

7 years agoAdd qualification to fix MSVC build.
Peter Collingbourne [Fri, 23 Sep 2016 23:23:23 +0000 (23:23 +0000)]
Add qualification to fix MSVC build.

llvm-svn: 282313

7 years ago[x86] fix FCOPYSIGN lowering to create constants instead of ConstantPool loads
Sanjay Patel [Fri, 23 Sep 2016 23:17:29 +0000 (23:17 +0000)]
[x86] fix FCOPYSIGN lowering to create constants instead of ConstantPool loads

This is similar to:
https://reviews.llvm.org/rL279958

By not prematurely lowering to loads, we should be able to more easily eliminate
the 'or' with zero instructions seen in copysign-constant-magnitude.ll.

We should also be able to extend this code to handle vectors.

llvm-svn: 282312

7 years agoMutatis mutandis for char * -> StringRef.
Jim Ingham [Fri, 23 Sep 2016 22:36:00 +0000 (22:36 +0000)]
Mutatis mutandis for char * -> StringRef.

llvm-svn: 282311

7 years agoAdd an accessor to get the value of RC_PLATFORM_NAME at build time
Enrico Granata [Fri, 23 Sep 2016 22:30:08 +0000 (22:30 +0000)]
Add an accessor to get the value of RC_PLATFORM_NAME at build time

llvm-svn: 282310

7 years agoFix build on Ubuntu.
Zachary Turner [Fri, 23 Sep 2016 22:27:03 +0000 (22:27 +0000)]
Fix build on Ubuntu.

This was in some code that was #ifdef'd out on Windows, so I
didn't see it.

llvm-svn: 282309

7 years agoUse llvm::to_string instead of std::to_string to fix bot
Teresa Johnson [Fri, 23 Sep 2016 22:25:03 +0000 (22:25 +0000)]
Use llvm::to_string instead of std::to_string to fix bot

This should fix the android build in this bot:
http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-buildserver/builds/11143

llvm-svn: 282308

7 years agoCombine two StringSwitch::Cases because Cases now can take 6 parameters.
Rui Ueyama [Fri, 23 Sep 2016 22:22:34 +0000 (22:22 +0000)]
Combine two StringSwitch::Cases because Cases now can take 6 parameters.

llvm-svn: 282307

7 years agoChange FileAction::GetPath() to return a StringRef.
Zachary Turner [Fri, 23 Sep 2016 22:11:51 +0000 (22:11 +0000)]
Change FileAction::GetPath() to return a StringRef.

llvm-svn: 282306

7 years agoAdd StringSwitch::Cases functions that takes 6 to 10 arguments.
Rui Ueyama [Fri, 23 Sep 2016 22:10:06 +0000 (22:10 +0000)]
Add StringSwitch::Cases functions that takes 6 to 10 arguments.

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

llvm-svn: 282305

7 years agoRevert "[profile] Hide lprofCurFilename"
Vedant Kumar [Fri, 23 Sep 2016 21:58:25 +0000 (21:58 +0000)]
Revert "[profile] Hide lprofCurFilename"

This reverts commit r282294. It breaks a Linux bot:

  http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/12180

It looks like the test checks that __llvm_profile_set_filename() alters the raw
profile filename in both the dylib and the main program. Now that
lprofCurFilename is hidden, this can't work, and we get two profiles (one for
the call to "main" and one for "func").

Back this change out so that we don't affect external users.

llvm-svn: 282304

7 years ago[MC] Support .ds directives in assembler parser
Petr Hosek [Fri, 23 Sep 2016 21:53:36 +0000 (21:53 +0000)]
[MC] Support .ds directives in assembler parser

These directives are already supported by GNU assembler.

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

llvm-svn: 282303

7 years agollc: Add -start-before/-stop-before options
Matthias Braun [Fri, 23 Sep 2016 21:46:02 +0000 (21:46 +0000)]
llc: Add -start-before/-stop-before options

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

llvm-svn: 282302

7 years agoUpdate clang for r282299.
Peter Collingbourne [Fri, 23 Sep 2016 21:43:51 +0000 (21:43 +0000)]
Update clang for r282299.

llvm-svn: 282301

7 years agoannotate more function visibility
Saleem Abdulrasool [Fri, 23 Sep 2016 21:36:24 +0000 (21:36 +0000)]
annotate more function visibility

These data and text symbols were missing annotations for building with hidden
visibility.  As we do not currently enable hidden visibility by default, this is
a NFC for the buildbots.

llvm-svn: 282300

7 years agoLTO: Simplify caching interface.
Peter Collingbourne [Fri, 23 Sep 2016 21:33:43 +0000 (21:33 +0000)]
LTO: Simplify caching interface.

The NativeObjectOutput class has a design problem: it mixes up the caching
policy with the interface for output streams, which makes the client-side
code hard to follow and would for example make it harder to replace the
cache implementation in an arbitrary client.

This change separates the two aspects by moving the caching policy
to a separate field in Config, replacing NativeObjectOutput with a
NativeObjectStream class which only deals with streams and does not need to
be overridden by most clients and introducing an AddFile callback for adding
files (e.g. from the cache) to the link.

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

llvm-svn: 282299

7 years agoAllow for tests to be disabled at runtime
Francis Ricci [Fri, 23 Sep 2016 21:32:47 +0000 (21:32 +0000)]
Allow for tests to be disabled at runtime

Summary:
The current implementation of the test suite allows the user to run
a certain subset of tests using '-p', but does not allow the inverse,
where a user wants to run all but some number of known failing tests.
Implement this functionality.

Reviewers: labath, zturner, tfiala

Subscribers: jingham, sas, lldb-commits

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

llvm-svn: 282298

7 years agoInstall only the manpage and only in the proper location
Enrico Granata [Fri, 23 Sep 2016 21:24:08 +0000 (21:24 +0000)]
Install only the manpage and only in the proper location

llvm-svn: 282297

7 years ago[AMDGPU] Fix for bz30427: wrong MTBUF encoding on VI
Valery Pykhtin [Fri, 23 Sep 2016 21:21:21 +0000 (21:21 +0000)]
[AMDGPU] Fix for bz30427: wrong MTBUF encoding on VI

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

llvm-svn: 282296

7 years agoWarn if we can't find the entry symbol.
Rafael Espindola [Fri, 23 Sep 2016 21:04:56 +0000 (21:04 +0000)]
Warn if we can't find the entry symbol.

Fixes pr30465.

llvm-svn: 282295

7 years ago[profile] Hide lprofCurFilename
Vedant Kumar [Fri, 23 Sep 2016 20:53:42 +0000 (20:53 +0000)]
[profile] Hide lprofCurFilename

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

llvm-svn: 282294

7 years ago[analyzer] Fix crash in RetainCountChecker::checkEndFunction
Alexander Shaposhnikov [Fri, 23 Sep 2016 20:49:01 +0000 (20:49 +0000)]
[analyzer] Fix crash in RetainCountChecker::checkEndFunction

The class BodyFarm creates bodies for
OSAtomicCompareAndSwap*, objc_atomicCompareAndSwap*, dispatch_sync*, dispatch_once*
and for them the flag isBodyAutosynthesized is set to true.

This diff
1. makes AnalysisConsumer::HandleCode skip the autosynthesized code
2. replaces assert(LCtx->getParent()) in RetainCountChecker::checkEndFunction
by assert(!LCtx->inTopFrame()) (minor cleanup)

Test plan: make -j8 check-clang-analysis

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

llvm-svn: 282293

7 years ago[libFuzzer] first steps in adding a proper automated test suite based on real-life...
Kostya Serebryany [Fri, 23 Sep 2016 20:43:22 +0000 (20:43 +0000)]
[libFuzzer] first steps in adding a proper automated test suite based on real-life code: add a script to build RE2 at a revision that has known bugs

llvm-svn: 282292

7 years ago[LTO] Add -flto-jobs=N to control backend parallelism
Teresa Johnson [Fri, 23 Sep 2016 20:38:09 +0000 (20:38 +0000)]
[LTO] Add -flto-jobs=N to control backend parallelism

Summary:
Currently, a linker option must be used to control the backend
parallelism of ThinLTO. The linker option varies depending on the
linker (e.g. gold vs ld64). Add a new clang option -flto-jobs=N
to control this.

I've added in the wiring to pass this to the gold plugin. I also
added in the logic to pass this down in the form I understand that
ld64 uses on MacOS, for the darwin target.

Reviewers: mehdi_amini, dexonsmith

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 282291

7 years ago[gold] Split plugin options controlling ThinLTO and codegen parallelism.
Teresa Johnson [Fri, 23 Sep 2016 20:35:19 +0000 (20:35 +0000)]
[gold] Split plugin options controlling ThinLTO and codegen parallelism.

Summary:
As suggested in D24826, use different options for ThinLTO backend
parallelism from the option controlling regular LTO code gen
parallelism. They are already split in the LTO API, and this enables
controlling them with different clang options.

Reviewers: pcc, mehdi_amini

Subscribers: dexonsmith, llvm-commits, mehdi_amini

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

llvm-svn: 282290

7 years agoRevert "set the underlying value of “#pragma STDC FP_CONTRACT” on by default"
Renato Golin [Fri, 23 Sep 2016 20:32:52 +0000 (20:32 +0000)]
Revert "set the underlying value of “#pragma STDC FP_CONTRACT” on by default"

This reverts commit r282259, as it broke the AArch64 test-suite bots.

llvm-svn: 282289

7 years ago[Coverage] Clarify a function contract (NFC)
Vedant Kumar [Fri, 23 Sep 2016 20:13:44 +0000 (20:13 +0000)]
[Coverage] Clarify a function contract (NFC)

llvm-svn: 282287

7 years ago[llvm-cov] Factor out logic to remove unmapped inputs (NFC)
Vedant Kumar [Fri, 23 Sep 2016 20:13:41 +0000 (20:13 +0000)]
[llvm-cov] Factor out logic to remove unmapped inputs (NFC)

llvm-svn: 282286

7 years agoAvoid counting sections twice.
Rafael Espindola [Fri, 23 Sep 2016 20:10:47 +0000 (20:10 +0000)]
Avoid counting sections twice.

We were counting the size of the bss section holding common symbols twice:

    Dot += CurOutSec->getSize();
    flush();

The new code is also simpler as now flush is the only function that
inserts in AlreadyOutputOS, which makes sense since the set hold fully
output sections.

llvm-svn: 282285

7 years ago[libFuzzer] reset Counters (trace-pc-guard) before every run
Kostya Serebryany [Fri, 23 Sep 2016 20:04:13 +0000 (20:04 +0000)]
[libFuzzer] reset Counters (trace-pc-guard) before every run

llvm-svn: 282284

7 years ago[MC] Support .dcb directives in assembler parser
Petr Hosek [Fri, 23 Sep 2016 19:25:15 +0000 (19:25 +0000)]
[MC] Support .dcb directives in assembler parser

These directives are already supported by GNU assembler.

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

llvm-svn: 282283

7 years ago[llvm-cov] Filter away source files that aren't in the coverage mapping
Vedant Kumar [Fri, 23 Sep 2016 18:57:35 +0000 (18:57 +0000)]
[llvm-cov] Filter away source files that aren't in the coverage mapping

... so that they don't show up in the index. This came up because polly
contains a .git directory and some other unmapped input in its source
dir.

llvm-svn: 282282

7 years ago[llvm-cov] Get rid of all invalid filename references
Vedant Kumar [Fri, 23 Sep 2016 18:57:32 +0000 (18:57 +0000)]
[llvm-cov] Get rid of all invalid filename references

We used to append filenames into a vector of std::string, and then
append a reference to each string into a separate vector. This made it
easier to work with the getUniqueSourceFiles API. But it's buggy.

std::string has a small-string optimization, so you can't expect to
capture a reference to one if you're copying it into a growing vector.
Add a test that triggers this invalid reference to std::string scenario,
and kill the issue with fire by just using ArrayRef<std::string>
everywhere.

llvm-svn: 282281

7 years ago[llvm-cov] Minor cleanup. NFC.
Vedant Kumar [Fri, 23 Sep 2016 18:57:27 +0000 (18:57 +0000)]
[llvm-cov] Minor cleanup. NFC.

llvm-svn: 282280

7 years ago[ELF] Resolve weak undefined TLS symbols when no phdr is available.
Davide Italiano [Fri, 23 Sep 2016 18:47:50 +0000 (18:47 +0000)]
[ELF] Resolve weak undefined TLS symbols when no phdr is available.

If we pass --gc-sections to lld and .tbss is not referenced,
the section is reclaimed and lld doesn't create a TLS program header.
R_TLS tries to access the program header -> lld crashes.
Mimic what bfd/gold do in this case and resolve a weak undefined
TLS symbol to the base of the TLS block, i.e. give it a value of zero.

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

llvm-svn: 282279

7 years ago[TLI] isdigit / isascii / toascii param type should match return type (PR30484)
Sanjay Patel [Fri, 23 Sep 2016 18:44:09 +0000 (18:44 +0000)]
[TLI] isdigit / isascii / toascii param type should match return type (PR30484)

We crash in LibCallSimplifier if we don't check the validity of the function signature properly.

llvm-svn: 282278

7 years agoChange Module::RemapPath to use StringRef.
Zachary Turner [Fri, 23 Sep 2016 18:42:38 +0000 (18:42 +0000)]
Change Module::RemapPath to use StringRef.

llvm-svn: 282277

7 years ago[ResetMachineFunction] Populate the comments in the header of the file.
Quentin Colombet [Fri, 23 Sep 2016 18:38:15 +0000 (18:38 +0000)]
[ResetMachineFunction] Populate the comments in the header of the file.

NFC

llvm-svn: 282276

7 years ago[ResetMachineFunction] Add statistic on the number of reset functions.
Quentin Colombet [Fri, 23 Sep 2016 18:38:13 +0000 (18:38 +0000)]
[ResetMachineFunction] Add statistic on the number of reset functions.

As the development of GlobalISel move forward, this statistic should
strictly decrease until it reaches zero. At this point, it would mean
GlobalISel can replace SDISel (at least on the tested inputs :P).

llvm-svn: 282275

7 years ago[RegisterBankInfo] Add statistics for dynamic partial mappings.
Quentin Colombet [Fri, 23 Sep 2016 18:38:06 +0000 (18:38 +0000)]
[RegisterBankInfo] Add statistics for dynamic partial mappings.

Collect statistics about the number of partial mappings dynamically
allocated and accessed. Ultimately, when the whole TableGen
infrastructure is set, those numbers should be zero.

llvm-svn: 282274

7 years agoScheduleDAG: Match enum names when printing sdep kinds
Matthias Braun [Fri, 23 Sep 2016 18:28:31 +0000 (18:28 +0000)]
ScheduleDAG: Match enum names when printing sdep kinds

It is less confusing to have the same names in the debug print as the
enum members.

llvm-svn: 282273

7 years agoBitcodeReader: Deduplicate code. NFC.
Peter Collingbourne [Fri, 23 Sep 2016 18:27:42 +0000 (18:27 +0000)]
BitcodeReader: Deduplicate code. NFC.

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

llvm-svn: 282272

7 years agoTry again to match the logic of the code before re-writing.
Zachary Turner [Fri, 23 Sep 2016 18:13:18 +0000 (18:13 +0000)]
Try again to match the logic of the code before re-writing.

llvm-svn: 282271

7 years agoTry to fix failing TestDataFormatterSkipSummary test case.
Zachary Turner [Fri, 23 Sep 2016 18:11:03 +0000 (18:11 +0000)]
Try to fix failing TestDataFormatterSkipSummary test case.

llvm-svn: 282270

7 years agoUpdate the prompt related functions to use StringRefs.
Zachary Turner [Fri, 23 Sep 2016 18:06:53 +0000 (18:06 +0000)]
Update the prompt related functions to use StringRefs.

llvm-svn: 282269

7 years agoSimplify. NFC.
Rui Ueyama [Fri, 23 Sep 2016 18:06:51 +0000 (18:06 +0000)]
Simplify. NFC.

llvm-svn: 282268

7 years ago[RegBankSelect] Use DEBUG_TYPE instead of repeating the name of the pass
Quentin Colombet [Fri, 23 Sep 2016 17:50:06 +0000 (17:50 +0000)]
[RegBankSelect] Use DEBUG_TYPE instead of repeating the name of the pass

NFC

llvm-svn: 282267

7 years ago[RegisterBank] Mark the dump method with LLVM_DUMP_METHOD.
Quentin Colombet [Fri, 23 Sep 2016 17:50:03 +0000 (17:50 +0000)]
[RegisterBank] Mark the dump method with LLVM_DUMP_METHOD.

NFC

llvm-svn: 282266

7 years agoUpdate OptionGroup::SetValue to take StringRef.
Zachary Turner [Fri, 23 Sep 2016 17:48:13 +0000 (17:48 +0000)]
Update OptionGroup::SetValue to take StringRef.

Then deal with all the fallout.

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

llvm-svn: 282265

7 years agoFix the following tests when running under cross-compilation:
Chad Rosier [Fri, 23 Sep 2016 17:40:40 +0000 (17:40 +0000)]
Fix the following tests when running under cross-compilation:

 Profile-aarch64 :: Linux/comdat_rename.test
 Profile-aarch64 :: Linux/extern_template.test
 Profile-aarch64 :: Linux/instrprof-comdat.test
 Profile-aarch64 :: Linux/instrprof-cs.c

The issue is that the created (aarch64) binaries were attempting to run natively
instead of running through %run, which guarantees running in the proper
environment if the compilation was configured correctly.

llvm-svn: 282264

7 years ago[compiler-rt] Fix a broken asan 64-bit test using ld_preload
Etienne Bergeron [Fri, 23 Sep 2016 17:40:31 +0000 (17:40 +0000)]
[compiler-rt] Fix a broken asan 64-bit test using ld_preload

Summary:
The 'asan_preload_test-1.cc' is not working with the i686 architecture.
To repro the error, run on a linux 64-bit:
```
ninja check-asan-dynamic
```

The following error occurs:
```
--
Exit Code: 1

Command Output (stderr):
--
/home/llvm/llvm/projects/compiler-rt/test/asan/TestCases/Linux/asan_preload_test-1.cc:18:12: error: expected string not found in input
 // CHECK: AddressSanitizer: heap-buffer-overflow
           ^
<stdin>:1:1: note: scanning from here
ERROR: ld.so: object 'libclang_rt.asan-i686.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
^
<stdin>:2:10: note: possible intended match here
==25982==AddressSanitizer CHECK failed: /home/llvm/llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:736 "((__interception::real_memcpy)) != (0)" (0x0, 0x0)
```

The unittest is running (where %shared_libasan is replaced by libclang_rt.asan-i686.so):
```
// RUN: env LD_PRELOAD=%shared_libasan not %run %t 2>&1 | FileCheck %s
```

But the executable also has a dependancy on libclang_rt.asan-i386.so (added by the clang driver):
```
linux-gate.so.1 =>  (0xf77cc000)
libclang_rt.asan-i386.so => not found
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf76ba000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7673000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7656000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf74a7000)
```

By looking to the clang driver (tools.cpp) we can see that every x86 architecture are mapped to 'i386'.
```
 StringRef MyArch;
    switch (getToolChain().getArch()) {
    case llvm::Triple::arm:
      MyArch = "arm";
      break;
    case llvm::Triple::x86:
      MyArch = "i386";
      break;
    case llvm::Triple::x86_64:
      MyArch = "amd64";
      break;
    default:
      llvm_unreachable("Unsupported architecture");
    }
```

This patch is implementing the same mapping but in the compiler-rt unittest.

Reviewers: rnk, vitalybuka

Subscribers: aemerson, kubabrecka, dberris, llvm-commits, chrisha

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

llvm-svn: 282263

7 years agoEnhance calcColdCallHeuristics for InvokeInst
Jun Bum Lim [Fri, 23 Sep 2016 17:26:14 +0000 (17:26 +0000)]
Enhance calcColdCallHeuristics for InvokeInst

Summary: When identifying cold blocks, consider only the edge to the normal destination if the terminator is InvokeInst and let calcInvokeHeuristics() decide edge weights for the InvokeInst.

Reviewers: mcrosier, hfinkel, davidxl

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 282262

7 years ago[asan] Stop appending -lm, -pthread and other linker options on Darwin for ASan unit...
Kuba Brecka [Fri, 23 Sep 2016 16:43:29 +0000 (16:43 +0000)]
[asan] Stop appending -lm, -pthread and other linker options on Darwin for ASan unit tests

On Darwin, -lm, -pthread and others are implied. -pthread currently produces a warning (compiler option unused).

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

llvm-svn: 282260

7 years agoset the underlying value of “#pragma STDC FP_CONTRACT” on by default
Sebastian Pop [Fri, 23 Sep 2016 16:16:25 +0000 (16:16 +0000)]
set the underlying value of “#pragma STDC FP_CONTRACT” on by default

Clang has the default FP contraction setting of “-ffp-contract=on”, which
doesn't really mean “on” in the conventional sense of the word, but rather
really means “according to the per-statement effective value of the relevant
pragma”.

Before this patch, Clang has that pragma defaulting to “off”. Since the
“-ffp-contract=on” mode is really an AND of two booleans and the second of them
defaults to “off”, the whole thing effectively defaults to “off”. This patch
changes the default value of the pragma to “on”, thus making the default pair of
booleans (on, on) rather than (on, off). This makes FP optimization slightly
more aggressive than before when not using either “-Ofast”, “-ffast-math”, or
“-ffp-contract=fast”. Even with this patch the compiler still respects
“-ffp-contract=off”.

As per a suggestion by Steve Canon, the added code does _not_ require “-O3” or
higher. This is so as to try our best to preserve identical floating-point
results for unchanged source code compiling for an unchanged target when only
changing from any optimization level in the set (“-O0”, “-O1”, “-O2”, “-O3”) to
any other optimization level in that set. “-Os” and “-Oz” seem to be behaving
identically, i.e. should probably be considered a part of the aforementioned
set, but I have not reviewed this rigorously. “-Ofast” is explicitly _not_ a
member of that set.

Patch authored by Abe Skolnik [a.skolnik@samsung.com] and Stephen Canon [scanon@apple.com].

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

llvm-svn: 282259