platform/upstream/llvm.git
5 years agoGroup forward declarations in one namespace lldb_private {}
Fangrui Song [Wed, 15 May 2019 09:15:13 +0000 (09:15 +0000)]
Group forward declarations in one namespace lldb_private {}

llvm-svn: 360757

5 years ago[CMake] Add error to clarify that lldb requires libcxx
Stefan Granitz [Wed, 15 May 2019 08:59:02 +0000 (08:59 +0000)]
[CMake] Add error to clarify that lldb requires libcxx

Summary:
This adds a specific error message to clarify that lldb requires libcxx when
built together with clang on macOS. In addition, the lldb building docs are also
updated.

Fixes https://bugs.llvm.org/show_bug.cgi?id=41866

Reviewers: sgraenitz, JDevlieghere, EricWF

Reviewed By: sgraenitz

Subscribers: mgorny, lldb-commits

Tags: #lldb

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

llvm-svn: 360756

5 years ago[[DAGCombiner][NFC] Add a comment.
Clement Courbet [Wed, 15 May 2019 08:21:18 +0000 (08:21 +0000)]
[[DAGCombiner][NFC] Add a comment.

As suggested in D61846.

llvm-svn: 360755

5 years agoDWARF: s/CompileUnit/Unit/ in DWARFFormValue
Pavel Labath [Wed, 15 May 2019 07:45:40 +0000 (07:45 +0000)]
DWARF: s/CompileUnit/Unit/ in DWARFFormValue

The class has been converted to use DWARFUnit, but a number of uses of
the words compile unit remained. This removes all such references
Get/SetCompileUnit becomes Get/SetUnit, and m_cu becomes m_unit.

llvm-svn: 360754

5 years agoReplace assert with static_assert here applicable.
Jonas Devlieghere [Wed, 15 May 2019 05:39:41 +0000 (05:39 +0000)]
Replace assert with static_assert here applicable.

Replaces assert() with static_assert() if the condition is can be
evaluated at compile time.

llvm-svn: 360753

5 years agoMark private unimplemented functions as deleted
Jonas Devlieghere [Wed, 15 May 2019 05:31:14 +0000 (05:31 +0000)]
Mark private unimplemented functions as deleted

Applies modernize-use-equals-delete to the LLDB code base and removes
the now redundant comments.

llvm-svn: 360751

5 years ago[Docs] Document lldb-dotest
Jonas Devlieghere [Wed, 15 May 2019 04:42:30 +0000 (04:42 +0000)]
[Docs] Document lldb-dotest

Document the lldb-dotest binary.

llvm-svn: 360748

5 years ago[X86] Use OR32mi8Locked instead of LOCK_OR32mi8 in emitLockedStackOp.
Craig Topper [Wed, 15 May 2019 04:15:46 +0000 (04:15 +0000)]
[X86] Use OR32mi8Locked instead of LOCK_OR32mi8 in emitLockedStackOp.

They encode the same way, but OR32mi8Locked sets hasUnmodeledSideEffects set
which should be stronger than the mayLoad/mayStore on LOCK_OR32mi8. I think
this makes sense since we are using it as a fence.

This also seems to hide the operation from the speculative load hardening pass
so I've reverted r360511.

llvm-svn: 360747

5 years agoRevert "build: use the correct variable"
Saleem Abdulrasool [Wed, 15 May 2019 03:57:07 +0000 (03:57 +0000)]
Revert "build: use the correct variable"

This reverts commit b5a8abd57f23e2f621d5ceb0f64f1bb8f9579c3f.  This
should not be needed as the lldb-server tool will add
`LLDB_CAN_USE_LLDB_SERVER` which will never be set to true on Windows.

llvm-svn: 360745

5 years ago[lldb] [lit] Fix whitespace in matches for remaining AVX512 tests
Michal Gorny [Wed, 15 May 2019 03:32:47 +0000 (03:32 +0000)]
[lldb] [lit] Fix whitespace in matches for remaining AVX512 tests

llvm-svn: 360744

5 years agoFix 2-field llvm.global_ctors `REQUIRES: asserts` tests after rL360742
Fangrui Song [Wed, 15 May 2019 03:08:21 +0000 (03:08 +0000)]
Fix 2-field llvm.global_ctors `REQUIRES: asserts` tests after rL360742

llvm-svn: 360743

5 years ago[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual...
Fangrui Song [Wed, 15 May 2019 02:35:32 +0000 (02:35 +0000)]
[IR] Disallow llvm.global_ctors and llvm.global_dtors of the 2-field form in textual format

The 3-field form was introduced by D3499 in 2014 and the legacy 2-field
form was planned to be removed in LLVM 4.0

For the textual format, this patch migrates the existing 2-field form to
use the 3-field form and deletes the compatibility code.
test/Verifier/global-ctors-2.ll checks we have a friendly error message.

For bitcode, lib/IR/AutoUpgrade UpgradeGlobalVariables will upgrade the
2-field form (add i8* null as the third field).

Reviewed By: rnk, dexonsmith

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

llvm-svn: 360742

5 years ago[Target] Generalize some behavior in Thread
Alex Langford [Wed, 15 May 2019 01:46:45 +0000 (01:46 +0000)]
[Target] Generalize some behavior in Thread

Summary:
I don't think there's a good reason for this behavior to be considered
ObjC-specific. We can generalize this.

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

llvm-svn: 360741

5 years ago[NFC] Reuse a helper function to eliminate duplicate code
Philip Reames [Wed, 15 May 2019 01:39:07 +0000 (01:39 +0000)]
[NFC] Reuse a helper function to eliminate duplicate code

llvm-svn: 360740

5 years ago[analyzer] MIGChecker: Fix redundant semicolon.
Artem Dergachev [Wed, 15 May 2019 01:36:41 +0000 (01:36 +0000)]
[analyzer] MIGChecker: Fix redundant semicolon.

llvm-svn: 360739

5 years ago[XCore] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 01:28:30 +0000 (01:28 +0000)]
[XCore] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360738

5 years ago[analyzer] MIGChecker: Add support for os_ref_retain().
Artem Dergachev [Wed, 15 May 2019 01:19:19 +0000 (01:19 +0000)]
[analyzer] MIGChecker: Add support for os_ref_retain().

Suppress MIG checker false positives that occur when the programmer increments
the reference count before calling a MIG destructor, and the MIG destructor
literally boils down to decrementing the reference count.

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

llvm-svn: 360737

5 years ago[X86] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 01:17:58 +0000 (01:17 +0000)]
[X86] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360736

5 years ago[WebAssembly] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 01:03:00 +0000 (01:03 +0000)]
[WebAssembly] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360735

5 years ago[SystemZ] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:46:18 +0000 (00:46 +0000)]
[SystemZ] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360734

5 years ago[Sparc] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:35:37 +0000 (00:35 +0000)]
[Sparc] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360733

5 years ago[RISCV] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:24:15 +0000 (00:24 +0000)]
[RISCV] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360732

5 years ago[PowerPC] Create a TargetInfo header. NFC
Richard Trieu [Wed, 15 May 2019 00:09:58 +0000 (00:09 +0000)]
[PowerPC] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360731

5 years agoMake SBDebugger.RunCommandInterpreter callable from Python.
Jim Ingham [Wed, 15 May 2019 00:08:55 +0000 (00:08 +0000)]
Make SBDebugger.RunCommandInterpreter callable from Python.

Authored by: Lukas Boger

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

llvm-svn: 360730

5 years ago[NVPTX] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:56:18 +0000 (23:56 +0000)]
[NVPTX] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360729

5 years ago[MSP430] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:45:18 +0000 (23:45 +0000)]
[MSP430] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360728

5 years ago[Mips] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:34:37 +0000 (23:34 +0000)]
[Mips] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360727

5 years ago[Lanai] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:17:18 +0000 (23:17 +0000)]
[Lanai] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360726

5 years ago[lit/Register] Fix matching of the output.
Davide Italiano [Tue, 14 May 2019 23:17:12 +0000 (23:17 +0000)]
[lit/Register] Fix matching of the output.

llvm-svn: 360725

5 years ago[Hexagon] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 23:04:55 +0000 (23:04 +0000)]
[Hexagon] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360724

5 years ago[polly] Fix non-determinism in IslNodeBuilder.
Eli Friedman [Tue, 14 May 2019 23:01:19 +0000 (23:01 +0000)]
[polly] Fix non-determinism in IslNodeBuilder.

The iteration order of OutsideLoopIterations matters for
IslNodeBuilder::getReferencesInSubtree, which inserts the values from
the map into a SetVector, which is eventually used to construct the
type of the context for parallel loops.

llvm-svn: 360723

5 years ago[BPF] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:54:06 +0000 (22:54 +0000)]
[BPF] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360722

5 years ago[AVR] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:41:58 +0000 (22:41 +0000)]
[AVR] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360721

5 years agoFix bots by adding target triple to test.
Leonard Chan [Tue, 14 May 2019 22:37:34 +0000 (22:37 +0000)]
Fix bots by adding target triple to test.

llvm-svn: 360720

5 years agoUse an offset from TOS for idempotent rmw locked op lowering
Philip Reames [Tue, 14 May 2019 22:32:42 +0000 (22:32 +0000)]
Use an offset from TOS for idempotent rmw locked op lowering

This was the portion split off D58632 so that it could follow the redzone API cleanup. Note that I changed the offset preferred from -8 to -64. The difference should be very minor, but I thought it might help address one concern which had been previously raised.

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

llvm-svn: 360719

5 years ago[ARM] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:29:50 +0000 (22:29 +0000)]
[ARM] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360718

5 years ago[libFuzzer] replace string_view with string to fix the bots. This is NFC, just slower.
Kostya Serebryany [Tue, 14 May 2019 22:16:04 +0000 (22:16 +0000)]
[libFuzzer] replace string_view with string to fix the bots. This is NFC, just slower.

llvm-svn: 360717

5 years ago[ARC] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 22:06:04 +0000 (22:06 +0000)]
[ARC] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360716

5 years ago[libFuzzer] #include <string_view>, hopefully should fix the windows build
Kostya Serebryany [Tue, 14 May 2019 22:05:41 +0000 (22:05 +0000)]
[libFuzzer] #include <string_view>, hopefully should fix the windows build

llvm-svn: 360715

5 years ago[AMDGPU] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 21:54:37 +0000 (21:54 +0000)]
[AMDGPU] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360713

5 years ago[libFuzzer] reimplement DFT's collect_data_flow inside libFuzzer so that we don't...
Kostya Serebryany [Tue, 14 May 2019 21:47:35 +0000 (21:47 +0000)]
[libFuzzer] reimplement DFT's collect_data_flow inside libFuzzer so that we don't need external python scripts

llvm-svn: 360712

5 years ago[OpenMP][AArch64] Fix compile with LLVM trunk.
Eli Friedman [Tue, 14 May 2019 21:44:54 +0000 (21:44 +0000)]
[OpenMP][AArch64] Fix compile with LLVM trunk.

The code is currently using the ambiguous instruction
"sub sp, sp, w9, lsl #4". The ARM reference manual says this isn't
valid, and it's not clear whether it's supposed to mean uxtw or uxtx.

It doesn't matter which instruction we use here, since the high
bits of the operand are zero anyway, so I arbitrarily choose uxtw, to
preserve the register name.

See https://reviews.llvm.org/D60840 for the LLVM patch.

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

llvm-svn: 360711

5 years ago[GWP-ASan] Initial build files, implementation of PRNG [1].
Mitch Phillips [Tue, 14 May 2019 21:43:11 +0000 (21:43 +0000)]
[GWP-ASan] Initial build files, implementation of PRNG [1].

Summary:
See D60593 for further information.
This patch slices off the PRNG implementation and the initial build files for GWP-ASan.

Reviewers: vlad.tsyrklevich, morehouse, vitalybuka

Reviewed By: morehouse

Subscribers: srhines, kubamracek, mgorny, #sanitizers, llvm-commits, cryptoad, eugenis

Tags: #sanitizers, #llvm

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

llvm-svn: 360710

5 years ago[AArch64] Create a TargetInfo header. NFC
Richard Trieu [Tue, 14 May 2019 21:33:53 +0000 (21:33 +0000)]
[AArch64] Create a TargetInfo header.  NFC

Move the declarations of getThe<Name>Target() functions into a new header in
TargetInfo and make users of these functions include this new header.
This fixes a layering problem.

llvm-svn: 360709

5 years ago[Polly] Don't crash on invalid delinearization result.
Eli Friedman [Tue, 14 May 2019 21:32:54 +0000 (21:32 +0000)]
[Polly] Don't crash on invalid delinearization result.

In certain cases, it's possible for delinearization to decide one of the
array dimensions should be some function of an induction variable inside
the scop.  Make sure if this happens, we refuse to use those dimensions
for delinearization.

Usually, we end up rejecting the scop before it actually crashes, but it
looks like it's possible to slip past other checks in certain cases
involving smax expressions.

Fixes a crash that started showing up this week on the polly AOSP
builder.  As far as I can tell, this is a longstanding issue, though;
it was just exposed by better SCEV analysis of smin expressions.

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

llvm-svn: 360708

5 years ago[NewPM] Port HWASan and Kernel HWASan
Leonard Chan [Tue, 14 May 2019 21:17:21 +0000 (21:17 +0000)]
[NewPM] Port HWASan and Kernel HWASan

Port hardware assisted address sanitizer to new PM following the same guidelines as msan and tsan.

Changes:
- Separate HWAddressSanitizer into a pass class and a sanitizer class.
- Create new PM wrapper pass for the sanitizer class.
- Use the getOrINsert pattern for some module level initialization declarations.
- Also enable kernel-kwasan in new PM
- Update llvm tests and add clang test.

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

llvm-svn: 360707

5 years ago[NFC][CodeGen][X86][AArch64] Add and-const-mask + const-shift pattern tests
Roman Lebedev [Tue, 14 May 2019 20:17:04 +0000 (20:17 +0000)]
[NFC][CodeGen][X86][AArch64] Add and-const-mask + const-shift pattern tests

Unlike instcombine, we currently don't turn and+shift into shift+and.
We probably should, likely unconditionally.

While i'm adding only all-ones (potentially shifted) mask,
this obviously isn't limited to any particular mask pattern:
https://rise4fun.com/Alive/kmX

Related to https://bugs.llvm.org/show_bug.cgi?id=41874

llvm-svn: 360706

5 years agoFix ASTMerge/namespace/test.cpp after r360701
Reid Kleckner [Tue, 14 May 2019 20:01:03 +0000 (20:01 +0000)]
Fix ASTMerge/namespace/test.cpp after r360701

llvm-svn: 360705

5 years ago[LICM] Allow AliasSetMap to contain top-level loops.
Florian Hahn [Tue, 14 May 2019 19:41:36 +0000 (19:41 +0000)]
[LICM] Allow AliasSetMap to contain top-level loops.

When an outer loop gets deleted by a different pass, before LICM visits
it, we cannot clean up its sub-loops in AliasSetMap, because at the
point we receive the deleteAnalysisLoop callback for the outer loop, the loop
object is already invalid and we cannot access its sub-loops any longer.

Reviewers: asbirlea, sanjoy, chandlerc

Reviewed By: asbirlea

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

llvm-svn: 360704

5 years agoTemporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compress...
Eric Christopher [Tue, 14 May 2019 19:40:42 +0000 (19:40 +0000)]
Temporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)"

This affects users of older (pre 2.26) binutils in such a way that they can't necessarily
work around it as it doesn't support the compress option on the command line. Reverting
to unblock them and we can revisit whether to make this change now or fix how we want
to express the option.

This reverts commit bdb21337e6e1732c9895966449c33c408336d295/r360403.

llvm-svn: 360703

5 years ago[AMDGPU][GFX8][GFX9] Corrected predicate of v_*_co_u32 aliases
Dmitry Preobrazhensky [Tue, 14 May 2019 19:16:24 +0000 (19:16 +0000)]
[AMDGPU][GFX8][GFX9] Corrected predicate of v_*_co_u32 aliases

Reviewers: rampitec, arsenm

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

llvm-svn: 360702

5 years agoUpdate ASTMerge FileCheck test expectations
Reid Kleckner [Tue, 14 May 2019 19:02:39 +0000 (19:02 +0000)]
Update ASTMerge FileCheck test expectations

I belive many of these diagnostics changed from errors to warnings in
r357394. I've simply mechanically updated the tests, but whoever owns
this code should probably audit for unintented behavior changes. I
wasn't able to find a flag to make these warnings errors again.

llvm-svn: 360701

5 years ago[LVI][CVP] Add support for abs/nabs select pattern flavor
Nikita Popov [Tue, 14 May 2019 18:53:47 +0000 (18:53 +0000)]
[LVI][CVP] Add support for abs/nabs select pattern flavor

Based on ConstantRange support added in D61084, we can now handle
abs and nabs select pattern flavors in LVI.

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

llvm-svn: 360700

5 years agoRestore test files accidentally deleted in r354839
Reid Kleckner [Tue, 14 May 2019 18:51:07 +0000 (18:51 +0000)]
Restore test files accidentally deleted in r354839

I think there must be a bug in git-llvm causing parent directories to be
deleted when the diff deletes files in a subdirectory. Perhaps it is
Windows-only.

There has been a behavior change, so some of these tests now fail. I
have marked them XFAIL and will fix them in a follow-up to separate the
changes.

llvm-svn: 360699

5 years ago[clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance ...
Matthias Gehre [Tue, 14 May 2019 18:23:10 +0000 (18:23 +0000)]
[clang-tidy] Fix invalid fixit for readability-static-accessed-through-instance (bug 40544)

Summary:
Fixed https://bugs.llvm.org/show_bug.cgi?id=40544
Before, we would generate a fixit like `(anonymous namespace)::Foo::fun();` for
the added test case.

Reviewers: aaron.ballman, alexfh, xazax.hun

Subscribers: rnkovacs, cfe-commits

Tags: #clang, #clang-tools-extra

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

llvm-svn: 360698

5 years ago[MemorySSA] LoopSimplify preserves MemorySSA only when flag is flipped.
Alina Sbirlea [Tue, 14 May 2019 18:07:18 +0000 (18:07 +0000)]
[MemorySSA] LoopSimplify preserves MemorySSA only when flag is flipped.

LoopSimplify can preserve MemorySSA after r360270.
But the MemorySSA analysis is retrieved and preserved only when the
EnableMSSALoopDependency is set to true. Use the same conditional to
mark the pass as preserved, otherwise subsequent passes will get an
invalid analysis.
Resolves PR41853.

llvm-svn: 360697

5 years agoFix a release mode warning introduced in r360694
Philip Reames [Tue, 14 May 2019 17:50:06 +0000 (17:50 +0000)]
Fix a release mode warning introduced in r360694

llvm-svn: 360696

5 years agobuild: use the correct variable
Saleem Abdulrasool [Tue, 14 May 2019 17:24:45 +0000 (17:24 +0000)]
build: use the correct variable

Adjust the variable that controls whether the unit tests use `lldb-server`.
This should repair the default build on Windows.

llvm-svn: 360695

5 years ago[IndVars] Extend reasoning about loop invariant exits to non-header blocks
Philip Reames [Tue, 14 May 2019 17:20:10 +0000 (17:20 +0000)]
[IndVars] Extend reasoning about loop invariant exits to non-header blocks

Noticed while glancing through the code for other reasons.  The extension is trivial enough, decided to just do it.

llvm-svn: 360694

5 years agolldb-server: rename `llgs::terminate` (NFC)
Saleem Abdulrasool [Tue, 14 May 2019 17:07:36 +0000 (17:07 +0000)]
lldb-server: rename `llgs::terminate` (NFC)

`terminate` overlaps with a C function on Windows:

```
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,13):  warning: 'terminate' redeclared without 'dllimport' attribute: 'dllexport' attribute added [-Winconsistent-dllimport]
static void terminate() { g_debugger_lifetime->Terminate(); }
            ^
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\corecrt_terminate.h(29,48):  note: previous declaration is here
    _ACRTIMP __declspec(noreturn) void __cdecl terminate() throw();
                                               ^
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,61):  warning: function declared 'noreturn' should not return [-Winvalid-noreturn]
static void terminate() { g_debugger_lifetime->Terminate(); }
                                                            ^
```

Rename the function to `terminate_debugger` to avoid the errant match.

llvm-svn: 360693

5 years agoSupport FNeg in SpeculativeExecution pass
Cameron McInally [Tue, 14 May 2019 16:51:18 +0000 (16:51 +0000)]
Support FNeg in SpeculativeExecution pass

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

llvm-svn: 360692

5 years agoRename MacOS X -> macOS where applicable.
Adrian Prantl [Tue, 14 May 2019 16:37:43 +0000 (16:37 +0000)]
Rename MacOS X -> macOS where applicable.

llvm-svn: 360691

5 years ago[Test] Autogen a test for ease of later changing
Philip Reames [Tue, 14 May 2019 16:37:29 +0000 (16:37 +0000)]
[Test] Autogen a test for ease of later changing

llvm-svn: 360690

5 years ago[AMDGPU] Fixed handling of imemdiate i1 literals
Stanislav Mekhanoshin [Tue, 14 May 2019 16:18:00 +0000 (16:18 +0000)]
[AMDGPU] Fixed handling of imemdiate i1 literals

This bug was exposed by the rL360395.

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

llvm-svn: 360689

5 years ago[AMDGPU] Fixed +DumpCode
Tim Renouf [Tue, 14 May 2019 16:17:14 +0000 (16:17 +0000)]
[AMDGPU] Fixed +DumpCode

The +DumpCode attribute is a horrible hack in AMDGPU to embed the
disassembly of the generated code into the elf file. It is used by LLPC
to implement an extension that allows the application to read back the
disassembly of the code. Longer term, we should re-implement that by
using the LLVM disassembler from the Vulkan driver.

Recent LLVM changes broke +DumpCode. With -filetype=asm it crashed, and
with -filetype=obj I think it did not include any instructions, only the
labels. Fixed with this commit: now it has no effect with -filetype=asm,
and works as intended with -filetype=obj.

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

Change-Id: I6436d86fe2ea220d74a643a85e64753747c9366b
llvm-svn: 360688

5 years ago[ARM][CMSE] Add cmse intrinsics for TT instructions
Javed Absar [Tue, 14 May 2019 16:14:24 +0000 (16:14 +0000)]
[ARM][CMSE] Add cmse intrinsics for TT instructions

Defines intrinsics cmse_TT, cmse_TTT, cmse_TTA, cmse_TTAT.
No tests here as the tests are in patches that uses these.
Reviewed By: Todd Snider, Dave Green
Differential Revision:  https://reviews.llvm.org/D59888

llvm-svn: 360687

5 years ago[AMDGPU] gfx1010 Strengthen some SMEM WAR hazard unit tests. NFC.
Stanislav Mekhanoshin [Tue, 14 May 2019 16:04:03 +0000 (16:04 +0000)]
[AMDGPU] gfx1010 Strengthen some SMEM WAR hazard unit tests. NFC.

Tighten conditions on SMEM WAR hazard unit tests to ensure rejection
of workaround insertion where a s_waitcnt is present in dependency
chain. The current workaround code already conforms to these revise
tests.

llvm-svn: 360686

5 years ago[LLD][ELF] Add the -z ifunc-noplt option
Fangrui Song [Tue, 14 May 2019 15:25:21 +0000 (15:25 +0000)]
[LLD][ELF] Add the -z ifunc-noplt option

Patch by Mark Johnston!

Summary:
When the option is configured, ifunc calls do not go through the PLT;
rather, they appear as regular function calls with relocations
referencing the ifunc symbol, and the resolver is invoked when
applying the relocation.  This is intended for use in freestanding
environments where text relocations are permissible and is incompatible
with the -z text option.  The option is motivated by ifunc usage in the
FreeBSD kernel, where ifuncs are used to elide CPU feature flag bit
checks in hot paths.  Instead of replacing the cost of a branch with that
of an indirect function call, the -z ifunc-noplt option is used to ensure
that ifunc calls carry no hidden overhead relative to normal function
calls.

Test Plan:
I added a couple of regression tests and tested the FreeBSD kernel
build using the latest lld sources.

To demonstrate the effects of the change, I used a micro-benchmark
which results in frequent invocations of a FreeBSD kernel ifunc.  The
benchmark was run with and without IBRS enabled, and with and without
-zifunc-noplt configured.  The observed speedup is small and consistent,
and is significantly larger with IBRS enabled:

https://people.freebsd.org/~markj/ifunc-noplt/noibrs.txt
https://people.freebsd.org/~markj/ifunc-noplt/ibrs.txt

Reviewed By: ruiu, MaskRay

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

llvm-svn: 360685

5 years ago[X86] Disable shouldFoldConstantShiftPairToMask for scalar shifts on AMD targets...
Simon Pilgrim [Tue, 14 May 2019 15:21:28 +0000 (15:21 +0000)]
[X86] Disable shouldFoldConstantShiftPairToMask for scalar shifts on AMD targets (PR40758)

D61068 handled vector shifts, this patch does the same for scalars where there are similar number of pipes for shifts as bit ops - this is true almost entirely for AMD targets where the scalar ALUs are well balanced.

This combine avoids AND immediate mask which usually means we reduce encoding size.

Some tests show use of (slow, scaled) LEA instead of SHL in some cases, but thats due to particular shift immediates - shift+mask generate these just as easily.

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

llvm-svn: 360684

5 years ago[AArch64][SVE2] Asm: add SQRDMLAH/SQRDMLSH instructions
Cullen Rhodes [Tue, 14 May 2019 15:10:16 +0000 (15:10 +0000)]
[AArch64][SVE2] Asm: add SQRDMLAH/SQRDMLSH instructions

Summary:
This patch adds support for the indexed and unpredicated vectors forms of the
SQRDMLAH and SQRDMLSH instructions.

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: rovka

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

llvm-svn: 360683

5 years ago[AArch64][SVE2] Asm: add integer multiply-add/subtract (indexed) instructions
Cullen Rhodes [Tue, 14 May 2019 15:01:00 +0000 (15:01 +0000)]
[AArch64][SVE2] Asm: add integer multiply-add/subtract (indexed) instructions

Summary:
This patch adds support for the following instructions:

  MLA mul-add, writing addend (Zda = Zda +  Zn * Zm[idx])
  MLS mul-sub, writing addend (Zda = Zda + -Zn * Zm[idx])

Predicated forms of these instructions were added in SVE.

The specification can be found here:
https://developer.arm.com/docs/ddi0602/latest

Reviewed By: rovka

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

llvm-svn: 360682

5 years ago[Sema] CodeSynthesisContext - add missing variable initialization to constructor...
Simon Pilgrim [Tue, 14 May 2019 14:58:47 +0000 (14:58 +0000)]
[Sema] CodeSynthesisContext - add missing variable initialization to constructor. NFCI.

SavedInNonInstantiationSFINAEContext isn't used outside of specific contexts but this fixes cppcheck and scan-build warnings.

llvm-svn: 360681

5 years agoReplace lit feature keyword 'not_COFF' with 'uses_COFF'.
Paul Robinson [Tue, 14 May 2019 14:51:54 +0000 (14:51 +0000)]
Replace lit feature keyword 'not_COFF' with 'uses_COFF'.

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

llvm-svn: 360680

5 years ago[ELF] --gdb-index: fix SIGSEGV when a DWARFAddressRange has invalid SectionIndex
Fangrui Song [Tue, 14 May 2019 14:41:20 +0000 (14:41 +0000)]
[ELF] --gdb-index: fix SIGSEGV when a DWARFAddressRange has invalid SectionIndex

See D61891: llvm had a bug that might create invalid (DW_AT_low_pc,DW_AT_high_pc) pairs or range list entries due to missing DW_AT_addr_base.

Reviewed By: ruiu

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

llvm-svn: 360679

5 years agoDWARF v5: emit DW_AT_addr_base if DW_AT_low_pc references .debug_addr
Fangrui Song [Tue, 14 May 2019 14:37:26 +0000 (14:37 +0000)]
DWARF v5: emit DW_AT_addr_base if DW_AT_low_pc references .debug_addr

The condition !AddrPool.empty() is tested before attachRangesOrLowHighPC(), which may add an entry to AddrPool. We emit DW_AT_low_pc (DW_FORM_addrx) but may incorrectly omit DW_AT_addr_base for LineTablesOnly. This can be easily reproduced:

clang -gdwarf-5 -gmlt -c a.cc

Fix this by moving !AddrPool.empty() below.

This was discovered while investigating an lld crash (fixed by D61889) on such object files: ld.lld --gdb-index a.o

Reviewed By: probinson

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

llvm-svn: 360678

5 years ago[PowerPC] Custom lower known CR bit spills
Lei Huang [Tue, 14 May 2019 14:27:06 +0000 (14:27 +0000)]
[PowerPC] Custom lower known CR bit spills

For known CRBit spills, CRSET/CRUNSET, it is more efficient to load and spill
the known value instead of extracting the bit.

eg. This sequence is currently used to spill a CRUNSET:
    crclr   4*cr5+lt
    mfocrf  r3,4
    rlwinm  r3,r3,20,0,0
    stw     r3,132(r1)

This patch custom lower it to:
    li  r3,0
    stw r3,132(r1)

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

llvm-svn: 360677

5 years ago[llvm-readobj] - Apply clang format. NFC.
George Rimar [Tue, 14 May 2019 14:22:44 +0000 (14:22 +0000)]
[llvm-readobj] - Apply clang format. NFC.

I am a bit tired of the formatting issues.

llvm-svn: 360676

5 years ago[APFloat] APFloat::Storage::Storage - fix use after move
Simon Pilgrim [Tue, 14 May 2019 14:13:30 +0000 (14:13 +0000)]
[APFloat] APFloat::Storage::Storage - fix use after move

This was mentioned both in https://www.viva64.com/en/b/0629/ and by scan-build checks

llvm-svn: 360675

5 years ago[Driver][Windows] Add dependent lib argument for profile instr generate
Russell Gallop [Tue, 14 May 2019 14:01:40 +0000 (14:01 +0000)]
[Driver][Windows] Add dependent lib argument for profile instr generate

This is needed so lld-link can find clang_rt.profile when self hosting
on Windows with PGO. Using clang-cl as a linker knows to add the library
but self hosting, using -DCMAKE_LINKER=<...>/lld-link.exe doesn't.

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

llvm-svn: 360674

5 years ago[libc++] [test] Use std::nextafter() instead of std::nexttoward()
Michal Gorny [Tue, 14 May 2019 13:56:20 +0000 (13:56 +0000)]
[libc++] [test] Use std::nextafter() instead of std::nexttoward()

Use std::nextafter() instead of std::nexttoward() in midpoint tests.
In the context of this test, this should not cause any difference.
Since nexttowardl() is not implemented on NetBSD 8, the latter function
combined with 'long double' type caused test failure.  nextafterl() does
not have this problem.

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

llvm-svn: 360673

5 years ago[lit][tests]Add feature libcxx-used and use it in llvm-*-fuzzer tests
Xing Xue [Tue, 14 May 2019 13:54:33 +0000 (13:54 +0000)]
[lit][tests]Add feature libcxx-used and use it in llvm-*-fuzzer tests

When a LLVM binary such as llvm-*-fuzzer is built with libc++, it has dependency on libc++. The path to find shared libraries specified in llvm-*-fuzzer is relative. As a result, these binaries cannot be copied to an arbitrary directory and launched from there. Changes in this patch add a LIT feature to indicate that libc++ is used to build and, based on the feature exclude test cases that test by copying llvm-*-fuzzer binaries to a directory.

Reviewers: hubert.reinterpretcast, dberris, amyk, jasonliu, EricWF

Reviewed By: hubert.reinterpretcast, amyk

Subscribers: javed.absar, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 360672

5 years agoSave the induction binary operator in IVDescriptors for non FP induction variables.
Kit Barton [Tue, 14 May 2019 13:26:36 +0000 (13:26 +0000)]
Save the induction binary operator in IVDescriptors for non FP induction variables.

Summary:
Currently InductionBinOps are only saved for FP induction variables, the PR extends it with non FP induction variable, so user of IVDescriptors can query the InductionBinOps for integer induction variables.

The changes in hasUnsafeAlgebra() and getUnsafeAlgebraInst() are required for the existing LIT test cases to pass. As described in the comment of the two functions, one of the requirement to return true is it is a FP induction variable. The checks was not needed because InductionBinOp was not set on non FP cases before.

https://reviews.llvm.org/D60565 depends on the patch.

Committed on behalf of @Whitney (Whitney Tsang).

Reviewers: jdoerfert, kbarton, fhahn, hfinkel, dmgreen, Meinersbur

Reviewed By: jdoerfert

Subscribers: mgorny, hiraditya, jsji, llvm-commits

Tags: #llvm

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

llvm-svn: 360671

5 years agoTableGen: support #ifndef in addition to #ifdef.
Tim Northover [Tue, 14 May 2019 13:04:25 +0000 (13:04 +0000)]
TableGen: support #ifndef in addition to #ifdef.

TableGen has a limited preprocessor, which only really supports
easier.

llvm-svn: 360670

5 years agoDWARF/NFC: Centralize DIERef conversions
Pavel Labath [Tue, 14 May 2019 12:44:40 +0000 (12:44 +0000)]
DWARF/NFC: Centralize DIERef conversions

apple and manual indexing code were creating a DIERef in a bunch of
places. Though the code itself is not much, it is also easy to simplify
by factoring out the DIERef creation. In HashedNameToDIE I create a
conversion operator from DIEInfo to DIERef, and in ManualDWARFIndex I
just create the DIERef in a global variable up-front.

This also reduces the diff in follow-up patches which change how DIERefs
are constructed.

llvm-svn: 360669

5 years agoMake getObjCEncodingForTypeImpl() take a bitmask instead of 8 bools
Nico Weber [Tue, 14 May 2019 12:32:37 +0000 (12:32 +0000)]
Make getObjCEncodingForTypeImpl() take a bitmask instead of 8 bools

Slightly easier to read, uses slightly less stack space, and makes it
impossible to mix up the order of all those bools.

No behavior change.

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

llvm-svn: 360668

5 years agoAdd a new language mode for C2x; enable [[attribute]] support by default in C2x.
Aaron Ballman [Tue, 14 May 2019 12:09:55 +0000 (12:09 +0000)]
Add a new language mode for C2x; enable [[attribute]] support by default in C2x.

llvm-svn: 360667

5 years agoMove SymbolTable::addFile to InputFiles.cpp.
Rui Ueyama [Tue, 14 May 2019 12:03:13 +0000 (12:03 +0000)]
Move SymbolTable::addFile to InputFiles.cpp.

The symbol table used to be a container of vectors of input files,
but that's no longer the case because the vectors are moved out of
SymbolTable and are now global variables.

Therefore, addFile doesn't have to belong to any class. This patch
moves the function out of the class.

This patch is a preparation for my RFC [1].

[1] http://lists.llvm.org/pipermail/llvm-dev/2019-April/131902.html

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

llvm-svn: 360666

5 years agoReinstate "FileCheck [5/12]: Introduce regular numeric variables"
Thomas Preud'homme [Tue, 14 May 2019 11:58:30 +0000 (11:58 +0000)]
Reinstate "FileCheck [5/12]: Introduce regular numeric variables"

This reinstates r360578 (git e47362c1ec1ea31b626336cc05822035601c3e57),
reverted in r360653 (git 004393681c25e34e921adccc69ae6378090dee54),
with a fix for the list added in FileCheck.rst to build without error.

Copyright:
    - Linaro (changes up to diff 183612 of revision D55940)
    - GraphCore (changes in later versions of revision D55940 and
                 in new revision created off D55940)

Reviewers: jhenderson, chandlerc, jdenny, probinson, grimar,
arichardson, rnk

Subscribers: hiraditya, llvm-commits, probinson, dblaikie, grimar,
arichardson, tra, rnk, kristina, hfinkel, rogfer01, JonChesterfield

Tags: #llvm

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

llvm-svn: 360665

5 years ago[X86] X86TargetLowering::LowerINTRINSIC_WO_CHAIN - ensure rounding control is initial...
Simon Pilgrim [Tue, 14 May 2019 11:30:39 +0000 (11:30 +0000)]
[X86] X86TargetLowering::LowerINTRINSIC_WO_CHAIN - ensure rounding control is initialized. NFCI.

Fixes scan-build warnings

llvm-svn: 360664

5 years agoAArch64: support binutils-like things on arm64_32.
Tim Northover [Tue, 14 May 2019 11:25:44 +0000 (11:25 +0000)]
AArch64: support binutils-like things on arm64_32.

This adds support for the arm64_32 watchOS ABI to LLVM's low level tools,
teaching them about the specific MachO choices and constants needed to
disassemble things.

llvm-svn: 360663

5 years agoGlobalOpt: do not promote globals used atomically to constants.
Tim Northover [Tue, 14 May 2019 11:03:13 +0000 (11:03 +0000)]
GlobalOpt: do not promote globals used atomically to constants.

Some atomic loads are implemented as cmpxchg (particularly if large or
floating), and that usually requires write access to the memory involved
or it will segfault.

We can still propagate the constant value to users we understand though.

llvm-svn: 360662

5 years ago[llvm-objcopy] Cache gnu_debuglink's target CRC
James Henderson [Tue, 14 May 2019 10:59:04 +0000 (10:59 +0000)]
[llvm-objcopy] Cache gnu_debuglink's target CRC

.gnu_debuglink section contains information regarding file with
debugging symbols, identified by its CRC32. This target file is not
intended to ever change or it would invalidate the stored checksum, yet
the checksum is calculated over and over again for each of the objects
inside the archive, usually hundreds of times.

This patch precomputes the CRC32 of the target once and then reuses the
value where required, saving lots of redundant I/O.

The error message reported should stay the same, although now it might
be reported earlier.

Reviewed by: jhenderson, jakehehrlich, MaskRay

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

Patch by Michal Janiszewski

llvm-svn: 360661

5 years ago[test]Make test work on Windows
James Henderson [Tue, 14 May 2019 10:53:35 +0000 (10:53 +0000)]
[test]Make test work on Windows

Previously, the test didn't work because '\' characters appeared in the
sed string, causing bogus escape characters to form in the substituted
string literal. Switching to using '%/p' causes the path to be emitted
with '/' characters instead, so that there are are no escaping issues.

Reviewed by: kzhuravl, grimar

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

llvm-svn: 360660

5 years ago[MemorySanitizer] getMMXVectorTy - assert valid element size. NFCI.
Simon Pilgrim [Tue, 14 May 2019 10:29:18 +0000 (10:29 +0000)]
[MemorySanitizer] getMMXVectorTy - assert valid element size. NFCI.

Fixes scan-build warnings

llvm-svn: 360658

5 years agoRevert r360637 "PR41817: Fix regression in r359260 that caused the MS compatibility"
Hans Wennborg [Tue, 14 May 2019 10:11:33 +0000 (10:11 +0000)]
Revert r360637 "PR41817: Fix regression in r359260 that caused the MS compatibility"

> extension allowing a "static" declaration to follow an "extern"
> declaration to stop working.

It introduced asserts for some "static-following-extern" cases, breaking the
Chromium build. See the cfe-commits thread for reproducer.

llvm-svn: 360657

5 years ago[IRTranslator] Don't hardcode GEP index type
Diana Picus [Tue, 14 May 2019 09:25:17 +0000 (09:25 +0000)]
[IRTranslator] Don't hardcode GEP index type

When breaking up loads and stores of aggregates, the IRTranslator uses
LLT::scalar(64) for the index type of the G_GEP instructions that
compute the addresses. This is unnecessarily large for 32-bit targets.
Use the int ptr type provided by the DataLayout instead.

Note that we're already doing the right thing when translating
getelementptr instructions from the IR. This is just an oversight when
generating new ones while translating loads/stores.

Both x86 and AArch64 already have tests confirming that the old
behaviour is preserved for 64-bit targets.

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

llvm-svn: 360656

5 years agoTestMinidumpNew.py: Use yaml2obj where possible
Pavel Labath [Tue, 14 May 2019 08:59:08 +0000 (08:59 +0000)]
TestMinidumpNew.py: Use yaml2obj where possible

Replace checked-in minidumps with their yaml forms now that yaml2obj
supports the ThreadList stream. I delete the test_modules_in_mini_dump
test altogether as this functionality is covered more systematically in
TestMinidumpUUID.py.

llvm-svn: 360655

5 years agotypedef enum -> enum
Fangrui Song [Tue, 14 May 2019 08:55:50 +0000 (08:55 +0000)]
typedef enum -> enum

Reviewed By: labath

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

llvm-svn: 360654

5 years agoRevert "FileCheck [5/12]: Introduce regular numeric variables"
Thomas Preud'homme [Tue, 14 May 2019 08:43:11 +0000 (08:43 +0000)]
Revert "FileCheck [5/12]: Introduce regular numeric variables"

This reverts r360578 (git e47362c1ec1ea31b626336cc05822035601c3e57) to
solve the sphinx build failure on
http://lab.llvm.org:8011/builders/llvm-sphinx-docs buildbot.

llvm-svn: 360653

5 years ago[CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER
Pavel Labath [Tue, 14 May 2019 08:18:06 +0000 (08:18 +0000)]
[CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER

r360631 introduced a "syntax error" which meant that cmake was still not
honoring the value of LLDB_CAN_USE_LLDB_SERVER variable. The correct
syntax for seting an internal cache variable is "set(VAR value CACHE
INTERNAL)", but the patch omitted the "CACHE" keyword. The "syntax
error" is in quotes because without the CACHE keyword this is still
valid syntax for setting the value of LLDB_CAN_USE_LLDB_SERVER to "1
INTERNAL".

There doesn't seem to be a need for this to be a cache variable so I'm
reverting this variable to a plain one, as it was before r360621.

This will hopefully fix the windows build.

llvm-svn: 360652