platform/upstream/llvm.git
6 years ago[XRay][darwin] Initial XRay in Darwin Support
Dean Michael Berris [Fri, 10 Nov 2017 05:50:13 +0000 (05:50 +0000)]
[XRay][darwin] Initial XRay in Darwin Support

Summary:
This change implements the changes required in both clang and
compiler-rt to allow building XRay-instrumented binaries in Darwin. For
now we limit this to x86_64. We also start building the XRay runtime
library in compiler-rt for osx.

A caveat to this is that we don't have the tests set up and running
yet, which we'll do in a set of follow-on changes.

This patch uses the monorepo layout for the coordinated change across
multiple projects.

Reviewers: kubamracek

Subscribers: mgorny, cfe-commits, llvm-commits

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

llvm-svn: 317875

6 years ago[esan] Fix compilation of signal handlers
Vitaly Buka [Fri, 10 Nov 2017 05:41:13 +0000 (05:41 +0000)]
[esan] Fix compilation of signal handlers

llvm-svn: 317874

6 years ago[X86] Reduce the number of FMA builtins needed by the frontend by adding negates...
Craig Topper [Fri, 10 Nov 2017 05:20:32 +0000 (05:20 +0000)]
[X86] Reduce the number of FMA builtins needed by the frontend by adding negates to operands of the fmadd and fmaddsub builtins.

The backend should be able to combine the negates to create fmsub, fnmadd, and fnmsub. faddsub converting to fsubadd still needs work I think, but should be very doable.

This matches what we already do for the masked builtins.

This only covers the packed builtins. Scalar builtins will be done after FMA4 is fixed.

llvm-svn: 317873

6 years ago[tsan] Use __sanitizer_siginfo from sanitizer_common
Vitaly Buka [Fri, 10 Nov 2017 04:27:47 +0000 (04:27 +0000)]
[tsan] Use __sanitizer_siginfo from sanitizer_common

llvm-svn: 317872

6 years ago[sanitizer] Remove unused <signal.h> which conflicts with asan declarations
Vitaly Buka [Fri, 10 Nov 2017 04:12:35 +0000 (04:12 +0000)]
[sanitizer] Remove unused <signal.h> which conflicts with asan declarations

llvm-svn: 317871

6 years ago[sanitizer] Forward declaration of __sanitizer_sigaction without signal interceptors
Vitaly Buka [Fri, 10 Nov 2017 04:05:38 +0000 (04:05 +0000)]
[sanitizer] Forward declaration of __sanitizer_sigaction without signal interceptors

llvm-svn: 317870

6 years ago[sanitizer] Remove unneeded forward declaration of real_sigaction
Vitaly Buka [Fri, 10 Nov 2017 04:00:58 +0000 (04:00 +0000)]
[sanitizer] Remove unneeded forward declaration of real_sigaction

llvm-svn: 317869

6 years ago[sanitizer] Remove unneeded forward declarations
Vitaly Buka [Fri, 10 Nov 2017 03:35:26 +0000 (03:35 +0000)]
[sanitizer] Remove unneeded forward declarations

llvm-svn: 317868

6 years ago[sanitizer] Remove unused <signal.h> which conflicts with asan declarations
Vitaly Buka [Fri, 10 Nov 2017 03:18:53 +0000 (03:18 +0000)]
[sanitizer] Remove unused <signal.h> which conflicts with asan declarations

llvm-svn: 317867

6 years ago[sanitizer] Fix "cast from 'const void *' to 'sigaction *'" on Darwin
Vitaly Buka [Fri, 10 Nov 2017 03:13:42 +0000 (03:13 +0000)]
[sanitizer] Fix "cast from 'const void *' to 'sigaction *'" on Darwin

llvm-svn: 317866

6 years ago[sanitizer] Remove references and hide CommonSanitizerReportMutex
Vitaly Buka [Fri, 10 Nov 2017 02:07:11 +0000 (02:07 +0000)]
[sanitizer] Remove references and hide CommonSanitizerReportMutex

llvm-svn: 317865

6 years ago[msan] Deadly signal handler for msan
Vitaly Buka [Fri, 10 Nov 2017 02:06:59 +0000 (02:06 +0000)]
[msan] Deadly signal handler for msan

Summary: Part of https://github.com/google/sanitizers/issues/637

Reviewers: eugenis, alekseyshl

Subscribers: llvm-commits, kubamracek

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

llvm-svn: 317864

6 years ago[msan] Move sigaction_impl and signal_impl
Vitaly Buka [Fri, 10 Nov 2017 02:06:50 +0000 (02:06 +0000)]
[msan] Move sigaction_impl and signal_impl

llvm-svn: 317863

6 years ago[AMDGPU] Fix pointer info for lowering load/store for r600 for amdgiz environment
Yaxun Liu [Fri, 10 Nov 2017 02:03:28 +0000 (02:03 +0000)]
[AMDGPU] Fix pointer info for lowering load/store for r600 for amdgiz environment

r600 uses dummy pointer info for lowering load/store. Since dummy pointer info
assumes address space 0, this causes isel failure when temporary load/store SDNodes
are generated for amdgiz environment.

Since the offest is not constant, FixedStack pseudo source value cannot be used
to create the pointer info. This patch creates pointer info using llvm undef value.
At least this provides correct address space so that isel can be done correctly.

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

llvm-svn: 317862

6 years ago[AMDGPU] Fix pointer info for pseudo source for r600
Yaxun Liu [Fri, 10 Nov 2017 01:53:24 +0000 (01:53 +0000)]
[AMDGPU] Fix pointer info for pseudo source for r600

The pointer info for pseudo source for r600 is not correct when
alloca addr space is not 0, which causes invalid SDNode for r600---amdgiz.

This patch fixes that.

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

llvm-svn: 317861

6 years ago[Driver] Make clang/cc conforms to UNIX standard
Steven Wu [Fri, 10 Nov 2017 01:32:47 +0000 (01:32 +0000)]
[Driver] Make clang/cc conforms to UNIX standard

Summary:
This is basically reverting r261774 with a tweak for clang-cl. UNIX
standard states:
When c99 encounters a compilation error that causes an object file not
to be created, it shall write a diagnostic to standard error and
continue to compile other source code operands, but it shall not perform
the link phase and it shall return a non-zero exit status

The same goes for c89 or cc. And they are all alias or shims pointing to
clang on Darwin.

The original commit was intended for CUDA so the error message doesn't
get emit twice for both host and device. It seems that the clang driver
has been changed to model the CUDA dependency differently. Now the
driver behaves the same without this commit.

rdar://problem/32223263

Reviewers: thakis, dexonsmith, tra

Reviewed By: tra

Subscribers: jlebar, cfe-commits

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

llvm-svn: 317860

6 years ago[AMDGPU] Update code object description
Tony Tye [Fri, 10 Nov 2017 01:00:54 +0000 (01:00 +0000)]
[AMDGPU] Update code object description

 - Use ELF header flags to identify processor.
 - Remove isa note record.
 - Add target feature section.
 - Make metadata for NumVGPRs, NumSGPRs and MaxFlatWorkGroupSize required.
 - Add FixedWorkGroupSize to CodeProps metadata.
 - Add ReqdWorkGroupSize* to kernel descriptor and move MaxFlatWorkGroupSize to be adjacent.
 - Move IsXNACKEnabled in the kernel descriptor to be at the end of the unused flags.
 - Remove IsDynamicCallStack from the metadata and kernel descriptor.
 - Remove legacy debugger metadata.
 - Remove old XNACK enabled processor names.

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

llvm-svn: 317855

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 10 Nov 2017 00:59:22 +0000 (00:59 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 317854

6 years ago[ThinLTO] Fix missing call graph edges for calls with bitcasts.
Volodymyr Sapsai [Fri, 10 Nov 2017 00:47:47 +0000 (00:47 +0000)]
[ThinLTO] Fix missing call graph edges for calls with bitcasts.

This change doesn't fix the root cause of the miscompile PR34966 as the root
cause is in the linker ld64. This change makes call graph more complete
allowing to have better module imports/exports.

rdar://problem/35344706

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: mehdi_amini, inglorion, eraman, llvm-commits, hiraditya

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

llvm-svn: 317853

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