platform/upstream/llvm.git
6 years agoUse EVT::changeVectorElementTypeToInteger() to convert index type to integer
Simon Pilgrim [Tue, 23 Jan 2018 15:30:07 +0000 (15:30 +0000)]
Use EVT::changeVectorElementTypeToInteger() to convert index type to integer

llvm-svn: 323207

6 years ago[X86][SSE] LowerBUILD_VECTORAsVariablePermute - ensure that the index vector has...
Simon Pilgrim [Tue, 23 Jan 2018 15:13:37 +0000 (15:13 +0000)]
[X86][SSE] LowerBUILD_VECTORAsVariablePermute - ensure that the index vector has the correct number of elements

llvm-svn: 323206

6 years agoAArch64: get type from correct result when forming BFX
Tim Northover [Tue, 23 Jan 2018 15:11:27 +0000 (15:11 +0000)]
AArch64: get type from correct result when forming BFX

Some nodes produce multiple values so when obtaining the type of an ISD::OR we
need to make sure we ask for the correct one. Hopefully that's all of them.

llvm-svn: 323205

6 years ago[clangd] Simplify code handling compile commands
Ilya Biryukov [Tue, 23 Jan 2018 15:07:52 +0000 (15:07 +0000)]
[clangd] Simplify code handling compile commands

Summary:
CppFile can now change compilation arguments during rebuild. This allows
simplifying code that manages CppFiles.

Reviewers: sammccall, bkramer, jkorous-apple

Reviewed By: sammccall

Subscribers: ioeric, jkorous-apple, klimek, cfe-commits

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

llvm-svn: 323204

6 years agoAccept iso date format in COFF/unchanged-importlib.test
Hans Wennborg [Tue, 23 Jan 2018 14:41:39 +0000 (14:41 +0000)]
Accept iso date format in COFF/unchanged-importlib.test

llvm-svn: 323203

6 years agoAArch64: get type from correct result when forming BFI/BFM
Tim Northover [Tue, 23 Jan 2018 14:37:03 +0000 (14:37 +0000)]
AArch64: get type from correct result when forming BFI/BFM

Some nodes produce multiple values so when obtaining the type of an ISD::OR we
need to make sure we ask for the correct one.

llvm-svn: 323202

6 years ago[X86] Legalize v32i1 without BWI via splitting to v16i1 rather than the default of...
Craig Topper [Tue, 23 Jan 2018 14:25:39 +0000 (14:25 +0000)]
[X86] Legalize v32i1 without BWI via splitting to v16i1 rather than the default of promoting to v32i8.

Summary:
For the most part its better to keep v32i1 as a mask type of a narrower width than trying to promote it to a ymm register.

I had to add some overrides to the methods that get the types for the calling convention so that we still use v32i8 for argument/return purposes.

There are still some regressions in here. I definitely saw some around shuffles. I think we probably should move vXi1 shuffle from lowering to a DAG combine where I think the extend and truncate we have to emit would be better combined.

I think we also need a DAG combine to remove trunc from (extract_vector_elt (trunc))

Overall this removes something like 13000 CHECK lines from lit tests.

Reviewers: zvi, RKSimon, delena, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

llvm-svn: 323201

6 years ago[X86] Add missing MOVSX/MOVZX instructions to load folding tables.
Craig Topper [Tue, 23 Jan 2018 14:09:22 +0000 (14:09 +0000)]
[X86] Add missing MOVSX/MOVZX instructions to load folding tables.

I'm not sure there's any way to generate these folding cases especially the movzx ones since even the register form is never emitted by codegen.

I'm just adding them to remove the difference with the autogenerated version of the folding table.

llvm-svn: 323200

6 years agoFix Driver/solaris-ld.c test on Windows
Fedor Sergeev [Tue, 23 Jan 2018 13:59:11 +0000 (13:59 +0000)]
Fix Driver/solaris-ld.c test on Windows

Fixing failure introduced with r323193.

llvm-svn: 323199

6 years agollvm-objdump: prevent out of bounds accesses during unwind dumping.
Tim Northover [Tue, 23 Jan 2018 13:51:57 +0000 (13:51 +0000)]
llvm-objdump: prevent out of bounds accesses during unwind dumping.

We were a bit too trusting about the offsets encoded in MachO compact unwind
sections, so this passes every access through a bounds check just in case. It
prevents a few segfaults on malformed object files, if one should ever come
along.

Mostly to silence fuzzers in the vague hope they might be able to produce
something useful without the noise.

llvm-svn: 323198

6 years agoFix memory leaks in GoParser
Raphael Isemann [Tue, 23 Jan 2018 13:50:46 +0000 (13:50 +0000)]
Fix memory leaks in GoParser

Summary: The GoParser is leaking memory in the tests due to not freeing allocated nodes when encountering some parsing errors. With this patch all GoParser tests are passing with enabled memory sanitizers/ubsan.

Reviewers: labath, davide

Reviewed By: labath

Subscribers: lldb-commits

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

llvm-svn: 323197

6 years ago[clang-tidy] Add -vfsoverlay flag
Ilya Biryukov [Tue, 23 Jan 2018 12:31:06 +0000 (12:31 +0000)]
[clang-tidy] Add -vfsoverlay flag

Summary:
It allows to remap and override files and directories on disk when
running clang-tidy. The intended use case for the flag is running
standalone clang-tidy binary for IDE and editor integration.

Patch by Vladimir Plyashkun.

Reviewers: alexfh, benlangmuir, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ilya-biryukov, cfe-commits

Tags: #clang-tools-extra

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

llvm-svn: 323196

6 years ago[Tooling] Added a VFS parameter to ClangTool
Ilya Biryukov [Tue, 23 Jan 2018 12:30:02 +0000 (12:30 +0000)]
[Tooling] Added a VFS parameter to ClangTool

Summary:
The parameter overrides the underlying vfs used by ClangTool for
filesystem operations.

Patch by Vladimir Plyashkun.

Reviewers: alexfh, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, cfe-commits

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

llvm-svn: 323195

6 years ago[Solaris] Make RHEL devtoolsets handling Linux-specific
Fedor Sergeev [Tue, 23 Jan 2018 12:24:01 +0000 (12:24 +0000)]
[Solaris] Make RHEL devtoolsets handling Linux-specific

Summary:
This patch is meant to address the last outstanding review comment on the already approved
(but not yet commited) https://reviews.llvm.org/D35755, namely making the handling of the RHEL
devtoolsets Linux-specific.

Don't know if it's best integrated into the former or applied subsequently.

Tested on i386-pc-solaris2.11 and x86_64-pc-linux-gnu.

Reviewers: fedor.sergeev, tstellar, jyknight

Reviewed By: fedor.sergeev

Subscribers: cfe-commits

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

llvm-svn: 323194

6 years ago[Solaris] gcc toolchain handling revamp
Fedor Sergeev [Tue, 23 Jan 2018 12:23:52 +0000 (12:23 +0000)]
[Solaris] gcc toolchain handling revamp

Summary:
General idea is to utilize generic (mostly Generic_GCC) code
and get rid of Solaris-specific handling as much as possible.

In particular:
- scanLibDirForGCCTripleSolaris was removed, relying on generic
  CollectLibDirsAndTriples

- findBiarchMultilibs is now properly utilized to switch between
   m32 and m64 include & lib paths on Solaris

- C system include handling copied from Linux (bar multilib hacks)

Fixes PR24606.

Reviewers: dlj, rafael, jyknight, theraven, tstellar

Reviewed By: jyknight

Subscribers: aaron.ballman, mgorny, krytarowski, ro, joerg, cfe-commits

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

llvm-svn: 323193

6 years ago[CGP] Fix the GV handling in complex addressing mode
Serguei Katkov [Tue, 23 Jan 2018 12:07:49 +0000 (12:07 +0000)]
[CGP] Fix the GV handling in complex addressing mode

If in complex addressing mode the difference is in GV then
base reg should not be installed because we plan to use
base reg as a merge point of different GVs.

This is a fix for PR35980.

Reviewers: reames, john.brawn, santosh
Reviewed By: john.brawn
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D42230

llvm-svn: 323192

6 years ago[clang-tidy] Don't generate fixes for invalid new expr location in modernize-make...
Haojian Wu [Tue, 23 Jan 2018 11:43:18 +0000 (11:43 +0000)]
[clang-tidy] Don't generate fixes for invalid new expr location in modernize-make-unique.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, xazax.hun, cfe-commits

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

llvm-svn: 323191

6 years ago[X86][SSE] LowerBUILD_VECTORAsVariablePermute - fix PSHUFB source/index operand ordering
Simon Pilgrim [Tue, 23 Jan 2018 11:39:06 +0000 (11:39 +0000)]
[X86][SSE] LowerBUILD_VECTORAsVariablePermute - fix PSHUFB source/index operand ordering

As detailed in rL317463, PSHUFB (like most variable shuffle instructions) uses Op[0] for the source vector and Op[1] for the shuffle index vector, VPERMV works in reverse which is probably where the confusion comes from.

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

llvm-svn: 323190

6 years ago[clangd] Use accessible scopes to query indexes for global code completion.
Haojian Wu [Tue, 23 Jan 2018 11:37:26 +0000 (11:37 +0000)]
[clangd] Use accessible scopes to query indexes for global code completion.

Summary:
 * For qualified completion (foo::a^)
       * unresolved qualifier - use global namespace ("::")
       * resolved qualifier - use all accessible namespaces inside the resolved qualifier.
 * For unqualified completion (vec^), use scopes that are accessible from the
      scope from which code completion occurs.

Reviewers: sammccall, ilya-biryukov

Reviewed By: sammccall

Subscribers: jkorous-apple, ioeric, klimek, cfe-commits

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

llvm-svn: 323189

6 years ago[clang-format] Ignore UnbreakableTailLength sometimes during breaking
Krasimir Georgiev [Tue, 23 Jan 2018 11:26:19 +0000 (11:26 +0000)]
[clang-format] Ignore UnbreakableTailLength sometimes during breaking

Summary:
This patch fixes an issue where the UnbreakableTailLength would be counted towards
the length of a token during breaking, even though we can break after the token.

For example, this proto text with column limit 20
```
# ColumnLimit: 20  V
foo: {
  bar: {
    bazoo: "aaaaaaa"
  }
}
```
was broken:
```
# ColumnLimit: 20  V
foo: {
  bar: {
    bazoo:
        "aaaaaaa"
  }
}
```
because the 2 closing `}` were counted towards the string literal's `UnbreakableTailLength`.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 323188

6 years ago[Analysis] Disable exp/exp2/pow finite lib calls on Android with -ffast-math.
MinSeong Kim [Tue, 23 Jan 2018 11:11:36 +0000 (11:11 +0000)]
[Analysis] Disable exp/exp2/pow finite lib calls on Android with -ffast-math.

Summary:
Since r322087, glibc's finite lib calls are generated when possible.
However, glibc is not supported on Android. Therefore this change
enables llvm to finely distinguish between linux and Android for
unsupported library calls. The change also include some regression
tests.

Reviewers: srhines, pirama

Reviewed By: srhines

Subscribers: kongyi, chh, javed.absar, llvm-commits

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

llvm-svn: 323187

6 years ago[ARM] Pass _Float16 as int or float
Sjoerd Meijer [Tue, 23 Jan 2018 10:13:49 +0000 (10:13 +0000)]
[ARM] Pass _Float16 as int or float

Pass and return _Float16 as if it were an int or float for ARM, but with the
top 16 bits unspecified, similarly like we already do for __fp16.

We will implement proper half-precision function argument lowering in the ARM
backend soon, but want to use this workaround in the mean time.

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

llvm-svn: 323185

6 years ago[mips] Properly select abs and sqrt instructions
Stefan Maksimovic [Tue, 23 Jan 2018 10:09:39 +0000 (10:09 +0000)]
[mips] Properly select abs and sqrt instructions

- Alter abs for micromips to have both AFGR64 and FGR64
  variants, same as sqrt
- Remove sqrt and abs from MicroMips32r6InstrInfo.td,
  use micromips FGR64 variants
- Restrict non-micromips abs/sqrt with NotInMicroMips
  predicate

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

llvm-svn: 323184

6 years agoThis change add's optimization remark in LoopVersioning LICM pass.
Ashutosh Nema [Tue, 23 Jan 2018 09:47:28 +0000 (09:47 +0000)]
This change add's optimization remark in LoopVersioning LICM pass.

Summary:
This patch is adding remark messages to the LoopVersioning LICM pass,
which will be useful for optimization remark emitter (ORE) infrastructure.

Patch by: Deepak Porwal

Reviewers: anemet, ashutosh.nema, eastig

Subscribers: eastig, vivekvpandya, fhahn, llvm-commits
llvm-svn: 323183

6 years ago[InstSimplify] (X << Y) % X -> 0
Anton Bikineev [Tue, 23 Jan 2018 09:27:47 +0000 (09:27 +0000)]
[InstSimplify] (X << Y) % X -> 0

llvm-svn: 323182

6 years agoPrevent unaligned memory read in parseMinidumpString
Raphael Isemann [Tue, 23 Jan 2018 08:04:27 +0000 (08:04 +0000)]
Prevent unaligned memory read in parseMinidumpString

Summary:
It's possible to hit an unaligned memory read when reading `source_length` as the `data` array is only aligned with 2 bytes (it's actually a UTF16 array). This patch memcpy's `source_length` into a local variable to prevent this:

```
MinidumpTypes.cpp:49:23: runtime error: load of misaligned address 0x7f0f4792692a for type 'const uint32_t' (aka 'const unsigned int'), which requires 4 byte alignment
```

Reviewers: dvlahovski, zturner, davide

Reviewed By: davide

Subscribers: davide, lldb-commits

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

llvm-svn: 323181

6 years agoFix name of 'macOS' and add asteriks to brands, NFC.
Jonas Hahnfeld [Tue, 23 Jan 2018 07:54:10 +0000 (07:54 +0000)]
Fix name of 'macOS' and add asteriks to brands, NFC.

llvm-svn: 323180

6 years agoupdate_mir_test_checks: Improve the check for LLVM IR in MIR files
Justin Bogner [Tue, 23 Jan 2018 06:39:04 +0000 (06:39 +0000)]
update_mir_test_checks: Improve the check for LLVM IR in MIR files

The LLVM IR section of a MIR document can start with "--- |" rather
than just "---", because "|" is a sigil for a freeform document in
YAML. We need to handle this so that we don't try to add check lines
to the LLVM IR functions in a MIR file.

llvm-svn: 323178

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Tue, 23 Jan 2018 05:50:06 +0000 (05:50 +0000)]
[NFC] fix trivial typos in comments

"the the" -> "the"

llvm-svn: 323177

6 years ago[NFC] fix trivial typos in comments
Hiroshi Inoue [Tue, 23 Jan 2018 05:49:30 +0000 (05:49 +0000)]
[NFC] fix trivial typos in comments

"the the" -> "the"

llvm-svn: 323176

6 years ago[X86] Don't reorder (srl (and X, C1), C2) if (and X, C1) can be matched as a movzx
Craig Topper [Tue, 23 Jan 2018 05:45:52 +0000 (05:45 +0000)]
[X86] Don't reorder (srl (and X, C1), C2) if (and X, C1) can be matched as a movzx

Summary:
If we can match as a zero extend there's no need to flip the order to get an encoding benefit. As movzx is 3 bytes with independent source/dest registers. The shortest 'and' we could make is also 3 bytes unless we get lucky in the register allocator and its on AL/AX/EAX which have a 2 byte encoding.

This patch was more impressive before r322957 went in. It removed some of the same Ands that got deleted by that patch.

Reviewers: spatel, RKSimon

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 323175

6 years ago[X86] Remove 'NOREX' comment from the printing of _NOREX instructions.
Craig Topper [Tue, 23 Jan 2018 05:37:00 +0000 (05:37 +0000)]
[X86] Remove 'NOREX' comment from the printing of _NOREX instructions.

Some of the NOREX instructions are used in 32-bit mode making this printing confusing. It also doesn't provide a lot of value since you can see the h-register being used by the instruction.

llvm-svn: 323174

6 years ago[X86] Various vXi1 insertion improvements.
Craig Topper [Tue, 23 Jan 2018 05:36:53 +0000 (05:36 +0000)]
[X86] Various vXi1 insertion improvements.

Add missing patterns for inserting v1i1 into a zero vector. Use insert_subvector to zero upper bits before inserting an element into a vXi1 vector. Replace kshift based isel pattern with insert_subvector based pattern now that code that caused the pattern has been fixed to emit insert_subvector.

llvm-svn: 323173

6 years agoUse 4 as the alignment of .eh_frame_hdr.
Rafael Espindola [Tue, 23 Jan 2018 05:23:23 +0000 (05:23 +0000)]
Use 4 as the alignment of .eh_frame_hdr.

It includes 32 bit values and this matches both gold and bfd.

llvm-svn: 323172

6 years ago[cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.
Don Hinton [Tue, 23 Jan 2018 03:30:23 +0000 (03:30 +0000)]
[cmake] Always respect existing CMAKE_REQUIRED_FLAGS when adding additional ones.

* Previously part of https://reviews.llvm.org/D41622.

llvm-svn: 323171

6 years agolibcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* filename...
Peter Collingbourne [Tue, 23 Jan 2018 02:07:27 +0000 (02:07 +0000)]
libcxx: Provide overloads for basic_filebuf::open() et al that take wchar_t* filenames on Windows.

This is an MSVC standard library extension. It seems like a reasonable
enough extension to me because wchar_t* is the native format for
filenames on that platform.

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

llvm-svn: 323170

6 years agolibcxx: Move Windows threading support into a .cpp file.
Peter Collingbourne [Tue, 23 Jan 2018 01:59:43 +0000 (01:59 +0000)]
libcxx: Move Windows threading support into a .cpp file.

This allows us to avoid polluting the namespace of users of <thread>
with the definitions in windows.h.

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

llvm-svn: 323169

6 years ago[WebAssembly] Update to match llvm changes to TABLE relocations
Sam Clegg [Tue, 23 Jan 2018 01:25:56 +0000 (01:25 +0000)]
[WebAssembly] Update to match llvm changes to TABLE relocations

TABLE relocations now store the function that is being refered
to indirectly.

See rL323165.

Also extend the call-indirect.ll a little.

Based on a patch by Nicholas Wilson!

llvm-svn: 323168

6 years agoNewPM: Improve/fix GCOV - which needs to run early in the pass pipeline.
David Blaikie [Tue, 23 Jan 2018 01:25:24 +0000 (01:25 +0000)]
NewPM: Improve/fix GCOV - which needs to run early in the pass pipeline.

Using a new extension point in the new PM, register GCOV at the start of
the pipeline rather than the end.

llvm-svn: 323167

6 years agoNewPM: Add an extension point for the start of the pipeline.
David Blaikie [Tue, 23 Jan 2018 01:25:20 +0000 (01:25 +0000)]
NewPM: Add an extension point for the start of the pipeline.

This applies to most pipelines except the LTO and ThinLTO backend
actions - it is for use at the beginning of the overall pipeline.

This extension point will be used to add the GCOV pass when enabled in
Clang.

llvm-svn: 323166

6 years ago[WebAssembly] Store function index rather than table index in TABLE_INDEX relocations
Sam Clegg [Tue, 23 Jan 2018 01:23:17 +0000 (01:23 +0000)]
[WebAssembly] Store function index rather than table index in TABLE_INDEX relocations

Relocations of type R_WEBASSEMBLY_TABLE_INDEX represent places
where the table index for a given function is needed.  While the
value stored in this location is a table index, the index in
the relocation entry itself is a function index (the index of
the function which is to be called indirectly).

This is how is was spec'd originally but the LLVM implementation
didn't do this.  This makes things a little simpler in the linker
since the table in the input file can essentially be ignored that
the output table can be created purely based on these relocations.

Patch by Nicholas Wilson!

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

llvm-svn: 323165

6 years ago[COFF] don't replace import library if contents are unchanged
Bob Haarman [Tue, 23 Jan 2018 00:36:42 +0000 (00:36 +0000)]
[COFF] don't replace import library if contents are unchanged

Summary:
This detects when an import library is about to be overwritten with a
newly built one with the same contents, and keeps the old library
instead. The use case for this is to avoid needlessly rebuilding
targets that depend on the import library in build systems that rely
on timestamps to determine whether a target requires rebuilding.

This feature was requested in PR35917.

Reviewers: rnk, ruiu, zturner, pcc

Reviewed By: ruiu

Subscribers: llvm-commits

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

llvm-svn: 323164

6 years ago[lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by
Lang Hames [Mon, 22 Jan 2018 23:53:56 +0000 (23:53 +0000)]
[lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by
building method override tables for CXXMethodDecls in
DWARFASTParserClang::CompleteTypeFromDWARF.

C++ virtual method calls in LLDB expressions may fail if the override table for
the method being called is not correct as IRGen will produce references to the
wrong (or a missing) vtable entry.

This patch does not fix calls to virtual methods with covariant return types as
it mistakenly treats these as overloads, rather than overrides. This will be
addressed in a future patch.

Review: https://reviews.llvm.org/D41997

Partially fixes <rdar://problem/14205774>

llvm-svn: 323163

6 years agoSmall fixes for detect_invalid_pointer_pairs.
Alex Shlyapnikov [Mon, 22 Jan 2018 23:28:52 +0000 (23:28 +0000)]
Small fixes for detect_invalid_pointer_pairs.

Summary:
One test-case uses a wrong operation (should be subtraction).
Second test-case should declare a global variables before a tested one
in order to guarantee we will find a red-zone.

Reviewers: kcc, jakubjelinek, alekseyshl

Reviewed By: alekseyshl

Subscribers: kubamracek

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

llvm-svn: 323162

6 years agoRevert r322595: Specify inline for isWhitespace in CommandLine.cpp
Rui Ueyama [Mon, 22 Jan 2018 23:27:50 +0000 (23:27 +0000)]
Revert r322595: Specify inline for isWhitespace in CommandLine.cpp

The original change was made based on a misunderstanding that
-DCMAKE_BUILD_TYPE=RelWithDebugInfo would produce the same executable
as -DCMAKE_BUILD_TYPE=Release modulo debug info. Turned out that's not
true -- it at least disables some optimizations such as function inlining.

llvm-svn: 323161

6 years agoUpdate cxx2a status
Marshall Clow [Mon, 22 Jan 2018 23:17:20 +0000 (23:17 +0000)]
Update cxx2a status

llvm-svn: 323160

6 years agoLast batch of P0202 constexpr additions: includes/set_intersection/exchange
Marshall Clow [Mon, 22 Jan 2018 23:10:40 +0000 (23:10 +0000)]
Last batch of P0202 constexpr additions: includes/set_intersection/exchange

llvm-svn: 323159

6 years agoAdd hasTrailingReturn AST matcher
Julie Hockett [Mon, 22 Jan 2018 22:45:23 +0000 (22:45 +0000)]
Add hasTrailingReturn AST matcher

Adds AST matcher for a FunctionDecl that has a trailing return type.

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

llvm-svn: 323158

6 years ago[ASTMatchers] [NFC] Fix code examples
Fangrui Song [Mon, 22 Jan 2018 22:34:15 +0000 (22:34 +0000)]
[ASTMatchers] [NFC] Fix code examples

Subscribers: klimek, cfe-commits

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

llvm-svn: 323157

6 years agoReland "[CodeGen] Fix crash when a function taking transparent union is redeclared."
Volodymyr Sapsai [Mon, 22 Jan 2018 22:29:24 +0000 (22:29 +0000)]
Reland "[CodeGen] Fix crash when a function taking transparent union is redeclared."

When a function taking transparent union is declared as taking one of
union members earlier in the translation unit, clang would hit an
"Invalid cast" assertion during EmitFunctionProlog. This case
corresponds to function f1 in test/CodeGen/transparent-union-redecl.c.
We decided to cast i32 to union because after merging function
declarations function parameter type becomes int,
CGFunctionInfo::ArgInfo type matches with ABIArgInfo type, so we decide
it is a trivial case. But these types should also be castable to
parameter declaration type which is not the case here.

Now the fix is in converting from ABIArgInfo type to VarDecl type and using
argument demotion when necessary.

Additional tests in Sema/transparent-union.c capture current behavior and make
sure there are no regressions.

rdar://problem/34949329

Reviewers: rjmccall, rafael

Reviewed By: rjmccall

Subscribers: aemerson, cfe-commits, kristof.beyls, ahatanak

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

llvm-svn: 323156

6 years agoIntroduce the "retpoline" x86 mitigation technique for variant #2 of the speculative...
Chandler Carruth [Mon, 22 Jan 2018 22:05:25 +0000 (22:05 +0000)]
Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre..

Summary:
First, we need to explain the core of the vulnerability. Note that this
is a very incomplete description, please see the Project Zero blog post
for details:
https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

The basis for branch target injection is to direct speculative execution
of the processor to some "gadget" of executable code by poisoning the
prediction of indirect branches with the address of that gadget. The
gadget in turn contains an operation that provides a side channel for
reading data. Most commonly, this will look like a load of secret data
followed by a branch on the loaded value and then a load of some
predictable cache line. The attacker then uses timing of the processors
cache to determine which direction the branch took *in the speculative
execution*, and in turn what one bit of the loaded value was. Due to the
nature of these timing side channels and the branch predictor on Intel
processors, this allows an attacker to leak data only accessible to
a privileged domain (like the kernel) back into an unprivileged domain.

The goal is simple: avoid generating code which contains an indirect
branch that could have its prediction poisoned by an attacker. In many
cases, the compiler can simply use directed conditional branches and
a small search tree. LLVM already has support for lowering switches in
this way and the first step of this patch is to disable jump-table
lowering of switches and introduce a pass to rewrite explicit indirectbr
sequences into a switch over integers.

However, there is no fully general alternative to indirect calls. We
introduce a new construct we call a "retpoline" to implement indirect
calls in a non-speculatable way. It can be thought of loosely as
a trampoline for indirect calls which uses the RET instruction on x86.
Further, we arrange for a specific call->ret sequence which ensures the
processor predicts the return to go to a controlled, known location. The
retpoline then "smashes" the return address pushed onto the stack by the
call with the desired target of the original indirect call. The result
is a predicted return to the next instruction after a call (which can be
used to trap speculative execution within an infinite loop) and an
actual indirect branch to an arbitrary address.

On 64-bit x86 ABIs, this is especially easily done in the compiler by
using a guaranteed scratch register to pass the target into this device.
For 32-bit ABIs there isn't a guaranteed scratch register and so several
different retpoline variants are introduced to use a scratch register if
one is available in the calling convention and to otherwise use direct
stack push/pop sequences to pass the target address.

This "retpoline" mitigation is fully described in the following blog
post: https://support.google.com/faqs/answer/7625886

We also support a target feature that disables emission of the retpoline
thunk by the compiler to allow for custom thunks if users want them.
These are particularly useful in environments like kernels that
routinely do hot-patching on boot and want to hot-patch their thunk to
different code sequences. They can write this custom thunk and use
`-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this
case, on x86-64 thu thunk names must be:
```
  __llvm_external_retpoline_r11
```
or on 32-bit:
```
  __llvm_external_retpoline_eax
  __llvm_external_retpoline_ecx
  __llvm_external_retpoline_edx
  __llvm_external_retpoline_push
```
And the target of the retpoline is passed in the named register, or in
the case of the `push` suffix on the top of the stack via a `pushl`
instruction.

There is one other important source of indirect branches in x86 ELF
binaries: the PLT. These patches also include support for LLD to
generate PLT entries that perform a retpoline-style indirection.

The only other indirect branches remaining that we are aware of are from
precompiled runtimes (such as crt0.o and similar). The ones we have
found are not really attackable, and so we have not focused on them
here, but eventually these runtimes should also be replicated for
retpoline-ed configurations for completeness.

For kernels or other freestanding or fully static executables, the
compiler switch `-mretpoline` is sufficient to fully mitigate this
particular attack. For dynamic executables, you must compile *all*
libraries with `-mretpoline` and additionally link the dynamic
executable and all shared libraries with LLD and pass `-z retpolineplt`
(or use similar functionality from some other linker). We strongly
recommend also using `-z now` as non-lazy binding allows the
retpoline-mitigated PLT to be substantially smaller.

When manually apply similar transformations to `-mretpoline` to the
Linux kernel we observed very small performance hits to applications
running typical workloads, and relatively minor hits (approximately 2%)
even for extremely syscall-heavy applications. This is largely due to
the small number of indirect branches that occur in performance
sensitive paths of the kernel.

When using these patches on statically linked applications, especially
C++ applications, you should expect to see a much more dramatic
performance hit. For microbenchmarks that are switch, indirect-, or
virtual-call heavy we have seen overheads ranging from 10% to 50%.

However, real-world workloads exhibit substantially lower performance
impact. Notably, techniques such as PGO and ThinLTO dramatically reduce
the impact of hot indirect calls (by speculatively promoting them to
direct calls) and allow optimized search trees to be used to lower
switches. If you need to deploy these techniques in C++ applications, we
*strongly* recommend that you ensure all hot call targets are statically
linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well
tuned servers using all of these techniques saw 5% - 10% overhead from
the use of retpoline.

We will add detailed documentation covering these components in
subsequent patches, but wanted to make the core functionality available
as soon as possible. Happy for more code review, but we'd really like to
get these patches landed and backported ASAP for obvious reasons. We're
planning to backport this to both 6.0 and 5.0 release streams and get
a 5.0 release with just this cherry picked ASAP for distros and vendors.

This patch is the work of a number of people over the past month: Eric, Reid,
Rui, and myself. I'm mailing it out as a single commit due to the time
sensitive nature of landing this and the need to backport it. Huge thanks to
everyone who helped out here, and everyone at Intel who helped out in
discussions about how to craft this. Also, credit goes to Paul Turner (at
Google, but not an LLVM contributor) for much of the underlying retpoline
design.

Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer

Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits

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

llvm-svn: 323155

6 years ago[WebAssembly] Remove --emit-relocs
Sam Clegg [Mon, 22 Jan 2018 21:55:43 +0000 (21:55 +0000)]
[WebAssembly] Remove --emit-relocs

This was added to mimic ELF, but maintaining it has cost
and we currently don't have any use for it outside of the
test code.

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

llvm-svn: 323154

6 years ago[AMDGPU] SI Load Store Optimizer: When merging with offset, use V_ADD_{I|U}32_e64
Mark Searles [Mon, 22 Jan 2018 21:46:43 +0000 (21:46 +0000)]
[AMDGPU] SI Load Store Optimizer: When merging with offset, use V_ADD_{I|U}32_e64
- Change inserted add ( V_ADD_{I|U}32_e32 ) to _e64 version ( V_ADD_{I|U}32_e64 ) so that the add uses a vreg for the carry; this prevents inserted v_add from killing VCC; the _e64 version doesn't accept a literal in its encoding, so we need to introduce a mov instr as well to get the imm into a register.
- Change pass name to "SI Load Store Optimizer"; this removes the '/', which complicates scripts.

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

llvm-svn: 323153

6 years agoAnother batch of P0202 constepr algirithms. remove/remove_if/remove_copy/remove_copy_...
Marshall Clow [Mon, 22 Jan 2018 21:43:04 +0000 (21:43 +0000)]
Another batch of P0202 constepr algirithms. remove/remove_if/remove_copy/remove_copy_if/reverse_copy, and tests (commented out) for rotate_copy, because that depends on std::copy

llvm-svn: 323152

6 years ago[clangd] Drop ~destructor completions - rarely helpful and work inconsistently
Sam McCall [Mon, 22 Jan 2018 21:05:00 +0000 (21:05 +0000)]
[clangd] Drop ~destructor completions - rarely helpful and work inconsistently

llvm-svn: 323149

6 years ago[CodeComplete] Omit templated constructors from member list too.
Sam McCall [Mon, 22 Jan 2018 20:44:47 +0000 (20:44 +0000)]
[CodeComplete] Omit templated constructors from member list too.

Also avoid printing a 'void' return type for constructor expressions.

llvm-svn: 323148

6 years agoStill more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical...
Marshall Clow [Mon, 22 Jan 2018 20:44:33 +0000 (20:44 +0000)]
Still more P0202 constexpr-ifying. This batch is: for_each/for_each_n/lexicographical_compare

llvm-svn: 323147

6 years ago[analyzer] Protect against dereferencing a null pointer
Alexander Shaposhnikov [Mon, 22 Jan 2018 20:18:42 +0000 (20:18 +0000)]
[analyzer] Protect against dereferencing a null pointer

The check (inside StackHintGeneratorForSymbol::getMessage)
if (!N)
    return getMessageForSymbolNotFound()
is moved to the beginning of the function.

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

Test plan: make check-all

llvm-svn: 323146

6 years ago[cmake] [libcxxabi] Fix find_path() problems when cross compiling
Don Hinton [Mon, 22 Jan 2018 19:41:05 +0000 (19:41 +0000)]
[cmake] [libcxxabi] Fix find_path() problems when cross compiling

When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, these find_path() invocations are looking for paths in
the libcxx and libunwind projects on the host system, not the
target system, which can be done by passing
NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323145

6 years ago[llvm-objcopy] Use physical instead of virtual address when aligning and placing...
Jake Ehrlich [Mon, 22 Jan 2018 19:27:30 +0000 (19:27 +0000)]
[llvm-objcopy] Use physical instead of virtual address when aligning and placing sections in binary

For sections with different virtual and physical addresses, alignment and
placement in the output binary should be based on the physical address.

Ran into this problem with a bare metal ARM project where llvm-objcopy added a
lot of zero-padding before the .data section that had differing addresses. GNU
objcopy did not add the padding, and after this fix, neither does llvm-objcopy.

Update a test case so a section has different physical and virtual addresses.

Fixes B35708

Authored By: Owen Shaw (owenpshaw)

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

llvm-svn: 323144

6 years ago[cmake] [libcxx] Fix find_path() problems when cross compiling.
Don Hinton [Mon, 22 Jan 2018 19:26:38 +0000 (19:26 +0000)]
[cmake] [libcxx] Fix find_path() problems when cross compiling.

When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxxabi project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323143

6 years ago[ubsan] Disable signal handling on Android.
Evgeniy Stepanov [Mon, 22 Jan 2018 19:26:01 +0000 (19:26 +0000)]
[ubsan] Disable signal handling on Android.

Summary: See rationale in the comments.

Reviewers: vitalybuka

Subscribers: srhines, llvm-commits, kubamracek

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

llvm-svn: 323142

6 years ago[cmake] [libunwind] Fix find_path() problems when cross compiling
Don Hinton [Mon, 22 Jan 2018 19:15:06 +0000 (19:15 +0000)]
[cmake] [libunwind] Fix find_path() problems when cross compiling

When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxx project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

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

llvm-svn: 323141

6 years agoasan: allow inline instrumentation for the kernel
Dmitry Vyukov [Mon, 22 Jan 2018 19:07:11 +0000 (19:07 +0000)]
asan: allow inline instrumentation for the kernel

Currently ASan instrumentation pass forces callback
instrumentation when applied to the kernel.
This patch changes the current behavior to allow
using inline instrumentation in this case.

Authored by andreyknvl. Reviewed in:
https://reviews.llvm.org/D42384

llvm-svn: 323140

6 years ago[AArch64] Create a separate feature set for Exynos M3
Evandro Menezes [Mon, 22 Jan 2018 19:03:26 +0000 (19:03 +0000)]
[AArch64] Create a separate feature set for Exynos M3

Distinguish the features from Exynos M2.

llvm-svn: 323139

6 years agoFix memory leak in TestClangASTContext.TestRecordHasFields
Raphael Isemann [Mon, 22 Jan 2018 18:56:33 +0000 (18:56 +0000)]
Fix memory leak in TestClangASTContext.TestRecordHasFields

Summary: We can't use unique_ptr's here because we use those variables as `out` parameters to some functions. Discovered by the memory sanitizer.

Subscribers: lldb-commits

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

llvm-svn: 323138

6 years agoAdd (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n. These...
Marshall Clow [Mon, 22 Jan 2018 18:38:18 +0000 (18:38 +0000)]
Add (commented out) constexpr tests for copy/copy_backwards/copy_if/copy_n.  These will be enabled when that part of P0202 is implemented. NFC at this time.

llvm-svn: 323137

6 years ago[ARM] Cleanup part of ARMBaseInstrInfo::optimizeCompareInstr (NFCI).
Joel Galenson [Mon, 22 Jan 2018 17:53:47 +0000 (17:53 +0000)]
[ARM] Cleanup part of ARMBaseInstrInfo::optimizeCompareInstr (NFCI).

As noted in another review, this loop is confusing.  This commit cleans it up
somewhat.

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

llvm-svn: 323136

6 years ago[CodeGen] Shrink MachineOperand by 8 bytes on Windows
Reid Kleckner [Mon, 22 Jan 2018 17:50:20 +0000 (17:50 +0000)]
[CodeGen] Shrink MachineOperand by 8 bytes on Windows

Use 'unsigned' for these bitfields so they actually pack together.
Previously it used three words for these bits instead of one.

Add some static_asserts to prevent this from being undone.

llvm-svn: 323135

6 years ago[Dockerfiles] Use a newer version of ninja when building inside debian8.
Ilya Biryukov [Mon, 22 Jan 2018 17:19:41 +0000 (17:19 +0000)]
[Dockerfiles] Use a newer version of ninja when building inside debian8.

Summary:
The debian8 repos have an old version of ninja that seems to sometimes crash
when building llvm.

Reviewers: ioeric, mehdi_amini

Reviewed By: ioeric

Subscribers: llvm-commits

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

llvm-svn: 323134

6 years ago[CodeComplete] Fix completion in the middle of idents in macro calls
Ilya Biryukov [Mon, 22 Jan 2018 17:18:28 +0000 (17:18 +0000)]
[CodeComplete] Fix completion in the middle of idents in macro calls

Summary:
This patch removes IdentifierInfo from completion token after remembering
the identifier in the preprocessor.

Prior to this patch, completion token had the IdentifierInfo set to null when
completing at the start of identifier and to the II for completion prefix
when in the middle of identifier.

This patch unifies how code completion token is handled when it is insterted
before the identifier and in the middle of the identifier.

The actual IdentifierInfo can still be obtained from the Preprocessor.

Reviewers: bkramer, arphaman

Reviewed By: bkramer

Subscribers: cfe-commits

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

llvm-svn: 323133

6 years ago[mips] add warnings for using dsp and msa flags with inappropriate revisions
Petar Jovanovic [Mon, 22 Jan 2018 16:43:30 +0000 (16:43 +0000)]
[mips] add warnings for using dsp and msa flags with inappropriate revisions

Dsp and dspr2 require MIPS revision 2, while msa requires revision 5. Adding
warnings for cases when these flags are used with earlier revision.

Patch by Milos Stojanovic.

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

llvm-svn: 323131

6 years ago[clang-tidy objc-property-declaration] New option IncludeDefaultAcronyms
Ben Hamilton [Mon, 22 Jan 2018 15:45:25 +0000 (15:45 +0000)]
[clang-tidy objc-property-declaration] New option IncludeDefaultAcronyms

Summary:
The existing option objc-property-declaration.Acronyms
replaces the built-in set of acronyms.

While this behavior is OK for clients that don't want the default
behavior, many clients may just want to add their own custom acronyms
to the default list.

This revision introduces a new option,
objc-property-declaration.IncludeDefaultAcronyms, which controls
whether the acronyms in objc-property-declaration.Acronyms are
appended to the default list (the default behavior) or whether they
replace.

I also updated the documentation.

Test Plan: make -j12 check-clang-tools

Reviewers: Wizard, hokein, klimek

Reviewed By: hokein

Subscribers: Eugene.Zelenko, cfe-commits

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

llvm-svn: 323130

6 years ago[SystemZ] Fix bootstrap failure due to invalid DAG loop
Ulrich Weigand [Mon, 22 Jan 2018 15:41:49 +0000 (15:41 +0000)]
[SystemZ] Fix bootstrap failure due to invalid DAG loop

The change in r322988 caused a failure in the bootstrap build bot.
The problem was that directly gluing a BR_CCMASK node to a
compare-and-swap could lead to issues if other nodes were
chained in between.  There is then no way to create a topological
sort that respects both the chain sequence and the glue property.

Fixed for now by rejecting the optimization in this case.  As a
future enhancement, we may be able to handle additional cases
by swapping chain links around.

llvm-svn: 323129

6 years agoFix bug in commit 323096 exposed by test in test-suite-verify-machineinstrs-x86_64h-O3
Marina Yatsina [Mon, 22 Jan 2018 15:31:05 +0000 (15:31 +0000)]
Fix bug in commit 323096 exposed by test in test-suite-verify-machineinstrs-x86_64h-O3

Change-Id: I0a4b10d0d6c8de606d989c567ec07944ae283a87
llvm-svn: 323126

6 years ago[AArch64][SVE] Asm: PTRUE and PTRUES instructions
Sander de Smalen [Mon, 22 Jan 2018 15:29:19 +0000 (15:29 +0000)]
[AArch64][SVE] Asm: PTRUE and PTRUES instructions

Summary: These instructions initialize a predicate vector from a pattern/immediate.

Reviewers: fhahn, rengolin, evandro, mcrosier, t.p.northover, samparker, olista01

Reviewed By: samparker

Subscribers: aemerson, javed.absar, tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 323124

6 years ago[DOCS] Mention OpenMP Tools Interface in runtime library
Jonas Hahnfeld [Mon, 22 Jan 2018 15:27:45 +0000 (15:27 +0000)]
[DOCS] Mention OpenMP Tools Interface in runtime library

Also list supported configurations (architectures + operating
systems).

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

llvm-svn: 323123

6 years ago[modules] Correctly overload getModule in the MultiplexExternalSemaSource
Raphael Isemann [Mon, 22 Jan 2018 15:27:25 +0000 (15:27 +0000)]
[modules] Correctly overload getModule in the MultiplexExternalSemaSource

Summary:
The MultiplexExternalSemaSource doesn't correctly overload the `getModule` function,
causing the multiplexer to not forward this call as intended.

Reviewers: v.g.vassilev

Reviewed By: v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 323122

6 years agoFix uninitialized variable in GoParser
Raphael Isemann [Mon, 22 Jan 2018 14:32:43 +0000 (14:32 +0000)]
Fix uninitialized variable in GoParser

Summary:
`m_last_tok` isn't initialized anywhere before it's used the first time (most likely in the `GoParser::Rule::error` method), which causes most of the GoParser tests to fail with sanitizers enabled with errors like this:

```
GoParser.cpp:52:21: runtime error: load of value <random value>, which is not a valid value for type 'GoLexer::TokenType'
UndefinedBehaviorSanitizer: undefined-behavior GoParser.cpp:52:21
```

Reviewers: ribrdb, davide, labath

Reviewed By: labath

Subscribers: labath, lldb-commits

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

llvm-svn: 323119

6 years ago[AArch64] optimise v4f16 fcmps to utilise vector instructions
Carey Williams [Mon, 22 Jan 2018 14:16:11 +0000 (14:16 +0000)]
[AArch64] optimise v4f16 fcmps to utilise vector instructions

Improves the code generation for v4f16 FCMP instructions when FullFP16 is not supported.
Generating FCTVL(s) rather than a longer series of FCVTs.

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

llvm-svn: 323118

6 years ago[ThinLTO] Re-commit of dot dumper after test fix
Eugene Leviant [Mon, 22 Jan 2018 13:35:40 +0000 (13:35 +0000)]
[ThinLTO] Re-commit of dot dumper after test fix

llvm-svn: 323116

6 years ago[analyzer] Model and check unrepresentable left shifts
Gabor Horvath [Mon, 22 Jan 2018 13:32:10 +0000 (13:32 +0000)]
[analyzer] Model and check unrepresentable left shifts

Patch by: Reka Nikolett Kovacs

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

llvm-svn: 323115

6 years agoFixing warnings caused by commit 323095
Marina Yatsina [Mon, 22 Jan 2018 13:24:10 +0000 (13:24 +0000)]
Fixing warnings caused by commit 323095

Change-Id: I4e1f81db2f5382a820f4016c23b243e4d5aebf51
llvm-svn: 323114

6 years agoRename DwarfAcceleratorTable to AppleAcceleratorTable. NFC
Pavel Labath [Mon, 22 Jan 2018 13:17:23 +0000 (13:17 +0000)]
Rename DwarfAcceleratorTable to AppleAcceleratorTable. NFC

This frees up the first name to be used as an base class for the
apple table and the dwarf5 .debug_names accel table. The rename  was
split off from D42297 (adding of debug_names support), which is still
under review.

llvm-svn: 323113

6 years agoFix MSVC implicit double-float truncation warning. NFCI.
Simon Pilgrim [Mon, 22 Jan 2018 13:15:16 +0000 (13:15 +0000)]
Fix MSVC implicit double-float truncation warning. NFCI.

llvm-svn: 323112

6 years ago[clangd] Try to fix build bot failue in r323101
Eric Liu [Mon, 22 Jan 2018 13:03:25 +0000 (13:03 +0000)]
[clangd] Try to fix build bot failue in r323101

llvm-svn: 323111

6 years ago[X86][AVX] Add test case for PR34370
Simon Pilgrim [Mon, 22 Jan 2018 12:27:22 +0000 (12:27 +0000)]
[X86][AVX] Add test case for PR34370

llvm-svn: 323106

6 years ago[X86][SSE] Add ISD::VECTOR_SHUFFLE to faux shuffle decoding (Reapplied)
Simon Pilgrim [Mon, 22 Jan 2018 12:05:17 +0000 (12:05 +0000)]
[X86][SSE] Add ISD::VECTOR_SHUFFLE to faux shuffle decoding (Reapplied)

Primarily, this allows us to use the aggressive extraction mechanisms in combineExtractWithShuffle earlier and make use of UNDEF elements that may be lost during lowering.

Reapplied after rL322279 was reverted at rL322335 due to PR35918, underlying issue was fixed at rL322644.

llvm-svn: 323104

6 years agoRevert "[SymbolFilePDB] Fix null array access when parsing the type of a function...
Pavel Labath [Mon, 22 Jan 2018 11:51:56 +0000 (11:51 +0000)]
Revert "[SymbolFilePDB] Fix null array access when parsing the type of a function without any arguments, i.e. 'int main()' and add support to test it"

This reverts commit r322995, as it breaks
lldb-Unit::SymbolFilePDBTests.TestTypedefs
<http://lab.llvm.org:8011/builders/lldb-windows7-android/builds/7715>.

llvm-svn: 323102

6 years ago[clangd] Add support for different file URI schemas.
Eric Liu [Mon, 22 Jan 2018 11:48:20 +0000 (11:48 +0000)]
[clangd] Add support for different file URI schemas.

Summary: I will replace the existing URI struct in Protocol.h with the new URI and rename FileURI to URI in a followup patch.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: jkorous-apple, klimek, mgorny, ilya-biryukov, cfe-commits

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

llvm-svn: 323101

6 years agoAdd SysV Abi for PPC64le
Pavel Labath [Mon, 22 Jan 2018 11:27:43 +0000 (11:27 +0000)]
Add SysV Abi for PPC64le

Summary:
This patch implements the ABI Plugin for PPC64le. It was based on the
ABI for PPC64. It also enables LLDB to evaluate expressions using JIT.

Reviewers: labath, clayborg, jhibbits, davide

Reviewed By: labath, clayborg, jhibbits, davide

Subscribers: davide, JDevlieghere, chmeee, emaste, jhibbits, hfinkel, lldb-commits, nemanjai, luporl, lbianc, mgorny, anajuliapc, kbarton

Differential Revision: https://reviews.llvm.org/D41702
Patch by Alexandre Yukio Yamashita <alexandre.yamashita@eldorado.org.br>

llvm-svn: 323100

6 years agoAdd test for interaction of --gc-sections and undefined references
James Henderson [Mon, 22 Jan 2018 10:58:06 +0000 (10:58 +0000)]
Add test for interaction of --gc-sections and undefined references

It is possible for a link to fail with an undefined reference, unless
--gc-sections is specified, removing the reference in the process. This
doesn't look to be tested anywhere explicitly, so I thought it useful
to add a test for it to ensure the behaviour is maintained.

Reviewers: ruiu

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

llvm-svn: 323099

6 years ago[AArch64][SVE] Asm: Predicate patterns
Sander de Smalen [Mon, 22 Jan 2018 10:46:00 +0000 (10:46 +0000)]
[AArch64][SVE] Asm: Predicate patterns

Summary:
This patch adds support for parsing/printing of named or unnamed
patterns that are used in SVE's PTRUE instruction, amongst others.

The pattern can be specified as a named pattern to initialize the predicate
vector or it can be specified as an immediate in the range 0-31.

Reviewers: fhahn, rengolin, evandro, mcrosier, t.p.northover

Reviewed By: fhahn

Subscribers: aemerson, javed.absar, tschuett, kristof.beyls, llvm-commits

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

llvm-svn: 323098

6 years ago[YAML] Plain scalars can not begin with most indicators.
Haojian Wu [Mon, 22 Jan 2018 10:20:48 +0000 (10:20 +0000)]
[YAML] Plain scalars can not begin with most indicators.

Summary:
Discovered when clangd loads YAML symbols, some symbol documentations
start with indicators (e.g. "-"), but YAML prints them as plain scalars
(no quotes), which make the YAML parser fail to parse.

For these kind of strings, we need quotes.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, llvm-commits, cfe-commits

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

llvm-svn: 323097

6 years agoBreak false dependencies for POPCNT, LZCNT, TZCNT
Marina Yatsina [Mon, 22 Jan 2018 10:07:01 +0000 (10:07 +0000)]
Break false dependencies for POPCNT, LZCNT, TZCNT

Add POPCNT, LZCNT, TZCNT to the list of instructions that have false dependency.
Add a test to make sure BreakFalseDeps breaks the dependencies for these instructions.
Update affected tests.

This fixes bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869

This is the final of multiple patches that fix this bugzilla.
Most of the patches are intended at refactoring the existent code.

Reviews of the refactoring done to enable this change:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333

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

Change-Id: If95cbf1a3f5c7dccff8f1b22ecb397542147303d
llvm-svn: 323096

6 years agoSeparate LoopTraversal, ReachingDefAnalysis and BreakFalseDeps into their own files.
Marina Yatsina [Mon, 22 Jan 2018 10:06:50 +0000 (10:06 +0000)]
Separate LoopTraversal, ReachingDefAnalysis and BreakFalseDeps into their own files.

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40334

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

Change-Id: Ie5f8eb34d98cfdfae23a3072eb69b5794f0e2d56
llvm-svn: 323095

6 years agoRename ExecutionDepsFix files to ExecutionDomainFix
Marina Yatsina [Mon, 22 Jan 2018 10:06:33 +0000 (10:06 +0000)]
Rename ExecutionDepsFix files to ExecutionDomainFix

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40331
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I6a048cca7fdafbfc42fb1bac94343e483befded8
llvm-svn: 323094

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:06:18 +0000 (10:06 +0000)]
ExecutionDepsFix refactoring:
- clang-format

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I131b126af13bc743bc5d69d83699e52b9b720979
llvm-svn: 323093

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:06:10 +0000 (10:06 +0000)]
ExecutionDepsFix refactoring:
- Moving comments to class definition in header file
- Changing comments to doxygen style
- Rephrase loop traversal explaining comment

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I9a12618db5b66128611fa71b54a233414f6012ac
llvm-svn: 323092

6 years agoExecutionDepsFix refactoring:
Marina Yatsina [Mon, 22 Jan 2018 10:06:01 +0000 (10:06 +0000)]
ExecutionDepsFix refactoring:
- Removing LiveRegs

This is the one of multiple patches that fix bugzilla https://bugs.llvm.org/show_bug.cgi?id=33869
Most of the patches are intended at refactoring the existent code.

Additional relevant reviews:
https://reviews.llvm.org/D40330
https://reviews.llvm.org/D40332
https://reviews.llvm.org/D40333
https://reviews.llvm.org/D40334

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

Change-Id: I8ab56d99951a6d6981542f68d94c1f624f3c9fbf
llvm-svn: 323091