platform/upstream/llvm.git
7 years ago[FreeBSD] Remove more dead code. NFCI.
Davide Italiano [Tue, 24 Oct 2017 23:31:53 +0000 (23:31 +0000)]
[FreeBSD] Remove more dead code. NFCI.

llvm-svn: 316530

7 years ago[ExpressionParser] Garbage-collect dead code. NFCI.
Davide Italiano [Tue, 24 Oct 2017 23:29:01 +0000 (23:29 +0000)]
[ExpressionParser] Garbage-collect dead code. NFCI.

llvm-svn: 316529

7 years agoCorrect behavior of fastcall when default CC is set.
Erich Keane [Tue, 24 Oct 2017 23:12:01 +0000 (23:12 +0000)]
Correct behavior of fastcall when default CC is set.

Fastcall doesn't support variadic function calls, so
setting the default calling convention to Fastcall would
result in incorrect code being emitted for these conditions.

This patch adds a 'variadic' test to the default calling conv
test, as well as fixes the behavior of fastcall.

llvm-svn: 316528

7 years agoRemove some unused function calls from ClangUserExpression.cpp
Stephane Sezer [Tue, 24 Oct 2017 23:01:33 +0000 (23:01 +0000)]
Remove some unused function calls from ClangUserExpression.cpp

llvm-svn: 316527

7 years agoRemove some dead code from ClangExpressionDeclMap.cpp
Stephane Sezer [Tue, 24 Oct 2017 22:56:05 +0000 (22:56 +0000)]
Remove some dead code from ClangExpressionDeclMap.cpp

llvm-svn: 316526

7 years agoImplement salavageDebugInfo functionality for SelectionDAG.
Adrian Prantl [Tue, 24 Oct 2017 22:55:12 +0000 (22:55 +0000)]
Implement salavageDebugInfo functionality for SelectionDAG.

Similar to how llvm::salvagDebugInfo hooks into InstCombine, this adds
a hook that can be invoked before an SDNode that is associated with an
SDDbgValue is erased to capture the effect of the deleted node in a
DIExpression.

The motivating example is an SDDebugValue attached to an ADD operation
that gets folded into a LOAD+OFFSET operation.

rdar://problem/32121503

llvm-svn: 316525

7 years agoAdd Triple::isOSUnknown
Sam Clegg [Tue, 24 Oct 2017 22:48:19 +0000 (22:48 +0000)]
Add Triple::isOSUnknown

Subscribers: aheejin

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

llvm-svn: 316524

7 years ago[Coverage] Provide a stable order for getInstantiationGroups
Vedant Kumar [Tue, 24 Oct 2017 22:35:29 +0000 (22:35 +0000)]
[Coverage] Provide a stable order for getInstantiationGroups

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

llvm-svn: 316523

7 years ago[Analyzer] Fix bug in testing scripts, which always marked result as failure.
George Karpenkov [Tue, 24 Oct 2017 22:24:13 +0000 (22:24 +0000)]
[Analyzer] Fix bug in testing scripts, which always marked result as failure.

llvm-svn: 316522

7 years agoReplaced unicode characters with ASCII, as introduced in r316518.
Erich Keane [Tue, 24 Oct 2017 22:00:25 +0000 (22:00 +0000)]
Replaced unicode characters with ASCII, as introduced in r316518.

llvm-svn: 316521

7 years agoRemove obsolete comment.
Rui Ueyama [Tue, 24 Oct 2017 21:44:43 +0000 (21:44 +0000)]
Remove obsolete comment.

llvm-svn: 316520

7 years agobpf: fix an uninitialized variable issue
Yonghong Song [Tue, 24 Oct 2017 21:36:33 +0000 (21:36 +0000)]
bpf: fix an uninitialized variable issue

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 316519

7 years agomplement __has_unique_object_representations
Erich Keane [Tue, 24 Oct 2017 21:31:50 +0000 (21:31 +0000)]
mplement __has_unique_object_representations

A helper builtin to facilitate implementing the
std::has_unique_object_representations type trait.

Requested here: https://bugs.llvm.org/show_bug.cgi?id=34942
Also already exists in GCC and MSVC.

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

llvm-svn: 316518

7 years agoARMAddressingModes.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:21 +0000 (21:29 +0000)]
ARMAddressingModes.h: Don't mark header functions as file local

llvm-svn: 316517

7 years agoValueMapper.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:21 +0000 (21:29 +0000)]
ValueMapper.h: Don't mark header functions as file local

llvm-svn: 316516

7 years agoTransforms/Utils/Local.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:20 +0000 (21:29 +0000)]
Transforms/Utils/Local.h: Don't mark header functions as file local

llvm-svn: 316515

7 years agoTargetOpcodes.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:19 +0000 (21:29 +0000)]
TargetOpcodes.h: Don't mark header functions as file local

llvm-svn: 316514

7 years agoPrintable.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:19 +0000 (21:29 +0000)]
Printable.h: Don't mark header functions as file local

llvm-svn: 316513

7 years agoConvertUTF.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:18 +0000 (21:29 +0000)]
ConvertUTF.h: Don't mark header functions as file local

llvm-svn: 316512

7 years agoAtomicOrdering.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:18 +0000 (21:29 +0000)]
AtomicOrdering.h: Don't mark header functions as file local

llvm-svn: 316511

7 years agoLaneBitmask.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:17 +0000 (21:29 +0000)]
LaneBitmask.h: Don't mark header functions as file local

llvm-svn: 316510

7 years agoType.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:16 +0000 (21:29 +0000)]
Type.h: Don't mark header functions as file local

llvm-svn: 316509

7 years agoHexagonDepTimingClasses.h: Don't mark header functions as file local
David Blaikie [Tue, 24 Oct 2017 21:29:16 +0000 (21:29 +0000)]
HexagonDepTimingClasses.h: Don't mark header functions as file local

llvm-svn: 316508

7 years agoWebassemblyAsmPrinter.h: Include WebAssemblyMachineFunctionInfo for use with MachineF...
David Blaikie [Tue, 24 Oct 2017 21:29:15 +0000 (21:29 +0000)]
WebassemblyAsmPrinter.h: Include WebAssemblyMachineFunctionInfo for use with MachineFunction::getInfo

llvm-svn: 316507

7 years agoX86Operand.h: Include X86MCTargetDesc.h for SSE register enum/names
David Blaikie [Tue, 24 Oct 2017 21:29:15 +0000 (21:29 +0000)]
X86Operand.h: Include X86MCTargetDesc.h for SSE register enum/names

llvm-svn: 316506

7 years agoX86AsmPrinter.h: Add missing header for complete type needed for MCCodeEmitter dtor.
David Blaikie [Tue, 24 Oct 2017 21:29:14 +0000 (21:29 +0000)]
X86AsmPrinter.h: Add missing header for complete type needed for MCCodeEmitter dtor.

llvm-svn: 316505

7 years agoRegisterUsageInfo.h: Add missing header for complete type needed for DenseMap traits
David Blaikie [Tue, 24 Oct 2017 21:29:10 +0000 (21:29 +0000)]
RegisterUsageInfo.h: Add missing header for complete type needed for DenseMap traits

llvm-svn: 316504

7 years ago[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Tue, 24 Oct 2017 21:24:53 +0000 (21:24 +0000)]
[Transforms] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

llvm-svn: 316503

7 years ago[COFF] Add support for /WX
Shoaib Meenai [Tue, 24 Oct 2017 21:19:22 +0000 (21:19 +0000)]
[COFF] Add support for /WX

link.exe supports this option to convert warnings into errors, and it's
useful to support in LLD as well.

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

llvm-svn: 316502

7 years ago[COFF] Clean up boolean flag handling
Shoaib Meenai [Tue, 24 Oct 2017 21:17:16 +0000 (21:17 +0000)]
[COFF] Clean up boolean flag handling

LLD's handling of boolean flags is suboptimal:
* All boolean flags have a corresponding `:no` flag to turn the flag
  off, and the linker should scan for both the non-suffixed and suffixed
  flags (and the last one should win), but right now it only scans for
  either the suffixed or non-suffixed flag (depending on the default
  flag value).
* The `B` multiclass only allows specifying help text for the suffixed
  (`:no`) flag, but for some flags (e.g. `/appcontainer`) the help text
  should be associated with the non-suffixed flag instead.

Extend the `B` multiclass to have help text for both non-suffixed and
suffixed flag variants, and alter the existing help text accordingly in
some cases. Scan for both the non-suffixed and suffixed variants in the
driver and set config values accordingly.

This should mostly have no behavior change, apart from the added help
text and the modified argument scanning. Some flags are handled slightly
differently now, however; for example, LLD would previously always treat
64-bit images as large address aware, whereas `/largeaddressaware:no` is
now respected for 64-bit images (which is also how link.exe behaves).

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

llvm-svn: 316501

7 years ago[Sema] Document+test the -Wsign-compare change for enums in C code [NFC]
Roman Lebedev [Tue, 24 Oct 2017 21:05:43 +0000 (21:05 +0000)]
[Sema] Document+test the -Wsign-compare change for enums in C code [NFC]

rL316268 / D39122 has fixed PR35009, and now when in C,
these three(?) diagnostics properly use the enum's underlying
datatype.

While it was fixed, the test coverage was clearly insufficient,
because the -Wsign-compare change didn't show up in any of the
tests, until it was reported in the post-commit mail for rL316268.

So add the test for the -Wsign-compare diagnostic for enum
for C code, and while there, document this in the release notes.

The fix itself was obviously correct, so unless we want to silence
this new diagnosed case, i deem this commit to be NFC.

llvm-svn: 316500

7 years agoUse ArgList::hasFlag().
Rui Ueyama [Tue, 24 Oct 2017 20:59:55 +0000 (20:59 +0000)]
Use ArgList::hasFlag().

I just didn't know that ArgList had that function.

llvm-svn: 316499

7 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Tue, 24 Oct 2017 20:56:09 +0000 (20:56 +0000)]
Fix Wdocumentation warning. NFCI.

llvm-svn: 316498

7 years agoRevert "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"
Martin Bohme [Tue, 24 Oct 2017 20:40:02 +0000 (20:40 +0000)]
Revert "[CodeGen][ExpandMemcmp][NFC] Allow memcmp to expand to vector loads (1)"

This reverts commit r316417, which causes internal compiles to OOM.
I don't unfortunately have a self-contained test case but will follow up
with courbet.

llvm-svn: 316497

7 years agoUse range-based for loop. NFC
Adrian Prantl [Tue, 24 Oct 2017 20:38:00 +0000 (20:38 +0000)]
Use range-based for loop. NFC

llvm-svn: 316496

7 years ago[NVPTX] allow address space inference for volatile loads/stores.
Artem Belevich [Tue, 24 Oct 2017 20:31:44 +0000 (20:31 +0000)]
[NVPTX] allow address space inference for volatile loads/stores.

If particular target supports volatile memory access operations, we can
avoid AS casting to generic AS. Currently it's only enabled in NVPTX for
loads and stores that access global & shared AS.

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

llvm-svn: 316495

7 years agoDelete unused instantiations of DIBuilder. NFC
Adrian Prantl [Tue, 24 Oct 2017 20:26:17 +0000 (20:26 +0000)]
Delete unused instantiations of DIBuilder. NFC

llvm-svn: 316494

7 years agoFix LLVM_LINK_LLVM_DYLIB=On build of llvm-cfi-verify
Sam Clegg [Tue, 24 Oct 2017 20:21:15 +0000 (20:21 +0000)]
Fix LLVM_LINK_LLVM_DYLIB=On build of llvm-cfi-verify

Subscribers: mgorny, aheejin

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

llvm-svn: 316493

7 years ago[X86][Broadwell] Added the instruction scheduling information for the Broadwell CPU.
Gadi Haber [Tue, 24 Oct 2017 20:19:47 +0000 (20:19 +0000)]
[X86][Broadwell] Added the instruction scheduling information for the Broadwell CPU.

Adding the scheduling information for the Browadwell (BDW) CPU target.

This patch adds the instruction scheduling information for the Broadwell (BDW) architecture target by adding the file X86SchedBroadwell.td located under the X86 Target.
We used the scheduling information retrieved from the Broadwell architects in order to create the file.
The scheduling information includes latency, number of micro-Ops and used ports by each BDW instruction.

The patch continues the scheduling replacement and insertion effort started with the SandyBridge (SNB) target in r310792, the Haswell (HSW) target in r311879, the SkylakeClient (SKL) target in rL313613 + rL315978 and the SkylakeServer (SKX) in rL315175.

Performance fluctuations may be expected due to code alignment effects.

Reviewers: zvi, RKSimon, craig.topper
Differential Revision: https://reviews.llvm.org/D39054

Change-Id: If6f799e5ff60e1091c8d43b05ea78c53581bae01
llvm-svn: 316492

7 years agoMove comment to the place where it makes more sense.
Rui Ueyama [Tue, 24 Oct 2017 20:11:07 +0000 (20:11 +0000)]
Move comment to the place where it makes more sense.

llvm-svn: 316491

7 years ago[llvm-cov] Use a stable sort on sub-views
Vedant Kumar [Tue, 24 Oct 2017 20:03:37 +0000 (20:03 +0000)]
[llvm-cov] Use a stable sort on sub-views

We need to use a stable sort on instantiation and expansion sub-views to
produce consistent output. Fortunately, we've gotten lucky and the tests
have checks for the stable order.

This is needed to unblock D39245. Once that lands, we'll have better
test coverage for sort non-determinism.

llvm-svn: 316490

7 years agoImprove comment.
Rui Ueyama [Tue, 24 Oct 2017 19:53:51 +0000 (19:53 +0000)]
Improve comment.

llvm-svn: 316489

7 years ago[OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.
Alexey Bataev [Tue, 24 Oct 2017 19:52:31 +0000 (19:52 +0000)]
[OPENMP] Fix PR35013: Fix passing VLAs captures to outlined functions.

Fixed passing of VLAs and variably-modified types to outlined functions.
Synchronized passing with the types codegen.

llvm-svn: 316488

7 years agoOn FreeBSD, skip the first entry in the dl_iterate_phdr list.
Dimitry Andric [Tue, 24 Oct 2017 19:45:59 +0000 (19:45 +0000)]
On FreeBSD, skip the first entry in the dl_iterate_phdr list.

Summary:
Similar to NetBSD, in FreeBSD, the first returned entry when callbacks
are done via dl_iterate_phdr will return the main program.  Ignore that
entry when checking that the dynamic ASan lib is loaded first.

Reviewers: eugenis, krytarowski, emaste, joerg

Reviewed By: eugenis, krytarowski

Subscribers: kubamracek, llvm-commits

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

llvm-svn: 316487

7 years agoSimplify.
Rui Ueyama [Tue, 24 Oct 2017 19:40:03 +0000 (19:40 +0000)]
Simplify.

llvm-svn: 316486

7 years agoUse range-based-for. NFC
Adrian Prantl [Tue, 24 Oct 2017 19:32:59 +0000 (19:32 +0000)]
Use range-based-for. NFC

llvm-svn: 316485

7 years agoCodeGen: Fix missing debug loc due to alloca
Yaxun Liu [Tue, 24 Oct 2017 19:14:43 +0000 (19:14 +0000)]
CodeGen: Fix missing debug loc due to alloca

Builder save/restores insertion pointer when emitting addr space cast
for alloca, but does not save/restore debug loc, which causes verifier
failure for certain call instructions.

This patch fixes that.

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

llvm-svn: 316484

7 years agoLLD/ELF/AMDGPU: Process AMDGPU-specific e_flags
Konstantin Zhuravlyov [Tue, 24 Oct 2017 19:05:32 +0000 (19:05 +0000)]
LLD/ELF/AMDGPU: Process AMDGPU-specific e_flags

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

llvm-svn: 316483

7 years ago[asan] Add more x86 prologue decodings to handle x64 VC 2017 CRT
Reid Kleckner [Tue, 24 Oct 2017 18:22:07 +0000 (18:22 +0000)]
[asan] Add more x86 prologue decodings to handle x64 VC 2017 CRT

Fixes atoi and strtol interception.

llvm-svn: 316482

7 years agobpf: fix a bug in trunc-op optimization
Yonghong Song [Tue, 24 Oct 2017 18:21:10 +0000 (18:21 +0000)]
bpf: fix a bug in trunc-op optimization

Previous implementation for per-function scope
is incorrect and too conservative.

Signed-off-by: Yonghong Song <yhs@fb.com>
llvm-svn: 316481

7 years ago[globalisel][tablegen] Fix future undefined behaviour in r316463.
Daniel Sanders [Tue, 24 Oct 2017 18:11:54 +0000 (18:11 +0000)]
[globalisel][tablegen] Fix future undefined behaviour in r316463.

I missed a dereference of `Matched` that preceeded the new check. Thanks to
Justin Bogner for spotting it.

llvm-svn: 316480

7 years agoMIR: Print the register class or bank in vreg defs
Justin Bogner [Tue, 24 Oct 2017 18:04:54 +0000 (18:04 +0000)]
MIR: Print the register class or bank in vreg defs

This updates the MIRPrinter to include the regclass when printing
virtual register defs, which is already valid syntax for the
parser. That is, given 64 bit %0 and %1 in a "gpr" regbank,

  %1(s64) = COPY %0(s64)

would now be written as

  %1:gpr(s64) = COPY %0(s64)

While this change alone introduces a bit of redundancy with the
registers block, it allows us to update the tests to be more concise
and understandable and brings us closer to being able to remove the
registers block completely.

Note: We generally only print the class in defs, but there is one
exception. If there are uses without any defs whatsoever, we'll print
the class on all uses. I'm not completely convinced this comes up in
meaningful machine IR, but for now the MIRParser and MachineVerifier
both accept that kind of stuff, so we don't want to have a situation
where we can print something we can't parse.

llvm-svn: 316479

7 years ago[PowerPC] Try to simplify a Swap if it feeds a Splat
Stefan Pintilie [Tue, 24 Oct 2017 17:44:27 +0000 (17:44 +0000)]
[PowerPC] Try to simplify a Swap if it feeds a Splat

If we have the situation where a Swap feeds a Splat we can sometimes change the
  index on the Splat and then remove the Swap instruction.

Fixed the test case that was failing and recommit after pulling the original
  commit.

  Original revision is here: https://reviews.llvm.org/D39009

llvm-svn: 316478

7 years agoBinaryFormat/MachO.h Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:14 +0000 (17:29 +0000)]
BinaryFormat/MachO.h Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline                                                                   function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316477

7 years agoValueTracking.h Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:14 +0000 (17:29 +0000)]
ValueTracking.h Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline                                                                   function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316476

7 years agoMemoryBuiltins.h: Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:13 +0000 (17:29 +0000)]
MemoryBuiltins.h: Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline                                                                   function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316475

7 years agoIndirectCallSiteVisitor.h:findIndirectCallSites Don't mark header functions as file...
David Blaikie [Tue, 24 Oct 2017 17:29:12 +0000 (17:29 +0000)]
IndirectCallSiteVisitor.h:findIndirectCallSites Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline                                                                   function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316474

7 years agoStringExtras.h Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:12 +0000 (17:29 +0000)]
StringExtras.h Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline                                                                   function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316473

7 years agoSmallVector.h:capacity_in_bytes Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:11 +0000 (17:29 +0000)]
SmallVector.h:capacity_in_bytes Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline
function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316472

7 years agoDenseMap.h:capacity_in_bytes Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:11 +0000 (17:29 +0000)]
DenseMap.h:capacity_in_bytes Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another inline
function in a header and also creates binary bloat from duplicate definitions.

llvm-svn: 316471

7 years agoBitVector.h:capacity_in_bytes Don't mark header functions as file-scope static
David Blaikie [Tue, 24 Oct 2017 17:29:08 +0000 (17:29 +0000)]
BitVector.h:capacity_in_bytes Don't mark header functions as file-scope static

This creates ODR violations if the function is called from another
inline function in a header and also creates binary bloat from duplicate
definitions.

llvm-svn: 316470

7 years agobpf: fix a bug in bpf-isel trunc-op optimization
Yonghong Song [Tue, 24 Oct 2017 17:29:03 +0000 (17:29 +0000)]
bpf: fix a bug in bpf-isel trunc-op optimization

In BPF backend, we try to optimize away redundant
trunc operations so that kernel verifier rewrite
remains valid. Previous implementation only works
for a single function.

This patch fixed the issue for multiple functions.
It clears internal map data structure before
performing optimization for each function.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 316469

7 years agoAdded instructions for obtaining clang-tools-extra to the Getting Started page.
Aaron Ballman [Tue, 24 Oct 2017 17:28:39 +0000 (17:28 +0000)]
Added instructions for obtaining clang-tools-extra to the Getting Started page.

llvm-svn: 316468

7 years agoAdd missing clangRewrite lib dependency for clangToolingRefactor
Alex Lorenz [Tue, 24 Oct 2017 17:23:53 +0000 (17:23 +0000)]
Add missing clangRewrite lib dependency for clangToolingRefactor

llvm-svn: 316467

7 years agoDoxygenify comments.
Adrian Prantl [Tue, 24 Oct 2017 17:23:40 +0000 (17:23 +0000)]
Doxygenify comments.

llvm-svn: 316466

7 years ago[refactor] Initial outline of implementation of "extract function" refactoring
Alex Lorenz [Tue, 24 Oct 2017 17:18:45 +0000 (17:18 +0000)]
[refactor] Initial outline of implementation of "extract function" refactoring

This commit adds an initial, skeleton outline of the "extract function"
refactoring. The extracted function doesn't capture variables / rewrite code
yet, it just basically does a simple copy-paste.
The following initiation rules are specified:

- extraction can only be done for executable code in a function/method/block.
  This means that you can't extract a global variable initialize into a function
  right now.
- simple literals and references are not extractable.

This commit also adds support for full source ranges to clang-refactor's test
mode.

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

llvm-svn: 316465

7 years ago[opt] Initialize WriteBitcode pass.
Michael Kruse [Tue, 24 Oct 2017 17:17:27 +0000 (17:17 +0000)]
[opt] Initialize WriteBitcode pass.

Probably due to a change of how some pass initializes its dependencies,
the -write-bitcode pass (Bitcode/Writer/BitcodeWriterPass.cpp) is not
initialized in opt anymore and therefore not usable with

opt -write-bitcode

Explicitly call initializeWriteBitcodePassPass() to make it available
in opt again.

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

llvm-svn: 316464

7 years ago[globalisel][tablegen] Multi-insn emission requires that BuildMIAction support not...
Daniel Sanders [Tue, 24 Oct 2017 17:08:43 +0000 (17:08 +0000)]
[globalisel][tablegen] Multi-insn emission requires that BuildMIAction support not being linked to an InstructionMatcher. NFC

When multi-instruction emission is supported, it will no longer be guaranteed
that every BuildMIAction has a corresponding matched instruction. BuildMIAction
should support not having one to cover the case where a rule produces more
instructions than it matched.

llvm-svn: 316463

7 years ago[X86][AVX] ComputeNumSignBitsForTargetNode - add support for X86ISD::VTRUNC
Simon Pilgrim [Tue, 24 Oct 2017 17:04:57 +0000 (17:04 +0000)]
[X86][AVX] ComputeNumSignBitsForTargetNode - add support for X86ISD::VTRUNC

llvm-svn: 316462

7 years ago[codeview] Fix handling of S_HEAPALLOCSITE
Reid Kleckner [Tue, 24 Oct 2017 17:02:40 +0000 (17:02 +0000)]
[codeview] Fix handling of S_HEAPALLOCSITE

The type index is from the TPI stream, not the IPI stream. Fix the
dumper, fix type index discovery, and add a test in LLD.

Also improve the log message we emit when we fail to rewrite type
indices in LLD. That's how I found this bug.

llvm-svn: 316461

7 years agoLLD/ELF: Allow targets to set e_flags
Konstantin Zhuravlyov [Tue, 24 Oct 2017 17:01:40 +0000 (17:01 +0000)]
LLD/ELF: Allow targets to set e_flags

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

llvm-svn: 316460

7 years ago[ZoneAlgo] Translate addArrayWriteAccess to isl++. NFC.
Michael Kruse [Tue, 24 Oct 2017 16:40:34 +0000 (16:40 +0000)]
[ZoneAlgo] Translate addArrayWriteAccess to isl++. NFC.

llvm-svn: 316459

7 years ago[code completion] Complete ObjC methods in @implementation without leading
Alex Lorenz [Tue, 24 Oct 2017 16:39:37 +0000 (16:39 +0000)]
[code completion] Complete ObjC methods in @implementation without leading
'-'/'+' prefix

rdar://12040840

llvm-svn: 316458

7 years ago[SelectionDAG] Add VSELECT support to ComputeNumSignBits
Simon Pilgrim [Tue, 24 Oct 2017 16:38:38 +0000 (16:38 +0000)]
[SelectionDAG] Add VSELECT support to ComputeNumSignBits

llvm-svn: 316457

7 years agoMark string_view's constructor from (ptr,len) as noexcept (an extension). Update...
Marshall Clow [Tue, 24 Oct 2017 16:30:06 +0000 (16:30 +0000)]
Mark string_view's constructor from (ptr,len) as noexcept (an extension). Update the tests to check this (and other noexcept bits

llvm-svn: 316456

7 years agoRefactor duplicated comment. NFC.
Rafael Espindola [Tue, 24 Oct 2017 16:27:31 +0000 (16:27 +0000)]
Refactor duplicated comment. NFC.

llvm-svn: 316455

7 years agoPowerPC: support the separator character in the IAS
Saleem Abdulrasool [Tue, 24 Oct 2017 16:19:56 +0000 (16:19 +0000)]
PowerPC: support the separator character in the IAS

PowerPC uses ; as a comment leader and the @ as a separator character.
Support this properly.

llvm-svn: 316454

7 years agoRemove repeated function name in doxygen comment.
Erich Keane [Tue, 24 Oct 2017 16:16:34 +0000 (16:16 +0000)]
Remove repeated function name in doxygen comment.

llvm-svn: 316453

7 years agoDisable threadprivate data cleanup if runtime is terminating
Jonathan Peyton [Tue, 24 Oct 2017 16:10:09 +0000 (16:10 +0000)]
Disable threadprivate data cleanup if runtime is terminating

The problem is due to the runtime's threadprivate cleanup code which tries to
access data that was already destroyed by one of the root threads.
__kmp_init_gtid is used as a checker here since it is set to false before actual
resource cleanup is done in __kmp_cleanup().

Patch by Hansang Bae

llvm-svn: 316452

7 years agoRevert "[lldbtests] Handle errors instead of crashing."
Pavel Labath [Tue, 24 Oct 2017 16:07:50 +0000 (16:07 +0000)]
Revert "[lldbtests] Handle errors instead of crashing."

The commit breaks the case where you specify just a filename to the
compiler. Previously, it would look up the compiler in your path, now it
complains that the compiler is not found. One of the lldb buildbots is
depending on this. It seems like a nice feature to have, as it means
less typing and being able to avoid hard-coding the system compiler path
in the bot config.

This reverts commit r316393.

llvm-svn: 316451

7 years ago[TableGen] Fix some formatting quirks in the subtarget output file.
Craig Topper [Tue, 24 Oct 2017 15:50:55 +0000 (15:50 +0000)]
[TableGen] Fix some formatting quirks in the subtarget output file.

llvm-svn: 316450

7 years ago[TableGen] Simplify some of the subtarget emission by removing code that avoids print...
Craig Topper [Tue, 24 Oct 2017 15:50:53 +0000 (15:50 +0000)]
[TableGen] Simplify some of the subtarget emission by removing code that avoids printing commas at the end of arrays and enums.

The C++ standard allows for trailing commas. We already do this in many other emitters.

llvm-svn: 316449

7 years ago[X86] truncateVectorCompareWithPACKSS - use PACKSSDW/PACKSSWB instead of just PACKSSWB.
Simon Pilgrim [Tue, 24 Oct 2017 15:38:16 +0000 (15:38 +0000)]
[X86] truncateVectorCompareWithPACKSS - use PACKSSDW/PACKSSWB instead of just PACKSSWB.

By using the widest type possible for PACKSS truncation we have a better chance of being able to peek through bitcasts and improves other combines driven by ComputeNumSignBits.

llvm-svn: 316448

7 years agoFix spelling in comment, field is isMsStruct, not Strust
Erich Keane [Tue, 24 Oct 2017 15:34:59 +0000 (15:34 +0000)]
Fix spelling in comment, field is isMsStruct, not Strust

llvm-svn: 316447

7 years ago[x86] add more vector ISA variants for memcmp expansion; NFC
Sanjay Patel [Tue, 24 Oct 2017 15:27:47 +0000 (15:27 +0000)]
[x86] add more vector ISA variants for memcmp expansion; NFC

...because every swiss cheese has different holes.

llvm-svn: 316446

7 years ago[ISLTools] Translate computeReachingWrite to isl++. NFC.
Michael Kruse [Tue, 24 Oct 2017 15:19:46 +0000 (15:19 +0000)]
[ISLTools] Translate computeReachingWrite to isl++. NFC.

llvm-svn: 316445

7 years ago[modules] Add a regression test for merging anon decls in extern C contexts.
Vassil Vassilev [Tue, 24 Oct 2017 14:52:35 +0000 (14:52 +0000)]
[modules] Add a regression test for merging anon decls in extern C contexts.

llvm-svn: 316444

7 years ago[utils] make retq/retl regex an option that is off by default
Sanjay Patel [Tue, 24 Oct 2017 14:32:52 +0000 (14:32 +0000)]
[utils] make retq/retl regex an option that is off by default

Ideally, we should compare 32- and 64-bit versions to see if the
ret line is the only difference and then insert the regex only
in that case. But this is a quick hack to avoid a bunch of noise
as existing tests are updated.

llvm-svn: 316443

7 years ago[ARM] Tighten up CHECK lines in a test
Oliver Stannard [Tue, 24 Oct 2017 14:20:13 +0000 (14:20 +0000)]
[ARM] Tighten up CHECK lines in a test

These tests checked for the line number without a leading ":", so for example,
a missed diagnostic on line 123 could match one on line 1123, 2123, etc,
desynchronising the test for hundreds of lines.

This couldn't cause it to incorrectly pass or fail, but made it hard to track
down test failures.

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

llvm-svn: 316442

7 years ago[ARM] Error for invalid shift in memory operand
Oliver Stannard [Tue, 24 Oct 2017 14:19:08 +0000 (14:19 +0000)]
[ARM] Error for invalid shift in memory operand

Report a diagnostic when we fail to parse a shift in a memory operand because
the shift type is not an identifier. Without this, we were silently ignoring
the whole instruction.

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

llvm-svn: 316441

7 years ago[X86] truncateVectorCompareWithPACKSS - remove duplicate variables. NFCI.
Simon Pilgrim [Tue, 24 Oct 2017 14:18:32 +0000 (14:18 +0000)]
[X86] truncateVectorCompareWithPACKSS - remove duplicate variables. NFCI.

llvm-svn: 316440

7 years agoMark string_view literals as 'noexcept'. Fixes PR#25054. Thanks to Pavel K for the...
Marshall Clow [Tue, 24 Oct 2017 14:06:00 +0000 (14:06 +0000)]
Mark string_view literals as 'noexcept'. Fixes PR#25054. Thanks to Pavel K for the bug report.

llvm-svn: 316439

7 years agoAdd Forgotten test for: Fix template parameter default args missed if redecled
Erich Keane [Tue, 24 Oct 2017 13:51:07 +0000 (13:51 +0000)]
Add Forgotten test for: Fix template parameter default args missed if redecled

Addendum to differential revision: https://reviews.llvm.org/D39127

llvm-svn: 316437

7 years agoDo not add a colon chunk to the code completion of class inheritance access modifiers
Erik Verbruggen [Tue, 24 Oct 2017 13:46:58 +0000 (13:46 +0000)]
Do not add a colon chunk to the code completion of class inheritance access modifiers

With enabled CINDEXTEST_CODE_COMPLETE_PATTERNS env option (which enables
IncludeCodePatterns in completion options) code completion after colon
currently suggests access modifiers with 2 completion chunks which is
incorrect.

Example:
class A : <Cursor>B
{
}

Currently we get 'NotImplemented:{TypedText public}{Colon :} (40)'
but the correct line is just 'NotImplemented:{TypedText public} (40)'

The fix introduces more specific scope that occurs between ':' and '{'
It allows us to determine when we don't need to add ':' as a second
chunk to the public/protected/private access modifiers.

Patch by Ivan Donchevskii!

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

llvm-svn: 316436

7 years agoUpdate f16c instruction scheduling on btver2.
Andrew V. Tischenko [Tue, 24 Oct 2017 13:38:30 +0000 (13:38 +0000)]
Update f16c instruction scheduling on btver2.
Differential Revision: https://reviews.llvm.org/D39051

llvm-svn: 316435

7 years agoX86CallFrameOptimization: Update comments and variable names. NFCI.
Zvi Rackover [Tue, 24 Oct 2017 13:24:26 +0000 (13:24 +0000)]
X86CallFrameOptimization: Update comments and variable names. NFCI.

Following up on D38738.

llvm-svn: 316434

7 years ago[Tooling] Add a factory method for CommonOptionsParser
Eric Liu [Tue, 24 Oct 2017 13:10:58 +0000 (13:10 +0000)]
[Tooling] Add a factory method for CommonOptionsParser

Summary: This returns error instead of exiting the program in case of error.

Reviewers: klimek, hokein

Reviewed By: hokein

Subscribers: cfe-commits

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

llvm-svn: 316433

7 years ago[DeLICM] Do not try to map to multiple array elements.
Michael Kruse [Tue, 24 Oct 2017 13:05:24 +0000 (13:05 +0000)]
[DeLICM] Do not try to map to multiple array elements.

Add check and skip when the store used to determine the target accesses
multiple array elements. Only a single array location should for
mapping the scalar. Having multiple creates problems when deciding which
element to load from. While MemoryAccess::getAddressFunction() should
select just one of them, other problems arise in code that assumes
that there is just one target element per statement instance.

This fixes llvm.org/PR34989

This also reverts r313902 which fixed llvm.org/PR34485 also caused by
a non-functional target array element. This patch avoids the situation
to occur in the first place.

llvm-svn: 316432

7 years agoX86CallFrameOptimization: Recognize 'store 0/-1 using and/or' idioms
Zvi Rackover [Tue, 24 Oct 2017 12:13:05 +0000 (12:13 +0000)]
X86CallFrameOptimization: Recognize 'store 0/-1 using and/or' idioms

Summary:
r264440 added or/and patterns for storing -1 or 0 with the intention of decreasing code size. However,
X86CallFrameOptimization does not recognize these memory accesses so it will not replace them with push's when profitable.

This patch fixes this problem by teaching X86CallFrameOptimization these store 0/-1 idioms.

An alternative fix would be to prevent the 'store 0/1 idioms' patterns from firing when accessing the stack. This would save
the need to teach the pass about these idioms. However, because X86CallFrameOptimization does not always fire we may result
in cases where neither X86CallFrameOptimization not the patterns for 'store 0/1 idioms' fire.

Fixes pr34863

Reviewers: DavidKreitzer, guyblank, aymanmus

Reviewed By: aymanmus

Subscribers: llvm-commits

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

llvm-svn: 316431

7 years ago[ConstantFolding] Avoid assert when folding ptrtoint of vectorized GEP
Bjorn Pettersson [Tue, 24 Oct 2017 12:08:11 +0000 (12:08 +0000)]
[ConstantFolding] Avoid assert when folding ptrtoint of vectorized GEP

Summary:
Got asserts in llvm::CastInst::getCastOpcode saying:
`DestBits == SrcBits && "Illegal cast to vector (wrong type or size)"' failed.

Problem seemed to be that llvm::ConstantFoldCastInstruction did
not handle ptrtoint cast of a getelementptr returning a vector
correctly. I assume such situations are quite rare, since the
GEP needs to be considered as a constant value (base pointer
being null).
The solution used here is to simply avoid the constant fold
of ptrtoint when the value is a vector. It is not supported,
and by bailing out we do not fail on assertions later on.

Reviewers: craig.topper, majnemer, davide, filcab, efriedma

Reviewed By: efriedma

Subscribers: efriedma, filcab, llvm-commits

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

llvm-svn: 316430