platform/upstream/llvm.git
6 years ago[clangd] Handle exit notification (proper shutdown)
Ilya Biryukov [Wed, 25 Oct 2017 08:45:41 +0000 (08:45 +0000)]
[clangd] Handle exit notification (proper shutdown)

Summary:
This changes the onShutdown handler to do essentially nothing (for now), and
instead exits the runloop when we receive the exit notification from the client.

Some clients may wait on the reply from the shutdown request before sending an
exit notification. If we exit the runloop already in the shutdown request, a
client might block forever.

This also gives us the opportunity to do any global cleanups and/or
serializations of PCH preambles to disk, but I've left that out for now.

See the LSP protocol documentation for details.

Reviewers: malaperle, krasimir, bkramer, sammccall, ilya-biryukov

Reviewed By: malaperle, sammccall, ilya-biryukov

Subscribers: cfe-commits

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

llvm-svn: 316564

6 years ago[ARM] OrCombineToBFI function
Sam Parker [Wed, 25 Oct 2017 08:37:33 +0000 (08:37 +0000)]
[ARM] OrCombineToBFI function

Extract the functionality to combine OR to BFI into its own function.

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

llvm-svn: 316563

6 years ago[ARM] Swap cmp operands for automatic shifts
Sam Parker [Wed, 25 Oct 2017 08:33:06 +0000 (08:33 +0000)]
[ARM] Swap cmp operands for automatic shifts

Swap the compare operands if the lhs is a shift and the rhs isn't,
as in arm and T2 the shift can be performed by the compare for its
second operand.

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

llvm-svn: 316562

6 years ago[clang-rename] Fix and enable the failing TemplatedClassFunction test.
Haojian Wu [Wed, 25 Oct 2017 08:25:25 +0000 (08:25 +0000)]
[clang-rename] Fix and enable the failing TemplatedClassFunction test.

Reviewers: ioeric

Reviewed By: ioeric

Subscribers: klimek, cfe-commits

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

llvm-svn: 316561

6 years ago[MachineScheduler] Minor refactoring.
Jonas Paulsson [Wed, 25 Oct 2017 08:23:33 +0000 (08:23 +0000)]
[MachineScheduler]  Minor refactoring.

Duplicated code found in three places put into a new static function:

/// Given a Count of resource usage and a Latency value, return true if a
/// SchedBoundary becomes resource limited.
static bool checkResourceLimit(unsigned LFactor, unsigned Count,
                               unsigned Latency) {
  return (int)(Count - (Latency * LFactor)) > (int)LFactor;
}

Review: Florian Hahn, Matthias Braun
https://reviews.llvm.org/D39235

llvm-svn: 316560

6 years agoFix the context/cursor size for ARM with WMMX enabled
Martin Storsjo [Wed, 25 Oct 2017 08:07:19 +0000 (08:07 +0000)]
Fix the context/cursor size for ARM with WMMX enabled

This was missed in SVN r274744 when the WMMX part was made optional;
when made optional, some struct fields were reordered, which caused
the total struct size to grow due to padding/alignment.

llvm-svn: 316559

6 years ago[tsan] Fix warnings in tsan_interceptors.cc from expansion of variadic macros
Dmitry Vyukov [Wed, 25 Oct 2017 08:05:13 +0000 (08:05 +0000)]
[tsan] Fix warnings in tsan_interceptors.cc from expansion of variadic macros

C99 technically requires the rest arguments to be used in C variadic macros.
This presents a problem with the macro SCOPED_TSAN_INTERCEPTOR when func
takes no arguments. This happens with the function pause. Like other void
argument functions, we pass in a fake argument to avoid this warning.

Author: Alex Langford (xiaobai)
Reviewed in: https://reviews.llvm.org/D39151

llvm-svn: 316558

6 years ago[AArch64] Add support for dllimport of values and functions
Martin Storsjo [Wed, 25 Oct 2017 07:25:18 +0000 (07:25 +0000)]
[AArch64] Add support for dllimport of values and functions

Previously, the dllimport attribute did the right thing in terms
of treating it as a pointer to a value, but this makes sure the
names get mangled properly, and calls to such functions load the
function from the __imp_ pointer.

This is based on SVN r212431 and r212430 where the same was
implemented for ARM.

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

llvm-svn: 316555

6 years agoDAG: Fix creating select with wrong condition type
Matt Arsenault [Wed, 25 Oct 2017 07:14:07 +0000 (07:14 +0000)]
DAG: Fix creating select with wrong condition type

This code added in r297930 assumed that it could create
a select with a condition type that is just an integer
bitcast of the selected type. For AMDGPU any vselect is
going to be scalarized (although the vector types are legal),
and all select conditions must be i1 (the same as getSetCCResultType).

This logic doesn't really make sense to me, but there's
never really been a consistent policy in what the select
condition mask type is supposed to be. Try to extend
the logic for skipping the transform for condition types
that aren't setccs. It doesn't seem quite right to me though,
but checking conditions that seem more sensible (like whether the
vselect is going to be expanded) doesn't work since this
seems to depend on that also.

llvm-svn: 316554

6 years agoAMDGPU: Add max-mix-insts subtarget feature
Matt Arsenault [Wed, 25 Oct 2017 07:00:51 +0000 (07:00 +0000)]
AMDGPU: Add max-mix-insts subtarget feature

llvm-svn: 316553

6 years ago[IRCE] Fix intersection between signed and unsigned ranges
Max Kazantsev [Wed, 25 Oct 2017 06:47:39 +0000 (06:47 +0000)]
[IRCE] Fix intersection between signed and unsigned ranges

IRCE for unsigned latch conditions was temporarily disabled by rL314881. The motivating
example contained an unsigned latch condition and a signed range check. One of the safe
iteration ranges was `[1, SINT_MAX + 1]`. Its right border was incorrectly interpreted as a negative
value in `IntersectRange` function, this lead to a miscompile under which we deleted a range check
without inserting a postloop where it was needed.

This patch brings back IRCE for unsigned latch conditions. Now we treat range intersection more
carefully. If the latch condition was unsigned, we only try to consider a range check for deletion if:
1. The range check is also unsigned, or
2. Safe iteration range of the range check lies within `[0, SINT_MAX]`.
The same is done for signed latch.

Values from `[0, SINT_MAX]` are unambiguous, these values are non-negative under any interpretation,
and all values of a range intersected with such range are also non-negative.

We also use signed/unsigned min/max functions for range intersection depending on type of the
latch condition.

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

llvm-svn: 316552

6 years ago[MemDep] DBG intrinsics don't impact abort limit for call site dependence analysis
Mikael Holmen [Wed, 25 Oct 2017 06:15:32 +0000 (06:15 +0000)]
[MemDep] DBG intrinsics don't impact abort limit for call site dependence analysis

Summary:
Memory dependence analysis no longer counts DbgInfoIntrinsics towards the
limit where to abort the analysis. Before, a bunch of calls to dbg.value
could affect the generated code, meaning that with -g we could generate
different code than without.

Reviewers: chandlerc, Prazek, davide, efriedma

Reviewed By: efriedma

Subscribers: llvm-commits

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

llvm-svn: 316551

6 years ago[IRCE] Smarter detection of empty ranges using SCEV
Max Kazantsev [Wed, 25 Oct 2017 06:10:02 +0000 (06:10 +0000)]
[IRCE] Smarter detection of empty ranges using SCEV

For a SCEV range, this patch replaces the naive emptiness check for SCEV ranges
which looks like `Begin == End` with a SCEV check. The range is guaranteed to be
empty of `Begin >= End`. We should filter such ranges out and do not try to perform
IRCE for them.

For example, we can get such range when intersecting range `[A, B)` and `[C, D)`
where `A < B < C < D`. The resulting range is `[max(A, C), min(B, D)) = [C, B)`.
This range is empty, but its `Begin` does not match with `End`.

Making IRCE for an empty range is basically safe but unprofitable because we
never actually get into the main loop where the range checks are supposed to
be eliminated. This patch uses SCEV mechanisms to treat loops with proved
`Begin >= End` as empty.

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

llvm-svn: 316550

6 years agoTry to fix test on windows.
Peter Collingbourne [Wed, 25 Oct 2017 05:33:28 +0000 (05:33 +0000)]
Try to fix test on windows.

llvm-svn: 316549

6 years ago[XRay][compiler-rt][NFC] Clean up xray log files before running test
Dean Michael Berris [Wed, 25 Oct 2017 05:19:20 +0000 (05:19 +0000)]
[XRay][compiler-rt][NFC] Clean up xray log files before running test

Improves the test behaviour in the face of failure. Without this change
the fdr-single-thread.cc test may leave around artefacts of a previous
failing run since the cleanup doesn't happen if any of the intermediary
steps fail.

Non-functional change.

Subscribers: llvm-commits
llvm-svn: 316548

6 years agoCOFF: Don't add /manifest* flags to the response file.
Peter Collingbourne [Wed, 25 Oct 2017 05:00:54 +0000 (05:00 +0000)]
COFF: Don't add /manifest* flags to the response file.

If /manifest:embed is enabled we're already creating a resource file
out of these flags and adding it to the linkrepro, and it doesn't
seem worth being able to repro side-by-side manifests.

Includes a test that covers this commit as well as r315948.

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

llvm-svn: 316547

6 years agoAssembly tests require x86 target.
Peter Collingbourne [Wed, 25 Oct 2017 04:24:20 +0000 (04:24 +0000)]
Assembly tests require x86 target.

llvm-svn: 316546

6 years agoCodeGen: fix a case of incorrect checks for ivars
Saleem Abdulrasool [Wed, 25 Oct 2017 03:58:15 +0000 (03:58 +0000)]
CodeGen: fix a case of incorrect checks for ivars

Ensure that we check the ivar containing decl for the DLL storage
attribute rather than the ivar itself as the dll storage is associated
to the interface decl not the ivar decl.

llvm-svn: 316545

6 years ago[ThinLTO] Make test for promoted names more specific
Teresa Johnson [Wed, 25 Oct 2017 03:41:31 +0000 (03:41 +0000)]
[ThinLTO] Make test for promoted names more specific

With r314527, promoted values get a suffix that is a decimal value of
the module hash instead of hex. Change the regex to match only decimal
suffix values.

llvm-svn: 316544

6 years agollvm-readobj: Add support for reading relocations in the Android packed format.
Peter Collingbourne [Wed, 25 Oct 2017 03:37:12 +0000 (03:37 +0000)]
llvm-readobj: Add support for reading relocations in the Android packed format.

This is in preparation for testing lld's upcoming relocation packing
feature (D39152). I have verified that this implementation correctly
unpacks the relocations from a Chromium DSO built with gold and the
Android relocation packer for ARM32 and ARM64.

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

llvm-svn: 316543

6 years ago[CMake] Build host builtins in Fuchsia toolchain even on Darwin
Petr Hosek [Wed, 25 Oct 2017 02:35:22 +0000 (02:35 +0000)]
[CMake] Build host builtins in Fuchsia toolchain even on Darwin

This is nedeeded for the toolchain to be actually usable as a host
toolchain on Darwin.

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

llvm-svn: 316542

6 years ago[CMake] Include clang-refactor in Fuchsia toolchain
Petr Hosek [Wed, 25 Oct 2017 02:31:38 +0000 (02:31 +0000)]
[CMake] Include clang-refactor in Fuchsia toolchain

This includes the clang-refactor in the toolchain distribution.

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

llvm-svn: 316541

6 years ago[clang-refactor] Use add_clang_tool CMake template
Petr Hosek [Wed, 25 Oct 2017 01:11:27 +0000 (01:11 +0000)]
[clang-refactor] Use add_clang_tool CMake template

This allows including clang-refactor in LLVM_DISTRIBUTION_COMPONENTS
to build clang-refactor as part of the toolchain distribution.

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

llvm-svn: 316540

6 years ago[Analyzer] Remove spaces inside comments mentioning the parameter name,
George Karpenkov [Wed, 25 Oct 2017 00:03:45 +0000 (00:03 +0000)]
[Analyzer] Remove spaces inside comments mentioning the parameter name,

to aid clang-tidy comprehension.
Requested by @alexfh in https://reviews.llvm.org/D39015

llvm-svn: 316539

6 years ago[Analyzer] Remove unnecessary semicolon in analyzer tests.
George Karpenkov [Wed, 25 Oct 2017 00:03:45 +0000 (00:03 +0000)]
[Analyzer] Remove unnecessary semicolon in analyzer tests.

llvm-svn: 316538

6 years agoCheck special-case-list regex before insertion.
Mitch Phillips [Tue, 24 Oct 2017 23:56:12 +0000 (23:56 +0000)]
Check special-case-list regex before insertion.

Summary:
Checks that the supplied regex to SpecialCaseList::Matcher::insert(..) is non-empty.

Reported by OSS-fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3688

Verified that this fixes the provided assertion failure (built with {asan, fuzzer}):
```
mitchp@mitchp2:~/llvm-build/git-fuzz$ ninja llvm-special-case-list-fuzzer[12/12] Linking CXX executable bin/llvm-special-case-list-fuzzer
mitchp@mitchp2:~/llvm-build/git-fuzz$ bin/llvm-special-case-list-fuzzer ~/Downloads/clusterfuzz-testcase-6748633157337088
INFO: Seed: 1697404507
INFO: Loaded 1 modules   (18581 inline 8-bit counters): 18581 [0x9e9f60, 0x9ee7f5),
INFO: Loaded 1 PC tables (18581 PCs): 18581 [0x9ee7f8,0xa37148),
bin/llvm-special-case-list-fuzzer: Running 1 inputs 1 time(s) each.
Running: /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088
Executed /usr/local/google/home/mitchp/Downloads/clusterfuzz-testcase-6748633157337088 in 0 ms
***
*** NOTE: fuzzing was not performed, you have only
***       executed the target code on a fixed set of inputs.
***
mitchp@mitchp2:~/llvm-build/git-fuzz$

```

Reviewers: kcc, vsk

Reviewed By: vsk

Subscribers: vsk, llvm-commits, vlad.tsyrklevich

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

llvm-svn: 316537

6 years ago[Analyzer] Store BodyFarm in std::unique_ptr
George Karpenkov [Tue, 24 Oct 2017 23:53:19 +0000 (23:53 +0000)]
[Analyzer] Store BodyFarm in std::unique_ptr

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

llvm-svn: 316536

6 years ago[Analyzer] [Tests] Minor refactor of testing infrastructure:
George Karpenkov [Tue, 24 Oct 2017 23:52:48 +0000 (23:52 +0000)]
[Analyzer] [Tests] Minor refactor of testing infrastructure:

Move utilities functions into a separate file to make comprehension
easier.

llvm-svn: 316535

6 years ago[Analyzer] [Tests] Remove temporary fields from generated reference results.
George Karpenkov [Tue, 24 Oct 2017 23:52:46 +0000 (23:52 +0000)]
[Analyzer] [Tests] Remove temporary fields from generated reference results.

Pointer to HTML diagnostics is removed (as it is not stored) as well as
the version (as it would be available from the commit message).

llvm-svn: 316534

6 years agoFix a compile warning on linux
Stephane Sezer [Tue, 24 Oct 2017 23:46:00 +0000 (23:46 +0000)]
Fix a compile warning on linux

Can't cast directly between a pointer to function and a pointer to
object.

llvm-svn: 316533

6 years agoAllow ObjectFilePECOFF to initialize with ARM binaries.
Stephane Sezer [Tue, 24 Oct 2017 23:40:59 +0000 (23:40 +0000)]
Allow ObjectFilePECOFF to initialize with ARM binaries.

Summary: This is required to start debugging WinPhone ARM targets.

Reviewers: compnerd, zturner, omjavaid

Reviewed By: compnerd

Subscribers: jasonmolenda, aemerson, rengolin, lldb-commits

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

llvm-svn: 316532

6 years ago[Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
Akira Hatanaka [Tue, 24 Oct 2017 23:38:14 +0000 (23:38 +0000)]
[Sema][ObjC] Look for either objc_bridge or objc_bridge_mutable when
determining whether a RecordDecl is CFError.

CFErrorRef used to be declared with "objc_bridge(NSError)" but is now
declared with "objc_bridge_mutable(NSError)". Look for either when
checking whether a RecordDecl is CFError.

rdar://problem/35034779

llvm-svn: 316531

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

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

llvm-svn: 316520

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

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

llvm-svn: 316489

6 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

6 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

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

llvm-svn: 316486

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

6 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

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

llvm-svn: 316466

6 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

6 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

6 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