platform/upstream/llvm.git
6 years ago[AArch64] Add support for UDF instruction
Diogo N. Sampaio [Tue, 30 Oct 2018 11:06:50 +0000 (11:06 +0000)]
[AArch64] Add support for UDF instruction

Summary: Add support for AArch64 UDF instruction.
UDF - Permanently Undefined generates an Undefined
Instruction exception (ESR_ELx.EC = 0b000000).

Reviewers: DavidSpickett, javed.absar, t.p.northover

Reviewed By: javed.absar

Subscribers: nhaehnle, kristof.beyls

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

llvm-svn: 345581

6 years agoUpdate generate_netbsd_syscalls.awk for NetBSD 8.99.25
Kamil Rytarowski [Tue, 30 Oct 2018 11:03:37 +0000 (11:03 +0000)]
Update generate_netbsd_syscalls.awk for NetBSD 8.99.25

Register new syscall getsockopt2.
Drop removed syscalls pmc_get_info and pmc_control.

While there address compiler warnings about potentially
unused variables.

llvm-svn: 345580

6 years ago[ELF][PPC64]Workaround bogus Visual Studio build warning
James Henderson [Tue, 30 Oct 2018 10:55:14 +0000 (10:55 +0000)]
[ELF][PPC64]Workaround bogus Visual Studio build warning

Visual Studio has a bug where it converts the integer literal 2147483648
into an unsigned int instead of a long long (i.e. it follows C89 rules).
The bug has been reported as:
https://developercommunity.visualstudio.com/content/problem/141813/-2147483648-c4146-error.html.

Because of this bug, we were getting a signed/unsigned comparison
warning in VS2015 from the old code (the subsequent unary negation had
no effect on the type).

Reviewed by: sfertile

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

llvm-svn: 345579

6 years ago[SelectionDAG] Add FoldBUILD_VECTOR to simplify new BUILD_VECTOR nodes
Simon Pilgrim [Tue, 30 Oct 2018 10:32:11 +0000 (10:32 +0000)]
[SelectionDAG] Add FoldBUILD_VECTOR to simplify new BUILD_VECTOR nodes

Similar to FoldCONCAT_VECTORS, this patch adds FoldBUILD_VECTOR to simplify cases that can avoid the creation of the BUILD_VECTOR - if all the operands are UNDEF or if the BUILD_VECTOR simplifies to a copy.

This exposed an assumption in some AMDGPU code that getBuildVector was guaranteed to be a BUILD_VECTOR node that I've tried to handle.

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

llvm-svn: 345578

6 years ago[x86] Fix issues with a realigned stack in MSVC compiled applications
Aleksandr Urakov [Tue, 30 Oct 2018 10:07:08 +0000 (10:07 +0000)]
[x86] Fix issues with a realigned stack in MSVC compiled applications

Summary:
This patch fixes issues with a stack realignment.

MSVC maintains two frame pointers (`ebx` and `ebp`) for a realigned stack - one
is used for access to function parameters, while another is used for access to
locals. To support this the patch:
- adds an alternative frame pointer (`ebx`);
- considers stack realignment instructions (e.g. `and esp, -32`);
- along with CFA (Canonical Frame Address) which point to the position next to
  the saved return address (or to the first parameter on the stack) introduces
  AFA (Aligned Frame Address) which points to the position of the stack pointer
  right after realignment. AFA is used for access to registers saved after the
  realignment (see the test);

Here is an example of the code with the realignment:
```
struct __declspec(align(256)) OverAligned {
  char c;
};

void foo(int foo_arg) {
  OverAligned oa_foo = { 1 };
  auto aaa_foo = 1234;
}

void bar(int bar_arg) {
  OverAligned oa_bar = { 2 };
  auto aaa_bar = 5678;
  foo(1111);
}

int main() {
  bar(2222);
  return 0;
}
```
and here is the `bar` disassembly:
```
push    ebx
mov     ebx, esp
sub     esp, 8
and     esp, -100h
add     esp, 4
push    ebp
mov     ebp, [ebx+4]
mov     [esp+4], ebp
mov     ebp, esp
sub     esp, 200h
mov     byte ptr [ebp-200h], 2
mov     dword ptr [ebp-4], 5678
push    1111            ; foo_arg
call    j_?foo@@YAXH@Z  ; foo(int)
add     esp, 4
mov     esp, ebp
pop     ebp
mov     esp, ebx
pop     ebx
retn
```

Reviewers: labath, zturner, jasonmolenda, stella.stamenova

Reviewed By: jasonmolenda

Subscribers: abidh, lldb-commits

Tags: #lldb

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

llvm-svn: 345577

6 years agoRemove trailing space from clang/Basic/LangOptions.h
Takuto Ikuta [Tue, 30 Oct 2018 09:42:49 +0000 (09:42 +0000)]
Remove trailing space from clang/Basic/LangOptions.h

llvm-svn: 345576

6 years ago[DAGCombiner] Improve X div/rem Y fold if single bit element type
David Bolvansky [Tue, 30 Oct 2018 09:07:22 +0000 (09:07 +0000)]
[DAGCombiner] Improve X div/rem Y fold if single bit element type

Summary: Tests by @spatel, thanks

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: sdardis, atanasyan, llvm-commits, spatel

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

llvm-svn: 345575

6 years agoHandle pthread_sigmask in DemangleFunctionName()
Kamil Rytarowski [Tue, 30 Oct 2018 08:51:34 +0000 (08:51 +0000)]
Handle pthread_sigmask in DemangleFunctionName()

Translate __libc_thr_sigsetmask to pthread_sigmask on NetBSD.

llvm-svn: 345574

6 years ago[OPENMP] Fix for "error: unused variable 'CED'"
Bjorn Pettersson [Tue, 30 Oct 2018 08:49:26 +0000 (08:49 +0000)]
[OPENMP] Fix for "error: unused variable 'CED'"

Quick fix to make code compile with -Werror,-Wunused-variable.

llvm-svn: 345573

6 years agoDrop now hidden ioctl(2) operations for NetBSD
Kamil Rytarowski [Tue, 30 Oct 2018 08:32:47 +0000 (08:32 +0000)]
Drop now hidden ioctl(2) operations for NetBSD

POWER_IOC_GET_TYPE_WITH_LOSSAGE is no longer accessible from userland.

llvm-svn: 345572

6 years agoHandle NetBSD symbol mangling for tzset
Kamil Rytarowski [Tue, 30 Oct 2018 08:16:14 +0000 (08:16 +0000)]
Handle NetBSD symbol mangling for tzset

Native code generated on NetBSD mangles tzet to __tzset50.

Handle this accordingly in MSan.

llvm-svn: 345571

6 years agoHandle NetBSD symbol mangling for nanosleep and vfork
Kamil Rytarowski [Tue, 30 Oct 2018 08:06:42 +0000 (08:06 +0000)]
Handle NetBSD symbol mangling for nanosleep and vfork

Summary:
Native code generated on NetBSD mangles:

 - vfork into __vfork14
 - nanosleep into __nanosleep50

Handle this accordingly in TSan.

Reviewers: vitalybuka, dvyukov, joerg

Reviewed By: vitalybuka

Subscribers: kubamracek, llvm-commits, #sanitizers, mgorny

Tags: #sanitizers

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

llvm-svn: 345570

6 years agoUtility: fix cross-compilation from Linux to Windows
Saleem Abdulrasool [Tue, 30 Oct 2018 06:29:28 +0000 (06:29 +0000)]
Utility: fix cross-compilation from Linux to Windows

Only attempt to link against Backtrace if it is found.  Without this,
trying to cross-compile to Windows would try to link against
"Backtrace_LIBRARY-NOTFOUND.lib".

llvm-svn: 345569

6 years ago[XRay] Migrate FDR runtime to use refactored controller
Dean Michael Berris [Tue, 30 Oct 2018 04:35:48 +0000 (04:35 +0000)]
[XRay] Migrate FDR runtime to use refactored controller

Summary:
This change completes the refactoring of the FDR runtime to support the
following:

- Generational buffer management.

- Centralised and well-tested controller implementation.

In this change we've had to:

- Greatly simplify the code in xray_fdr_logging.cc to only implement the
  glue code for calling into the controller.

- Implement the custom and typed event logging functions in the
  FDRLogWriter.

- Imbue the `XRAY_NEVER_INSTRUMENT` attribute onto all functions in the
  controller implementation.

Reviewers: mboerger, eizan, jfb

Subscribers: jfb, llvm-commits

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

llvm-svn: 345568

6 years ago[LegalizeTypes] Teach PromoteIntRes_BITCAST to better handle a bitcast with vector...
Craig Topper [Tue, 30 Oct 2018 03:27:15 +0000 (03:27 +0000)]
[LegalizeTypes] Teach PromoteIntRes_BITCAST to better handle a bitcast with vector output type and a vector input type that needs to be widened

Summary: Previously if we had a bitcast vector output type that needs promotion and a vector input type that needs widening we would just do a stack store and load to handle the conversion. We can do a little better if we can widen the bitcast to a legal vector type the same size as the widened input type. Then we can do the bitcast between this widened type and the widened input type. Afterwards we can extract_subvector back to the original output and any_extend that. Type legalization will then circle back and handle promotion of the extract_subvector and the any_extend will just be removed. This will avoid going through the stack and allows us to remove a custom version of this legalization from X86.

Reviewers: efriedma, RKSimon

Reviewed By: efriedma

Subscribers: javed.absar, llvm-commits

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

llvm-svn: 345567

6 years ago[AArch64] Add test case for D53229. NFC
Craig Topper [Tue, 30 Oct 2018 03:27:13 +0000 (03:27 +0000)]
[AArch64] Add test case for D53229. NFC

llvm-svn: 345566

6 years ago[X86] Cleanup the code in LowerFABSorFNEG and LowerFCOPYSIGN a little. NFC
Craig Topper [Tue, 30 Oct 2018 03:27:12 +0000 (03:27 +0000)]
[X86] Cleanup the code in LowerFABSorFNEG and LowerFCOPYSIGN a little. NFC

Use SelectionDAG::EVTToAPFloatSemantics. Make the LogicVT calculation in LowerFABSorFNEG similar to LowerFCOPYSIGN. Use APInt::getSignedMaxValue instead of ~APInt::getSignMask.

llvm-svn: 345565

6 years ago[X86] Stop changing f128 fand/for/fxor to v2i64.
Craig Topper [Tue, 30 Oct 2018 03:27:11 +0000 (03:27 +0000)]
[X86] Stop changing f128 fand/for/fxor to v2i64.

The additional patterns don't cost us much and it seems better than changing element widths.

llvm-svn: 345564

6 years ago[lldb-mi] Implement -gdb-set breakpoint pending on/off
Marc-Andre Laperle [Tue, 30 Oct 2018 03:10:41 +0000 (03:10 +0000)]
[lldb-mi] Implement -gdb-set breakpoint pending on/off

Summary:
This allows creating pending breakpoint automatically when a location is not found.
This is used by some front-ends instead of doing "-break-insert -f" every time.

See also https://sourceware.org/gdb/onlinedocs/gdb/Set-Breaks.html

Signed-off-by: Marc-Andre Laperle <malaperle@gmail.com>
Subscribers: MaskRay, llvm-commits, lldb-commits, ki.stfu

Tags: #lldb

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

llvm-svn: 345563

6 years agoPR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
Richard Smith [Tue, 30 Oct 2018 02:02:49 +0000 (02:02 +0000)]
PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.

We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.

llvm-svn: 345562

6 years agoUnify definition of _LIBCPP_BEGIN/END_NAMESPACE_STD
Eric Fiselier [Tue, 30 Oct 2018 02:02:00 +0000 (02:02 +0000)]
Unify definition of _LIBCPP_BEGIN/END_NAMESPACE_STD

llvm-svn: 345561

6 years agoAMDGPU: Remove custom BUILD_VECTOR combine
Matt Arsenault [Tue, 30 Oct 2018 01:37:59 +0000 (01:37 +0000)]
AMDGPU: Remove custom BUILD_VECTOR combine

This was looping in a testcase and removing it
now slightly improves a test.

llvm-svn: 345560

6 years agoAMDGPU: Use scavengeRegisterBackwards
Matt Arsenault [Tue, 30 Oct 2018 01:33:14 +0000 (01:33 +0000)]
AMDGPU: Use scavengeRegisterBackwards

llvm-svn: 345559

6 years ago[analyzer] Allow padding checker to traverse simple class hierarchies
Alexander Shaposhnikov [Tue, 30 Oct 2018 01:20:37 +0000 (01:20 +0000)]
[analyzer] Allow padding checker to traverse simple class hierarchies

The existing padding checker skips classes that have any base classes.
This patch allows the checker to traverse very simple cases:
classes that have no fields and have exactly one base class.
This is important mostly in the case of array declarations.

Patch by Max Bernstein!

Test plan: make check-all

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

llvm-svn: 345558

6 years ago[ubsan-minimal] update comments in CMakeLists.txt
Vitaly Buka [Tue, 30 Oct 2018 01:20:12 +0000 (01:20 +0000)]
[ubsan-minimal] update comments in CMakeLists.txt

Summary:
Prepend minimal when UBsan is mentioned and delete a dead comment

Patch by Igor Sugak

Reviewers: eugenis, pcc

Reviewed By: eugenis

Subscribers: mgorny, llvm-commits, #sanitizers

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

llvm-svn: 345557

6 years ago[sanitizer] Move interceptor initialization check into real_clock_gettime
Vitaly Buka [Tue, 30 Oct 2018 01:20:01 +0000 (01:20 +0000)]
[sanitizer] Move interceptor initialization check into real_clock_gettime

Reviewers: cryptoad, kubamracek

Subscribers: llvm-commits

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

llvm-svn: 345556

6 years agoRemove dead declaration
Matt Arsenault [Tue, 30 Oct 2018 01:12:12 +0000 (01:12 +0000)]
Remove dead declaration

llvm-svn: 345555

6 years agoFix typos in comment
Matt Arsenault [Tue, 30 Oct 2018 01:11:52 +0000 (01:11 +0000)]
Fix typos in comment

llvm-svn: 345554

6 years agoPass TRI to printReg
Matt Arsenault [Tue, 30 Oct 2018 01:11:31 +0000 (01:11 +0000)]
Pass TRI to printReg

llvm-svn: 345553

6 years ago[CMake][Fuchsia] Drop the LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
Petr Hosek [Mon, 29 Oct 2018 23:10:49 +0000 (23:10 +0000)]
[CMake][Fuchsia] Drop the LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT

Now that libc++ uses __exclude_from_explicit_instantiation__ attribute,
this is no longer needed.

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

llvm-svn: 345552

6 years ago[compiler-rt][builtins] Don't #include CoreFoundation in os_version_check.c
Erik Pilkington [Mon, 29 Oct 2018 23:01:26 +0000 (23:01 +0000)]
[compiler-rt][builtins] Don't #include CoreFoundation in os_version_check.c

This breaks some configurations, so just forward declare everything that we need.

rdar://35943793

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

llvm-svn: 345551

6 years ago[builtins] Fix -Wunused-local-typedef warning in compile time asserts
Reid Kleckner [Mon, 29 Oct 2018 22:48:14 +0000 (22:48 +0000)]
[builtins] Fix -Wunused-local-typedef warning in compile time asserts

Use the __attribute__ spellings when compiling with clang-cl so that
__attribute__((unused)) expands to something.

llvm-svn: 345550

6 years agoRemove unneeded friend declarations that clang-cl warns on
Reid Kleckner [Mon, 29 Oct 2018 22:38:13 +0000 (22:38 +0000)]
Remove unneeded friend declarations that clang-cl warns on

llvm-svn: 345549

6 years ago[AliasSetTracker] Cleanup addPointer interface. [NFCI]
Alina Sbirlea [Mon, 29 Oct 2018 22:25:59 +0000 (22:25 +0000)]
[AliasSetTracker] Cleanup addPointer interface. [NFCI]

Summary:
Attempting to simplify the addPointer interface.
Currently there's code decomposing a MemoryLocation into (Ptr, Size, AAMDNodes) only to recreate the MemoryLocation inside the call.

Reviewers: reames, mkazantsev

Subscribers: sanjoy, jlebar, llvm-commits

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

llvm-svn: 345548

6 years ago[CMake] When built with LLVM, not use `-Wl,-z,defs`
Petr Hosek [Mon, 29 Oct 2018 22:16:56 +0000 (22:16 +0000)]
[CMake] When built with LLVM, not use `-Wl,-z,defs`

This matches standalone build behavior. PR28681

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

Patch By: tabloid.adroit

llvm-svn: 345547

6 years ago[DWARF][NFC] Refactor range list extraction and dumping
Wolfgang Pieb [Mon, 29 Oct 2018 22:16:47 +0000 (22:16 +0000)]
[DWARF][NFC] Refactor range list extraction and dumping

The purpose of this patch is twofold:
- Fold pre-DWARF v5 functionality into v5 to eliminate the need for 2 different
  versions of range list handling. We get rid of DWARFDebugRangelist{.cpp,.h}.
- Templatize the handling of range list tables so that location list handling
  can take advantage of it as well. Location list and range list tables have the
  same basic layout.

A non-NFC version of this patch was previously submitted with r342218, but it caused
errors with some TSan tests. This patch has no functional changes. The difference to
the non-NFC patch is that there are no changes to rangelist dumping in this patch.

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

llvm-svn: 345546

6 years ago[ASTImporter] Reorder fields after structure import is finished
Aleksei Sidorin [Mon, 29 Oct 2018 21:46:18 +0000 (21:46 +0000)]
[ASTImporter] Reorder fields after structure import is finished

There are multiple reasons why field structures can be imported
in wrong order. The simplest is the ability of field initializers
and method bodies to refer fields not in order they are listed in.
Unfortunately, there is no clean solution for that currently
so I'm leaving a FIXME.

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

llvm-svn: 345545

6 years ago[llvm-objcopy] Move elf-specific code into subfolder
Alexander Shaposhnikov [Mon, 29 Oct 2018 21:22:58 +0000 (21:22 +0000)]
[llvm-objcopy] Move elf-specific code into subfolder

In this diff the elf-specific code is moved into the subfolder ELF
(and factored out from llvm-objcopy.cpp).

Test plan: make check-all

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

llvm-svn: 345544

6 years agoAdd parens to fix incorrect assert check.
Erich Keane [Mon, 29 Oct 2018 21:21:55 +0000 (21:21 +0000)]
Add parens to fix incorrect assert check.

&& has higher priority than ||, so this assert works really oddly. Add
parens to match the programmer's intent.

Change-Id: I3abe1361ee0694462190c5015779db664012f3d4
llvm-svn: 345543

6 years agoAMDGPU: Enable code object v3 by default
Konstantin Zhuravlyov [Mon, 29 Oct 2018 21:07:27 +0000 (21:07 +0000)]
AMDGPU: Enable code object v3 by default

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

llvm-svn: 345542

6 years ago[InstSimplify] add tests for abs/nabs+icmp folding; NFC
Sanjay Patel [Mon, 29 Oct 2018 21:05:41 +0000 (21:05 +0000)]
[InstSimplify] add tests for abs/nabs+icmp folding; NFC

llvm-svn: 345541

6 years ago[Driver] Include missing touch files for sanitized library paths
Petr Hosek [Mon, 29 Oct 2018 21:04:12 +0000 (21:04 +0000)]
[Driver] Include missing touch files for sanitized library paths

These were forgotten in r345537 causing test failures on Clang builders.

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

llvm-svn: 345540

6 years ago[LoopUnroll] NFC. Factor out runtime-loop.ll common test behavior.
Fedor Sergeev [Mon, 29 Oct 2018 20:38:23 +0000 (20:38 +0000)]
[LoopUnroll] NFC. Factor out runtime-loop.ll common test behavior.

Adding COMMON prefix to get common part handled there.
Needed to simplify test changes for D53440.

llvm-svn: 345538

6 years ago[Driver] Support sanitized libraries on Fuchsia
Petr Hosek [Mon, 29 Oct 2018 20:37:52 +0000 (20:37 +0000)]
[Driver] Support sanitized libraries on Fuchsia

When using sanitizers, add <resource_dir>/<target>/lib/<sanitizer>
to the list of library paths to support using sanitized version of
runtime libraries if available.

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

llvm-svn: 345537

6 years agoIn swiftcall, don't merge FP/vector types within a chunk.
John McCall [Mon, 29 Oct 2018 20:32:36 +0000 (20:32 +0000)]
In swiftcall, don't merge FP/vector types within a chunk.

llvm-svn: 345536

6 years ago[MachineOutliner] Inherit target features from parent function
Jessica Paquette [Mon, 29 Oct 2018 20:27:07 +0000 (20:27 +0000)]
[MachineOutliner] Inherit target features from parent function

If a function has target features, it may contain instructions that aren't
represented in the default set of instructions. If the outliner pulls out one
of these instructions, and the function doesn't have the right attributes
attached, we'll run into an LLVM error explaining that the target doesn't
support the necessary feature for the instruction.

This makes outlined functions inherit target features from their parents.

It also updates the machine-outliner.ll test to check that we're properly
inheriting target features.

llvm-svn: 345535

6 years ago[libc++abi] Provide __cxa_thread_atexit on Fuchsia
Petr Hosek [Mon, 29 Oct 2018 20:20:26 +0000 (20:20 +0000)]
[libc++abi] Provide __cxa_thread_atexit on Fuchsia

Fuchsia already supports this interface.

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

llvm-svn: 345534

6 years ago[OPENMP]Fix PR39372: Does not complain about loop bound variable not
Alexey Bataev [Mon, 29 Oct 2018 20:17:42 +0000 (20:17 +0000)]
[OPENMP]Fix PR39372: Does not complain about loop bound variable not
being shared.

According to the standard, the variables with unspecified data-sharing
attributes in presence of `default(none)` clause must be reported to
users. Compiler did not generate error reports for the variables used in
other OpenMP regions. Patch fixes this.

llvm-svn: 345533

6 years agoRelax fast register allocator related test cases; NFC
Matthias Braun [Mon, 29 Oct 2018 20:10:42 +0000 (20:10 +0000)]
Relax fast register allocator related test cases; NFC

- Relex hard coded registers and stack frame sizes
- Some test cleanups
- Change phi-dbg.ll to match on mir output after phi elimination instead
  of going through the whole codegen pipeline.

This is in preparation for https://reviews.llvm.org/D52010
I'm committing all the test changes upfront that work before and after
independently.

llvm-svn: 345532

6 years ago[analyzer][NFC] Refactor PlistDiagnostics to use a class instead of passing 9 paramet...
Kristof Umann [Mon, 29 Oct 2018 20:06:30 +0000 (20:06 +0000)]
[analyzer][NFC] Refactor PlistDiagnostics to use a class instead of passing 9 parameters around

This has been a long time coming. Note the usage of AnalyzerOptions: I'll need
it for D52742, and added it in rC343620. The main motivation for this was that
I'll need to add yet another parameter to every single function, and some
functions would reach their 10th parameter with that change.

llvm-svn: 345531

6 years agoAMDGPU: Switch some lld tests to v2
Konstantin Zhuravlyov [Mon, 29 Oct 2018 19:59:12 +0000 (19:59 +0000)]
AMDGPU: Switch some lld tests to v2

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

llvm-svn: 345530

6 years agoXFAIL test on OS X availability
Eric Fiselier [Mon, 29 Oct 2018 19:52:22 +0000 (19:52 +0000)]
XFAIL test on OS X availability

llvm-svn: 345529

6 years ago[X86] Set isMachineVerifierClean() back to false (PR27481)
Simon Pilgrim [Mon, 29 Oct 2018 19:51:52 +0000 (19:51 +0000)]
[X86] Set isMachineVerifierClean() back to false (PR27481)

Put back the isMachineVerifierClean() override removed at rL345513 to fix Windows ThinLTO tests

llvm-svn: 345528

6 years ago[OpenMP] Fix condition.
Gheorghe-Teodor Bercea [Mon, 29 Oct 2018 19:44:25 +0000 (19:44 +0000)]
[OpenMP] Fix condition.

Summary: Iteration variable must be strictly less than the number of iterations. This fixes a bug introduced by previous patch D53448.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

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

llvm-svn: 345527

6 years agoAdded Phab link for P0927
Marshall Clow [Mon, 29 Oct 2018 19:31:35 +0000 (19:31 +0000)]
Added Phab link for P0927

llvm-svn: 345526

6 years agoBug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned...
Eric Fiselier [Mon, 29 Oct 2018 19:25:02 +0000 (19:25 +0000)]
Bug 39129: Speeding up partition_point/lower_bound/upper_bound/ by using unsigned division by 2 when possible.

Patch by Denis Yaroshevskiy (denis.yaroshevskij@gmail.com)

The rational and measurements can be found in the bug description: https://bugs.llvm.org/show_bug.cgi?id=39129

Reviewed as https://reviews.llvm.org/D52697

llvm-svn: 345525

6 years ago[HotColdSplitting] Allow outlining single-block cold regions
Vedant Kumar [Mon, 29 Oct 2018 19:15:39 +0000 (19:15 +0000)]
[HotColdSplitting] Allow outlining single-block cold regions

It can be profitable to outline single-block cold regions because they
may be large.

Allow outlining single-block regions if they have over some threshold of
non-debug, non-terminator instructions. I chose 3 as the threshold after
experimenting with several internal frameworks.

In practice, reducing the threshold further did not give much
improvement, whereas increasing it resulted in substantial regressions.

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

llvm-svn: 345524

6 years agoFix mismatch between size_t and uint64_t in std::set benchmark.
Samuel Benzaquen [Mon, 29 Oct 2018 19:08:31 +0000 (19:08 +0000)]
Fix mismatch between size_t and uint64_t in std::set benchmark.

llvm-svn: 345523

6 years ago[clang-query] Add non-exclusive output API
Stephen Kelly [Mon, 29 Oct 2018 18:59:56 +0000 (18:59 +0000)]
[clang-query] Add non-exclusive output API

Summary:
Add granular options for AST dumping, text printing and diagnostics.

This makes it possible to

* Have both diag and dump active at once
* Extend the output with other queryable content in the future.

Reviewers: aaron.ballman, pcc, ioeric, ilya-biryukov, klimek, sammccall

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 345522

6 years ago[WebAssembly] Lower away condition truncations for scalar selects
Thomas Lively [Mon, 29 Oct 2018 18:38:12 +0000 (18:38 +0000)]
[WebAssembly] Lower away condition truncations for scalar selects

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits

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

llvm-svn: 345521

6 years ago[X86][SSE] getFauxShuffleMask - Fix shuffle mask adjustment for multiple inserted...
Simon Pilgrim [Mon, 29 Oct 2018 18:25:48 +0000 (18:25 +0000)]
[X86][SSE] getFauxShuffleMask - Fix shuffle mask adjustment for multiple inserted subvectors

Part of the issue discovered in PR39483, although its not fully exposed until I reapply rL345395 (by reverting rL345451)

llvm-svn: 345520

6 years ago[X86] Add AES to KNL CPUs to match clang.
Craig Topper [Mon, 29 Oct 2018 18:17:01 +0000 (18:17 +0000)]
[X86] Add AES to KNL CPUs to match clang.

I believe this was lost from KNL when AES was pushed from Westmere to Skylake recently. KNL used to inherit from IVB.

llvm-svn: 345519

6 years ago[AMDGPU] Fixed return value causing warning and regression
Stanislav Mekhanoshin [Mon, 29 Oct 2018 17:53:23 +0000 (17:53 +0000)]
[AMDGPU] Fixed return value causing warning and regression

llvm-svn: 345518

6 years agoRevert "Revert "Support for groups of attributes in #pragma clang attribute""
Erik Pilkington [Mon, 29 Oct 2018 17:38:42 +0000 (17:38 +0000)]
Revert "Revert "Support for groups of attributes in #pragma clang attribute""

This reverts commit r345487, which reverted r345486. I think the crashes were
caused by an OOM on the builder, trying again to confirm...

llvm-svn: 345517

6 years ago[libc++] Use exclude_from_explicit_instantiation instead of always_inline
Louis Dionne [Mon, 29 Oct 2018 17:30:04 +0000 (17:30 +0000)]
[libc++] Use exclude_from_explicit_instantiation instead of always_inline

Summary:
This commit adopts the exclude_from_explicit_instantiation attribute discussed
at [1] and reviewed in [2] in libc++ to supplant the use of __always_inline__
for visibility purposes.

This change means that users wanting to link together translation units built
with different versions of libc++'s headers into the same final linked image
MUST define the _LIBCPP_HIDE_FROM_ABI_PER_TU macro to 1 when building those
TUs. Doing otherwise will lead to ODR violations and ABI issues.

[1]: http://lists.llvm.org/pipermail/cfe-dev/2018-August/059024.html
[2]: https://reviews.llvm.org/D51789

Reviewers: rsmith, EricWF

Subscribers: dexonsmith, libcxx-commits

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

llvm-svn: 345516

6 years ago[AArch64] Rename FP16FML instruction format (NFC)
Bryan Chan [Mon, 29 Oct 2018 17:27:34 +0000 (17:27 +0000)]
[AArch64] Rename FP16FML instruction format (NFC)

Rename SIMDThreeSameMult (etc.) to SIMDThreeSameVectorFML (etc.) to follow
usual naming convention, and add some comments in the .td files.

llvm-svn: 345515

6 years ago[AMDGPU] Match v_swap_b32
Stanislav Mekhanoshin [Mon, 29 Oct 2018 17:26:01 +0000 (17:26 +0000)]
[AMDGPU] Match v_swap_b32

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

llvm-svn: 345514

6 years ago[X86] Enable the MachineVerifier by default
Francis Visoiu Mistrih [Mon, 29 Oct 2018 16:57:43 +0000 (16:57 +0000)]
[X86] Enable the MachineVerifier by default

The machine verifier was disabled for x86 by default. There are now only
9 tests failing, compared to what previously was between 20 and 30.

This is a good opportunity to file bugs for all the remaining issues,
then explicitly disable the failing tests and enabling the machine
verifier by default.

This allows us to avoid adding new tests that break the verifier.

PR27481

llvm-svn: 345513

6 years ago[Intrinsic] Signed and Unsigned Saturation Subtraction Intirnsics
Leonard Chan [Mon, 29 Oct 2018 16:54:37 +0000 (16:54 +0000)]
[Intrinsic] Signed and Unsigned Saturation Subtraction Intirnsics

Add an intrinsic that takes 2 integers and perform saturation subtraction on
them.

This is a part of implementing fixed point arithmetic in clang where some of
the more complex operations will be implemented as intrinsics.

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

llvm-svn: 345512

6 years ago[AArch64] Return address signing B key support
Luke Cheeseman [Mon, 29 Oct 2018 16:26:58 +0000 (16:26 +0000)]
[AArch64] Return address signing B key support

- Add support to generate AUTIBSP, PACIBSP, RETAB instructions for return
  address signing
- The key used to sign the function is controlled by the function attribute
  "sign-return-address-key"

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

llvm-svn: 345511

6 years ago[AST] Only store the needed data in SwitchStmt
Bruno Ricci [Mon, 29 Oct 2018 16:12:37 +0000 (16:12 +0000)]
[AST] Only store the needed data in SwitchStmt

Don't store the data for the init statement and condition variable
if not needed. This cuts the size of SwitchStmt by up to 2 pointers.
The order of the children is intentionally kept the same.

Also use the newly available space in the bit-fields of Stmt
to store the bit representing whether all enums have been covered
instead of using a PointerIntPair.

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

Reviewed By: rjmccall

llvm-svn: 345510

6 years ago[OpenMP][NVPTX] Use single loops when generating code for distribute parallel for
Gheorghe-Teodor Bercea [Mon, 29 Oct 2018 15:45:47 +0000 (15:45 +0000)]
[OpenMP][NVPTX] Use single loops when generating code for distribute parallel for

Summary: This patch adds a new code generation path for bound sharing directives containing distribute parallel for. The new code generation scheme applies to chunked schedules on distribute and parallel for directives. The scheme simplifies the code that is being generated by eliminating the need for an outer for loop over chunks for both distribute and parallel for directives. In the case of distribute it applies to any sized chunk while in the parallel for case it only applies when chunk size is 1.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 345509

6 years ago[LLVM-C] Add Builder Bindings to Common Memory Intrinsics
Robert Widmann [Mon, 29 Oct 2018 15:31:40 +0000 (15:31 +0000)]
[LLVM-C] Add Builder Bindings to Common Memory Intrinsics

Summary: Add IRBuilder bindings for memmove, memcpy, and memset.

Reviewers: whitequark, deadalnix

Reviewed By: whitequark

Subscribers: harlanhaskins, llvm-commits

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

llvm-svn: 345508

6 years ago[OpenMP][NVPTX] Enable default scheduling for parallel for in non-SPMD cases.
Gheorghe-Teodor Bercea [Mon, 29 Oct 2018 15:23:23 +0000 (15:23 +0000)]
[OpenMP][NVPTX] Enable default scheduling for parallel for in non-SPMD cases.

Summary: This patch enables the choosing of the default schedule for parallel for loops even in non-SPMD cases.

Reviewers: ABataev, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

llvm-svn: 345507

6 years ago[AST] Check that GNU range case statements are correctly imported.
Bruno Ricci [Mon, 29 Oct 2018 15:04:19 +0000 (15:04 +0000)]
[AST] Check that GNU range case statements are correctly imported.

The test for case statements did not cover GNU range case statements.

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

Reviewed By: rjmccall

llvm-svn: 345506

6 years ago[OPENMP] Do not capture private loop counters.
Alexey Bataev [Mon, 29 Oct 2018 15:01:58 +0000 (15:01 +0000)]
[OPENMP] Do not capture private loop counters.

If the loop counter is not declared in the context of the loop and it is
private, such loop counters should not be captured in the outlined
regions.

llvm-svn: 345505

6 years ago[git/svn] Ignore Visual Studio's CMakeSettings.json.
Michael Kruse [Mon, 29 Oct 2018 14:51:02 +0000 (14:51 +0000)]
[git/svn] Ignore Visual Studio's CMakeSettings.json.

When using Visual Studio's built-in support for CMake, the CMakeSettings.json contains the build configurations (build dir, generator, toolchain, cmake variables, etc). It is specific to the build machine, therefore should not be versioned.

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

llvm-svn: 345504

6 years ago[llvm-objdump] Don't crash when using `-a` on non-archives
James Henderson [Mon, 29 Oct 2018 14:17:08 +0000 (14:17 +0000)]
[llvm-objdump] Don't crash when using `-a` on non-archives

This fixes PR39402. The crash was caused when dereferencing nullptr in
DumpObject and printArchiveChild.

Reviewed By: jhenderson

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

Patch by Xing GUO

llvm-svn: 345503

6 years agoAdd the isStaticLocal() AST matcher for matching on local static variables.
Aaron Ballman [Mon, 29 Oct 2018 13:47:56 +0000 (13:47 +0000)]
Add the isStaticLocal() AST matcher for matching on local static variables.

Patch by Joe Ranieri.

llvm-svn: 345502

6 years ago[X86] Remove outdated test
Francis Visoiu Mistrih [Mon, 29 Oct 2018 13:41:46 +0000 (13:41 +0000)]
[X86] Remove outdated test

This test breaks the X86 MachineVerifier. It looks like the MIR part is
completely useless.

The original author suggests that it can be removed.

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

llvm-svn: 345501

6 years ago[llvm-mca] Lower to mca::Instructon before the pipeline is run.
Andrea Di Biagio [Mon, 29 Oct 2018 13:29:22 +0000 (13:29 +0000)]
[llvm-mca] Lower to mca::Instructon before the pipeline is run.

Before this change, the lowering of instructions from llvm::MCInst to
mca::Instruction was done as part of the first stage of the pipeline (i.e. the
FetchStage).  In particular, FetchStage was responsible for picking the next
instruction from the source sequence, and lower it to an mca::Instruction with
the help of an object of class InstrBuilder.

The dependency on InstrBuilder was problematic for a number of reasons. Class
InstrBuilder only knows how to lower from llvm::MCInst to mca::Instruction.
That means, it is hard to support a different scenario where instructions
in input are not instances of class llvm::MCInst. Even if we managed to
specialize InstrBuilder, and generalize most of its internal logic, the
dependency on InstrBuilder in FetchStage would have caused more troubles (other
than complicating the pipeline logic).

With this patch, the lowering step is done before the pipeline is run. The
pipeline is no longer responsible for lowering from MCInst to mca::Instruction.
As a consequence of this, the FetchStage no longer needs to interact with an
InstrBuilder. The mca::SourceMgr class now simply wraps a reference to a
sequence of mca::Instruction objects.
This simplifies the logic of FetchStage, and increases the usability of it.  As
a result, on a debug build, we see a 7-9% speedup; on a release build, the
speedup is around 3-4%.

llvm-svn: 345500

6 years ago[llvm-mca][UpdateTestChecks] Don't try to align blocks that have already been subject...
Greg Bedwell [Mon, 29 Oct 2018 13:24:20 +0000 (13:24 +0000)]
[llvm-mca][UpdateTestChecks] Don't try to align blocks that have already been subject to alignment in update_mca_test_checks.py

This fixes PR39466.

llvm-svn: 345499

6 years ago[LLDB] - Fix outdated comment. NFC.
George Rimar [Mon, 29 Oct 2018 12:33:19 +0000 (12:33 +0000)]
[LLDB] - Fix outdated comment. NFC.

llvm-svn: 345498

6 years ago[OpenCL] Fix serialization of OpenCLExtensionDecls
Andrew Savonichev [Mon, 29 Oct 2018 11:14:01 +0000 (11:14 +0000)]
[OpenCL] Fix serialization of OpenCLExtensionDecls

Summary:
I recently discovered that adding the following code into `opencl-c.h` causes
failure of `test/Headers/opencl-c-header.cl`:
```
#pragma OPENCL EXTENSION cl_my_ext : begin
void cl_my_ext_foobarbaz();
#pragma OPENCL EXTENSIOn cl_my_ext : end
```

Clang crashes at the assertion is `ASTReader::getGlobalSubmoduleID()`:
```
assert(I != M.SubmoduleRemap.end() && "Invalid index into submodule index remap");
```

The root cause of the problem that to deserialize `OPENCL_EXTENSION_DECLS`
section `ASTReader` needs to deserialize a Decl contained in it. In turn,
deserializing a Decl requires information about whether this declaration is
part of a (sub)module, but this information is not read yet because it is
located further in a module file.

Reviewers: Anastasia, yaxunl, JDevlieghere

Reviewed By: Anastasia

Subscribers: sidorovd, cfe-commits, asavonic

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

llvm-svn: 345497

6 years ago[ASTImporter] Import overrides before importing the rest of the chain
Gabor Marton [Mon, 29 Oct 2018 10:18:28 +0000 (10:18 +0000)]
[ASTImporter] Import overrides before importing the rest of the chain

Summary:
During method import we check for structural eq of two methods.
In the structural eq check we check for their isVirtual() flag. That
flag, however, may depend on the number of overrides. Before this
change we imported the overrides *after* we had imported the rest of the
redecl chain.  So, during the import of another decl from the chain
IsVirtual() gave false result.

Writing tests for this is not really possible, because there is no way
to remove an overridden method via the AST API.
(We should access the private ASTContext::OverriddenMethods container.)
Also, we should do the remove in the middle of the import process.

Reviewers: a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

llvm-svn: 345496

6 years ago[llvm-objdump] Add '--full-contents' as alias for '-s'
James Henderson [Mon, 29 Oct 2018 10:05:39 +0000 (10:05 +0000)]
[llvm-objdump] Add '--full-contents' as alias for '-s'

This fixes PR39404.

Reviewed By: jhenderson

Patch by Xing Guo

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

llvm-svn: 345495

6 years agoMark test/tsan/getline_nohang as XFAIL for NetBSD
Kamil Rytarowski [Mon, 29 Oct 2018 09:44:42 +0000 (09:44 +0000)]
Mark test/tsan/getline_nohang as XFAIL for NetBSD

llvm-svn: 345493

6 years agoDisable the GNU strerror_r TSan test for NetBSD
Kamil Rytarowski [Mon, 29 Oct 2018 09:12:38 +0000 (09:12 +0000)]
Disable the GNU strerror_r TSan test for NetBSD

Revert older change that was incorrect in this test.
It was already reverted in the past after an attempt to port it to Darwin.

While there, mark FreeBSD as unsupported as well.

llvm-svn: 345492

6 years ago[ARM][NFC] Fix test inlineasm-X-allocation.ll
Sjoerd Meijer [Mon, 29 Oct 2018 08:45:56 +0000 (08:45 +0000)]
[ARM][NFC] Fix test inlineasm-X-allocation.ll

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

llvm-svn: 345491

6 years agoMark test/tsan/ignore_lib5 as unsupported for NetBSD
Kamil Rytarowski [Mon, 29 Oct 2018 08:42:46 +0000 (08:42 +0000)]
Mark test/tsan/ignore_lib5 as unsupported for NetBSD

ReadProcMaps() on NetBSD does not handle >=1MB of memory layout information.

llvm-svn: 345490

6 years ago[XRay] Guard call to postCurrentThreadFCT()
Dean Michael Berris [Mon, 29 Oct 2018 05:39:43 +0000 (05:39 +0000)]
[XRay] Guard call to postCurrentThreadFCT()

Summary:
Some cases where `postCurrentThreadFCT()` are not guarded by our
recursion guard. We've observed that sometimes these can lead to
deadlocks when some functions (like memcpy()) gets outlined and the
version of memcpy is XRay-instrumented, which can be materialised by the
compiler in the implementation of lower-level components used by the
profiling runtime.

This change ensures that all calls to `postCurrentThreadFCT` are guarded
by our thread-recursion guard, to prevent deadlocks.

Reviewers: mboerger, eizan

Subscribers: llvm-commits

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

llvm-svn: 345489

6 years ago[X86] Force floating point values in constant pool decoding to print in scientific...
Craig Topper [Mon, 29 Oct 2018 04:52:04 +0000 (04:52 +0000)]
[X86] Force floating point values in constant pool decoding to print in scientific notation so they can't be confused with integers.

When the floating point constants are whole numbers they have no decimal point so look like integers, but mean something very different in something like an 'and' instruction.

Ideally we would just print a decimal point and a 0, but I couldn't see how to make APFloat::toString do that.

llvm-svn: 345488

6 years agoRevert "Support for groups of attributes in #pragma clang attribute"
Erik Pilkington [Mon, 29 Oct 2018 03:24:16 +0000 (03:24 +0000)]
Revert "Support for groups of attributes in #pragma clang attribute"

This reverts commit r345486.

Looks like it causes some old versions of GCC to crash, I'll see if I can
work around it and recommit...

llvm-svn: 345487

6 years agoSupport for groups of attributes in #pragma clang attribute
Erik Pilkington [Mon, 29 Oct 2018 02:29:21 +0000 (02:29 +0000)]
Support for groups of attributes in #pragma clang attribute

This commit enables pushing an empty #pragma clang attribute push, then adding
multiple attributes to it, then popping them all with #pragma clang attribute
pop, just like #pragma clang diagnostic. We still support the current way of
adding these, #pragma clang attribute push(__attribute__((...))), by treating it
like a combined push/attribute. This is needed to create macros like:

DO_SOMETHING_BEGIN(attr1, attr2, attr3)
// ...
DO_SOMETHING_END

rdar://45496947

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

llvm-svn: 345486

6 years ago[XRay] Use more portable control block
Dean Michael Berris [Mon, 29 Oct 2018 02:18:14 +0000 (02:18 +0000)]
[XRay] Use more portable control block

Summary:
In D53560, we assumed a specific layout for memory without using an
explicit structure. This follow-up change uses more portable layout
control by using unions in a struct, and consolidating the memory
management code in the buffer queue.

We also take the opportunity to improve the documentation on the types
and operations, along with simplifying some of the logic in the buffer
queue implementation.

Reviewers: mboerger, eizan

Subscribers: jfb, llvm-commits

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

llvm-svn: 345485

6 years ago[X86] Recognize constant splats in LowerFCOPYSIGN.
Craig Topper [Sun, 28 Oct 2018 23:51:35 +0000 (23:51 +0000)]
[X86] Recognize constant splats in LowerFCOPYSIGN.

llvm-svn: 345484

6 years ago[X86] Add test case to show failure to handle splat vectors in the constant check...
Craig Topper [Sun, 28 Oct 2018 23:51:33 +0000 (23:51 +0000)]
[X86] Add test case to show failure to handle splat vectors in the constant check in LowerFCOPYSIGN.

llvm-svn: 345483

6 years agoRevert "Revert "DebugInfo: reduce DIE range verification on object files""
Saleem Abdulrasool [Sun, 28 Oct 2018 22:30:48 +0000 (22:30 +0000)]
Revert "Revert "DebugInfo: reduce DIE range verification on object files""

This reverts commit 836c763dadbd9478fa35b1a291a38bf17aa206ba.  Default
initialize the values that MSAN caught.

llvm-svn: 345482

6 years ago[SelectionDAG] Fix bad indentation. NFC
Craig Topper [Sun, 28 Oct 2018 21:24:20 +0000 (21:24 +0000)]
[SelectionDAG] Fix bad indentation. NFC

llvm-svn: 345481

6 years ago[llvm-exegesis] Fix SNB counter definition and handling.
Clement Courbet [Sun, 28 Oct 2018 19:09:14 +0000 (19:09 +0000)]
[llvm-exegesis] Fix SNB counter definition and handling.

Summary: SNB is the only one that has P23 as a single proc res.

Reviewers: gchatelet

Subscribers: tschuett, llvm-commits

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

llvm-svn: 345480