platform/upstream/llvm.git
7 years ago[DebugInfo] Handle endianness when moving debug info for split integer values (reapplied)
Bjorn Pettersson [Tue, 3 Oct 2017 11:03:02 +0000 (11:03 +0000)]
[DebugInfo] Handle endianness when moving debug info for split integer values (reapplied)

Summary:
Take the target's endianness into account when splitting the
debug information in DAGTypeLegalizer::SetExpandedInteger.

This patch fixes so that, for big-endian targets, the fragment
expression corresponding to the high part of a split integer
value is placed at offset 0, in order to correctly represent
the memory address order.

I have attached a PPC32 reproducer where the resulting DWARF
pieces for a 64-bit integer were incorrectly reversed.

Original patch was reverted due to using -stop-after=isel in
the test case (but that is only working when AMDGPU target
is included in the llc build). The test case has now been
updated to use -stop-before=expand-isel-pseudos instead.

Patch by: dstenb

Reviewers: JDevlieghere, aprantl, dblaikie

Reviewed By: JDevlieghere, aprantl, dblaikie

Subscribers: nemanjai

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

llvm-svn: 314781

7 years ago[CodeGen] Introduce generic TBAA access descriptors
Ivan A. Kosarev [Tue, 3 Oct 2017 10:52:39 +0000 (10:52 +0000)]
[CodeGen] Introduce generic TBAA access descriptors

With this patch we implement a concept of TBAA access descriptors
that are capable of representing both scalar and struct-path
accesses in a generic way.

This is part of D37826 reworked to be a separate patch to
simplify review.

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

llvm-svn: 314780

7 years ago[ARM] Use new assembler diags for ARM
Oliver Stannard [Tue, 3 Oct 2017 10:26:11 +0000 (10:26 +0000)]
[ARM] Use new assembler diags for ARM

This converts the ARM AsmParser to use the new assembly matcher error
reporting mechanism, which allows errors to be reported for multiple
instruction encodings when it is ambiguous which one the user intended
to use.

By itself this doesn't improve many error messages, because we don't have
diagnostic text for most operand types, but as we add that then this will allow
more of those diagnostic strings to be used when they are relevant.

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

llvm-svn: 314779

7 years agoRemove unused variable. NFCI.
Simon Pilgrim [Tue, 3 Oct 2017 10:01:02 +0000 (10:01 +0000)]
Remove unused variable. NFCI.

llvm-svn: 314778

7 years ago[X86][SSE] Add support for shuffle combining from PACKSS/PACKUS
Simon Pilgrim [Tue, 3 Oct 2017 09:54:03 +0000 (09:54 +0000)]
[X86][SSE] Add support for shuffle combining from PACKSS/PACKUS

Mentioned in D38472

llvm-svn: 314777

7 years ago[X86][SSE] Add support for PACKSS/PACKUS constant folding
Simon Pilgrim [Tue, 3 Oct 2017 09:41:00 +0000 (09:41 +0000)]
[X86][SSE] Add support for PACKSS/PACKUS constant folding

Pulled out of D38472

llvm-svn: 314776

7 years ago[MiSched] - Simplify ProcResEntry access
Javed Absar [Tue, 3 Oct 2017 09:35:04 +0000 (09:35 +0000)]
[MiSched] - Simplify ProcResEntry access

Reviewed by: @MatzeB
Differential Revision: https://reviews.llvm.org/D38447

llvm-svn: 314775

7 years ago[Assembler] Report multiple near misses for invalid instructions
Oliver Stannard [Tue, 3 Oct 2017 09:33:12 +0000 (09:33 +0000)]
[Assembler] Report multiple near misses for invalid instructions

The current table-generated assembly instruction matcher returns a
64-bit error code when matching fails. Since multiple instruction
encodings with the same mnemonic can fail for different reasons, it uses
some heuristics to decide which message is important.

This heuristic does not work well for targets that have many encodings
with the same mnemonic but different operands, or which have different
versions of instructions controlled by subtarget features, as it is hard
to know which encoding the user was intending to use.

Instead of trying to improve the heuristic in the table-generated
matcher, this patch changes it to report a list of near-miss encodings.
This list contains an entry for each encoding with the correct mnemonic,
but with exactly one thing preventing it from being valid. This thing
could be a single invalid operand, a missing target feature or a failed
target-specific validation function.

The target-specific assembly parser can then report an error message
giving multiple options for instruction variants that the user may have
been trying to use. For example, I am working on a patch to use this for
ARM, which can give this error for an invalid instruction for ARMv6-M:

  <stdin>:8:3: error: invalid instruction, multiple near-miss encodings found
    adds r0, r1, #0x8
    ^
  <stdin>:8:3: note: for one encoding: instruction requires: thumb2
    adds r0, r1, #0x8
    ^
  <stdin>:8:16: note: for one encoding: expected an integer in range [0, 7]
    adds r0, r1, #0x8
                 ^
  <stdin>:8:16: note: for one encoding: expected a register in range [r0, r7]
    adds r0, r1, #0x8
                 ^

This also allows the target-specific assembly parser to apply its own
heuristics to suppress some errors. For example, the error "instruction
requires: arm-mode" is never going to be useful when targeting an
M-profile architecture (which does not have ARM mode).

This patch just adds the target-independent mechanism for doing this,
all targets still use the old mechanism. I've added a bit in the
AsmParser tablegen class to allow targets to switch to this new
mechanism. To use this, the target-specific assembly parser will have to
be modified for the change in signature of MatchInstructionImpl, and to
report errors based on the list of near-misses.

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

llvm-svn: 314774

7 years agoISel type legalization: add debug messages. NFCI.
Sjoerd Meijer [Tue, 3 Oct 2017 08:54:15 +0000 (08:54 +0000)]
ISel type legalization: add debug messages. NFCI.

This adds some more debug messages to the type legalizer and functions
like PromoteNode, ExpandNode, ExpandLibCall in an attempt to make
the debug messages a little bit more informative and useful.

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

llvm-svn: 314773

7 years ago[llvm-readobj][RISCV] Pretty-print RISCV e_flags
Alex Bradbury [Tue, 3 Oct 2017 08:41:59 +0000 (08:41 +0000)]
[llvm-readobj][RISCV] Pretty-print RISCV e_flags

llvm-svn: 314772

7 years ago[RISCV] Add missed test case for r314770
Alex Bradbury [Tue, 3 Oct 2017 08:03:14 +0000 (08:03 +0000)]
[RISCV] Add missed test case for r314770

Differential Revision: https://reviews.llvm.org/D38311
Patch by https://reviews.llvm.org/D38311

llvm-svn: 314771

7 years ago[RISCV] Parse RISC-V eflags in ObjectYAML
Alex Bradbury [Tue, 3 Oct 2017 08:00:47 +0000 (08:00 +0000)]
[RISCV] Parse RISC-V eflags in ObjectYAML

Differential Revision: https://reviews.llvm.org/D38311
Patch by Chih-Mao Chen.

llvm-svn: 314770

7 years ago[trivial] fix format, NFC
Hiroshi Inoue [Tue, 3 Oct 2017 07:28:58 +0000 (07:28 +0000)]
[trivial] fix format, NFC

llvm-svn: 314769

7 years ago[ObjectYAML] Handle SHF_COMPRESSED
Shoaib Meenai [Tue, 3 Oct 2017 06:35:55 +0000 (06:35 +0000)]
[ObjectYAML] Handle SHF_COMPRESSED

This was previously being silently dropped by obj2yaml and caused
parsing errors with yaml2obj.

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

llvm-svn: 314768

7 years ago[X86] Provide the LSDA pointer with RIP relative addressing if necessary
Martin Storsjo [Tue, 3 Oct 2017 06:29:58 +0000 (06:29 +0000)]
[X86] Provide the LSDA pointer with RIP relative addressing if necessary

This makes sure the LSDA pointer isn't truncated to 32 bit.

Make LowerINTRINSIC_WO_CHAIN a member function instead of a static
function, so that it can use the getGlobalWrapperKind method.

This solves the second half of the issues mentioned in PR34720.

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

llvm-svn: 314767

7 years ago[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueue
Dean Michael Berris [Tue, 3 Oct 2017 06:15:34 +0000 (06:15 +0000)]
[XRay][compiler-rt] Use a hand-written circular buffer in BufferQueue

Summary:
This change removes the dependency on using a std::deque<...> for the
storage of the buffers in the buffer queue. We instead implement a
fixed-size circular buffer that's resilient to exhaustion, and preserves
the semantics of the BufferQueue.

We're moving away from using std::deque<...> for two reasons:

  - We want to remove dependencies on the STL for data structures.

  - We want the data structure we use to not require re-allocation in
    the normal course of operation.

The internal implementation of the buffer queue uses heap-allocated
arrays that are initialized once when the BufferQueue is created, and
re-uses slots in the buffer array as buffers are returned in order.

We also change the lock used in the implementation to a spinlock
instead of a blocking mutex. We reason that since the release operations
now take very little time in the critical section, that a spinlock would
be appropriate.

This change is related to D38073.

Reviewers: dblaikie, kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 314766

7 years agofixup: use UNUSED, restore alignment for cache-line friendliness, and report on error...
Dean Michael Berris [Tue, 3 Oct 2017 06:11:20 +0000 (06:11 +0000)]
fixup: use UNUSED, restore alignment for cache-line friendliness, and report on errors found when pthread_create_key fails

llvm-svn: 314765

7 years ago[XRay][compiler-rt] Use pthread for initializing thread-local data
Dean Michael Berris [Tue, 3 Oct 2017 06:11:13 +0000 (06:11 +0000)]
[XRay][compiler-rt] Use pthread for initializing thread-local data

Summary:
We avoid using C++11's thread_local keyword on non-trivially
destructible objects because it may introduce deadlocks when the C++
runtime registers destructors calling std::malloc(...). The deadlock may
happen when the allocator implementation is itself XRay instrumented.

To avoid having to call malloc(...) and free(...) in particular, we use
pthread_once, pthread_create_key, and pthread_setspecific to instead
manually register the cleanup implementation we want.

The code this replaces used an RAII type that implements the cleanup
functionality in the destructor, that was then initialized as a
function-local thread_local object. While it works in usual situations,
unfortunately it breaks when using a malloc implementation that itself
is XRay-instrumented.

Reviewers: dblaikie, kpw, pelikan

Subscribers: llvm-commits

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

llvm-svn: 314764

7 years ago[Lint] Avoid failed assertion by fetching the proper pointer type
Mikael Holmen [Tue, 3 Oct 2017 06:03:49 +0000 (06:03 +0000)]
[Lint] Avoid failed assertion by fetching the proper pointer type

Summary:
When checking if a constant expression is a noop cast we fetched the
IntPtrType by doing DL->getIntPtrType(V->getType())). However, there can
be cases where V doesn't return a pointer, and then getIntPtrType()
triggers an assertion.

Now we pass DataLayout to isNoopCast so the method itself can determine
what the IntPtrType is.

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: wdng, llvm-commits

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

llvm-svn: 314763

7 years ago[InstCombine] Change a bunch of methods to take APInts by reference instead of pointer.
Craig Topper [Tue, 3 Oct 2017 05:31:07 +0000 (05:31 +0000)]
[InstCombine] Change a bunch of methods to take APInts by reference instead of pointer.

This allows us to remove a bunch of dereferences and only have a few dereferences at the call sites.

llvm-svn: 314762

7 years ago[InstCombine] Replace an equality compare of two APInt pointers with a compare of...
Craig Topper [Tue, 3 Oct 2017 04:55:04 +0000 (04:55 +0000)]
[InstCombine] Replace an equality compare of two APInt pointers with a compare of the APInts themselves.

Apparently this works by virtue of the fact that the pointers are pointers to the APInts stored inside of the ConstantInt objects. But I really don't think we should be relying on that.

llvm-svn: 314761

7 years ago[Legalizer] Add support for G_OR NarrowScalar.
Quentin Colombet [Tue, 3 Oct 2017 04:53:56 +0000 (04:53 +0000)]
[Legalizer] Add support for G_OR NarrowScalar.

Legalize bitwise OR:
 A = BinOp<Ty> B, C
into:
 B1, ..., BN = G_UNMERGE_VALUES B
 C1, ..., CN = G_UNMERGE_VALUES C
 A1 = BinOp<Ty/N> B1, C2
 ...
 AN = BinOp<Ty/N> BN, CN
 A = G_MERGE_VALUES A1, ..., AN

llvm-svn: 314760

7 years agolldCommon depends on intrinsics_gen, due to llvm/CodeGen/CommandFlags.h
NAKAMURA Takumi [Tue, 3 Oct 2017 04:18:46 +0000 (04:18 +0000)]
lldCommon depends on intrinsics_gen, due to llvm/CodeGen/CommandFlags.h

llvm-svn: 314759

7 years ago[X86] Add AVX512 check lines to the cost model truncate test.
Craig Topper [Tue, 3 Oct 2017 03:47:34 +0000 (03:47 +0000)]
[X86] Add AVX512 check lines to the cost model truncate test.

llvm-svn: 314758

7 years agoRewrite a function so that it doesn't use pointers to pointers. NFC.
Rui Ueyama [Tue, 3 Oct 2017 03:09:05 +0000 (03:09 +0000)]
Rewrite a function so that it doesn't use pointers to pointers. NFC.

Previous code was a bit puzzling because of its use of pointers.
In this patch, we pass a vector and its offsets, instead of pointers to
vector elements.

llvm-svn: 314756

7 years agoFix test suite misconfiguration on OS X
Eric Fiselier [Tue, 3 Oct 2017 02:25:05 +0000 (02:25 +0000)]
Fix test suite misconfiguration on OS X

llvm-svn: 314755

7 years agoR34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.
Richard Smith [Tue, 3 Oct 2017 01:58:15 +0000 (01:58 +0000)]
R34811: Allow visibilities other than 'default' for VisibleNoLinkage entities.

llvm-svn: 314754

7 years agoAdd parens around the boolean condition of one of the added asserts in r314747 ...
Faisal Vali [Tue, 3 Oct 2017 01:33:36 +0000 (01:33 +0000)]
Add parens around the boolean condition of one of the added asserts in r314747 ...
  ... in the hopes of teaching the bots the gift of silence ;)

For quick reference: https://reviews.llvm.org/rL314747

llvm-svn: 314753

7 years ago[ubsan] Skip alignment checks which are folded away
Vedant Kumar [Tue, 3 Oct 2017 01:27:26 +0000 (01:27 +0000)]
[ubsan] Skip alignment checks which are folded away

Don't emit alignment checks which the IR constant folder throws away.

I've tested this out on X86FastISel.cpp. While this doesn't decrease
end-to-end compile-time significantly, it results in 122 fewer type
checks (1% reduction) overall, without adding any real complexity.

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

llvm-svn: 314752

7 years ago[ubsan] Save the result of getLLVMContext. NFC.
Vedant Kumar [Tue, 3 Oct 2017 01:27:26 +0000 (01:27 +0000)]
[ubsan] Save the result of getLLVMContext. NFC.

llvm-svn: 314751

7 years ago[ubsan] Add helpers to decide when null/vptr checks are required. NFC.
Vedant Kumar [Tue, 3 Oct 2017 01:27:25 +0000 (01:27 +0000)]
[ubsan] Add helpers to decide when null/vptr checks are required. NFC.

llvm-svn: 314750

7 years ago[ubsan] Save a ptrtoint when emitting alignment checks
Vedant Kumar [Tue, 3 Oct 2017 01:27:24 +0000 (01:27 +0000)]
[ubsan] Save a ptrtoint when emitting alignment checks

The alignment check emits a ptrtoint instruction which can be reused in
the call to the diagnostic handler.

llvm-svn: 314749

7 years agoRemove an assertion I added from the refactoring of pasteTokens (https://reviews...
Faisal Vali [Tue, 3 Oct 2017 01:20:40 +0000 (01:20 +0000)]
Remove an assertion I added from the refactoring of pasteTokens (https://reviews.llvm.org/rL314747).
  - it made the bots v angry!

I'm not exactly sure why the assertion doesn't hold - if anyone has any insight - would appreciate it.

Thanks!

llvm-svn: 314748

7 years ago[NFC] Refactor PasteTokens so that it can be passed the Token Stream and Index to...
Faisal Vali [Tue, 3 Oct 2017 00:52:14 +0000 (00:52 +0000)]
[NFC] Refactor PasteTokens so that it can be passed the Token Stream and Index to start concatenating at.
  In passing:
    - change the name of the function to pasteTokens c/w coding standards
    - rename CurToken to CurTokenIdx (since it is not the token, but the index)
    - add doxygen comments to document some of pasteTokens' functionality
    - use parameter names different from the data member names.

This will be useful for implementing __VA_OPT__ (https://reviews.llvm.org/D35782#inline-322587)

llvm-svn: 314747

7 years agoAdd a comment.
Rui Ueyama [Tue, 3 Oct 2017 00:45:24 +0000 (00:45 +0000)]
Add a comment.

llvm-svn: 314746

7 years agoLTO: Improve error reporting when adding a cache entry.
Peter Collingbourne [Tue, 3 Oct 2017 00:44:21 +0000 (00:44 +0000)]
LTO: Improve error reporting when adding a cache entry.

Move error handling code next to the code that returns the error,
and change the error message in order to distinguish it from a similar
error message elsewhere in this file.

llvm-svn: 314745

7 years agoSparseSolver: Rename getOrInitValueState to getValueState, matching what SCCP calls it
Daniel Berlin [Tue, 3 Oct 2017 00:26:21 +0000 (00:26 +0000)]
SparseSolver: Rename getOrInitValueState to getValueState, matching what SCCP calls it

llvm-svn: 314744

7 years ago[clang-cl] Claim ignored /O[12xd] arguments
Reid Kleckner [Tue, 3 Oct 2017 00:14:03 +0000 (00:14 +0000)]
[clang-cl] Claim ignored /O[12xd] arguments

Fixes PR34809

llvm-svn: 314743

7 years agoAMDGPU: Remove global isGCN predicates
Matt Arsenault [Tue, 3 Oct 2017 00:06:41 +0000 (00:06 +0000)]
AMDGPU: Remove global isGCN predicates

These are problematic because they apply to everything,
and can easily clobber whatever more specific predicate
you are trying to add to a function.

Currently instructions use SubtargetPredicate/PredicateControl
to apply this to patterns applied to an instruction definition,
but not to free standing Pats. Add a wrapper around Pat
so the special PredicateControls requirements can be appended
to the final predicate list like how Mips does it.

llvm-svn: 314742

7 years ago[InstSimplify] teach SimplifySelectInst() to fold more vector selects
Haicheng Wu [Mon, 2 Oct 2017 23:43:52 +0000 (23:43 +0000)]
[InstSimplify] teach SimplifySelectInst() to fold more vector selects

Call ConstantFoldSelectInstruction() to fold cases like below

select <2 x i1><i1 true, i1 false>, <2 x i8> <i8 0, i8 1>, <2 x i8> <i8 2, i8 3>

All operands are constants and the condition has mixed true and false conditions.

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

llvm-svn: 314741

7 years ago[PassManager] Retire cl::opt that have been set for a while. NFCI.
Davide Italiano [Mon, 2 Oct 2017 23:39:20 +0000 (23:39 +0000)]
[PassManager] Retire cl::opt that have been set for a while. NFCI.

llvm-svn: 314740

7 years ago[PowerPC] Revert r314666.
Tim Shen [Mon, 2 Oct 2017 23:20:06 +0000 (23:20 +0000)]
[PowerPC] Revert r314666.

See https://reviews.llvm.org/D38172.

I tried to XFAIL it, but sometimes XPASS triggers the bot. Simply
revert it.

llvm-svn: 314739

7 years agoBuild fix: don't try to link in lldConfig
Hans Wennborg [Mon, 2 Oct 2017 23:09:37 +0000 (23:09 +0000)]
Build fix: don't try to link in lldConfig

Config was removed in r314719.

llvm-svn: 314736

7 years agoImprove test runner output for broken configurations.
Eric Fiselier [Mon, 2 Oct 2017 22:52:51 +0000 (22:52 +0000)]
Improve test runner output for broken configurations.

Previously LIT would often fail while attempting to set up/configure
the test compiler; normally when attempting to dump the builtin macros.
This sort of failure provided no useful information about what went
wrong with the compiler, making the actual issues hard --- if not
impossible --- to debug easily.

This patch changes the LIT configuration to report the failure explicitly,
including the failed compile command and the stdout/stderr output.

llvm-svn: 314735

7 years agoTemplate the sparse propagation solver instead of using void pointers
Daniel Berlin [Mon, 2 Oct 2017 22:49:49 +0000 (22:49 +0000)]
Template the sparse propagation solver instead of using void pointers

Summary:
This avoids using void * as the type of the lattice value and ugly casts needed to make that happen.
(If folks want to use references, etc, they can use a reference_wrapper).

Reviewers: davide, mssimpso

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 314734

7 years agoPR33839: Fix -Wunused handling for structured binding declarations.
Richard Smith [Mon, 2 Oct 2017 22:43:36 +0000 (22:43 +0000)]
PR33839: Fix -Wunused handling for structured binding declarations.

We warn about a structured binding declaration being unused only if none of its
bindings are used.

llvm-svn: 314733

7 years ago[PowerPC] Temporarily disable the test introduced by r314666
Tim Shen [Mon, 2 Oct 2017 22:40:32 +0000 (22:40 +0000)]
[PowerPC] Temporarily disable the test introduced by r314666

See https://reviews.llvm.org/D38172 for details.

llvm-svn: 314732

7 years agoMove install_name_tool to a separate make target.
Jason Molenda [Mon, 2 Oct 2017 22:11:22 +0000 (22:11 +0000)]
Move install_name_tool to a separate make target.

llvm-svn: 314731

7 years agoFix another build breakage.
Rui Ueyama [Mon, 2 Oct 2017 22:05:46 +0000 (22:05 +0000)]
Fix another build breakage.

llvm-svn: 314730

7 years agoRe-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding"
Geoff Berry [Mon, 2 Oct 2017 22:01:37 +0000 (22:01 +0000)]
Re-enable "[MachineCopyPropagation] Extend pass to do COPY source forwarding"

Issues addressed since original review:
- Avoid bug in regalloc greedy/machine verifier when forwarding to use
  in an instruction that re-defines the same virtual register.
- Fixed bug when forwarding to use in EarlyClobber instruction slot.
- Fixed incorrect forwarding to register definitions that showed up in
  explicit_uses() iterator (e.g. in INLINEASM).
- Moved removal of dead instructions found by
  LiveIntervals::shrinkToUses() outside of loop iterating over
  instructions to avoid instructions being deleted while pointed to by
  iterator.
- Fixed ARMLoadStoreOptimizer bug exposed by this change in r311907.
- The pass no longer forwards COPYs to physical register uses, since
  doing so can break code that implicitly relies on the physical
  register number of the use.
- The pass no longer forwards COPYs to undef uses, since doing so
  can break the machine verifier by creating LiveRanges that don't
  end on a use (since the undef operand is not considered a use).

  [MachineCopyPropagation] Extend pass to do COPY source forwarding

  This change extends MachineCopyPropagation to do COPY source forwarding.

  This change also extends the MachineCopyPropagation pass to be able to
  be run during register allocation, after physical registers have been
  assigned, but before the virtual registers have been re-written, which
  allows it to remove virtual register COPY LiveIntervals that become dead
  through the forwarding of all of their uses.

llvm-svn: 314729

7 years agoRemove trailing whitespace to trigger re-cmaking
Michael Liao [Mon, 2 Oct 2017 21:54:38 +0000 (21:54 +0000)]
Remove trailing whitespace to trigger re-cmaking

llvm-svn: 314728

7 years ago[X86] Run dos2unix on two disassembler tests.
Craig Topper [Mon, 2 Oct 2017 21:46:58 +0000 (21:46 +0000)]
[X86] Run dos2unix on two disassembler tests.

llvm-svn: 314727

7 years ago[X86][NFC] Add X86CmovConverterPass to the pass registry.
Amjad Aboud [Mon, 2 Oct 2017 21:46:37 +0000 (21:46 +0000)]
[X86][NFC] Add X86CmovConverterPass to the pass registry.

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

llvm-svn: 314726

7 years agoFix the shared library build.
Rui Ueyama [Mon, 2 Oct 2017 21:32:51 +0000 (21:32 +0000)]
Fix the shared library build.

llvm-svn: 314725

7 years agoAttempt to fix buildbots.
Rui Ueyama [Mon, 2 Oct 2017 21:21:36 +0000 (21:21 +0000)]
Attempt to fix buildbots.

llvm-svn: 314724

7 years agollvm-dwarfdump: support the --ignore-case option.
Adrian Prantl [Mon, 2 Oct 2017 21:21:09 +0000 (21:21 +0000)]
llvm-dwarfdump: support the --ignore-case option.

llvm-svn: 314723

7 years ago[Analyzer] Avoid copy and modifying passed reference in BodyFarm::create_call_once
George Karpenkov [Mon, 2 Oct 2017 21:01:46 +0000 (21:01 +0000)]
[Analyzer] Avoid copy and modifying passed reference in BodyFarm::create_call_once

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

llvm-svn: 314722

7 years agoRemove dead file.
Michael Liao [Mon, 2 Oct 2017 21:00:52 +0000 (21:00 +0000)]
Remove dead file.

llvm-svn: 314720

7 years agoMove new lld's code to Common subdirectory.
Rui Ueyama [Mon, 2 Oct 2017 21:00:41 +0000 (21:00 +0000)]
Move new lld's code to Common subdirectory.

New lld's files are spread under lib subdirectory, and it isn't easy
to find which files are actually maintained. This patch moves maintained
files to Common subdirectory.

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

llvm-svn: 314719

7 years ago[builtins] ARM: Reland fix for assembling builtins in thumb state.
Manoj Gupta [Mon, 2 Oct 2017 20:56:49 +0000 (20:56 +0000)]
[builtins] ARM: Reland fix for assembling builtins in thumb state.

Summary:
clang does not assemble files in thumb mode unless .thumb declaration
is present. Add .thumb/.arm decl to _FUNCTION macros to ensure  that
files are assembled correctly.

Also add a fix to ensure that armv7k-watchos can assemble the
aeabi_c{f|d}cmp.S files.

Fixes PR 34715.

Reviewers: compnerd, peter.smith, srhines, weimingz, rengolin, efriedma, t.p.northover, fjricci

Reviewed By: compnerd

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

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

llvm-svn: 314718

7 years agoAdd ELFOSABI_FIRST_ARCH, ELFOSABI_LAST_ARCH and start using those in llvm-readobj
Konstantin Zhuravlyov [Mon, 2 Oct 2017 20:49:58 +0000 (20:49 +0000)]
Add ELFOSABI_FIRST_ARCH, ELFOSABI_LAST_ARCH and start using those in llvm-readobj

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

llvm-svn: 314717

7 years agoAdd CMake support for building for MinGW
Martin Storsjo [Mon, 2 Oct 2017 20:46:37 +0000 (20:46 +0000)]
Add CMake support for building for MinGW

This section is similar to what already exists in libcxx and libcxxabi.

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

llvm-svn: 314716

7 years agoAMDGPU: Fix typos
Matt Arsenault [Mon, 2 Oct 2017 20:31:18 +0000 (20:31 +0000)]
AMDGPU: Fix typos

llvm-svn: 314715

7 years agoAMDGPU: Fix potentially incorrectly matching check lines
Matt Arsenault [Mon, 2 Oct 2017 20:31:16 +0000 (20:31 +0000)]
AMDGPU: Fix potentially incorrectly matching check lines

These check lines are supposed to make sure the new d16
load instructions aren't used, but the expected instruction
name is a prefix of the incorrect instruction name.

llvm-svn: 314714

7 years agoAdd support for custom loaders to the sanitizer symbolizer
Francis Ricci [Mon, 2 Oct 2017 20:22:16 +0000 (20:22 +0000)]
Add support for custom loaders to the sanitizer symbolizer

Summary:
Adds a fallback mode to procmaps when the symbolizer
fails to locate a module for a given address by using
dl_iterate_phdr.

Reviewers: kubamracek, rnk, vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: srhines, llvm-commits

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

llvm-svn: 314713

7 years ago[InstCombine] auto-generate complete checks; NFC
Sanjay Patel [Mon, 2 Oct 2017 20:16:59 +0000 (20:16 +0000)]
[InstCombine] auto-generate complete checks; NFC

llvm-svn: 314712

7 years agoFix a data race found by tsan.
Rui Ueyama [Mon, 2 Oct 2017 20:16:13 +0000 (20:16 +0000)]
Fix a data race found by tsan.

Reads from `Live` and writes to `OutputOff` in the following code race
even though they are logically independent because they are bitfields
sharing the same word.

  for (size_t I = 0, E = Sec->Pieces.size(); I != E; ++I) {
    if (!Sec->Pieces[I].Live)
      continue;
    CachedHashStringRef Str = Sec->getData(I);
    size_t ShardId = getShardId(Str.hash());
    if ((ShardId & (Concurrency - 1)) == ThreadId)
      Sec->Pieces[I].OutputOff = Shards[ShardId].add(Str);
  }

llvm-svn: 314711

7 years ago[InstCombine] add icmp (shr X, Y), 0 test; NFC
Sanjay Patel [Mon, 2 Oct 2017 20:07:15 +0000 (20:07 +0000)]
[InstCombine] add icmp (shr X, Y), 0 test; NFC

llvm-svn: 314710

7 years agoFix two header comments. NFC.
Hans Wennborg [Mon, 2 Oct 2017 19:48:28 +0000 (19:48 +0000)]
Fix two header comments. NFC.

llvm-svn: 314709

7 years agoAdd std::move in RefactoringActionRulesTest.cpp
Alex Lorenz [Mon, 2 Oct 2017 19:02:42 +0000 (19:02 +0000)]
Add std::move in RefactoringActionRulesTest.cpp

Should fix http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental

llvm-svn: 314708

7 years agoRewrite a comment.
Rui Ueyama [Mon, 2 Oct 2017 18:54:59 +0000 (18:54 +0000)]
Rewrite a comment.

llvm-svn: 314707

7 years agoAdd support for Myriad ma2x8x series of CPUs
Walter Lee [Mon, 2 Oct 2017 18:50:57 +0000 (18:50 +0000)]
Add support for Myriad ma2x8x series of CPUs

Summary:
Also:
- Add support for some older Myriad CPUs that were missing.
- Fix some incorrect compiler defines for exisitng CPUs.

Reviewers: jyknight

Subscribers: fedor.sergeev

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

llvm-svn: 314706

7 years agoAdd support for Myriad ma2x8x series of CPUs
Walter Lee [Mon, 2 Oct 2017 18:50:48 +0000 (18:50 +0000)]
Add support for Myriad ma2x8x series of CPUs

Summary: Also add support for some older Myriad CPUs that were missing.

Reviewers: jyknight

Subscribers: fedor.sergeev

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

llvm-svn: 314705

7 years ago[refactor] Simplify the refactoring interface
Alex Lorenz [Mon, 2 Oct 2017 18:42:43 +0000 (18:42 +0000)]
[refactor] Simplify the refactoring interface

This commit simplifies the interface for the refactoring action rules and the
refactoring requirements. It merges the selection constraints and the selection
requirements into one class. The refactoring actions rules must now be
implemented using subclassing instead of raw function / lambda pointers. This
change also removes a bunch of template-based traits and other
template definitions that are now redundant.

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

llvm-svn: 314704

7 years agointeger/sub_sat: Use clang builtin instead of llvm asm
Jan Vesely [Mon, 2 Oct 2017 18:39:03 +0000 (18:39 +0000)]
integer/sub_sat: Use clang builtin instead of llvm asm

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314703

7 years agointeger/add_sat: Use clang builtin instead of llvm asm
Jan Vesely [Mon, 2 Oct 2017 18:39:00 +0000 (18:39 +0000)]
integer/add_sat: Use clang builtin instead of llvm asm

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314702

7 years agointeger/clz: Use clang builtin instead of llvm asm
Jan Vesely [Mon, 2 Oct 2017 18:38:57 +0000 (18:38 +0000)]
integer/clz: Use clang builtin instead of llvm asm

The generated llvm IR mostly identical. char/uchar case is a bit worse.

reviewer: Tom Stellard

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
llvm-svn: 314701

7 years agoAdd a testcase to check that debug info is upgraded when compiling LLVM IR
Adrian Prantl [Mon, 2 Oct 2017 18:31:52 +0000 (18:31 +0000)]
Add a testcase to check that debug info is upgraded when compiling LLVM IR
through clang.

llvm-svn: 314700

7 years agoMove the stripping of invalid debug info from the Verifier to AutoUpgrade.
Adrian Prantl [Mon, 2 Oct 2017 18:31:29 +0000 (18:31 +0000)]
Move the stripping of invalid debug info from the Verifier to AutoUpgrade.

This came out of a recent discussion on llvm-dev
(https://reviews.llvm.org/D38042). Currently the Verifier will strip
the debug info metadata from a module if it finds the dbeug info to be
malformed. This feature is very valuable since it allows us to improve
the Verifier by making it stricter without breaking bcompatibility,
but arguable the Verifier pass should not be modifying the IR. This
patch moves the stripping of broken debug info into AutoUpgrade
(UpgradeDebugInfo to be precise), which is a much better location for
this since the stripping of malformed (i.e., produced by older, buggy
versions of Clang) is a (harsh) form of AutoUpgrade.

This change is mostly NFC in nature, the one big difference is the
behavior when LLVM module passes are introducing malformed debug
info. Prior to this patch, a NoAsserts build would have printed a
warning and stripped the debug info, after this patch the Verifier
will report a fatal error. I believe this behavior is actually more
desirable anyway.

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

llvm-svn: 314699

7 years ago[InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp...
Sanjay Patel [Mon, 2 Oct 2017 18:26:44 +0000 (18:26 +0000)]
[InstCombine] remove one-use restriction for icmp (shr exact X, C1), C2 --> icmp X, (C2<<C1)

llvm-svn: 314698

7 years agoRevert "Add /System/Library/PrivateFrameworks as a header search path."
Douglas Gregor [Mon, 2 Oct 2017 18:22:19 +0000 (18:22 +0000)]
Revert "Add /System/Library/PrivateFrameworks as a header search path."

This reverts commit f7a95215a435aa8d5f64f43a8bb23ba077270755.

llvm-svn: 314697

7 years ago[InstCombine] add icmp (lshr X, C1), C2 test; NFC
Sanjay Patel [Mon, 2 Oct 2017 18:16:17 +0000 (18:16 +0000)]
[InstCombine] add icmp (lshr X, C1), C2 test; NFC

llvm-svn: 314696

7 years agoFix building on macOS after SVN r314492
Martin Storsjo [Mon, 2 Oct 2017 18:14:06 +0000 (18:14 +0000)]
Fix building on macOS after SVN r314492

That commit incorrectly expanded the assumption that defined(__APPLE__)
implies SjLj exception handling, which only is true within ARM
code sections.

llvm-svn: 314695

7 years agoUpdate getMergedLocation to check the instruction type and merge properly.
Dehao Chen [Mon, 2 Oct 2017 18:13:14 +0000 (18:13 +0000)]
Update getMergedLocation to check the instruction type and merge properly.

Summary: If the merged instruction is call instruction, we need to set the scope to the closes common scope between 2 locations, otherwise it will cause trouble when the call is getting inlined.

Reviewers: dblaikie, aprantl

Reviewed By: dblaikie, aprantl

Subscribers: llvm-commits, sanjoy

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

llvm-svn: 314694

7 years ago[clangd] Handle workspace/didChangeWatchedFiles
Marc-Andre Laperle [Mon, 2 Oct 2017 18:00:37 +0000 (18:00 +0000)]
[clangd] Handle workspace/didChangeWatchedFiles

Summary:
The client can send notifications when it detects watched files have
changed. This patch adds the protocol handling for this type of notification.
For now, the notification will be passed down to the ClangdServer, but it will
not be acted upon. However, this will become useful for the indexer to react
to file changes.
The events could also potentially be used to invalidate other caches
(compilation database, etc).

This change also updates the VSCode extension so that it sends the events.

Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewers: ilya-biryukov, Nebiroth

Subscribers: ilya-biryukov

Tags: #clang-tools-extra

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

llvm-svn: 314693

7 years ago[Analyzer] Make testing scripts flake8 compliant
George Karpenkov [Mon, 2 Oct 2017 17:59:12 +0000 (17:59 +0000)]
[Analyzer] Make testing scripts flake8 compliant

Differential Review: https://reviews.llvm.org/D38213

llvm-svn: 314692

7 years ago[CUDA] Fix name of __activemask()
Jonas Hahnfeld [Mon, 2 Oct 2017 17:50:11 +0000 (17:50 +0000)]
[CUDA] Fix name of __activemask()

The name has two underscores in the official CUDA documentation:
http://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#warp-vote-functions

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

llvm-svn: 314691

7 years agoCodeView symbol dumper: use symbolic names for registers
Hans Wennborg [Mon, 2 Oct 2017 17:44:47 +0000 (17:44 +0000)]
CodeView symbol dumper: use symbolic names for registers

https://reviews.llvm.org/D38469

llvm-svn: 314690

7 years agoRevert "[Sema] Warn on attribute nothrow conflicting with language specifiers"
Reid Kleckner [Mon, 2 Oct 2017 17:16:14 +0000 (17:16 +0000)]
Revert "[Sema] Warn on attribute nothrow conflicting with language specifiers"

This reverts r314461.

It is warning on user code that uses END_COM_MAP(), which expands to
declare QueryInterface with conflicting exception specifers. I've spent
a while trying to understand why, but haven't been able to extract a
reduced test case. Let's revert and I'll keep trying.

llvm-svn: 314689

7 years agoEliminate ftrunc if source is know to be rounded
Stanislav Mekhanoshin [Mon, 2 Oct 2017 16:57:07 +0000 (16:57 +0000)]
Eliminate ftrunc if source is know to be rounded

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

llvm-svn: 314688

7 years agoUpdate IUnknown lit test to pass on Win32
Erich Keane [Mon, 2 Oct 2017 16:49:32 +0000 (16:49 +0000)]
Update IUnknown lit test to pass on Win32

llvm-svn: 314687

7 years ago[OPENMP] Capture argument of `device` clause for target-based
Alexey Bataev [Mon, 2 Oct 2017 16:32:39 +0000 (16:32 +0000)]
[OPENMP] Capture argument of `device` clause for target-based
directives.

The argument of the `device` clause in target-based executable
directives must be captured to support codegen for the `target`
directives with the `depend` clauses.

llvm-svn: 314686

7 years ago[dwarfdump] Add -show-form
Jonas Devlieghere [Mon, 2 Oct 2017 16:02:04 +0000 (16:02 +0000)]
[dwarfdump] Add -show-form

This enables printing of DWARF form types after the DWARF attribute
types.

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

llvm-svn: 314685

7 years agoRevert "Add support for custom loaders to the sanitizer symbolizer"
Francis Ricci [Mon, 2 Oct 2017 15:55:11 +0000 (15:55 +0000)]
Revert "Add support for custom loaders to the sanitizer symbolizer"

This reverts commit r314671, which hangs on the gcc sanitizer buildbot.

llvm-svn: 314684

7 years ago[clang-format] Fix regression about short functions after #else
Krasimir Georgiev [Mon, 2 Oct 2017 15:53:37 +0000 (15:53 +0000)]
[clang-format] Fix regression about short functions after #else

Summary:
This patch fixes a regression introduced in r312904, where the formatter confuses
the `else` in `#else` with an `else` of an `if-else` statement.
For example, formatting this code with google style
```
#ifdef A
int f() {}
#else
int f() {}
#endif
```
resulted in
```
#ifdef A
int f() {}
#else
int f() {
}
#endif
```

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: klimek, cfe-commits

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

llvm-svn: 314683

7 years ago[X86][SSE] Add PACKSS/PACKUS constant folding tests
Simon Pilgrim [Mon, 2 Oct 2017 15:43:26 +0000 (15:43 +0000)]
[X86][SSE] Add PACKSS/PACKUS constant folding tests

llvm-svn: 314682

7 years agoRegenerate test (missing broadcast constant comments). NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 15:22:35 +0000 (15:22 +0000)]
Regenerate test (missing broadcast constant comments). NFCI.

Still avoiding the floating point comments to prevent linux/windows discrepancies.

llvm-svn: 314681

7 years agoRegenerate test (missing broadcast constant comments). NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 15:21:14 +0000 (15:21 +0000)]
Regenerate test (missing broadcast constant comments). NFCI.

llvm-svn: 314680

7 years agoRegenerate test. NFCI.
Simon Pilgrim [Mon, 2 Oct 2017 15:16:30 +0000 (15:16 +0000)]
Regenerate test. NFCI.

llvm-svn: 314679

7 years ago[clangd] Command line arg to specify compile_commands.json path
Ilya Biryukov [Mon, 2 Oct 2017 15:13:20 +0000 (15:13 +0000)]
[clangd] Command line arg to specify compile_commands.json path

Summary: Adds compileCommands command line argument to specify an absolute path directly to the requested compile_commands.json for flags.

Reviewed By: ilya-biryukov

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

llvm-svn: 314678