platform/upstream/llvm.git
6 years ago[libFuzzer] trying to make sigusr tests more reliable
Kostya Serebryany [Fri, 10 Nov 2017 00:26:23 +0000 (00:26 +0000)]
[libFuzzer] trying to make sigusr tests more reliable

llvm-svn: 317852

6 years ago[libFuzzer] split a test into two
Kostya Serebryany [Fri, 10 Nov 2017 00:18:13 +0000 (00:18 +0000)]
[libFuzzer] split a test into two

llvm-svn: 317851

6 years ago[support] allocate exact size required for mapping in Support/Windws/Path.inc
Bob Haarman [Fri, 10 Nov 2017 00:17:31 +0000 (00:17 +0000)]
[support] allocate exact size required for mapping in Support/Windws/Path.inc

Summary:
zturner suggested that mapped_file_region::init() on Windows seems to
create mappings that are larger than they need to be: Offset+Size
instead of Size. Indeed, that appears to be the case. I confirmed that
tests pass with mappings of just Size bytes, and fail with Size-1
bytes, suggesting that Size is indeed the correct value.

Reviewers: amccarth, zturner

Reviewed By: zturner

Subscribers: hiraditya, llvm-commits

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

llvm-svn: 317850

6 years ago[analyzer] [NFC] Minor ExprEngineC refactoring
George Karpenkov [Thu, 9 Nov 2017 23:33:37 +0000 (23:33 +0000)]
[analyzer] [NFC] Minor ExprEngineC refactoring

Move a repeated block of code into a function.

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

llvm-svn: 317849

6 years ago[SimplifyCFG] Fix a test case.
Easwaran Raman [Thu, 9 Nov 2017 23:17:52 +0000 (23:17 +0000)]
[SimplifyCFG] Fix a test case.

This was first committed in r317845, but had the order of branch weights
wrong and didn't properly check the output.

llvm-svn: 317848

6 years ago[sanitizer] Remove unneeded "struct"
Vitaly Buka [Thu, 9 Nov 2017 23:06:59 +0000 (23:06 +0000)]
[sanitizer] Remove unneeded "struct"

llvm-svn: 317847

6 years ago[sanitizer] Fix signal interceptors build on Windows
Vitaly Buka [Thu, 9 Nov 2017 23:05:01 +0000 (23:05 +0000)]
[sanitizer] Fix signal interceptors build on Windows

llvm-svn: 317846

6 years agoAdd a wrapper function to set branch weights metadata.
Easwaran Raman [Thu, 9 Nov 2017 22:52:20 +0000 (22:52 +0000)]
Add a wrapper function to set branch weights metadata.

Summary:
This wrapper checks if there is at least one non-zero weight before
setting the metadata.

Reviewers: davidxl

Subscribers: llvm-commits

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

llvm-svn: 317845

6 years ago[msan] Extract signal_impl and sigaction_impl
Vitaly Buka [Thu, 9 Nov 2017 22:52:15 +0000 (22:52 +0000)]
[msan] Extract signal_impl and sigaction_impl

Summary: Preparation for using interceptor from sanitizer_common.

Reviewers: eugenis

Subscribers: llvm-commits

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

llvm-svn: 317844

6 years ago[sanitizer] Allow sanitizers to redefine implementation of signal interceptors
Vitaly Buka [Thu, 9 Nov 2017 22:48:54 +0000 (22:48 +0000)]
[sanitizer] Allow sanitizers to redefine implementation of signal interceptors

Reviewers: eugenis

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 317843

6 years ago[msan] Replace CommonSanitizerReportMutex with ScopedErrorReportLock
Vitaly Buka [Thu, 9 Nov 2017 22:48:45 +0000 (22:48 +0000)]
[msan] Replace CommonSanitizerReportMutex with ScopedErrorReportLock

llvm-svn: 317842

6 years ago[Reassociate] regenerate test checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 22:41:39 +0000 (22:41 +0000)]
[Reassociate] regenerate test checks; NFC

llvm-svn: 317841

6 years ago[libFuzzer] use pkill instead of killall in a test since the bots don't have killall
Kostya Serebryany [Thu, 9 Nov 2017 22:01:06 +0000 (22:01 +0000)]
[libFuzzer] use pkill instead of killall in a test since the bots don't have killall

llvm-svn: 317840

6 years ago[analyzer] do not crash when trying to convert an APSInt to an unexpected type
George Karpenkov [Thu, 9 Nov 2017 21:49:38 +0000 (21:49 +0000)]
[analyzer] do not crash when trying to convert an APSInt to an unexpected type

This is the issue breaking the postgresql bot, purely by chance exposed
through taint checker, somehow appearing after
https://reviews.llvm.org/D38358 got committed.

The backstory is that the taint checker requests SVal for the value of
the pointer, and analyzer has a "fast path" in the getter to return a
constant when we know that the value is constant.
Unfortunately, the getter requires a cast to get signedness correctly,
and for the pointer `void *` the cast crashes.

This is more of a band-aid patch, as I am not sure what could be done
here "correctly", but it should be applied in any case to avoid the
crash.

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

llvm-svn: 317839

6 years ago[clangd] Fix compilation database detection
Sam McCall [Thu, 9 Nov 2017 21:45:27 +0000 (21:45 +0000)]
[clangd] Fix compilation database detection

llvm-svn: 317838

6 years ago[libFuzzer] update links in the docs
Kostya Serebryany [Thu, 9 Nov 2017 21:35:28 +0000 (21:35 +0000)]
[libFuzzer] update links in the docs

llvm-svn: 317837

6 years ago[libFuzzer] update the docs, document how to resume the merge
Kostya Serebryany [Thu, 9 Nov 2017 21:32:02 +0000 (21:32 +0000)]
[libFuzzer] update the docs, document how to resume the merge

llvm-svn: 317836

6 years ago[libFuzzer] make sure to flush IO when done merging one file
Kostya Serebryany [Thu, 9 Nov 2017 21:30:33 +0000 (21:30 +0000)]
[libFuzzer] make sure to flush IO when done merging one file

llvm-svn: 317835

6 years ago[sanitizer] Revert rL317822
Kostya Kortchinsky [Thu, 9 Nov 2017 21:26:07 +0000 (21:26 +0000)]
[sanitizer] Revert rL317822

Summary:
This reverts D39490.

For toolchains generated with older NDKs (<=r13b as far as we tested),
`cpu_set_t` doesn't exist in `sched.h`.
We have to figure out another way to get the number of CPUs without this.

Reviewers: rnk

Reviewed By: rnk

Subscribers: kubamracek, llvm-commits, krytarowski

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

llvm-svn: 317834

6 years ago[index] tag declarations should use the decl role instead of ref
Alex Lorenz [Thu, 9 Nov 2017 20:50:59 +0000 (20:50 +0000)]
[index] tag declarations should use the decl role instead of ref

The 'decl' role is more canonical than the 'ref'. This helps us establish the
'specialization-of' relation just by looking at decls or defs.

rdar://31884960

llvm-svn: 317832

6 years ago[libFuzzer] Don't add leaking inputs to corpus.
Matt Morehouse [Thu, 9 Nov 2017 20:44:08 +0000 (20:44 +0000)]
[libFuzzer] Don't add leaking inputs to corpus.

Reviewers: kcc

Reviewed By: kcc

Subscribers: llvm-commits

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

llvm-svn: 317831

6 years agoAdd a Cross-compilation toolchain file for MSVC.
Zachary Turner [Thu, 9 Nov 2017 20:38:16 +0000 (20:38 +0000)]
Add a Cross-compilation toolchain file for MSVC.

With this patch, you can now cross-compile for Windows
on non-Windows hosts.

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

This allows cross-compiling for windows on other platforms.

llvm-svn: 317830

6 years ago[libFuzzer] handle SIGUSR1/SIGUSR2 and try to exit grafully on these signals
Kostya Serebryany [Thu, 9 Nov 2017 20:30:19 +0000 (20:30 +0000)]
[libFuzzer] handle SIGUSR1/SIGUSR2 and try to exit grafully on these signals

llvm-svn: 317829

6 years ago[python] [tests] Update priority values in code completion test
Michal Gorny [Thu, 9 Nov 2017 20:17:41 +0000 (20:17 +0000)]
[python] [tests] Update priority values in code completion test

The priority for destructors and operators was reduced in r314019.
Adjust the values used in the test appropriately to fix the test
failure.

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

llvm-svn: 317828

6 years agoFix out-of-order stepping behavior in programs with hoisted constants.
Paul Robinson [Thu, 9 Nov 2017 20:01:31 +0000 (20:01 +0000)]
Fix out-of-order stepping behavior in programs with hoisted constants.

When the Constant Hoisting pass moves expensive constants into a
common block, it would assign a debug location equal to the last use
of that constant. While this is certainly intuitive, it places the
constant in an out-of-order location, according to the debug location
information. This produces out-of-order stepping when debugging
programs affected by this pass.

This patch creates in-order stepping behavior by merging the debug
locations for hoisted constants, and the new insertion point.

Patch by Matthew Voss!

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

llvm-svn: 317827

6 years ago[utils] Fix RISC-V support in update_llc_test_checks.py
Alex Bradbury [Thu, 9 Nov 2017 20:01:25 +0000 (20:01 +0000)]
[utils] Fix RISC-V support in update_llc_test_checks.py

scrub_asm_riscv now takes two arguments rather than one.

llvm-svn: 317826

6 years agoPreserve debug info when DAG-combinging (zext (truncate x)) -> (and x, mask).
Adrian Prantl [Thu, 9 Nov 2017 19:50:20 +0000 (19:50 +0000)]
Preserve debug info when DAG-combinging (zext (truncate x)) -> (and x, mask).

rdar://problem/27139077

llvm-svn: 317825

6 years ago[Support] Make llvm::Error and Expected faster.
Zachary Turner [Thu, 9 Nov 2017 19:31:52 +0000 (19:31 +0000)]
[Support] Make llvm::Error and Expected faster.

Whenever LLVM_ENABLE_ABI_BREAKING_CHECKS is enabled, which
is usually the case for example when asserts are enabled,
Error's destructor does some additional checking to make sure
that that it does not represent an error condition and that it
was checked.

However, this is -- by definition -- not the likely codepath.
Some profiling shows that at least with some compilers, simply
calling assertIsChecked -- in a release build with full
optimizations -- can account for up to 15% of the entire
runtime of the program, even though this function should almost
literally be a no-op.

The problem is that the assertIsChecked function can be considered
too big to inline depending on the compiler's inliner.  Since it's
unlikely to ever need to failure path though, we can move it out
of line and force it to not be inlined, so that the fast path
can be inlined.

In my test (using lld to link clang with CMAKE_BUILD_TYPE=Release
and LLVM_ENABLE_ASSERTIONS=ON), this reduces link time from 27
seconds to 23.5 seconds, which is a solid 15% gain.

llvm-svn: 317824

6 years agoRevert new ThinLTO ASAN test until lit support added
Teresa Johnson [Thu, 9 Nov 2017 19:26:54 +0000 (19:26 +0000)]
Revert new ThinLTO ASAN test until lit support added

This reverts commit r317723 and r317728. Will be re-added when
support for LTO/ThinLTO added to test/asan/lit.cfg.

llvm-svn: 317823

6 years ago[scudo] Make getNumberOfCPUs Fuchsia compliant
Kostya Kortchinsky [Thu, 9 Nov 2017 19:18:55 +0000 (19:18 +0000)]
[scudo] Make getNumberOfCPUs Fuchsia compliant

Summary: This change allows Fuchsia to boot properly using the Scudo allocator.

Reviewers: cryptoad, alekseyshl, krytarowski

Reviewed By: cryptoad, krytarowski

Subscribers: rnk, krytarowski, kubamracek, llvm-commits

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

llvm-svn: 317822

6 years ago[SLP] Fix PR23510: Try to find best possible vectorizable stores.
Alexey Bataev [Thu, 9 Nov 2017 19:07:16 +0000 (19:07 +0000)]
[SLP] Fix PR23510: Try to find best possible vectorizable stores.

Summary:
The analysis of the store sequence goes in straight order - from the
first store to the last. Bu the best opportunity for vectorization will
happen if we're going to use reverse order - from last store to the
first. It may be best because usually users have some initialization
part + further processing and this first initialization may confuse
SLP vectorizer.

Reviewers: RKSimon, hfinkel, mkuper, spatel

Subscribers: llvm-commits

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

llvm-svn: 317821

6 years ago[analyzer] assume bitwise arithmetic axioms
George Karpenkov [Thu, 9 Nov 2017 19:06:22 +0000 (19:06 +0000)]
[analyzer] assume bitwise arithmetic axioms

Patches the solver to assume that bitwise OR of an unsigned value with a
constant always produces a value larger-or-equal than the constant, and
bitwise AND with a constant always produces a value less-or-equal than
the constant.

This patch is especially useful in the context of using bitwise
arithmetic for error code encoding: the analyzer would be able to state
that the error code produced using a bitwise OR is non-zero.

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

llvm-svn: 317820

6 years ago[Reassociate] auto-generate test checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 18:26:49 +0000 (18:26 +0000)]
[Reassociate] auto-generate test checks; NFC

llvm-svn: 317819

6 years ago[Reassociate] don't name values "tmp"; NFCI
Sanjay Patel [Thu, 9 Nov 2017 18:14:24 +0000 (18:14 +0000)]
[Reassociate] don't name values "tmp"; NFCI

The toxic stew of created values named 'tmp' and tests that already have
values named 'tmp' and CHECK lines looking for values named 'tmp' causes
bad things to happen in our test line auto-generation scripts because it
wants to use 'TMP' as a prefix for unnamed values. Use less 'tmp' to
avoid that.

llvm-svn: 317818

6 years ago[GlobalMerge] Stable sort GlobalSets to fix non-deterministic sort order
Mandeep Singh Grang [Thu, 9 Nov 2017 18:05:17 +0000 (18:05 +0000)]
[GlobalMerge] Stable sort GlobalSets to fix non-deterministic sort order

Summary: This fixes failure in CodeGen/AArch64/global-merge-group-by-use.ll uncovered by D39245.

Reviewers: ab, asl

Reviewed By: ab

Subscribers: aemerson, llvm-commits, kristof.beyls

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

llvm-svn: 317817

6 years agoAdd _LIBCPP_INLINE_VISIBILITY to __compressed_pair_elem members
Alex Lorenz [Thu, 9 Nov 2017 17:54:49 +0000 (17:54 +0000)]
Add _LIBCPP_INLINE_VISIBILITY to __compressed_pair_elem members

The commit r300140 changed the implementation of compressed_pair, but didn't add
_LIBCPP_INLINE_VISIBILITY to the constructors and get members of the
compressed_pair_elem class. This patch adds the visibility annotation.

I didn't find a way to test this change with libc++ regression tests.

rdar://35352579

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

llvm-svn: 317816

6 years agorevert r317812 [BasicAA] fix build break by converting the previously introduced...
Nuno Lopes [Thu, 9 Nov 2017 17:35:36 +0000 (17:35 +0000)]
revert r317812 [BasicAA] fix build break by converting the previously introduced assert into an if stmt

The code has a bug, but some tests regress.
I'll discuss this further on the mailing list.

llvm-svn: 317815

6 years ago[Builtins] Do not use tailcall for Thumb1
Weiming Zhao [Thu, 9 Nov 2017 17:32:57 +0000 (17:32 +0000)]
[Builtins] Do not use tailcall for Thumb1

Summary:
The `b` instruction in Thumb1 has limited range, which may cause link-time errors if the jump target is far away.
This patch guards the tailcalls for non-Thumb1

Reviewers: peter.smith, compnerd, rengolin, eli.friedman

Reviewed By: rengolin

Subscribers: joerg, dalias, javed.absar, llvm-commits

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

llvm-svn: 317814

6 years ago[OPENMP] Codegen for `#pragma omp target parallel for simd`.
Alexey Bataev [Thu, 9 Nov 2017 17:32:15 +0000 (17:32 +0000)]
[OPENMP] Codegen for `#pragma omp target parallel for simd`.

Added codegen for `#pragma omp target parallel for simd` and clauses.

llvm-svn: 317813

6 years ago[BasicAA] fix build break by converting the previously introduced assert into an...
Nuno Lopes [Thu, 9 Nov 2017 17:06:42 +0000 (17:06 +0000)]
[BasicAA] fix build break by converting the previously introduced assert into an if stmt
Apparently V1Size == -1 doest imply V2Size == -1, which is a bit surprising to me.

llvm-svn: 317812

6 years ago[OPENMP] Treat '#pragma omp target parallel for simd' as simd directive.
Alexey Bataev [Thu, 9 Nov 2017 17:01:35 +0000 (17:01 +0000)]
[OPENMP] Treat '#pragma omp target parallel for simd' as simd directive.

`#pragma omp target parallel for simd` mistakenly was not treated as a
simd directive, fixed this problem.

llvm-svn: 317811

6 years agorevert r317809 - [Reassociate] regenerate test checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 16:46:04 +0000 (16:46 +0000)]
revert r317809 - [Reassociate] regenerate test checks; NFC

The reassociate pass generates named values such as "%tmp2" which trips up the script's regex's
because the script uses a 'TMP' prefix for unnamed values (%2).

llvm-svn: 317810

6 years ago[Reassociate] regenerate test checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 16:35:30 +0000 (16:35 +0000)]
[Reassociate] regenerate test checks; NFC

llvm-svn: 317809

6 years agoUpdate formatting to reflect change in clang-format. NFC.
Michael Kruse [Thu, 9 Nov 2017 16:33:29 +0000 (16:33 +0000)]
Update formatting to reflect change in clang-format. NFC.

clang-format has changed its algorithm
for sorting includes in r317794.

llvm-svn: 317808

6 years ago[SystemZ] Add support for the "o" inline asm constraint
Ulrich Weigand [Thu, 9 Nov 2017 16:31:57 +0000 (16:31 +0000)]
[SystemZ] Add support for the "o" inline asm constraint

We don't really need any special handling of "offsettable"
memory addresses, but since some existing code uses inline
asm statements with the "o" constraint, add support for this
constraint for compatibility purposes.

llvm-svn: 317807

6 years ago[Reassociate] regenerate test checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 16:30:19 +0000 (16:30 +0000)]
[Reassociate] regenerate test checks; NFC

llvm-svn: 317806

6 years ago[Reassociate] add check lines; NFC
Sanjay Patel [Thu, 9 Nov 2017 16:25:35 +0000 (16:25 +0000)]
[Reassociate] add check lines; NFC

llvm-svn: 317805

6 years ago[Reassociate] add tests with 'reassoc' FMF and regenerate checks; NFC
Sanjay Patel [Thu, 9 Nov 2017 16:23:32 +0000 (16:23 +0000)]
[Reassociate] add tests with 'reassoc' FMF and regenerate checks; NFC

llvm-svn: 317804

6 years ago[BasicAA] add assertion for corner case in aliasGEP()
Nuno Lopes [Thu, 9 Nov 2017 16:16:46 +0000 (16:16 +0000)]
[BasicAA] add assertion for corner case in aliasGEP()

llvm-svn: 317803

6 years ago[PowerPC][msan] Update msan to handle changed memory layouts in newer kernels
Bill Seurer [Thu, 9 Nov 2017 16:14:57 +0000 (16:14 +0000)]
[PowerPC][msan] Update msan to handle changed memory layouts in newer kernels

In more recent Linux kernels (including those with 47 bit VMAs) the layout of
virtual memory for powerpc64 changed causing the memory sanitizer to not
work properly.  This patch adjusts the memory ranges in the tables for the
memory sanitizer to work on the newer kernels while continuing to work on the
older ones as well.

Tested on several 4.x and 3.x kernel releases.

llvm-svn: 317802

6 years ago[mips] Correct microMIP's jump and add unconditional branch pseudo
Simon Dardis [Thu, 9 Nov 2017 16:02:18 +0000 (16:02 +0000)]
[mips] Correct microMIP's jump and add unconditional branch pseudo

Correct the definition of 'j' as being unavailable for microMIPS32R6 and
provide the 'b' assembly idiom for codegen purposes for microMIPS32r3.

Provide the necessary 'br' pattern for microMIPS32R6 as it now longer
incorrectly uses the 'j' instruction.

Reviewers: atanasyan

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

llvm-svn: 317801

6 years ago[VirtualFileSystem] InMemoryFileSystem::addFile(): Type and Perms
Ben Hamilton [Thu, 9 Nov 2017 16:01:16 +0000 (16:01 +0000)]
[VirtualFileSystem] InMemoryFileSystem::addFile(): Type and Perms

Summary:
This implements a FIXME in InMemoryFileSystem::addFile(), allowing
clients to specify User, Group, Type, and/or Perms when creating a
file in an in-memory filesystem.

New tests included. Ran tests with:

% ninja BasicTests && ./tools/clang/unittests/Basic/BasicTests

Fixes PR#35172 (https://bugs.llvm.org/show_bug.cgi?id=35172)

Reviewers: bkramer, hokein

Reviewed By: bkramer, hokein

Subscribers: alexfh

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

llvm-svn: 317800

6 years ago[clang-format] Keep Sphinx happy after r317794
Krasimir Georgiev [Thu, 9 Nov 2017 15:54:59 +0000 (15:54 +0000)]
[clang-format] Keep Sphinx happy after r317794

llvm-svn: 317799

6 years agoAdd const to some variables to avoid const_casts
Jonas Hahnfeld [Thu, 9 Nov 2017 15:52:29 +0000 (15:52 +0000)]
Add const to some variables to avoid const_casts

In these places the const attribute seems correct and doesn't
need any other change, so let's do it.

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

llvm-svn: 317798

6 years agoRemove const from variables with dynamic memory
Jonas Hahnfeld [Thu, 9 Nov 2017 15:52:25 +0000 (15:52 +0000)]
Remove const from variables with dynamic memory

Allocated memory is typically not 'const' if it needs to be freed.
This patch removes around 50 wrong const attributes, modifies the
corresponding functions and finally gets rid of some const_casts.
These have especially been strange for __kmp_str_fname_free() that
added a 'const' to call __kmp_str_free() which removed it again.

Two minor cleanups that I performed in this process:
 * __kmp_tool_libraries now lives in kmp_settings.cpp as it is
   used nowhere else.
 * __kmp_msg_empty was removed as it was never used and Clang
   now complained that it was assigned a string literal that
   is 'const char *'.

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

llvm-svn: 317797

6 years ago[RISCV] Re-generate test/CodeGen/RISCV/alu32.ll using update_llc_test_checks.py
Alex Bradbury [Thu, 9 Nov 2017 15:45:42 +0000 (15:45 +0000)]
[RISCV] Re-generate test/CodeGen/RISCV/alu32.ll using update_llc_test_checks.py

No real change, but makes it marginally easier to merge the remainder of the
out-of-tree patches.

llvm-svn: 317796

6 years agollgs-tests: Replace the "log+return false" pattern with llvm::Error
Pavel Labath [Thu, 9 Nov 2017 15:45:09 +0000 (15:45 +0000)]
llgs-tests: Replace the "log+return false" pattern with llvm::Error

Summary:
These tests used to log the error message and return plain bool mainly
because at the time they we written, we did not have a nice way to
assert on llvm::Error values. That is no longer true, so replace this
pattern with a more idiomatic approach.

As a part of this patch, I also move the formatting of
GDBRemoteCommunication::PacketResult values out of the test code, as
that can be useful elsewhere.

Reviewers: zturner, eugene

Subscribers: mgorny, lldb-commits

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

llvm-svn: 317795

6 years ago[clang-format] Sort using declarations by splitting on '::'
Krasimir Georgiev [Thu, 9 Nov 2017 15:41:23 +0000 (15:41 +0000)]
[clang-format] Sort using declarations by splitting on '::'

Summary: This patch improves using declarations sorting.

Reviewers: bkramer

Reviewed By: bkramer

Subscribers: cfe-commits, klimek

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

llvm-svn: 317794

6 years ago[clang-format] Apply a clang-tidy suggestion, NFC
Krasimir Georgiev [Thu, 9 Nov 2017 15:12:17 +0000 (15:12 +0000)]
[clang-format] Apply a clang-tidy suggestion, NFC

llvm-svn: 317793

6 years agoAdd a unit test for ClangASTContext template arguments handling
Pavel Labath [Thu, 9 Nov 2017 15:06:31 +0000 (15:06 +0000)]
Add a unit test for ClangASTContext template arguments handling

I am planning to make changes to this piece of code, so I wrote this
test to add more coverage to it first.

llvm-svn: 317792

6 years ago[RISCV] MC layer support for the standard RV32A instruction set extension
Alex Bradbury [Thu, 9 Nov 2017 15:00:03 +0000 (15:00 +0000)]
[RISCV] MC layer support for the standard RV32A instruction set extension

llvm-svn: 317791

6 years agoFix 'not all control paths return a value' warning on MSVC builds
Simon Pilgrim [Thu, 9 Nov 2017 14:56:17 +0000 (14:56 +0000)]
Fix 'not all control paths return a value' warning on MSVC builds

llvm-svn: 317790

6 years agoReapply: Allow yaml2obj to order implicit sections for ELF
Dave Lee [Thu, 9 Nov 2017 14:53:43 +0000 (14:53 +0000)]
Reapply: Allow yaml2obj to order implicit sections for ELF

Summary:
This change allows yaml input to control the order of implicitly added sections
(`.symtab`, `.strtab`, `.shstrtab`). The order is controlled by adding a
placeholder section of the given name to the Sections field.

This change is to support changes in D39582, where it is desirable to control
the location of the `.dynsym` section.

This reapplied version fixes:
  1. use of a function call within an assert
  2. failing lld test which has an unnamed section
  3. incorrect section count when given an unnamed section

Additionally, one more test to cover the unnamed section failure.

Reviewers: compnerd, jakehehrlich

Reviewed By: jakehehrlich

Subscribers: llvm-commits

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

llvm-svn: 317789

6 years ago[RISCV] MC layer support for the standard RV32M instruction set extension
Alex Bradbury [Thu, 9 Nov 2017 14:46:30 +0000 (14:46 +0000)]
[RISCV] MC layer support for the standard RV32M instruction set extension

llvm-svn: 317788

6 years ago[OMPT] Fix test cancel_parallel.c
Jonas Hahnfeld [Thu, 9 Nov 2017 14:26:14 +0000 (14:26 +0000)]
[OMPT] Fix test cancel_parallel.c

If a parallel region is cancelled, execution resumes at the end
of the structured block. That is why this test cannot use the
"normal" macros that print right after inserting the label.
Instead it previously printed the addresses before the pragma
and swapped the checks compared to the other tests.

However, this does not work because FileChecks '*' is greedy
so that RETURN_ADDRESS always matched the second address. This
makes the test fail when an "overflow" occurrs and the first
address matches the value of codeptr_ra.

I discovered this on my MacBook but I'm unable to reproduce the
failure with the current version. Nevertheless we should fix this
problem to avoid that this test fails later after an unrelated change.

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

llvm-svn: 317787

6 years ago[OMPT] Add support for testing return addresses on POWER
Jonas Hahnfeld [Thu, 9 Nov 2017 14:26:12 +0000 (14:26 +0000)]
[OMPT] Add support for testing return addresses on POWER

Return addresses are determined based on the address of a label
that is inserted directly after a pragma / API call. In some cases
the tests can assume a known number of instructions between the
addresses. However, the instructions and their encoded lengths
depend on the target that the test is compiled on.

Firstly, this patch refactors the macro print_current_address() to
allow such target dependent modifications and adds information for
the observed instructions on POWER. Secondly, it adapts the related
macro print_fuzzy_address() to reuse much of "hacky" code and fixes
the used formatting strings in the printf() call. Finally, it also
adds documentation about how these macros are intended to work.

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

llvm-svn: 317786

6 years agoSched model improving on btver2: JFPU01 resource, vtestp* for xmm.
Andrew V. Tischenko [Thu, 9 Nov 2017 14:19:59 +0000 (14:19 +0000)]
Sched model improving on btver2: JFPU01 resource, vtestp* for xmm.
Differential Revision: https://reviews.llvm.org/D39802

llvm-svn: 317785

6 years ago[clang-format] Fix a clang-tidy finding, NFC
Krasimir Georgiev [Thu, 9 Nov 2017 13:22:03 +0000 (13:22 +0000)]
[clang-format] Fix a clang-tidy finding, NFC

llvm-svn: 317784

6 years ago[clang-format] Fix argument name comment, NFC
Krasimir Georgiev [Thu, 9 Nov 2017 13:19:14 +0000 (13:19 +0000)]
[clang-format] Fix argument name comment, NFC

llvm-svn: 317783

6 years agoAdd -print-schedule scheduling comments to inline asm.
Andrew V. Tischenko [Thu, 9 Nov 2017 12:45:40 +0000 (12:45 +0000)]
Add -print-schedule scheduling comments to inline asm.
Differential Revision: https://reviews.llvm.org/D39728

llvm-svn: 317782

6 years ago[MIPS] Fix calculation of the R_MICROMIPS_LO16 / HI16 relocations
Simon Atanasyan [Thu, 9 Nov 2017 12:10:14 +0000 (12:10 +0000)]
[MIPS] Fix calculation of the R_MICROMIPS_LO16 / HI16 relocations

llvm-svn: 317781

6 years ago[clangd] Add rename support.
Haojian Wu [Thu, 9 Nov 2017 11:30:04 +0000 (11:30 +0000)]
[clangd] Add rename support.

Summary:
Make clangd handle "textDocument/rename" request. The rename
functionality comes from the "local-rename" sub-tool of clang-refactor.

Currently clangd only supports local rename (only symbol occurrences in
the main file will be renamed).

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

Subscribers: cfe-commits, ioeric, arphaman, mgorny

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

llvm-svn: 317780

6 years agoSimplify NativeProcessProtocol::GetArchitecture/GetByteOrder
Pavel Labath [Thu, 9 Nov 2017 10:43:16 +0000 (10:43 +0000)]
Simplify NativeProcessProtocol::GetArchitecture/GetByteOrder

Summary:
These functions used to return bool to signify whether they were able to
retrieve the data. This is redundant because the ArchSpec and ByteOrder
already have their own "invalid" states, *and* because both of the
current implementations (linux, netbsd) can always provide a valid
result.

This allows us to simplify bits of the code handling these values.

Reviewers: eugene, krytarowski

Subscribers: javed.absar, lldb-commits

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

llvm-svn: 317779

6 years ago[MIPS] Setup less-significant bit in a symbol value in microMIPS thunks
Simon Atanasyan [Thu, 9 Nov 2017 10:42:22 +0000 (10:42 +0000)]
[MIPS] Setup less-significant bit in a symbol value in microMIPS thunks

The less-significant bit signals about microMIPS code for jump/branch instructions.

llvm-svn: 317778

6 years ago[Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.
Sam McCall [Thu, 9 Nov 2017 10:37:39 +0000 (10:37 +0000)]
[Tooling] Use FixedCompilationDatabase when `compile_flags.txt` is found.

Summary:
This is an alternative to JSONCompilationDatabase for simple projects that
don't use a build system such as CMake.
(You can also drop one in ~, to make your tools use e.g. C++11 by default)

There's no facility for varying flags per-source-file or per-machine.
Possibly this could be accommodated backwards-compatibly using cpp, but even if
not the simplicity seems worthwhile for the cases that are addressed.

Tested with clangd, works great! (requires clangd restart)

Reviewers: klimek

Subscribers: ilya-biryukov, cfe-commits

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

llvm-svn: 317777

6 years agoFix a bug with the use of __builtin_bzero in a conditional expression.
John McCall [Thu, 9 Nov 2017 09:32:32 +0000 (09:32 +0000)]
Fix a bug with the use of __builtin_bzero in a conditional expression.

Patch by Bharathi Seshadri!

llvm-svn: 317776

6 years ago[X86] Give priority to EVEX FMA instructions over FMA4 instructions.
Craig Topper [Thu, 9 Nov 2017 08:26:26 +0000 (08:26 +0000)]
[X86] Give priority to EVEX FMA instructions over FMA4 instructions.

No existing processor has both so it doesn't really matter what we do here. But we were previously just relying on pattern order which gave FMA4 priority.

llvm-svn: 317775

6 years ago[sanitizers] Rename GetStackTraceWithPcBpAndContext
Vitaly Buka [Thu, 9 Nov 2017 07:53:06 +0000 (07:53 +0000)]
[sanitizers] Rename GetStackTraceWithPcBpAndContext

Name does not need to enumerate arguments.

llvm-svn: 317774

6 years ago[msan] Add context argument into GetStackTrace
Vitaly Buka [Thu, 9 Nov 2017 07:48:53 +0000 (07:48 +0000)]
[msan] Add context argument into GetStackTrace

llvm-svn: 317773

6 years ago[lsan] Add "static" to internal function
Vitaly Buka [Thu, 9 Nov 2017 07:46:30 +0000 (07:46 +0000)]
[lsan] Add "static" to internal function

llvm-svn: 317772

6 years agoFix "default label in switch which covers all enumeration values" warning
Vitaly Buka [Thu, 9 Nov 2017 07:46:13 +0000 (07:46 +0000)]
Fix "default label in switch which covers all enumeration values" warning

llvm-svn: 317771

6 years ago[SectionMemoryManager] Abstract out mmap, munmap, mprotect even more ; NFC
Sanjoy Das [Thu, 9 Nov 2017 06:31:33 +0000 (06:31 +0000)]
[SectionMemoryManager] Abstract out mmap, munmap, mprotect even more ; NFC

Summary:
This will let ORC JIT clients plug in custom logic for the mmap, munmap and
mprotect paths.

Reviewers: loladiro, dblaikie

Subscribers: mcrosier, llvm-commits

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

llvm-svn: 317770

6 years ago[X86] Make X86ISD::FMADDS3 isel patterns commutable.
Craig Topper [Thu, 9 Nov 2017 06:17:05 +0000 (06:17 +0000)]
[X86] Make X86ISD::FMADDS3 isel patterns commutable.

This was missed when FMADDS3 was split from X86ISD::FMADDS3_RND.

llvm-svn: 317769

6 years ago[GVN PRE] Patch the source for Phi node in PRE
Serguei Katkov [Thu, 9 Nov 2017 06:02:18 +0000 (06:02 +0000)]
[GVN PRE] Patch the source for Phi node in PRE

We must patch all existing incoming values of Phi node,
otherwise it is possible that we can see poison
where program does not expect to see it.

This is the similar what GVN does.

The added test test/Transforms/GVN/PRE/pre-jt-add.ll shows an
example of wrong optimization done by jump threading due to
GVN PRE did not patch existing incoming value.

Reviewers: mkazantsev, wmi, dberlin, davide
Reviewed By: dberlin
Subscribers: efriedma, llvm-commits
Differential Revision: https://reviews.llvm.org/D39637

llvm-svn: 317768

6 years ago[libFuzzer] allow merge to resume after being preempted
Kostya Serebryany [Thu, 9 Nov 2017 05:49:28 +0000 (05:49 +0000)]
[libFuzzer] allow merge to resume after being preempted

llvm-svn: 317767

6 years ago[X86] Rename the VEX scalar fma builtins to end with a '3' to match gcc
Craig Topper [Thu, 9 Nov 2017 04:10:46 +0000 (04:10 +0000)]
[X86] Rename the VEX scalar fma builtins to end with a '3' to match gcc

I think we need to use different builtins for the FMA4 instructions since those instructions zero the upper bits and FMA3 instructions pass the bits through.

So this moves the existing builtins to be the FMA3 versions. New versions will be added for FMA4.

llvm-svn: 317766

6 years ago[X86] Rename the VEX scalar fma builtins to end with a '3' to match gcc
Craig Topper [Thu, 9 Nov 2017 04:10:42 +0000 (04:10 +0000)]
[X86] Rename the VEX scalar fma builtins to end with a '3' to match gcc

I think we need to use different builtins for the FMA4 instructions since those instructions zero the upper bits and FMA3 instructions pass the bits through.

So this moves the existing builtins to be the FMA3 versions. New versions will be added for FMA4.

llvm-svn: 317765

7 years ago[llvm-cov] Fix more -path-equivalence test bugs
Vedant Kumar [Thu, 9 Nov 2017 02:50:24 +0000 (02:50 +0000)]
[llvm-cov] Fix more -path-equivalence test bugs

llvm-svn: 317764

7 years ago[llvm-cov] Fix a -path-equivalence bug in a test
Vedant Kumar [Thu, 9 Nov 2017 02:42:34 +0000 (02:42 +0000)]
[llvm-cov] Fix a -path-equivalence bug in a test

llvm-svn: 317763

7 years ago[llvm-cov] Don't render empty region marker lines
Vedant Kumar [Thu, 9 Nov 2017 02:33:44 +0000 (02:33 +0000)]
[llvm-cov] Don't render empty region marker lines

This fixes an issue where llvm-cov prints an empty line, thinking it
needs to display region markers, when it actually doesn't.

llvm-svn: 317762

7 years ago[Coverage] Use the wrapped segment when a line has entry segments
Vedant Kumar [Thu, 9 Nov 2017 02:33:43 +0000 (02:33 +0000)]
[Coverage] Use the wrapped segment when a line has entry segments

We've worked around bugs in the frontend by ignoring the count from
wrapped segments when a line has at least one region entry segment.
Those frontend bugs are now fixed, so it's time to regenerate the
checked-in covmapping files and remove the workaround.

llvm-svn: 317761

7 years ago[Coverage] Emit deferred regions in headers
Vedant Kumar [Thu, 9 Nov 2017 02:33:40 +0000 (02:33 +0000)]
[Coverage] Emit deferred regions in headers

There are some limitations with emitting regions in macro expansions
because we don't gather file IDs within the expansions. Fix the check
that prevents us from emitting deferred regions in expansions to make an
exception for headers, which is something we can handle.

rdar://35373009

llvm-svn: 317760

7 years ago[Coverage] Complete top-level deferred regions before labels
Vedant Kumar [Thu, 9 Nov 2017 02:33:39 +0000 (02:33 +0000)]
[Coverage] Complete top-level deferred regions before labels

The area immediately after a terminated region in the function top-level
should have the same count as the label it precedes.

This solves another problem with wrapped segments. Consider:

  1| a:
  2|   return 0;
  3| b:
  4|   return 1;

Without a gap area starting after the first return, the wrapped segment
from line 2 would make it look like line 3 is executed, when it's not.

rdar://35373009

llvm-svn: 317759

7 years ago[Coverage] Emit a gap area after if conditions
Vedant Kumar [Thu, 9 Nov 2017 02:33:38 +0000 (02:33 +0000)]
[Coverage] Emit a gap area after if conditions

The area immediately after the closing right-paren of an if condition
should have a count equal to the 'then' block's count. Use a gap region
to set this count, so that region highlighting for the 'then' block
remains precise.

This solves a problem we have with wrapped segments. Consider:

  1| if (false)
  2|   foo();

Without a gap area starting after the condition, the wrapped segment
from line 1 would make it look like line 2 is executed, when it's not.

rdar://35373009

llvm-svn: 317758

7 years agoubsan: Allow programs to use setenv to configure ubsan_standalone.
Peter Collingbourne [Thu, 9 Nov 2017 02:22:07 +0000 (02:22 +0000)]
ubsan: Allow programs to use setenv to configure ubsan_standalone.

Previously ubsan_standalone used the GetEnv function to read the
environment variables UBSAN_OPTIONS and UBSAN_SYMBOLIZER_PATH. The
problem with GetEnv is that it does not respect changes to the
environment variables made using the libc setenv function, which
prevents clients from setting environment variables to configure
ubsan before loading ubsan-instrumented libraries.

The reason why we have GetEnv is that some runtimes need to read
environment variables while they initialize using .preinit_array,
and getenv does not work while .preinit_array functions are being
called. However, it is unnecessary for ubsan_standalone to initialize
that early. So this change switches ubsan_standalone to using getenv
and removes the .preinit_array entry. The static version of the runtime
still ends up being initialized using a C++ constructor that exists
to support the shared runtime.

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

llvm-svn: 317757

7 years ago[libFuzzer] mechanically simplify a test, NFC
Kostya Serebryany [Thu, 9 Nov 2017 02:13:43 +0000 (02:13 +0000)]
[libFuzzer] mechanically simplify a test, NFC

llvm-svn: 317756

7 years agoAMDGPU: Merge BUFFER_STORE_DWORD_OFFEN/OFFSET into x2, x4
Marek Olsak [Thu, 9 Nov 2017 01:52:55 +0000 (01:52 +0000)]
AMDGPU: Merge BUFFER_STORE_DWORD_OFFEN/OFFSET into x2, x4

Summary:
Only 56 shaders (out of 48486) are affected.

Totals from affected shaders (changed stats only):
SGPRS: 2420 -> 2460 (1.65 %)
Spilled VGPRs: 94 -> 112 (19.15 %)
Scratch size: 524 -> 528 (0.76 %) dwords per thread
Code Size: 187400 -> 184992 (-1.28 %) bytes

One DiRT Showdown shader spills 6 more VGPRs.
One Grid Autosport shader spills 12 more VGPRs.

The other 54 shaders only have a decrease in code size.
(I'm ignoring the SGPR noise)

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 317755

7 years agoAMDGPU: Lower buffer store and atomic intrinsics manually
Marek Olsak [Thu, 9 Nov 2017 01:52:48 +0000 (01:52 +0000)]
AMDGPU: Lower buffer store and atomic intrinsics manually

Summary:
Without this, SIMemoryLegalizer inserts s_waitcnt vmcnt(0) before every
buffer store and atomic instruction.

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 317754

7 years agoAMDGPU: Merge BUFFER_LOAD_DWORD_OFFSET into x2, x4
Marek Olsak [Thu, 9 Nov 2017 01:52:36 +0000 (01:52 +0000)]
AMDGPU: Merge BUFFER_LOAD_DWORD_OFFSET into x2, x4

Summary: Only 3 (out of 48486) shaders are affected.

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, t-tye, llvm-commits

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

llvm-svn: 317753

7 years agoAMDGPU: Merge BUFFER_LOAD_DWORD_OFFEN into x2, x4
Marek Olsak [Thu, 9 Nov 2017 01:52:30 +0000 (01:52 +0000)]
AMDGPU: Merge BUFFER_LOAD_DWORD_OFFEN into x2, x4

Summary:
-9.9% code size decrease in affected shaders.

Totals (changed stats only):
SGPRS: 2151462 -> 2170646 (0.89 %)
VGPRS: 1634612 -> 1640288 (0.35 %)
Spilled SGPRs: 8942 -> 8940 (-0.02 %)
Code Size: 52940672 -> 51727288 (-2.29 %) bytes
Max Waves: 373066 -> 371718 (-0.36 %)

Totals from affected shaders:
SGPRS: 283520 -> 302704 (6.77 %)
VGPRS: 227632 -> 233308 (2.49 %)
Spilled SGPRs: 3966 -> 3964 (-0.05 %)
Code Size: 12203080 -> 10989696 (-9.94 %) bytes
Max Waves: 44070 -> 42722 (-3.06 %)

Reviewers: arsenm, nhaehnle

Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 317752