platform/upstream/llvm.git
7 years agoAdd a script to dump out all project inter-dependencies.
Zachary Turner [Fri, 3 Mar 2017 22:40:46 +0000 (22:40 +0000)]
Add a script to dump out all project inter-dependencies.

llvm-svn: 296920

7 years agoFix hash requirements check in __hash_table.
Eric Fiselier [Fri, 3 Mar 2017 22:35:58 +0000 (22:35 +0000)]
Fix hash requirements check in __hash_table.

r296565 attempted to add better diagnostics when an unordered container
is instantiated with a hash that doesn't meet the Hash requirements.

However I mistakenly checked the wrong set of requirements. Specifically
it checked if the hash met the requirements for specializations of
std::hash. However these requirements are stricter than the generic
Hash requirements.

This patch fixes the assertions to only check the Hash requirements.

llvm-svn: 296919

7 years ago[x86] refactor combineAddOrSubToADCOrSBB(); NFCI
Sanjay Patel [Fri, 3 Mar 2017 22:35:11 +0000 (22:35 +0000)]
[x86] refactor combineAddOrSubToADCOrSBB(); NFCI

The comments were wrong, and this is not an obvious transform.
This hopefully makes it clearer that we're missing the commuted
patterns for adds. It's less clear that this is actually a good
transform for all micro-arch.

This is prep work for trying to clean up the current adc/sbb
codegen because it's definitely not happening optimally.

llvm-svn: 296918

7 years agoSilence a warning, NFC
Krzysztof Parzyszek [Fri, 3 Mar 2017 22:21:02 +0000 (22:21 +0000)]
Silence a warning, NFC

llvm-svn: 296917

7 years ago[PGO] Text format profile reader needs to clear the value profile
Rong Xu [Fri, 3 Mar 2017 21:56:34 +0000 (21:56 +0000)]
[PGO] Text format profile reader needs to clear the value profile

Summary:
Reset the ValueData for each function to avoid using the ones in
the previous function.

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: llvm-commits, xur

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

llvm-svn: 296916

7 years agoDetect the existence of pthread_{s,g}etname_np in libpthread on Linux
Krzysztof Parzyszek [Fri, 3 Mar 2017 21:53:12 +0000 (21:53 +0000)]
Detect the existence of pthread_{s,g}etname_np in libpthread on Linux

Older Linux distributions may not have those functions.

llvm-svn: 296915

7 years agoFix Threading path when LLVM_ENABLE_THREADS=0.
Zachary Turner [Fri, 3 Mar 2017 21:49:38 +0000 (21:49 +0000)]
Fix Threading path when LLVM_ENABLE_THREADS=0.

llvm-svn: 296914

7 years agoun-Xfail Fuzzer test that decided to pass on Green Dragon
Mehdi Amini [Fri, 3 Mar 2017 21:28:05 +0000 (21:28 +0000)]
un-Xfail Fuzzer test that decided to pass on Green Dragon

It may be flacky, I'll turn it into unsupported if it fails again.

llvm-svn: 296913

7 years agoMC: De-duplicate the object streamer implementations of EmitFileDirective into MCObje...
Peter Collingbourne [Fri, 3 Mar 2017 21:22:06 +0000 (21:22 +0000)]
MC: De-duplicate the object streamer implementations of EmitFileDirective into MCObjectStreamer. NFCI.

llvm-svn: 296912

7 years ago[ObjectYAML] [DWARF] Abstract DWARF Initial Length values
Chris Bieneman [Fri, 3 Mar 2017 21:11:55 +0000 (21:11 +0000)]
[ObjectYAML] [DWARF] Abstract DWARF Initial Length values

In the DWARF 4 Spec section 7.2.2, data in many DWARF sections, and some DWARF structures start with "Initial Length Values", which are a 32-bit length, and an optional 64-bit length if the 32 bit value == UINT32_MAX.

This patch abstracts the Initial Length type in YAML, and extends its use to all the DWARF structures that are supported in the DWARFYAML code that have Initial Length values.

llvm-svn: 296911

7 years agoIsolate Target-specific functionality of DataExtractor.
Zachary Turner [Fri, 3 Mar 2017 20:57:05 +0000 (20:57 +0000)]
Isolate Target-specific functionality of DataExtractor.

In an effort to move the various DataBuffer / DataExtractor
classes from Core -> Utility, we have to separate the low-level
functionality from the higher level functionality.  Only a
few functions required anything other than reading/writing
raw bytes, so those functions are separated out into a
more appropriate area.  Specifically, Dump() and DumpHexBytes()
are moved into free functions in Core/DumpDataExtractor.cpp,
and GetGNUEHPointer is moved into a static function in the
only file that it's referenced from.

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

llvm-svn: 296910

7 years agoMove Log from Core -> Utility.
Zachary Turner [Fri, 3 Mar 2017 20:56:28 +0000 (20:56 +0000)]
Move Log from Core -> Utility.

All references to Host and Core have been removed, so this
class can now safely be lowered into Utility.

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

llvm-svn: 296909

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 3 Mar 2017 20:48:54 +0000 (20:48 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 296908

7 years agoLTO: Hash the set of imported symbols for each module.
Peter Collingbourne [Fri, 3 Mar 2017 20:25:30 +0000 (20:25 +0000)]
LTO: Hash the set of imported symbols for each module.

This set may affect code generation and is sensitive to link order (and
possibly in the future to the linker's choice of prevailing symbol), so we
need to include it.

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

llvm-svn: 296907

7 years ago[Windows] Remove the #include <eh.h> hack.
Zachary Turner [Fri, 3 Mar 2017 20:21:59 +0000 (20:21 +0000)]
[Windows] Remove the #include <eh.h> hack.

Prior to MSVC 2015 we had to manually include this header any
time we were going to include <thread> or <future> due to a
bug in MSVC's STL implementation.  This has been fixed in MSVC
for some time now, and we require VS 2015 minimum, so we can
remove this across all subprojects.

llvm-svn: 296906

7 years agoRegisterCoalescer: Simplify subrange splitting code; NFC
Matthias Braun [Fri, 3 Mar 2017 19:05:34 +0000 (19:05 +0000)]
RegisterCoalescer: Simplify subrange splitting code; NFC

- Use slightly better variable names / compute in a more direct way.

llvm-svn: 296905

7 years agoTeach lit to expand glob expressions.
Zachary Turner [Fri, 3 Mar 2017 18:55:24 +0000 (18:55 +0000)]
Teach lit to expand glob expressions.

This will enable removing hacks throughout the codebase
in clang and compiler-rt that feed multiple inputs to a
testing utility by globbing, all of which are either disabled
on Windows currently or using xargs / find hacks.

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

llvm-svn: 296904

7 years agoFix a compiler warning
Sanjoy Das [Fri, 3 Mar 2017 18:53:09 +0000 (18:53 +0000)]
Fix a compiler warning

llvm-svn: 296903

7 years agoAdd missing #includes for FreeBSD.
Zachary Turner [Fri, 3 Mar 2017 18:38:22 +0000 (18:38 +0000)]
Add missing #includes for FreeBSD.

llvm-svn: 296902

7 years agoMake TargetInstrInfo::isPredicable take a const reference, NFC
Krzysztof Parzyszek [Fri, 3 Mar 2017 18:30:54 +0000 (18:30 +0000)]
Make TargetInstrInfo::isPredicable take a const reference, NFC

llvm-svn: 296901

7 years ago[sancov] better input parameters validation
Mike Aizatsky [Fri, 3 Mar 2017 18:22:20 +0000 (18:22 +0000)]
[sancov] better input parameters validation

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

llvm-svn: 296900

7 years agoTry again to appease the FreeBSD bot.
Zachary Turner [Fri, 3 Mar 2017 18:21:04 +0000 (18:21 +0000)]
Try again to appease the FreeBSD bot.

The actual logic was wrong, not just the type conversion.
This should get it correct.

llvm-svn: 296899

7 years ago[LoopUnrolling] Peel loops with invariant backedge Phi input
Sanjoy Das [Fri, 3 Mar 2017 18:19:15 +0000 (18:19 +0000)]
[LoopUnrolling] Peel loops with invariant backedge Phi input

Summary:
If a loop contains a Phi node which has an invariant input from back
edge, it is profitable to peel such loops (rather than unroll them) to
use the advantage that this Phi is always invariant starting from 2nd
iteration. After the 1st iteration is peeled, other optimizations can
potentially simplify calculations with this invariant.

Patch by Max Kazantsev!

Reviewers: sanjoy, apilipenko, igor-laevsky, anna, mkuper, reames

Reviewed By: mkuper

Subscribers: mkuper, mzolotukhin, llvm-commits

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

llvm-svn: 296898

7 years ago[LoopUnrolling] Re-prioritize Peeling and Partial unrolling
Sanjoy Das [Fri, 3 Mar 2017 18:19:10 +0000 (18:19 +0000)]
[LoopUnrolling] Re-prioritize Peeling and Partial unrolling

Summary:
In current implementation the loop peeling happens after trip-count based partial unrolling and may
sometimes not happen at all due to it (for example, if trip count is known, but UP.Partial = false). This
is generally bad, the more than there are some situations where peeling is profitable even if the partial
unrolling is disabled.

This patch is a NFC which reorders peeling and partial unrolling application and prepares the code for
implementation of the said optimizations.

Patch by Max Kazantsev!

Reviewers: sanjoy, anna, reames, apilipenko, igor-laevsky, mkuper

Reviewed By: mkuper

Subscribers: mkuper, llvm-commits, mzolotukhin

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

llvm-svn: 296897

7 years agoReland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Fri, 3 Mar 2017 18:02:02 +0000 (18:02 +0000)]
Reland 4: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

llvm-svn: 296895

7 years ago[x86] clean up materializeSBB(); NFCI
Sanjay Patel [Fri, 3 Mar 2017 17:58:39 +0000 (17:58 +0000)]
[x86] clean up materializeSBB(); NFCI

This is producing SBB where it is obviously not necessary, so it needs to be limited.

llvm-svn: 296894

7 years agoTry to appease the FreeBSD bots.
Zachary Turner [Fri, 3 Mar 2017 17:56:14 +0000 (17:56 +0000)]
Try to appease the FreeBSD bots.

pthread_self() returns a pthread_t, but we were setting it to
an int.  It seems the cast to int when calling sysctl is still
the correct thing to do, though.

llvm-svn: 296892

7 years agoDon't bring in llvm/Support/thread.h in Threading.cpp
Zachary Turner [Fri, 3 Mar 2017 17:39:24 +0000 (17:39 +0000)]
Don't bring in llvm/Support/thread.h in Threading.cpp

Doing so defines the type llvm::thread.  On FreeBSD, we need
to call a macro which references its own ::thread type, which
causes an ambiguity due to ADL when inside of the llvm namespace.

Since we don't even need this unless LLVM_ENABLE_THREADS == 1,
we don't even need this type anyway, as it is always equal to
std::thread, so we can just use that directly.

llvm-svn: 296891

7 years agoAdd #include for unistd.h on Linux.
Zachary Turner [Fri, 3 Mar 2017 17:24:55 +0000 (17:24 +0000)]
Add #include for unistd.h on Linux.

llvm-svn: 296890

7 years agoFix libc++ test to pass in C++03 mode
Mehdi Amini [Fri, 3 Mar 2017 17:24:29 +0000 (17:24 +0000)]
Fix libc++ test to pass in C++03 mode

Was hitting: "error: scalar initializer cannot be empty"

llvm-svn: 296889

7 years ago[clang-tidy] Yet another docs fixes
Piotr Padlewski [Fri, 3 Mar 2017 17:16:11 +0000 (17:16 +0000)]
[clang-tidy] Yet another docs fixes

llvm-svn: 296888

7 years ago[Support] Provide access to current thread name/thread id.
Zachary Turner [Fri, 3 Mar 2017 17:15:17 +0000 (17:15 +0000)]
[Support] Provide access to current thread name/thread id.

Applications often need the current thread id when making
system calls, and some operating systems provide the notion
of a thread name, which can be useful in enabling better
diagnostics when debugging or logging.

This patch adds an accessor for the thread id, and "best effort"
getters and setters for the thread name.  Since this is
non critical functionality, no error is returned to indicate
that a platform doesn't support thread names.

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

llvm-svn: 296887

7 years agoUse APInt::setBits instead of OR'ing in a separate APInt::getBitsSet call
Simon Pilgrim [Fri, 3 Mar 2017 17:03:52 +0000 (17:03 +0000)]
Use APInt::setBits instead of OR'ing in a separate APInt::getBitsSet call

llvm-svn: 296886

7 years agoAndroid.rules: fix building on mac
Pavel Labath [Fri, 3 Mar 2017 17:03:46 +0000 (17:03 +0000)]
Android.rules: fix building on mac

realpath is not available as an executable on mac. I give up, I am just
going to leave the path with ..'s in it.

llvm-svn: 296885

7 years ago[Analyzer] Terminate analysis on OpenMP code instead of assertion crash
Aleksei Sidorin [Fri, 3 Mar 2017 16:58:53 +0000 (16:58 +0000)]
[Analyzer] Terminate analysis on OpenMP code instead of assertion crash

* ExprEngine assumes that OpenMP statements should never appear in CFG.
  However, current CFG doesn't know anything about OpenMP and passes
  such statements as CFG nodes causing "UNREACHABLE executed!" crashes.
  Since there is no OpenMP implementation in ExprEngine or CFG,
  we stop the analysis on OpenMP statements to avoid crashes.

This fixes PR31835.

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

llvm-svn: 296884

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 3 Mar 2017 16:58:51 +0000 (16:58 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 296883

7 years agoUse APInt::getLowBitsSet instead of APInt::getBitsSet for lower bit mask creation
Simon Pilgrim [Fri, 3 Mar 2017 16:56:33 +0000 (16:56 +0000)]
Use APInt::getLowBitsSet instead of APInt::getBitsSet for lower bit mask creation

llvm-svn: 296882

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 3 Mar 2017 16:45:57 +0000 (16:45 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 296881

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 3 Mar 2017 16:42:43 +0000 (16:42 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 296880

7 years agoUse APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation
Simon Pilgrim [Fri, 3 Mar 2017 16:35:57 +0000 (16:35 +0000)]
Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation

Avoids all the unnecessary extra bitrange creation/shift stages.

llvm-svn: 296879

7 years ago[compiler-rt][asan] Turn on ASAN unittests for win64.
Etienne Bergeron [Fri, 3 Mar 2017 16:35:46 +0000 (16:35 +0000)]
[compiler-rt][asan] Turn on ASAN unittests for win64.

Summary:
Asan is now working on windows 64-bit.
This patch is turning on the unittest.

Reviewers: rnk

Reviewed By: rnk

Subscribers: kubamracek, dberris, beanz, mgorny, llvm-commits, chrisha

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

llvm-svn: 296878

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 3 Mar 2017 16:34:35 +0000 (16:34 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 296877

7 years agoAndroid.rules: fix building on windows
Pavel Labath [Fri, 3 Mar 2017 16:29:56 +0000 (16:29 +0000)]
Android.rules: fix building on windows

$(realpath), which I guess is a make builtin, gives strange results on
Windows. $(shell realpath) invokes the gnuwin external binary, which
works correctly.

llvm-svn: 296876

7 years ago[x86] fix formatting; NFC
Sanjay Patel [Fri, 3 Mar 2017 15:17:41 +0000 (15:17 +0000)]
[x86] fix formatting; NFC

llvm-svn: 296875

7 years agoUse APInt::getHighBitsSet instead of APInt::getBitsSet for upper bit mask creation
Simon Pilgrim [Fri, 3 Mar 2017 14:37:57 +0000 (14:37 +0000)]
Use APInt::getHighBitsSet instead of APInt::getBitsSet for upper bit mask creation

llvm-svn: 296874

7 years ago[AMDGPU][MC] Fix for Bug 30829 + LIT tests
Dmitry Preobrazhensky [Fri, 3 Mar 2017 14:31:06 +0000 (14:31 +0000)]
[AMDGPU][MC] Fix for Bug 30829 + LIT tests

Added code to check constant bus restrictions for VOP formats (only one SGPR value or literal-constant may be used by the instruction).
Note that the same checks are performed by SIInstrInfo::verifyInstruction (used by lowering code).
Added LIT tests.

llvm-svn: 296873

7 years agoRevert "Re-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline.""
Benjamin Kramer [Fri, 3 Mar 2017 14:27:53 +0000 (14:27 +0000)]
Revert "Re-apply "[GVNHoist] Move GVNHoist to function simplification part of pipeline.""

This reverts commit r296759. Miscompiles bash.

llvm-svn: 296872

7 years agoUse APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation
Simon Pilgrim [Fri, 3 Mar 2017 14:25:46 +0000 (14:25 +0000)]
Use APInt::getOneBitSet instead of APInt::getBitsSet for sign bit mask creation

Avoids all the unnecessary extra bitrange creation/shift stages.

llvm-svn: 296871

7 years agotest: shorten test trace file names
Pavel Labath [Fri, 3 Mar 2017 13:49:38 +0000 (13:49 +0000)]
test: shorten test trace file names

Make sure we don't generate extremely long file names for test trace log
file, as this can cause path-too-long errors. As the compilers in the
android ndk are deeply nested, it's very easy to trigger these.

I chose to output at most 4 path components -- this should keep the full
path for common cases like /usr/bin/gcc with room to spare, and should
be enough to uniquely identify the compiler for more deeply nested
cases.

llvm-svn: 296870

7 years agotestsuite/android: build test executables with the android ndk directly
Pavel Labath [Fri, 3 Mar 2017 13:49:34 +0000 (13:49 +0000)]
testsuite/android: build test executables with the android ndk directly

Summary:
This teaches the test makefiles about the Android NDK, so we are able to
run the tests without first going through the make_standalone_toolchain
script. The motivation for this is the ability to run both libc++ and
libstdc++ tests together, which previously was not possible because
make_standalone_toolchain bakes in the STL to use during toolchain
creation time. The support for this is not present yet -- this change
only make sure we don't regress for existing funcionality (gcc w/
libstdc++). Clang and libc++ support will be added later.

I've checked that the mips android targets compile after this change,
but I have no way of checking whether this breaks anything. If you are
reading this and it broke you, let me know.

Reviewers: tberghammer, danalbert

Subscribers: srhines, lldb-commits

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

llvm-svn: 296869

7 years agoMade GetClangTargetCPU() const.
Pavel Labath [Fri, 3 Mar 2017 13:35:49 +0000 (13:35 +0000)]
Made GetClangTargetCPU() const.

Summary:
It does not change members or call non-const members.
HostInfo::GetArchitecture() returns a const object ref (maybe others?),
which can't access the non-const function.

Reviewers: labath, eugene

Reviewed By: labath, eugene

Subscribers: lldb-commits

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

llvm-svn: 296868

7 years ago[clang-tidy] Fix modernize-use-emplace docs
Piotr Padlewski [Fri, 3 Mar 2017 12:42:22 +0000 (12:42 +0000)]
[clang-tidy] Fix modernize-use-emplace docs

llvm-svn: 296867

7 years agoFix Wdocumentation warning
Simon Pilgrim [Fri, 3 Mar 2017 12:09:11 +0000 (12:09 +0000)]
Fix Wdocumentation warning

llvm-svn: 296866

7 years ago[ARM] fpscr read/write intrinsics not aware of each other
Ranjeet Singh [Fri, 3 Mar 2017 11:40:07 +0000 (11:40 +0000)]
[ARM] fpscr read/write intrinsics not aware of each other

The intrinsics __builtin_arm_get_fpscr and __builtin_arm_set_fpscr read and
write to the fpscr (Floating-Point Status and Control Register) register.

A bug exists in the __builtin_arm_get_fpscr intrinsic definition in llvm which
treats this intrinsic as a IntroNoMem which means it's not a memory access and
doesn't have any other side-effects. Having this property on this intrinsic
means that various optimizations can be done on this such as common
sub-expression elimination with other reads. This can cause issues if there has
been write to this register, e.g.

void foo(int *p) {
     p[0] = __builtin_arm_get_fpscr();
     __builtin_arm_set_fpscr(1);
     p[1] = __builtin_arm_get_fpscr();
}

in the above example the second read is currently CSE'd into the first read,
this is because llvm isn't aware that the write done by __builtin_arm_set_fpscr
effects the same register that __builtin_arm_get_fpscr reads from, to fix this
problem I've removed the property IntrNoMem so that __builtin_arm_get_fpscr is
treated as a memory access.

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

llvm-svn: 296865

7 years ago[clang-tidy] Format code around applied fixes
Alexander Kornienko [Fri, 3 Mar 2017 11:16:34 +0000 (11:16 +0000)]
[clang-tidy] Format code around applied fixes

Summary:
Add -format option (disabled by default for now) to trigger formatting
of replacements.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: kimgr, malcolm.parsons, JDevlieghere, cfe-commits

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

llvm-svn: 296864

7 years ago[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be...
Mohammad Shahid [Fri, 3 Mar 2017 10:02:47 +0000 (10:02 +0000)]
[SLP] Fixes the bug due to absence of in order uses of scalars which needs to be available
for VectorizeTree() API.This API uses it for proper mask computation to be used in shufflevector IR.
The fix is to compute the mask for out of order memory accesses while building the vectorizable tree
instead of actual vectorization of vectorizable tree.It also needs to recompute the proper Lane for
external use of vectorizable scalars based on shuffle mask.

Reviewers: mkuper

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

Change-Id: Ide8773ce0ad3562f3cf4d1a0ad0f487e2f60ce5d
llvm-svn: 296863

7 years ago[SDAG] Revert r296476 (and r296486, r296668, r296690).
Chandler Carruth [Fri, 3 Mar 2017 10:02:25 +0000 (10:02 +0000)]
[SDAG] Revert r296476 (and r296486, r296668, r296690).

This patch causes compile times for some patterns to explode. I have
a (large, unreduced) test case that slows down by more than 20x and
several test cases slow down by 2x. I'm sending some of the test cases
directly to Nirav and following up with more details in the review log,
but this should unblock anyone else hitting this.

llvm-svn: 296862

7 years ago[PowerPC] Enable -fomit-frame-pointer by default for PPC
Nemanja Ivanovic [Fri, 3 Mar 2017 09:49:17 +0000 (09:49 +0000)]
[PowerPC] Enable -fomit-frame-pointer by default for PPC

As is the case on platforms like Mips, X86 and SystemZ, the -fomit-frame-pointer
should be enabled by default on PPC when optimizing at -O1 and above. This
brings the behaviour of LLVM on PPC in line with GCC.

Committing on behalf of Hiroshi Inoue.

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

llvm-svn: 296861

7 years agoFix a typo in the comments. Patch by marktwtn from https://github.com/llvm-mirror...
Sylvestre Ledru [Fri, 3 Mar 2017 09:36:04 +0000 (09:36 +0000)]
Fix a typo in the comments. Patch by marktwtn from https://github.com/llvm-mirror/llvm/pull/16/files

llvm-svn: 296860

7 years ago[X86] Generate VZEROUPPER for Skylake-avx512.
Amjad Aboud [Fri, 3 Mar 2017 09:03:24 +0000 (09:03 +0000)]
[X86] Generate VZEROUPPER for Skylake-avx512.
VZEROUPPER should not be issued on Knights Landing (KNL), but on Skylake-avx512 it should be.

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

llvm-svn: 296859

7 years ago[clang-tidy] google-readability-casting: don't use constructor call syntax for const...
Alexander Kornienko [Fri, 3 Mar 2017 08:18:49 +0000 (08:18 +0000)]
[clang-tidy] google-readability-casting: don't use constructor call syntax for const types

llvm-svn: 296858

7 years ago[AArch64AsmParser] rewrite of function parseSysAlias
Sjoerd Meijer [Fri, 3 Mar 2017 08:12:47 +0000 (08:12 +0000)]
[AArch64AsmParser] rewrite of function parseSysAlias

This is a cleanup/rewrite of the parseSysAlias function. It was not using the
tablegen instruction descriptions, but was “manually” matching the mnemonics
and recreating the operands whereas all this information is already in
tablegen; all this code has been replaced with calls to lookupXYZByName
tablegen calls.

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

llvm-svn: 296857

7 years ago[GlobalISel][X86] Support float/double and vector types.
Igor Breger [Fri, 3 Mar 2017 08:06:46 +0000 (08:06 +0000)]
[GlobalISel][X86] Support float/double and vector types.

Summary: [GlobalISel][X86] Add support for f32/f64 and vector types in RegisterBank and InstructionSelector.

Reviewers: delena, zvi

Reviewed By: zvi

Subscribers: dberris, rovka, llvm-commits, kristof.beyls

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

llvm-svn: 296856

7 years agoRemove some dead code in FileSpec.
Zachary Turner [Fri, 3 Mar 2017 06:14:38 +0000 (06:14 +0000)]
Remove some dead code in FileSpec.

This in turn triggered some fallout where other files had
been transitively picking up includes that they needed from
FileSpec.h, so I've fixed those up as well.

llvm-svn: 296855

7 years agoClean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES
Eric Fiselier [Fri, 3 Mar 2017 03:43:25 +0000 (03:43 +0000)]
Clean up more usages of _LIBCPP_HAS_NO_RVALUE_REFERENCES

llvm-svn: 296854

7 years ago[tests] Specify the dependence to NVPTX backend for Polly ACC test cases
Tobias Grosser [Fri, 3 Mar 2017 03:38:50 +0000 (03:38 +0000)]
[tests] Specify the dependence to NVPTX backend for Polly ACC test cases

Some Polly ACC test cases fail without a working NVPTX backend. We explicitly
specify this dependence in REQUIRES. Alternatively, we could have only marked
polly-acc as supported in case the NVPTX backend is available, but as we might
use other backends in the future, this does not seem to be the best choice.

For this to work, we also need to make the 'targets_to_build' information
available.

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 296853

7 years ago[test] Do not emit binary data to output
Tobias Grosser [Fri, 3 Mar 2017 03:24:34 +0000 (03:24 +0000)]
[test] Do not emit binary data to output

Suggested-by: Michael Kruse <llvm@meinersbur.de>
llvm-svn: 296852

7 years agoFix sign-compare warning in test; Oddly this only appears on OS X
Eric Fiselier [Fri, 3 Mar 2017 02:02:07 +0000 (02:02 +0000)]
Fix sign-compare warning in test; Oddly this only appears on OS X

llvm-svn: 296851

7 years agoRevert r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld...
Peter Collingbourne [Fri, 3 Mar 2017 02:00:22 +0000 (02:00 +0000)]
Revert r296730, "cmake: Configure the ThinLTO cache directory when using ELF lld or gold."

Causes a build failure on the clang-with-thin-lto-ubuntu bot.
http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/2117/steps/build-stage3-compiler/logs/stdio

llvm-svn: 296850

7 years ago[msan] Test for _mm_getcsr and _mm_setcsr (r296848).
Evgeniy Stepanov [Fri, 3 Mar 2017 01:13:23 +0000 (01:13 +0000)]
[msan] Test for _mm_getcsr and _mm_setcsr (r296848).

llvm-svn: 296849

7 years ago[msan] Handle x86_sse_stmxcsr and x86_sse_ldmxcsr.
Evgeniy Stepanov [Fri, 3 Mar 2017 01:12:43 +0000 (01:12 +0000)]
[msan] Handle x86_sse_stmxcsr and x86_sse_ldmxcsr.

llvm-svn: 296848

7 years agoLiveDebugValues: Assume calls never clobber SP.
Adrian Prantl [Fri, 3 Mar 2017 01:08:25 +0000 (01:08 +0000)]
LiveDebugValues: Assume calls never clobber SP.

A call should never modify the stack pointer, but some backends are
not so sure about this and never list SP in the regmask. For the
purposes of LiveDebugValues we assume a call never clobbers SP. We
already have a similar workaround in DbgValueHistoryCalculator (which
we hopefully can retire soon).

This fixes the availabilty of local ASANified variables on AArch64.

rdar://problem/27757381

llvm-svn: 296847

7 years ago[ProfileData] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 3 Mar 2017 01:07:34 +0000 (01:07 +0000)]
[ProfileData] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 296846

7 years agoCodeGen: BlockPlacement: Precompute layout for chains of triangles.
Kyle Butt [Fri, 3 Mar 2017 01:00:22 +0000 (01:00 +0000)]
CodeGen: BlockPlacement: Precompute layout for chains of triangles.

For chains of triangles with small join blocks that can be tail duplicated, a
simple calculation of probabilities is insufficient. Tail duplication
can be profitable in 3 different ways for these cases:

1) The post-dominators marked 50% are actually taken 56% (This shrinks with
   longer chains)
2) The chains are statically correlated. Branch probabilities have a very
   U-shaped distribution.
   [http://nrs.harvard.edu/urn-3:HUL.InstRepos:24015805]
   If the branches in a chain are likely to be from the same side of the
   distribution as their predecessor, but are independent at runtime, this
   transformation is profitable. (Because the cost of being wrong is a small
   fixed cost, unlike the standard triangle layout where the cost of being
   wrong scales with the # of triangles.)
3) The chains are dynamically correlated. If the probability that a previous
   branch was taken positively influences whether the next branch will be
   taken
We believe that 2 and 3 are common enough to justify the small margin in 1.

The code pre-scans a function's CFG to identify this pattern and marks the edges
so that the standard layout algorithm can use the computed results.

llvm-svn: 296845

7 years ago[msan] Remove stale comments.
Evgeniy Stepanov [Fri, 3 Mar 2017 00:25:56 +0000 (00:25 +0000)]
[msan] Remove stale comments.

ClStoreCleanOrigin flag was removed back in 2014.

llvm-svn: 296844

7 years agoFix msc-version.c test to handle _MSC_VER=1910
Dave Bartolomeo [Fri, 3 Mar 2017 00:08:55 +0000 (00:08 +0000)]
Fix msc-version.c test to handle _MSC_VER=1910

Previously, VC++ has always set _MSC_VER to a four-digit value with the two least significant digits set to zero. Visual Studio 2017, however, sets _MSC_VER=1910, and we expect to update the least significant digit as we release major updates for VS 2017. This patch fixes the msc-version.c test to handle non-zero values in the two least significant digits of _MSC_VER.

llvm-svn: 296843

7 years agoAMDGPU: Fix missing dominator tree dependency
Matt Arsenault [Thu, 2 Mar 2017 23:50:51 +0000 (23:50 +0000)]
AMDGPU: Fix missing dominator tree dependency

llvm-svn: 296842

7 years agoRevert "Reland 3: [analyzer] NFC: Update test infrastructure to support multiple...
Dominic Chen [Thu, 2 Mar 2017 23:30:53 +0000 (23:30 +0000)]
Revert "Reland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"

This reverts commit ea36f1406e1f36bf456c3f3929839b024128e468.

llvm-svn: 296841

7 years agoWork around test failure on 32 bit OS X
Eric Fiselier [Thu, 2 Mar 2017 23:18:40 +0000 (23:18 +0000)]
Work around test failure on 32 bit OS X

llvm-svn: 296840

7 years agoThinLTOBitcodeWriter: Do not follow operand edges of type GlobalValue when looking...
Peter Collingbourne [Thu, 2 Mar 2017 23:10:17 +0000 (23:10 +0000)]
ThinLTOBitcodeWriter: Do not follow operand edges of type GlobalValue when looking for virtual functions.

Such edges may otherwise result in infinite recursion if a pointer to a vtable
is reachable from the vtable itself. This can happen in practice if a TU
defines the ABI types used to implement RTTI, and is itself compiled with RTTI.

Fixes PR32121.

llvm-svn: 296839

7 years agoMove defClobbersUseOrDef to being a protected member of a class since we don't want...
Daniel Berlin [Thu, 2 Mar 2017 23:06:46 +0000 (23:06 +0000)]
Move defClobbersUseOrDef to being a protected member of a class since we don't want anyone else using it

llvm-svn: 296838

7 years agoReland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Thu, 2 Mar 2017 23:05:45 +0000 (23:05 +0000)]
Reland 3: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

llvm-svn: 296837

7 years agoRevert "Reland 2: [analyzer] NFC: Update test infrastructure to support multiple...
Dominic Chen [Thu, 2 Mar 2017 22:58:06 +0000 (22:58 +0000)]
Revert "Reland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint managers"

This reverts commit f93343c099fff646a2314cc7f4925833708298b1.

llvm-svn: 296836

7 years agoReland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint...
Dominic Chen [Thu, 2 Mar 2017 22:45:24 +0000 (22:45 +0000)]
Reland 2: [analyzer] NFC: Update test infrastructure to support multiple constraint managers

Summary: Replace calls to %clang/%clang_cc1 with %clang_analyze_cc1 when invoking static analyzer, and perform runtime substitution to select the appropriate constraint manager, per D28952.

Reviewers: xazax.hun, NoQ, zaks.anna, dcoughlin

Subscribers: mgorny, rgov, mikhail.ramalho, a.sidorin, cfe-commits

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

llvm-svn: 296835

7 years agoPython commands as first class citizens.
Jim Ingham [Thu, 2 Mar 2017 22:24:01 +0000 (22:24 +0000)]
Python commands as first class citizens.

This should be a necessary precursor to adding support
for any future extension languages.

llvm-svn: 296834

7 years agoMention fetching thread lists lazily.
Jim Ingham [Thu, 2 Mar 2017 22:13:45 +0000 (22:13 +0000)]
Mention fetching thread lists lazily.

llvm-svn: 296833

7 years ago[BypassSlowDivision] Use ValueTracking to simplify run-time checks
Nikolai Bozhenov [Thu, 2 Mar 2017 22:12:15 +0000 (22:12 +0000)]
[BypassSlowDivision] Use ValueTracking to simplify run-time checks

ValueTracking is used for more thorough analysis of operands. Based on the
analysis, either run-time checks can be simplified (e.g. check only one operand
instead of two) or the transformation can be avoided. For example, it is quite
often the case that a divisor is promoted from a shorter type and run-time
checks for it are redundant.

With additional compile-time analysis of values, two special cases naturally
arise and are addressed by the patch:

 1) Both operands are known to be short enough. Then, the long division can be
    simply replaced with a short one without CFG modification.

 2) If a division is unsigned and the dividend is known to be short then the
    long division is not needed at all. Because if the divisor is too big for
    short division then the quotient is obviously zero (and the remainder is
    equal to the dividend). Actually, the division is not needed when
    (divisor > dividend).

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

llvm-svn: 296832

7 years agoremove max_size() extension from polymorphic_allocator. It is unneeded
Eric Fiselier [Thu, 2 Mar 2017 22:10:14 +0000 (22:10 +0000)]
remove max_size() extension from polymorphic_allocator. It is unneeded

llvm-svn: 296831

7 years agoFix libc++ test experimental/algorithms/alg.random.sample/sample.pass.cpp when ran...
Mehdi Amini [Thu, 2 Mar 2017 22:08:42 +0000 (22:08 +0000)]
Fix libc++ test experimental/algorithms/alg.random.sample/sample.pass.cpp when ran in c++11 mode 32 bits

llvm-svn: 296830

7 years agoCMake: Clean up VersionFromVCS.cmake
Tom Stellard [Thu, 2 Mar 2017 22:05:13 +0000 (22:05 +0000)]
CMake: Clean up VersionFromVCS.cmake

Summary:
Fix a few problems in VersionFromVCS.cmake to make it more reliable:

- Stop using git svn info to retrieve the svn revision.  I am unable to
  determine what the svn revision returned by this command means.
  During my testing this command returned a revision from a month
  ago which was not the HEAD of any of my local branches.

  Also, this revision was never actually added to the version string due
  to a typo in the script.  All it was used for was to reject the
  revision number returned by git svn find-rev HEAD when the revision
  numbers didn't match.

- Populate GIT_COMMIT even when we detect a git repo without any
  svn information.

Reviewers: mehdi_amini, beanz

Reviewed By: beanz

Subscribers: mgorny, llvm-commits

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

llvm-svn: 296829

7 years ago[BypassSlowDivision] Refactor fast division insertion logic (NFC)
Nikolai Bozhenov [Thu, 2 Mar 2017 22:05:07 +0000 (22:05 +0000)]
[BypassSlowDivision] Refactor fast division insertion logic (NFC)

The most important goal of the patch is to break large insertFastDiv function
into separate pieces, so that later a different fast insertion logic can be
implemented using some of these pieces.

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

llvm-svn: 296828

7 years agoForgot about local variable lookup.
Jim Ingham [Thu, 2 Mar 2017 22:04:05 +0000 (22:04 +0000)]
Forgot about local variable lookup.

Yay for coffee lines.

llvm-svn: 296826

7 years ago[DAGCombiner] Fix DebugLoc propagation when folding !(x cc y) -> (x !cc y)
Taewook Oh [Thu, 2 Mar 2017 21:58:35 +0000 (21:58 +0000)]
[DAGCombiner] Fix DebugLoc propagation when folding !(x cc y) -> (x !cc y)

Summary:
Currently, when 't1: i1 = setcc t2, t3, cc' followed by 't4: i1 = xor t1, Constant:i1<-1>' is folded into 't5: i1 = setcc t2, t3 !cc', SDLoc of newly created SDValue 't5' follows SDLoc of 't4', not 't1'. However, as the opcode of newly created SDValue is 'setcc', it make more sense to take DebugLoc from 't1' than 't4'. For the code below

```
extern int bar();
extern int baz();

int foo(int x, int y) {
  if (x != y)
    return bar();
  else
    return baz();
}
```

, following is the bitcode representation of 'foo' at the end of llvm-ir level optimization:

```
define i32 @foo(i32 %x, i32 %y) !dbg !4 {
entry:
  tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !9, metadata !11), !dbg !12
  tail call void @llvm.dbg.value(metadata i32 %y, i64 0, metadata !10, metadata !11), !dbg !13
  %cmp = icmp ne i32 %x, %y, !dbg !14
  br i1 %cmp, label %if.then, label %if.else, !dbg !16

if.then:                                          ; preds = %entry
  %call = tail call i32 (...) @bar() #3, !dbg !17
  br label %return, !dbg !18

if.else:                                          ; preds = %entry
  %call1 = tail call i32 (...) @baz() #3, !dbg !19
  br label %return, !dbg !20

return:                                           ; preds = %if.else, %if.then
  %retval.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ]
  ret i32 %retval.0, !dbg !21
}

!14 = !DILocation(line: 5, column: 9, scope: !15)
!16 = !DILocation(line: 5, column: 7, scope: !4)

```

As you can see, in 'entry' block, 'icmp' instruction and 'br' instruction have different debug locations. However, with current implementation, there's no distinction between debug locations of these two when they are lowered to asm instructions. This is because 'icmp' and 'br' become 'setcc' 'xor' and 'brcond' in SelectionDAG, where SDLoc of 'setcc' follows the debug location of 'icmp' but SDLOC of 'xor' and 'brcond' follows the debug location of 'br' instruction, and SDLoc of 'xor' overwrites SDLoc of 'setcc' when they are folded. This patch addresses this issue.

Reviewers: atrick, bogner, andreadb, craig.topper, aprantl

Reviewed By: andreadb

Subscribers: jlebar, mkuper, jholewinski, andreadb, llvm-commits

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

llvm-svn: 296825

7 years ago[DAG] early exit to improve readability and formatting of visitMemCmpCall(); NFCI
Sanjay Patel [Thu, 2 Mar 2017 21:56:43 +0000 (21:56 +0000)]
[DAG] early exit to improve readability and formatting of visitMemCmpCall(); NFCI

llvm-svn: 296824

7 years agoWork around GCC linking errors within libc++abi due to missing new/delete definitions
Eric Fiselier [Thu, 2 Mar 2017 21:55:17 +0000 (21:55 +0000)]
Work around GCC linking errors within libc++abi due to missing new/delete definitions

llvm-svn: 296823

7 years agoWork around GCC linking errors within libc++abi due to missing new/delete definitions
Eric Fiselier [Thu, 2 Mar 2017 21:55:03 +0000 (21:55 +0000)]
Work around GCC linking errors within libc++abi due to missing new/delete definitions

llvm-svn: 296822

7 years ago[Hexagon] Pick the right branch opcode depending on branch probabilities
Krzysztof Parzyszek [Thu, 2 Mar 2017 21:49:49 +0000 (21:49 +0000)]
[Hexagon] Pick the right branch opcode depending on branch probabilities

Specifically, pick the opcode with the correct branch prediction, i.e.
jump:t or jump:nt.

llvm-svn: 296821

7 years agoRevert "AMDGPU: Re-do update for branch-relaxation test"
Tobias Grosser [Thu, 2 Mar 2017 21:47:51 +0000 (21:47 +0000)]
Revert "AMDGPU: Re-do update for branch-relaxation test"

This commit also relied on r296812, which I just reverted. We should probably
apply it again, after the r296812 has been discussed and been reapplied in some
variant.

llvm-svn: 296820

7 years agoAdd a reference to the projects in the Get involved section.
Jim Ingham [Thu, 2 Mar 2017 21:45:39 +0000 (21:45 +0000)]
Add a reference to the projects in the Get involved section.

llvm-svn: 296819

7 years agoCodeGen: MachineBlockPlacement: Remove the unused outlining heuristic.
Kyle Butt [Thu, 2 Mar 2017 21:44:24 +0000 (21:44 +0000)]
CodeGen: MachineBlockPlacement: Remove the unused outlining heuristic.

Outlining optional branches isn't a good heuristic, and it's never been
on by default. Remove it to clean things up.

llvm-svn: 296818