platform/upstream/llvm.git
7 years agoRewrite loops to use range-based for. (NFC)
Adrian Prantl [Wed, 28 Sep 2016 17:31:17 +0000 (17:31 +0000)]
Rewrite loops to use range-based for. (NFC)

llvm-svn: 282608

7 years ago[NVPTX] Added intrinsics for atom.gen.{sys|cta}.* instructions.
Artem Belevich [Wed, 28 Sep 2016 17:25:38 +0000 (17:25 +0000)]
[NVPTX] Added intrinsics for atom.gen.{sys|cta}.* instructions.

These are only available on sm_60+ GPUs.

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

llvm-svn: 282607

7 years ago[SCEV] Use a SmallPtrSet as a temporary union predicate; NFC
Sanjoy Das [Wed, 28 Sep 2016 17:14:58 +0000 (17:14 +0000)]
[SCEV] Use a SmallPtrSet as a temporary union predicate; NFC

Summary:
Instead of creating and destroying SCEVUnionPredicate instances (which
internally creates and destroys a DenseMap), use temporary SmallPtrSet
instances of remember the set of predicates that will get reified into a
SCEVUnionPredicate.

Reviewers: silviu.baranga, sbaranga

Subscribers: sanjoy, mcrosier, llvm-commits, mzolotukhin

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

llvm-svn: 282606

7 years agozorg Xcode python test suite target arch update
Todd Fiala [Wed, 28 Sep 2016 16:43:47 +0000 (16:43 +0000)]
zorg Xcode python test suite target arch update

This changes the Xcode target used by the Green Dragon Xcode CI.
When calling xcodebuild with LLDB_PYTHON_TESTSUITE_ARCH set, the
arch's xUnit XML output is now set to an arch-specific filename:

$(BUILD_DIR)/test-results-$(LLDB_PYTHON_TESTSUITE_ARCH).xml.

The change also ensures that the Python testsuite sees the Xcode
build settings passed in through environment variables.

llvm-svn: 282605

7 years agoRevert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is...
Nirav Dave [Wed, 28 Sep 2016 16:37:50 +0000 (16:37 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."

This reverts commit r282600 due to test failues with MCJIT

llvm-svn: 282604

7 years agoSort headers. NFC.
Rafael Espindola [Wed, 28 Sep 2016 16:31:05 +0000 (16:31 +0000)]
Sort headers. NFC.

llvm-svn: 282603

7 years ago[AVR] Rename the builtin calling convention names
Dylan McKay [Wed, 28 Sep 2016 16:04:40 +0000 (16:04 +0000)]
[AVR] Rename the builtin calling convention names

'BUILTIN' is clearer than 'RT' in this context.

llvm-svn: 282602

7 years ago[x86] Accept 'retn' as an alias to 'ret[lqw]'\'ret' (At&t\Intel)
Marina Yatsina [Wed, 28 Sep 2016 15:52:56 +0000 (15:52 +0000)]
[x86] Accept 'retn' as an alias to 'ret[lqw]'\'ret' (At&t\Intel)

Implement 'retn' simply by aliasing it to the relevant 'ret' instruction

Commit on behalf of coby

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

llvm-svn: 282601

7 years agoIn visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Nirav Dave [Wed, 28 Sep 2016 15:50:43 +0000 (15:50 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.

  Simplify Consecutive Merge Store Candidate Search

  Now that address aliasing is much less conservative, push through
  simplified store merging search which only checks for parallel stores
  through the chain subgraph. This is cleaner as the separation of
  non-interfering loads/stores from the store-merging logic.

  Whem merging stores, search up the chain through a single load, and
  finds all possible stores by looking down from through a load and a
  TokenFactor to all stores visited. This improves the quality of the
  output SelectionDAG and generally the output CodeGen (with some
  exceptions).

  Additional Minor Changes:

    1. Finishes removing unused AliasLoad code
    2. Unifies the the chain aggregation in the merged stores across
       code paths
    3. Re-add the Store node to the worklist after calling
       SimplifyDemandedBits.
    4. Increase GatherAllAliasesMaxDepth from 6 to 18. That number is
       arbitrary, but seemed sufficient to not cause regressions in
       tests.

  This finishes the change Matt Arsenault started in r246307 and
  jyknight's original patch.

  Many tests required some changes as memory operations are now
  reorderable. Some tests relying on the order were changed to use
  volatile memory operations

  Noteworthy tests:

    CodeGen/AArch64/argument-blocks.ll -
      It's not entirely clear what the test_varargs_stackalign test is
      supposed to be asserting, but the new code looks right.

    CodeGen/AArch64/arm64-memset-inline.lli -
    CodeGen/AArch64/arm64-stur.ll -
    CodeGen/ARM/memset-inline.ll -
      The backend now generates *worse* code due to store merging
      succeeding, as we do do a 16-byte constant-zero store efficiently.

    CodeGen/AArch64/merge-store.ll -
      Improved, but there still seems to be an extraneous vector insert
      from an element to itself?

    CodeGen/PowerPC/ppc64-align-long-double.ll -
      Worse code emitted in this case, due to the improved store->load
      forwarding.

    CodeGen/X86/dag-merge-fast-accesses.ll -
    CodeGen/X86/MergeConsecutiveStores.ll -
    CodeGen/X86/stores-merging.ll -
    CodeGen/Mips/load-store-left-right.ll -
      Restored correct merging of non-aligned stores

    CodeGen/AMDGPU/promote-alloca-stored-pointer-value.ll -
      Improved. Correctly merges buffer_store_dword calls

    CodeGen/AMDGPU/si-triv-disjoint-mem-access.ll -
      Improved. Sidesteps loading a stored value and merges two stores

    CodeGen/X86/pr18023.ll -
      This test has been removed, as it was asserting incorrect
      behavior. Non-volatile stores *CAN* be moved past volatile loads,
      and now are.

    CodeGen/X86/vector-idiv.ll -
    CodeGen/X86/vector-lzcnt-128.ll -
      It's basically impossible to tell what these tests are actually
      testing. But, looks like the code got better due to the memory
      operations being recognized as non-aliasing.

    CodeGen/X86/win32-eh.ll -
      Both loads of the securitycookie are now merged.

    CodeGen/AMDGPU/vgpr-spill-emergency-stack-slot-compute.ll -
      This test appears to work but no longer exhibits the spill
      behavior.

Reviewers: arsenm, hfinkel, tstellarAMD, nhaehnle, jyknight

Subscribers: wdng, nhaehnle, nemanjai, arsenm, weimingz, niravd, RKSimon, aemerson, qcolombet, resistor, tstellarAMD, t.p.northover, spatel

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

llvm-svn: 282600

7 years agolibunwind: Add OpenBSD case for _Unwind_Ptr typedef
Ed Maste [Wed, 28 Sep 2016 15:37:21 +0000 (15:37 +0000)]
libunwind: Add OpenBSD case for _Unwind_Ptr typedef

Patch by Mark Kettenis

llvm-svn: 282599

7 years ago[AVR] Import the LLVM namespace inside AVRMCTargetDesc.cpp
Dylan McKay [Wed, 28 Sep 2016 15:35:26 +0000 (15:35 +0000)]
[AVR] Import the LLVM namespace inside AVRMCTargetDesc.cpp

llvm-svn: 282598

7 years ago[AVR] Add AVRMCTargetDesc.cpp
Dylan McKay [Wed, 28 Sep 2016 15:31:12 +0000 (15:31 +0000)]
[AVR] Add AVRMCTargetDesc.cpp

Summary:
This adds the AVRMCTargetDesc file in tree. It allows creation of the
core classes used in the backend.

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny

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

llvm-svn: 282597

7 years ago[ELF] Support -z max-page-size option
Petr Hosek [Wed, 28 Sep 2016 15:20:47 +0000 (15:20 +0000)]
[ELF] Support -z max-page-size option

This options issupported by both BFD ld and gold and allows
overriding the max page size whose default values are defined by
the target.

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

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

llvm-svn: 282596

7 years ago[ELF] - Created new "Invalid" subfolder for testcases.
George Rimar [Wed, 28 Sep 2016 15:11:58 +0000 (15:11 +0000)]
[ELF] - Created new "Invalid" subfolder for testcases.

This subfolder just like "linkerscript" subfolder keeps
testcases with invalid input. According to PR30540 it seems
we might have many new ones soon, so it is seems reasonable to
separate them from regular testcases.

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

llvm-svn: 282595

7 years ago[AVR] Update the signature of createAVRAsmBackend
Dylan McKay [Wed, 28 Sep 2016 14:35:07 +0000 (14:35 +0000)]
[AVR] Update the signature of createAVRAsmBackend

It has been recently changed to also take a MCTargetOptions structure.

llvm-svn: 282594

7 years ago[AVR] Enable the assembly parser
Dylan McKay [Wed, 28 Sep 2016 14:34:42 +0000 (14:34 +0000)]
[AVR] Enable the assembly parser

We very recently landed the code. This commit enables the parser.

It also adds a missing include to AVRAsmParser.cpp

llvm-svn: 282593

7 years ago[InstSimplify] allow or-of-icmps folds with vector splat constants
Sanjay Patel [Wed, 28 Sep 2016 14:27:21 +0000 (14:27 +0000)]
[InstSimplify] allow or-of-icmps folds with vector splat constants

llvm-svn: 282592

7 years ago[InstSimplify] add vector splat tests for or-of-icmps
Sanjay Patel [Wed, 28 Sep 2016 14:17:35 +0000 (14:17 +0000)]
[InstSimplify] add vector splat tests for or-of-icmps

llvm-svn: 282591

7 years ago[InstSimplify] allow and-of-icmps folds with vector splat constants
Sanjay Patel [Wed, 28 Sep 2016 13:53:13 +0000 (13:53 +0000)]
[InstSimplify] allow and-of-icmps folds with vector splat constants

llvm-svn: 282590

7 years agoAlso use the proper register numbers on CloudABI.
Ed Schouten [Wed, 28 Sep 2016 13:51:23 +0000 (13:51 +0000)]
Also use the proper register numbers on CloudABI.

Without this change applied, unw_step() fails to obtain the next frame
properly.

llvm-svn: 282589

7 years ago[AVR] Merge most recent changes to AVRInstrInfo.td
Dylan McKay [Wed, 28 Sep 2016 13:44:02 +0000 (13:44 +0000)]
[AVR] Merge most recent changes to AVRInstrInfo.td

This adds two new things:

- Operand types per fixup
- Atomic pseudo operations

llvm-svn: 282588

7 years ago[AVR] Update the data layout
Dylan McKay [Wed, 28 Sep 2016 13:29:10 +0000 (13:29 +0000)]
[AVR] Update the data layout

The previous data layout caused issues when dealing with atomics.

Foe example, it is illegal to load a 16-bit value with less than 16-bits
of alignment.

This changes the data layout so that all types are aligned by at least
their own width.

Interestingly, this also _slightly_ decreased register pressure in some
cases.

llvm-svn: 282587

7 years ago[AVR] Handle AVR relocations when handling ELF files
Dylan McKay [Wed, 28 Sep 2016 13:23:42 +0000 (13:23 +0000)]
[AVR] Handle AVR relocations when handling ELF files

llvm-svn: 282586

7 years ago[AVR] Allow llvm-objdump to handle AVR ELF files
Dylan McKay [Wed, 28 Sep 2016 13:15:17 +0000 (13:15 +0000)]
[AVR] Allow llvm-objdump to handle AVR ELF files

llvm-svn: 282585

7 years ago[AVR] Add assembly parser
Dylan McKay [Wed, 28 Sep 2016 13:02:57 +0000 (13:02 +0000)]
[AVR] Add assembly parser

Summary: This patch adds the AVRAsmParser library.

Reviewers: arsenm, kparzysz

Subscribers: wdng, beanz, mgorny, kparzysz, simoncook, jtbandes, llvm-commits

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

llvm-svn: 282584

7 years agoTrying to buildbot failures caused by r282577.
Eric Liu [Wed, 28 Sep 2016 12:49:14 +0000 (12:49 +0000)]
Trying to buildbot failures caused by r282577.

llvm-svn: 282583

7 years ago[ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber
Dmitry Vyukov [Wed, 28 Sep 2016 12:28:16 +0000 (12:28 +0000)]
[ASAN] Pass previous stack information through __sanitizer_finish_switch_fiber

This patch extends __sanitizer_finish_switch_fiber method to optionally return previous stack base and size.

This solves the problem of coroutines/fibers library not knowing the original stack context from which the library is used. It's incorrect to assume that such context is always the default stack of current thread (e.g. one such library may be used from a fiber/coroutine created by another library). Bulding a separate stack tracking mechanism would not only duplicate AsanThread, but also require each coroutines/fibers library to integrate with it.

Author: Andrii Grynenko (andriigrynenko)
Reviewed in: https://reviews.llvm.org/D24628

llvm-svn: 282582

7 years ago[X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests
Elad Cohen [Wed, 28 Sep 2016 11:59:09 +0000 (11:59 +0000)]
[X86] Remove the mm_malloc.h include guard hack from the X86 builtins tests

The X86 clang/test/CodeGen/*builtins.c tests define the mm_malloc.h include
guard as a hack for avoiding its inclusion (mm_malloc.h requires a hosted
environment since it expects stdlib.h to be available - which is not the case
in these internal clang codegen tests).
This patch removes this hack and instead passes -ffreestanding to clang cc1.

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

llvm-svn: 282581

7 years ago[X86][FastISel] Use a COPY from K register to a GPR instead of a K operation
Guy Blank [Wed, 28 Sep 2016 11:22:17 +0000 (11:22 +0000)]
[X86][FastISel] Use a COPY from K register to a GPR instead of a K operation

The KORTEST was introduced due to a bug where a TEST instruction used a K register.
but, turns out that the opposite case of KORTEST using a GPR is now happening

The change removes the KORTEST flow and adds a COPY instruction from the K reg to a GPR.

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

llvm-svn: 282580

7 years agoStrip trailing whitespace
Simon Pilgrim [Wed, 28 Sep 2016 11:08:00 +0000 (11:08 +0000)]
Strip trailing whitespace

llvm-svn: 282579

7 years agoASTMerge: explicitly specify arch for GCCAsmStmt test to calm non-x86 buildbots
Aleksei Sidorin [Wed, 28 Sep 2016 11:04:42 +0000 (11:04 +0000)]
ASTMerge: explicitly specify arch for GCCAsmStmt test to calm non-x86 buildbots

This should fix r282572.

llvm-svn: 282578

7 years agoMerge conflicting replacements when they are order-independent.
Eric Liu [Wed, 28 Sep 2016 11:02:16 +0000 (11:02 +0000)]
Merge conflicting replacements when they are order-independent.

Summary:
Now two replacements are considered order-independent if applying them in
either order produces the same result. These include (but not restricted
to) replacements that:
  - don't overlap (being directly adjacent is fine) and
  - are overlapping deletions.
  - are insertions at the same offset and applying them in either order
    has the same effect, i.e. X + Y = Y + X if one inserts text X and the
    other inserts text Y.

Discussion about this design can be found in D24717

Reviewers: djasper, klimek

Subscribers: omtcyfz, cfe-commits

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

llvm-svn: 282577

7 years agoASTMerge: specify arch for GCCAsmStmt test explicitly to calm non-x86 buildbots
Aleksei Sidorin [Wed, 28 Sep 2016 10:57:36 +0000 (10:57 +0000)]
ASTMerge: specify arch for GCCAsmStmt test explicitly to calm non-x86 buildbots

llvm-svn: 282576

7 years ago[libunwind] Add support for a single-threaded libunwind build
Asiri Rathnayake [Wed, 28 Sep 2016 10:57:15 +0000 (10:57 +0000)]
[libunwind] Add support for a single-threaded libunwind build

The EHABI unwinder is thread-agnostic, SJLJ unwinder and the DWARF unwinder have
a couple of pthread dependencies.

This patch makes it possible to build the whole of libunwind for a
single-threaded environment.

Reviewers: compnerd

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

llvm-svn: 282575

7 years ago[StaticAnalyzer] Fix false positives for vardecls that are technically unreachable...
Daniel Marjamaki [Wed, 28 Sep 2016 10:39:53 +0000 (10:39 +0000)]
[StaticAnalyzer] Fix false positives for vardecls that are technically unreachable but they are needed.

Example:

    switch (x) {
      int a;  // <- This is unreachable but needed
    case 1:
      a = ...

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

llvm-svn: 282574

7 years agoFix warnings in clang-completion-mode.el.
Manuel Klimek [Wed, 28 Sep 2016 10:20:10 +0000 (10:20 +0000)]
Fix warnings in clang-completion-mode.el.

- Use defvar to declare variables
- Don't use delete-backward-char, which is for interactive use only

Patch by Philipp Stephani

llvm-svn: 282573

7 years ago[ASTImporter] Implement some expression-related AST node import (part 2)
Aleksei Sidorin [Wed, 28 Sep 2016 10:16:56 +0000 (10:16 +0000)]
[ASTImporter] Implement some expression-related AST node import (part 2)

* Some code cleanup
* Add tests not present in http://reviews.llvm.org/D14286
* Integrate a test suite from Serge Pavlov (http://reviews.llvm.org/D14224)
* ArrayTypeTraitExpr: serialize sub-expression to avoid keeping it undefined
* Implement import of some nodes:
  - ArrayTypeTraitExpr
  - ExpressionTraitExpr
  - OpaqueValueExpr
  - ArraySubscriptExpr
  - ExplicitCastExpr
  - ImplicitValueInitExpr
  - OffsetOfExpr
  - CXXThisExpr
  - CXXThrowExpr
  - CXXNoexceptExpr
  - CXXDefaultArgExpr
  - CXXScalarValueInitExpr
  - CXXBindTemporaryExpr
  - CXXTemporaryObjectExpr
  - MaterializeTemporaryExpr
  - ExprWithCleanups

  - StaticAssertDecl
  - FriendDecl

  - DecayedType

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

llvm-svn: 282572

7 years ago[lsan] [aarch64] Fix calculating TLS area
Strahinja Petrovic [Wed, 28 Sep 2016 10:15:15 +0000 (10:15 +0000)]
[lsan] [aarch64] Fix calculating TLS area

This patch fixes calculating begin of TLS area on AARCH64.
Differential Revision: https://reviews.llvm.org/D24454

llvm-svn: 282571

7 years ago[SystemZ] Implementation of getUnrollingPreferences().
Jonas Paulsson [Wed, 28 Sep 2016 09:41:38 +0000 (09:41 +0000)]
[SystemZ] Implementation of getUnrollingPreferences().

This commit enables more unrolling for SystemZ by implementing the
SystemZTargetTransformInfo::getUnrollingPreferences() method.

It has been found that it is better to only unroll moderately, so the
DefaultUnrollRuntimeCount has been moved into UnrollingPreferences in order
to set this to a lower value for SystemZ (4).

Reviewers: Evgeny Stupachenko, Ulrich Weigand.
https://reviews.llvm.org/D24451

llvm-svn: 282570

7 years ago[Headers] Replace stray indentation with tabs with spaces. NFC.
Martin Storsjo [Wed, 28 Sep 2016 09:34:51 +0000 (09:34 +0000)]
[Headers] Replace stray indentation with tabs with spaces. NFC.

This matches the rest of the surrounding file.

llvm-svn: 282569

7 years ago[ELF] Ignore sections flagged with SHF_EXCLUDE
Eugene Leviant [Wed, 28 Sep 2016 08:42:02 +0000 (08:42 +0000)]
[ELF] Ignore sections flagged with SHF_EXCLUDE

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

llvm-svn: 282568

7 years ago[DAG] Remove isVectorClearMaskLegal() check from vector_build dagcombine
Michael Kuperstein [Wed, 28 Sep 2016 06:13:58 +0000 (06:13 +0000)]
[DAG] Remove isVectorClearMaskLegal() check from vector_build dagcombine

This check currently doesn't seem to do anything useful on any in-tree target:
On non-x86, it always evaluates to false, so we never hit the code path that
creates the shuffle with zero.
On x86, it just forwards to isShuffleMaskLegal(), which is a reasonable thing to
query in general, but doesn't make sense if only restricted to zero blends.

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

llvm-svn: 282567

7 years agoReverting r282565.
Jason Molenda [Wed, 28 Sep 2016 03:16:14 +0000 (03:16 +0000)]
Reverting r282565.

A testbot found a regression introduced in the testsuite with
the changes in r282565 on Ubuntu (TestStepNoDebug.ReturnValueTestCase).
I'll get this set up on an ubuntu box and figure out what is happening
there -- likely a problem with the eh_frame augmentation, which isn't
used on macosx.

llvm-svn: 282566

7 years agoRefactor the x86 UnwindAssembly class into a separate class called
Jason Molenda [Wed, 28 Sep 2016 02:52:19 +0000 (02:52 +0000)]
Refactor the x86 UnwindAssembly class into a separate class called
x86AssemblyInspectionEngine and the current UnwindAssembly_x86 to
allow for the core engine to be exercised by unit tests.

The UnwindAssembly_x86 class will have access to Targets, Processes,
Threads, RegisterContexts -- it will be working in the full lldb
environment.

x86AssemblyInspectionEngine is layered away from all of that, it is
given some register definitions and a bag of bytes to profile.

I wrote an initial unittest for a do-nothing simple x86_64/i386
function to start with.  I'll be adding more.

The x86 assembly unwinder was added to lldb early in its bringup;
I made some modernization changes as I was refactoring the code
to make it more consistent with how we write lldb today.

I also added RegisterContextMinidump_x86_64.cpp to the xcode project
file so I can run the unittests from that.

The testsuite passes with this change, but there was quite a bit of
code change by the refactoring and it's possible there are some
issues.  I'll be testing this more in the coming days, but it looks
like it is behaving correctly as far as I can tell with automated
testing.

<rdar://problem/28509178>

llvm-svn: 282565

7 years agoRevert r282556. This change made several bots unhappy.
Richard Smith [Wed, 28 Sep 2016 02:20:06 +0000 (02:20 +0000)]
Revert r282556. This change made several bots unhappy.

llvm-svn: 282564

7 years ago[LTO] Mark member function as const to fix compiler errors.
Davide Italiano [Wed, 28 Sep 2016 01:49:07 +0000 (01:49 +0000)]
[LTO] Mark member function as const to fix compiler errors.

llvm-svn: 282563

7 years ago[libFuzzer] speedup TracePC::FinalizeTrace
Kostya Serebryany [Wed, 28 Sep 2016 01:16:24 +0000 (01:16 +0000)]
[libFuzzer] speedup TracePC::FinalizeTrace

llvm-svn: 282562

7 years ago[LAA] Rename emitAnalysis to recordAnalys. NFC
Adam Nemet [Wed, 28 Sep 2016 00:58:36 +0000 (00:58 +0000)]
[LAA] Rename emitAnalysis to recordAnalys. NFC

Ever since LAA was split out into an analysis on its own, this function
stopped emitting the report directly.  Instead it stores it to be
retrieved by the client which can then emit it as its own report
(e.g. -Rpass-analysis=loop-vectorize).

llvm-svn: 282561

7 years ago[ELF] Use MaxPageSize for aligning PT_LOAD
Petr Hosek [Wed, 28 Sep 2016 00:09:20 +0000 (00:09 +0000)]
[ELF] Use MaxPageSize for aligning PT_LOAD

This matches the behavior of Binutils linkers. We also change the
default MaxPageSize on x86-64 to 0x1000 to preserver the current
behavior, which is the same as the behavior implemented by gold.

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

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

llvm-svn: 282560

7 years ago[Inliner] Port all opt remarks to new streaming API
Adam Nemet [Tue, 27 Sep 2016 23:47:03 +0000 (23:47 +0000)]
[Inliner] Port all opt remarks to new streaming API

llvm-svn: 282559

7 years agoPass -S to opt in this test to avoid printing binary on mismatch
Adam Nemet [Tue, 27 Sep 2016 23:46:59 +0000 (23:46 +0000)]
Pass -S to opt in this test to avoid printing binary on mismatch

The purpose of the test is to verify diagnostics.

llvm-svn: 282558

7 years agoPut new warning in a diagnostic group.
Matthias Braun [Tue, 27 Sep 2016 23:44:38 +0000 (23:44 +0000)]
Put new warning in a diagnostic group.

The warning I added in r282426 should be a diagnostic group.

llvm-svn: 282557

7 years agoP0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of
Richard Smith [Tue, 27 Sep 2016 23:44:22 +0000 (23:44 +0000)]
P0145R3 (C++17 evaluation order tweaks): evaluate the right-hand side of
assignment and compound-assignment operators before the left-hand side. (Even
if it's an overloaded operator.)

This completes the implementation of P0145R3 + P0400R0 for all targets except
Windows, where the evaluation order guarantees for <<, >>, and ->* are
unimplementable as the ABI requires the function arguments are evaluated from
right to left (because parameter destructors are run from left to right in the
callee).

llvm-svn: 282556

7 years agoRevert r282547 and add test to show correct behavior.
Richard Trieu [Tue, 27 Sep 2016 23:44:07 +0000 (23:44 +0000)]
Revert r282547 and add test to show correct behavior.

llvm-svn: 282555

7 years ago[Coverage] The coverage region for switch covers the code after the switch.
Alex Lorenz [Tue, 27 Sep 2016 23:30:36 +0000 (23:30 +0000)]
[Coverage] The coverage region for switch covers the code after the switch.

This patch fixes a regression introduced in r262697 that changed the way the
coverage regions for switches are constructed. The PGO instrumentation counter
for a switch statement refers to the counter at the exit of the switch.
Therefore, the coverage region for the switch statement should cover the code
that comes after the switch, and not the switch statement itself.

rdar://28480997

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

llvm-svn: 282554

7 years agoNext set of additional error checks for invalid Mach-O files for the
Kevin Enderby [Tue, 27 Sep 2016 23:24:13 +0000 (23:24 +0000)]
Next set of additional error checks for invalid Mach-O files for the
other load commands that use the MachO::dylinker_command type
but not used in llvm libObject code but used in llvm tool code.

This includes LC_ID_DYLINKER, LC_LOAD_DYLINKER
and LC_DYLD_ENVIRONMENT load commands.

llvm-svn: 282553

7 years ago[CMake] Force CMP0057 to NEW
Chris Bieneman [Tue, 27 Sep 2016 23:18:32 +0000 (23:18 +0000)]
[CMake] Force CMP0057 to NEW

Hans reported an issue with r282510 on the list. This should resolve the issue.

llvm-svn: 282552

7 years ago[LTO] Add an API to check if a symbol is a TLS one.
Davide Italiano [Tue, 27 Sep 2016 22:59:29 +0000 (22:59 +0000)]
[LTO] Add an API to check if a symbol is a TLS one.

Will be used in lld.

llvm-svn: 282551

7 years ago[AArch64][RegisterBankInfo] Switch to statically allocated ValueMapping.
Quentin Colombet [Tue, 27 Sep 2016 22:55:04 +0000 (22:55 +0000)]
[AArch64][RegisterBankInfo] Switch to statically allocated ValueMapping.

Another step toward TableGen'ed like structure for the RegisterBankInfo
of AArch64. By doing this, we also save a bit of compile time for the
exact same output.

llvm-svn: 282550

7 years ago[AArch64][RegisterBankInfo] Fix copy/paste in comments.
Quentin Colombet [Tue, 27 Sep 2016 22:54:57 +0000 (22:54 +0000)]
[AArch64][RegisterBankInfo] Fix copy/paste in comments.

NFC.

llvm-svn: 282549

7 years ago[sanitizer_common] Delete some copy/move methods in InternalScopedBuffer
Vedant Kumar [Tue, 27 Sep 2016 22:52:34 +0000 (22:52 +0000)]
[sanitizer_common] Delete some copy/move methods in InternalScopedBuffer

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

llvm-svn: 282548

7 years agoFix defaulted member functions for templated classes.
Richard Trieu [Tue, 27 Sep 2016 22:28:59 +0000 (22:28 +0000)]
Fix defaulted member functions for templated classes.

In some cases, non-special member functions were being marked as being defaulted
in templated classes.  This can cause interactions with later code that expects
the default function to be one of the specific member functions.  Fix the check
so that templated class members are checked the same way as non-templated class
members are.

llvm-svn: 282547

7 years ago[x86] add folds for FP logic with vector zeros
Sanjay Patel [Tue, 27 Sep 2016 22:28:13 +0000 (22:28 +0000)]
[x86] add folds for FP logic with vector zeros

The 'or' case shows up in copysign. The copysign code also had
redundant checking for a scalar zero operand with 'and', so I
removed that.

I'm not sure how to test vector 'and', 'andn', and 'xor' yet,
but it seems better to just include all of the logic ops since
we're fixing 'or' anyway.

llvm-svn: 282546

7 years agoShorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC
Adam Nemet [Tue, 27 Sep 2016 22:19:29 +0000 (22:19 +0000)]
Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC

With the new streaming interface in LLVM, these class names need to be
typed a lot and it's way too looong.

llvm-svn: 282545

7 years agoShorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC
Adam Nemet [Tue, 27 Sep 2016 22:19:23 +0000 (22:19 +0000)]
Shorten DiagnosticInfoOptimizationRemark* to OptimizationRemark*. NFC

With the new streaming interface, these class names need to be typed a
lot and it's way too looong.

llvm-svn: 282544

7 years ago[TargetRegisterInfo, AArch64] Add target hook for isConstantPhysReg().
Geoff Berry [Tue, 27 Sep 2016 22:17:27 +0000 (22:17 +0000)]
[TargetRegisterInfo, AArch64] Add target hook for isConstantPhysReg().

Summary:
The current implementation of isConstantPhysReg() checks for defs of
physical registers to determine if they are constant.  Some
architectures (e.g. AArch64 XZR/WZR) have registers that are constant
and may be used as destinations to indicate the generated value is
discarded, preventing isConstantPhysReg() from returning true.  This
change adds a TargetRegisterInfo hook that overrides the no defs check
for cases such as this.

Reviewers: MatzeB, qcolombet, t.p.northover, jmolloy

Subscribers: junbuml, aemerson, mcrosier, rengolin

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

llvm-svn: 282543

7 years ago[Inliner] Fold the analysis remark into the missed remark
Adam Nemet [Tue, 27 Sep 2016 21:58:17 +0000 (21:58 +0000)]
[Inliner] Fold the analysis remark into the missed remark

There is really no reason for these to be separate.

The vectorizer started this pretty bad tradition that the text of the
missed remarks is pretty meaningless, i.e. vectorization failed.  There,
you have to query analysis to get the full picture.

I think we should just explain the reason for missing the optimization
in the missed remark when possible.  Analysis remarks should provide
information that the pass gathers regardless whether the optimization is
passing or not.

llvm-svn: 282542

7 years ago[LoopSimplify] When simplifying phis in loop-simplify, do it only if it preserves...
Michael Zolotukhin [Tue, 27 Sep 2016 21:03:45 +0000 (21:03 +0000)]
[LoopSimplify] When simplifying phis in loop-simplify, do it only if it preserves LCSSA form.

llvm-svn: 282541

7 years agoAdapt to LLVM optimization remark interface change. NFC
Adam Nemet [Tue, 27 Sep 2016 20:55:12 +0000 (20:55 +0000)]
Adapt to LLVM optimization remark interface change. NFC

llvm-svn: 282540

7 years agoOutput optimization remarks in YAML
Adam Nemet [Tue, 27 Sep 2016 20:55:07 +0000 (20:55 +0000)]
Output optimization remarks in YAML

(Re-committed after moving the template specialization under the yaml
namespace.  GCC was complaining about this.)

This allows various presentation of this data using an external tool.
This was first recommended here[1].

As an example, consider this module:

  1 int foo();
  2 int bar();
  3
  4 int baz() {
  5   return foo() + bar();
  6 }

The inliner generates these missed-optimization remarks today (the
hotness information is pulled from PGO):

  remark: /tmp/s.c:5:10: foo will not be inlined into baz (hotness: 30)
  remark: /tmp/s.c:5:18: bar will not be inlined into baz (hotness: 30)

Now with -pass-remarks-output=<yaml-file>, we generate this YAML file:

  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 10 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: foo
    - String:  will not be inlined into
    - Caller: baz
  ...
  --- !Missed
  Pass:            inline
  Name:            NotInlined
  DebugLoc:        { File: /tmp/s.c, Line: 5, Column: 18 }
  Function:        baz
  Hotness:         30
  Args:
    - Callee: bar
    - String:  will not be inlined into
    - Caller: baz
  ...

This is a summary of the high-level decisions:

* There is a new streaming interface to emit optimization remarks.
E.g. for the inliner remark above:

   ORE.emit(DiagnosticInfoOptimizationRemarkMissed(
                DEBUG_TYPE, "NotInlined", &I)
            << NV("Callee", Callee) << " will not be inlined into "
            << NV("Caller", CS.getCaller()) << setIsVerbose());

NV stands for named value and allows the YAML client to process a remark
using its name (NotInlined) and the named arguments (Callee and Caller)
without parsing the text of the message.

Subsequent patches will update ORE users to use the new streaming API.

* I am using YAML I/O for writing the YAML file.  YAML I/O requires you
to specify reading and writing at once but reading is highly non-trivial
for some of the more complex LLVM types.  Since it's not clear that we
(ever) want to use LLVM to parse this YAML file, the code supports and
asserts that we're writing only.

On the other hand, I did experiment that the class hierarchy starting at
DiagnosticInfoOptimizationBase can be mapped back from YAML generated
here (see D24479).

* The YAML stream is stored in the LLVM context.

* In the example, we can probably further specify the IR value used,
i.e. print "Function" rather than "Value".

* As before hotness is computed in the analysis pass instead of
DiganosticInfo.  This avoids the layering problem since BFI is in
Analysis while DiagnosticInfo is in IR.

[1] https://reviews.llvm.org/D19678#419445

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

llvm-svn: 282539

7 years agoSort headers
Adam Nemet [Tue, 27 Sep 2016 20:55:01 +0000 (20:55 +0000)]
Sort headers

llvm-svn: 282538

7 years agoUpdate FileSpec's interface to use StringRefs.
Zachary Turner [Tue, 27 Sep 2016 20:48:37 +0000 (20:48 +0000)]
Update FileSpec's interface to use StringRefs.

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

llvm-svn: 282537

7 years ago[cmake] Support overriding remaining HTML doc install directories
Michal Gorny [Tue, 27 Sep 2016 19:52:29 +0000 (19:52 +0000)]
[cmake] Support overriding remaining HTML doc install directories

Support overriding the Doxygen & OCamldoc install directories,
and provide a more FHS-compliant defaults for both of them. This extends
r282240 that added this override for Sphinx-built documentation.

LLVM_INSTALL_DOXYGEN_HTML_DIR and LLVM_INSTALL_OCAMLDOC_HTML_DIR are
added, to control the location where Doxygen-generated and
OCamldoc-generated HTML docs are installed appropriately. They both
specify CMake-style install paths, and therefore can either by relative
to the install prefix or absolute.

The new defaults are subdirectories of share/doc/llvm, and replace
the previous directories of 'docs/html' and 'docs/ocaml/html' that
resulted in creating invalid '/usr/docs' that furthermore lacked proper
namespacing for the LLVM package. The new defaults are consistent with
the ones used for Sphinx HTML documentation, differing only in the last
component. Since the 'html' subdirectory is already used for Sphinx
docs, the 'doxygen-html' and 'ocaml-html' directories are used instead.

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

llvm-svn: 282536

7 years agoFix a typo, depricated -> deprecated
Martin Storsjo [Tue, 27 Sep 2016 19:45:30 +0000 (19:45 +0000)]
Fix a typo, depricated -> deprecated

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

llvm-svn: 282534

7 years agoAdapt to LLVM EnableStatistics() change.
Matthias Braun [Tue, 27 Sep 2016 19:38:59 +0000 (19:38 +0000)]
Adapt to LLVM EnableStatistics() change.

llvm-svn: 282533

7 years agoStatistic: Bring back printing on exit by default
Matthias Braun [Tue, 27 Sep 2016 19:38:55 +0000 (19:38 +0000)]
Statistic: Bring back printing on exit by default

Turns out several external projects relied on llvm printing statistics
on exit. Let's go back to this behaviour by default and have an optional
parameter to disable it.

llvm-svn: 282532

7 years ago[COFF] Add support for IMAGE_REL_ARM_SECREL
Martin Storsjo [Tue, 27 Sep 2016 19:27:17 +0000 (19:27 +0000)]
[COFF] Add support for IMAGE_REL_ARM_SECREL

Handle this in the exact same way as IMAGE_REL_AMD64_SECREL
and IMAGE_REL_I386_SECREL.

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

llvm-svn: 282531

7 years agobuiltins: use thumb-2 if possible on comparesf2
Saleem Abdulrasool [Tue, 27 Sep 2016 19:12:31 +0000 (19:12 +0000)]
builtins: use thumb-2 if possible on comparesf2

This code can be built with thumb-2 like many of the other builtin routines.
Enable that here as well.

llvm-svn: 282530

7 years agoAdding a RegisterContextMinidump_x86_64 converter
Dimitar Vlahovski [Tue, 27 Sep 2016 19:05:55 +0000 (19:05 +0000)]
Adding a RegisterContextMinidump_x86_64 converter

Summary:
This is a register context converter from Minidump to Linux reg context.
This knows the layout of the register context in the Minidump file
(which is the same as in Windows FYI) and as a result emits a binary data
buffer that matches the Linux register context binary layout.
This way we can reuse the existing RegisterContextLinux_x86_64 and
RegisterContextCorePOSIX_x86_64 classes.

Reviewers: labath, zturner

Subscribers: beanz, mgorny, lldb-commits, amccarth

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

llvm-svn: 282529

7 years ago[lit] Add instructions to run lit's test suite
Daniel Dunbar [Tue, 27 Sep 2016 18:58:50 +0000 (18:58 +0000)]
[lit] Add instructions to run lit's test suite

 - Patch by Brian Gesiak.

 - https://reviews.llvm.org/D24968

llvm-svn: 282525

7 years agoRevert r282483 - [cmake] Add linker option "-Wl,-z,defs" in standalone build
Michal Gorny [Tue, 27 Sep 2016 18:54:02 +0000 (18:54 +0000)]
Revert r282483 - [cmake] Add linker option "-Wl,-z,defs" in standalone build

Revert r282483 as it causes build failures due to missing symbols when
not linking to -lgcc_s (i.e. doing pure LLVM stack build). The patch can
be reintroduced when the build system is fixed to add all needed
libraries (libunwind, compiler-rt).

llvm-svn: 282524

7 years ago[llvm-cxxfilt] Use llvm::outs(). Simplify.
Davide Italiano [Tue, 27 Sep 2016 18:50:30 +0000 (18:50 +0000)]
[llvm-cxxfilt] Use llvm::outs(). Simplify.

This adds a dependency on Support/. As llvm-cxxfilt will grow
support for options this will be needed anyway.

llvm-svn: 282523

7 years ago[x86] use isNullFPConstant(); NFCI
Sanjay Patel [Tue, 27 Sep 2016 18:48:02 +0000 (18:48 +0000)]
[x86] use isNullFPConstant(); NFCI

Also, put the related FP logic functions together to see the similarities.

llvm-svn: 282522

7 years ago[DebugInfo] Add comments to phi dbg.value tracking code, NFC
Reid Kleckner [Tue, 27 Sep 2016 18:45:31 +0000 (18:45 +0000)]
[DebugInfo] Add comments to phi dbg.value tracking code, NFC

LLVM developers might be surprised to learn that there are blocks
without valid insertion points (catchswitch), so it seems worth calling
that out explicitly.  Also add a FIXME about what we should really be
doing if we ever need to make optimized Windows EH code debuggable.

While I'm here, make auto usage more consistent with LLVM standards and
avoid an unecessary call to insertBefore.

llvm-svn: 282521

7 years ago[RDF] Add "dead" flag to node attributes
Krzysztof Parzyszek [Tue, 27 Sep 2016 18:24:33 +0000 (18:24 +0000)]
[RDF] Add "dead" flag to node attributes

llvm-svn: 282520

7 years ago[RDF] Special treatment of exception handling registers
Krzysztof Parzyszek [Tue, 27 Sep 2016 18:18:44 +0000 (18:18 +0000)]
[RDF] Special treatment of exception handling registers

A landing pad can have live-in registers that are defined by the runtime,
not the program (exception pointer register and exception selector
register). Make sure to recognize that case and not link these registers
with any defs in the program.
Each landing pad will have phi nodes added at the beginning to provide
definitions of these registers, but the uses of those phi nodes will not
have any reaching defs.

llvm-svn: 282519

7 years agoImprove CMake output of host and target triple
Chris Bieneman [Tue, 27 Sep 2016 18:08:40 +0000 (18:08 +0000)]
Improve CMake output of host and target triple

Summary:
The previous output was confusing as it would output "Taget triple:
x86_64-unknown-linux-gnu" even when LLVM_HOST_TRIPLE or
LLVM_DEFAULT_TARGET_TRIPLE were set on the CMake command line

Patch by: Alex Richardson!

Reviewers: beanz

Subscribers: Eugene.Zelenko

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

llvm-svn: 282516

7 years ago[SCEV] Replace a struct with a function; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:48 +0000 (18:01 +0000)]
[SCEV] Replace a struct with a function; NFC

We can do this now thanks to C++11 lambdas.

llvm-svn: 282515

7 years ago[SCEV] Use find instead of find_as; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:46 +0000 (18:01 +0000)]
[SCEV] Use find instead of find_as; NFC

We don't need the extra generality here.

llvm-svn: 282514

7 years ago[SCEV] Reduce the scope of a struct; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:44 +0000 (18:01 +0000)]
[SCEV] Reduce the scope of a struct; NFC

llvm-svn: 282513

7 years ago[SCEV] Remove custom RAII wrapper; NFC
Sanjoy Das [Tue, 27 Sep 2016 18:01:42 +0000 (18:01 +0000)]
[SCEV] Remove custom RAII wrapper; NFC

Instead use the pre-existing `scope_exit` class.

llvm-svn: 282512

7 years ago[SCEV] Make PendingLoopPredicates more frugal; NFCI
Sanjoy Das [Tue, 27 Sep 2016 18:01:38 +0000 (18:01 +0000)]
[SCEV] Make PendingLoopPredicates more frugal; NFCI

I don't expect `PendingLoopPredicates` to have very many
elements (e.g. when -O3'ing the sqlite3 amalgamation,
`PendingLoopPredicates` has at most 3 elements).  So now we use a
`SmallPtrSet` for it instead of the more heavyweight `DenseSet`.

llvm-svn: 282511

7 years ago[CMake] Use if(... IN_LIST ...) instead of list(FIND...)
Chris Bieneman [Tue, 27 Sep 2016 17:47:24 +0000 (17:47 +0000)]
[CMake] Use if(... IN_LIST ...) instead of list(FIND...)

NFC. This is just a little code cleanup to make things easier to read and understand.

llvm-svn: 282510

7 years agoMixed type atomic routines for unsigned integers.
Jonathan Peyton [Tue, 27 Sep 2016 17:38:48 +0000 (17:38 +0000)]
Mixed type atomic routines for unsigned integers.

New routines should be used for atomics like "<int>OP=<float>" when <int> is
unsigned. Using functions __kmpc_atomic_fixed<bits>_<op>_fp) produces incorrect
results

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

llvm-svn: 282509

7 years agoconvert TestFatArchives.py over to no-debug-info test
Todd Fiala [Tue, 27 Sep 2016 17:17:21 +0000 (17:17 +0000)]
convert TestFatArchives.py over to no-debug-info test

We only use the .o-style debug info here regardless, so having
it run all three debuginfo styles was a waste.

This also strips out the custom build function and uses the
TestBase.build() method.

llvm-svn: 282508

7 years agoDisable monitor thread creation by default.
Jonathan Peyton [Tue, 27 Sep 2016 17:11:17 +0000 (17:11 +0000)]
Disable monitor thread creation by default.

This change set disables creation of the monitor thread by default.  The global
counter maintained by the monitor thread was replaced by logic that uses system
time directly, and cyclic yielding on Linux target was also removed since there
was no clear benefit of using it. Turning on KMP_USE_MONITOR variable (=1)
enables creation of monitor thread again if it is really necessary for some
reasons.

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

llvm-svn: 282507

7 years agoPropagate DBG_VALUE entries when there are unvisited predecessors
Keith Walker [Tue, 27 Sep 2016 16:46:07 +0000 (16:46 +0000)]
Propagate DBG_VALUE entries when there are unvisited predecessors

Variables are sometimes missing their debug location information in
blocks in which the variables should be available. This would occur
when one or more predecessor blocks had not yet been visited by the
routine which propagated the information from predecessor blocks.

This is addressed by only considering predecessor blocks which have
already been visited.

The solution to this problem was suggested by Daniel Berlin on the
LLVM developer mailing list.

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

llvm-svn: 282506

7 years agoUse xxhash for fast --build-id.
Rafael Espindola [Tue, 27 Sep 2016 16:43:49 +0000 (16:43 +0000)]
Use xxhash for fast --build-id.

The speed improvements I got were:

firefox
  master 7.050784981
  patch  6.842361079 0.970439617353
chromium
  master 4.260626249
  patch  4.183148025 0.981815296749
chromium fast
  master 1.829028591
  patch  1.806439277 0.987649556649
the gold plugin
  master 0.336154128
  patch  0.331893374 0.987324998728
clang
  master 0.561869781
  patch  0.558640828 0.994253200458
llvm-as
  master 0.034025959
  patch  0.033984389 0.99877828572
the gold plugin fsds
  master 0.360710529
  patch  0.356483564 0.988281559145
clang fsds
  master 0.640518422
  patch  0.632329874 0.987215749432
llvm-as fsds
  master 0.031569416
  patch  0.030822055 0.976326423017
scylla
  master 3.154770529
  patch  3.11982016 0.988921422754

llvm-svn: 282505

7 years agoRevert "Adapt to LLVM optimization remark interface change. NFC"
Adam Nemet [Tue, 27 Sep 2016 16:39:27 +0000 (16:39 +0000)]
Revert "Adapt to LLVM optimization remark interface change. NFC"

This reverts commit r282500.

llvm-svn: 282504

7 years agoRevert "Output optimization remarks in YAML"
Adam Nemet [Tue, 27 Sep 2016 16:39:24 +0000 (16:39 +0000)]
Revert "Output optimization remarks in YAML"

This reverts commit r282499.

The GCC bots are failing

llvm-svn: 282503