OSDN Git Service

android-x86/external-llvm.git
7 years agoDummy commit.
Jan Sjodin [Wed, 14 Dec 2016 21:57:18 +0000 (21:57 +0000)]
Dummy commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289721 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LTO] Add the missing datalayout in a test.
Davide Italiano [Wed, 14 Dec 2016 21:57:14 +0000 (21:57 +0000)]
[LTO] Add the missing datalayout in a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289720 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LTO] Reject modules without datalayout.
Davide Italiano [Wed, 14 Dec 2016 21:57:04 +0000 (21:57 +0000)]
[LTO] Reject modules without datalayout.

Also, udpate the ~60 failing tests in the tree which did
not contain a valid datalayout.
This fixes PR31123. lld will be updated in a following patch,
immediately after this is committed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289719 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[asan] Don't skip instrumentation of masked load/store unless we've seen a full load...
Filipe Cabecinhas [Wed, 14 Dec 2016 21:57:04 +0000 (21:57 +0000)]
[asan] Don't skip instrumentation of masked load/store unless we've seen a full load/store on that pointer.

Reviewers: kcc, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289718 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[asan] Hook ClInstrumentWrites and ClInstrumentReads to masked operation instrumentation.
Filipe Cabecinhas [Wed, 14 Dec 2016 21:56:59 +0000 (21:56 +0000)]
[asan] Hook ClInstrumentWrites and ClInstrumentReads to masked operation instrumentation.

Reviewers: kcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289717 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCreate SampleProfileLoader pass in llvm instead of clang
Dehao Chen [Wed, 14 Dec 2016 21:40:47 +0000 (21:40 +0000)]
Create SampleProfileLoader pass in llvm instead of clang

Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289714 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Split 128-bit vectors in BUILD_VECTOR lowering
Eli Friedman [Wed, 14 Dec 2016 20:44:38 +0000 (20:44 +0000)]
[ARM] Split 128-bit vectors in BUILD_VECTOR lowering

Given that INSERT_VECTOR_ELT operates on D registers anyway, combining
64-bit vectors into a 128-bit vector is basically free. Therefore, try
to split BUILD_VECTOR nodes before giving up and lowering them to a series
of INSERT_VECTOR_ELT instructions. Sometimes this allows dramatically
better lowerings; see testcases for examples. Inspired by similar code
in the x86 backend for AVX.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289706 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agofix gcc warning about a superfluous ;
Nico Weber [Wed, 14 Dec 2016 20:33:54 +0000 (20:33 +0000)]
fix gcc warning about a superfluous ;

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289705 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Folding of a compare with RHS const should merge debug locations
Robert Lougher [Wed, 14 Dec 2016 20:27:22 +0000 (20:27 +0000)]
[InstCombine] Folding of a compare with RHS const should merge debug locations

If all the operands to a phi node are compares that have a RHS constant,
instcombine will try to pull them through the phi node, combining them into
a single operation. When it does this, the debug location of the new op
should be the merged debug locations of the phi node arguments.

Patch 8 of 8 for D26256.  Folding of a compare that has a RHS constant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289704 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.
Eli Friedman [Wed, 14 Dec 2016 20:25:26 +0000 (20:25 +0000)]
[ARM] Add ARMISD::VLD1DUP to match vld1_dup more consistently.

Currently, there are substantial problems forming vld1_dup even if the
VDUP survives legalization. The lack of an actual node
leads to terrible results: not only can we not form post-increment vld1_dup
instructions, but we form scalar pre-increment and post-increment
loads which force the loaded value into a GPR. This patch fixes that
by combining the vdup+load into an ARMISD node before DAGCombine
messes it up.

Also includes a crash fix for vld2_dup (see testcase @vld2dupi8_postinc_variable).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289703 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName...
Amjad Aboud [Wed, 14 Dec 2016 20:24:54 +0000 (20:24 +0000)]
[DebugInfo] Changed DIBuilder::createCompileUnit() to take DIFile instead of FileName and Directory.
This way it will be easier to expand DIFile (e.g., to contain checksum) without the need to modify the createCompileUnit() API.

Reviewers: llvm-commits, rnk

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289702 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix build failure due to r289674 on certain systems
Yaxun Liu [Wed, 14 Dec 2016 20:17:47 +0000 (20:17 +0000)]
Fix build failure due to r289674 on certain systems

Removed a useless include which caused conflict.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289700 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Folding of a binop with RHS const should merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 20:07:49 +0000 (20:07 +0000)]
[InstCombine] Folding of a binop with RHS const should merge the debug locations

If all the operands to a phi node are a binop with a RHS constant, instcombine
will try to pull them through the phi node, combining them into a single
operation. When it does this, the debug location of the new op should be the
merged debug locations of the phi node arguments.

Patch 7 of 8 for D26256.  Folding of a binop with RHS constant.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289699 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDebugInfo: Improve type safety and simplify some subprogram finalization code
David Blaikie [Wed, 14 Dec 2016 19:38:39 +0000 (19:38 +0000)]
DebugInfo: Improve type safety and simplify some subprogram finalization code

This probably ended up this way aften the subprogram<>function link
inversion and debug info metadata schema changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289697 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[GVNHoist] Move GVNHoist to function simplification part of pipeline.
Geoff Berry [Wed, 14 Dec 2016 19:38:22 +0000 (19:38 +0000)]
[GVNHoist] Move GVNHoist to function simplification part of pipeline.

Summary:
Move GVNHoist to later in the optimization pipeline, specifically, to
the function simplification part of the pipeline.  The new pipeline
location allows GVNHoist to run on a function after its callees have
been inlined but before the function has been considered for inlining
into its callers, exposing more opportunities for hoisting.

Performance results on AArch64 kryo:
Improvements:
  Benchmarks/CoyoteBench/fftbench  -24.952%
  spec2006/bzip2                    -4.071%
  internal bmark                    -3.177%
  Benchmarks/PAQ8p/paq8p            -1.754%
  spec2000/perlbmk                  -1.328%
  spec2006/h264ref                  -1.140%

Regressions:
  internal bmark                    +1.818%
  Benchmarks/mafft/pairlocalalign   +1.084%

Reviewers: sebpop, dberlin, hiraditya

Subscribers: aemerson, mehdi_amini, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289696 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting...
Andrew Kaylor [Wed, 14 Dec 2016 19:30:18 +0000 (19:30 +0000)]
[WinEH] Avoid holding references to BlockColor (DenseMap) entries while inserting new elements

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289694 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] When folding casts through a phi node merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 19:24:01 +0000 (19:24 +0000)]
[InstCombine] When folding casts through a phi node merge the debug locations

If all the operands to a phi node are a cast, instcombine will try to pull
them through the phi node, combining them into a single cast. When it does
this, the debug location of the new cast should be the merged debug locations
of the phi node arguments.

Patch 6 of 8 for D26256.  Folding of a cast operation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289693 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoInclude <cstdarg> in PrettyStackTrace.cpp, fixing the bots.
Sean Callanan [Wed, 14 Dec 2016 19:19:53 +0000 (19:19 +0000)]
Include <cstdarg> in PrettyStackTrace.cpp, fixing the bots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289691 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPrepare PrettyStackTrace for LLDB adoption
Sean Callanan [Wed, 14 Dec 2016 19:09:43 +0000 (19:09 +0000)]
Prepare PrettyStackTrace for LLDB adoption

This patch fixes the linkage for __crashtracer_info__, making it have the proper mangling (extern "C") and linkage (private extern).
It also adds a new PrettyStackTrace type, allowing LLDB to adopt this instead of Host::SetCrashDescriptionWithFormat().

Without this patch, CrashTracer on macOS won't pick up pretty stack traces from any LLVM client.
An LLDB commit adopting this API will follow shortly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289689 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Folding loads through a phi node should merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 19:02:14 +0000 (19:02 +0000)]
[InstCombine] Folding loads through a phi node should merge the debug locations

If all the operands to a phi node are a load, instcombine will try to pull
them through the phi node, combining them into a single load. When it does
this, the debug location of the new load should be the merged debug locations
of the phi node arguments.

Patch 5 of 8 for D26256.  Folding of a load operation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289688 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] When folding GEP through a phi node merge the debug locations
Robert Lougher [Wed, 14 Dec 2016 18:37:50 +0000 (18:37 +0000)]
[InstCombine] When folding GEP through a phi node merge the debug locations

If all the operands to a phi node are getelementptr, instcombine
will try to pull them through the phi node, combining them into a single
operation.  When it does this, the debug location of the new getelementptr
should be the merged debug locations of the phi node arguments.

Patch 4 of 8 for D26256.  Folding of a getelementptr operation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289684 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoThis change does two things:
Eric Christopher [Wed, 14 Dec 2016 18:29:39 +0000 (18:29 +0000)]
This change does two things:

Adds a "Discriminator" field to struct DILineInfo, which defaults to 0.
Fills out the "Discriminator" field in DILineInfo in DWARFDebugLine::LineTable::getFileLineInfoForAddress().

in order to have a slightly nicer interface in getFileLineInfoForAddress.

Patch by Simon Que!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289683 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Merge debug locations when folding through a phi node
Robert Lougher [Wed, 14 Dec 2016 18:14:57 +0000 (18:14 +0000)]
[InstCombine] Merge debug locations when folding through a phi node

If all the operands to a phi node are of the same operation, instcombine
will try to pull them through the phi node, combining them into a single
operation.  When it does this, the debug location of the operation should
be the merged debug locations of the phi node arguments.

Patch 3 of 8 for D26256.  Folding of a compare operation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289681 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] disable msan for one more hook that reads target's data that might be...
Kostya Serebryany [Wed, 14 Dec 2016 18:13:02 +0000 (18:13 +0000)]
[libFuzzer] disable msan for one more hook that reads target's data that might be uninitialized

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289680 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] Merge debug locations when folding through a phi node
Robert Lougher [Wed, 14 Dec 2016 17:49:19 +0000 (17:49 +0000)]
[InstCombine] Merge debug locations when folding through a phi node

If all the operands to a phi node are of the same operation, instcombine
will try to pull them through the phi node, combining them into a single
operation.  When it does this, the debug location of the operation should
be the merged debug locations of the phi node arguments.

Patch 2 of 8 for D26256.  Folding of a binary operation.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289679 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agorevert r289669 which breaks bots
Dehao Chen [Wed, 14 Dec 2016 17:23:16 +0000 (17:23 +0000)]
revert r289669 which breaks bots

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289676 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Emit runtime metadata version 2 as YAML
Yaxun Liu [Wed, 14 Dec 2016 17:16:52 +0000 (17:16 +0000)]
AMDGPU: Emit runtime metadata version 2 as YAML

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289674 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agolit.cfg: Check value of build config rather than converting to boolean
Derek Schuff [Wed, 14 Dec 2016 17:05:34 +0000 (17:05 +0000)]
lit.cfg: Check value of build config rather than converting to boolean

This is a CMake var which never evaluates to false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289673 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Make AllocationPriority of SGPRs higher than VGPRs
Matt Arsenault [Wed, 14 Dec 2016 16:52:06 +0000 (16:52 +0000)]
AMDGPU: Make AllocationPriority of SGPRs higher than VGPRs

Since SGPRs should spill to VGPRs, they should be allocated first.
I don't think this is sufficient for SGPRs to always spill to
VGPRs though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289671 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCreate SampleProfileLoader pass in llvm instead of clang
Dehao Chen [Wed, 14 Dec 2016 16:49:28 +0000 (16:49 +0000)]
Create SampleProfileLoader pass in llvm instead of clang

Summary: We used to create SampleProfileLoader pass in clang. This makes LTO/ThinLTO unable to add this pass in the linker plugin. This patch moves the SampleProfileLoader pass creation from clang to llvm pass manager builder.

Reviewers: tejohnson, davidxl, dnovillo

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289669 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is...
Nirav Dave [Wed, 14 Dec 2016 16:43:44 +0000 (16:43 +0000)]
Revert "In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled."

Reverting due to ARM MCJIT and MIPS LLD error.

This reverts commit r289659.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289667 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAMDGPU: Change vintrp printing
Matt Arsenault [Wed, 14 Dec 2016 16:36:12 +0000 (16:36 +0000)]
AMDGPU: Change vintrp printing

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289664 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert gold part of change, just liblto
Derek Schuff [Wed, 14 Dec 2016 16:20:25 +0000 (16:20 +0000)]
Revert gold part of change, just liblto

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289663 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDisable libLTO tests when libLTO is not built
Derek Schuff [Wed, 14 Dec 2016 16:20:22 +0000 (16:20 +0000)]
Disable libLTO tests when libLTO is not built

Summary:
The current test only checks whether ld64 is available, causing tests
to fail when ld64 is avilable but libLTO is not built.

Reviewers: beanz, mehdi_amini

Subscribers: mehdi_amini, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289662 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNew API for merging debug locations. NFC.
Robert Lougher [Wed, 14 Dec 2016 16:14:17 +0000 (16:14 +0000)]
New API for merging debug locations. NFC.

Given two debug locations the function getMergedLocation combines the
locations into a single location (which may be an empty location).
Please see https://reviews.llvm.org/D26256 for the discussion leading
up to this API.

Note the function is currently a stub.  This allows optimisations to
use the API although no location will actually be used.

This is patch 1 out of 8 for D26256.  As suggested by David Blaikie,
each change in D26256 has been broken out into a separate patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289661 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIn visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.
Nirav Dave [Wed, 14 Dec 2016 15:44:26 +0000 (15:44 +0000)]
In visitSTORE, always use FindBetterChain, rather than only when UseAA is enabled.

Retrying after fixing after removing load-store factoring through
token factors in favor of improved token factor operand pruning

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.

Reviewers: arsenm, hfinkel, tstellarAMD, jyknight, nhaehnle

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289659 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWdocumentation fix
Simon Pilgrim [Wed, 14 Dec 2016 15:14:44 +0000 (15:14 +0000)]
Wdocumentation fix

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289655 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DAGCombiner] Try to use SelectionDAG::isKnownToBeAPowerOfTwo instead of just APInt...
Simon Pilgrim [Wed, 14 Dec 2016 15:08:13 +0000 (15:08 +0000)]
[DAGCombiner] Try to use SelectionDAG::isKnownToBeAPowerOfTwo instead of just APInt::isPowerOf2

Generalize sdiv/udiv/srem/urem combines using APInt::isPowerOf2, which only works for const/splat-const values, to call SelectionDAG::isKnownToBeAPowerOfTwo instead which recognises many more cases.

Added a DAGCombiner::BuildLogBase2 helper since PowerOf2 combines often involve taking the log2 of such a value.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289654 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix bug 30945- [AVX512] Failure to flip vector comparison to remove not mask instruction
Michael Zuckerman [Wed, 14 Dec 2016 14:57:10 +0000 (14:57 +0000)]
Fix bug 30945- [AVX512] Failure to flip vector comparison to remove not mask instruction

adding new optimization opportunity by adding new X86ISelLowering pattern. The test case was shown in https://llvm.org/bugs/show_bug.cgi?id=30945.

Test explanation:
Select gets three arguments mask, op and op2. In this case, the Mask is a result of ICMP. The ICMP instruction compares (with equal operand) the zero initializer vector and the result of the first ICMP.

In general, The result of "cmp eq, op1, zero initializers" is "not(op1)" where op1 is a mask. By rearranging of the two arguments inside the Select instruction, we can get the same result. Without the necessary of the middle phase ("cmp eq, op1, zero initializers").

Missed optimization opportunity:
vpcmpled %zmm0, %zmm1, %k0
knotw %k0, %k1

can be combine to
vpcmpgtd %zmm0, %zmm2, %k1

Reviewers:
1. delena
2. igorb

Commited after check all
Differential Revision: https://reviews.llvm.org/D27160

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289653 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Add AVX1 tests to sdiv/udiv srem/urem combine tests
Simon Pilgrim [Wed, 14 Dec 2016 14:39:51 +0000 (14:39 +0000)]
[X86][SSE] Add AVX1 tests to sdiv/udiv srem/urem combine tests

As requested on D27714

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289652 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[AVR] Add the very first on-target test"
Renato Golin [Wed, 14 Dec 2016 13:24:20 +0000 (13:24 +0000)]
Revert "[AVR] Add the very first on-target test"

This reverts commit r289648, as it's an execution test and relies on the
emulator/dispatcher being available on all builders.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289651 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdapt to recent APFloat change
Stephan Bergmann [Wed, 14 Dec 2016 12:11:35 +0000 (12:11 +0000)]
Adapt to recent APFloat change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289649 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVR] Add the very first on-target test
Dylan McKay [Wed, 14 Dec 2016 12:03:39 +0000 (12:03 +0000)]
[AVR] Add the very first on-target test

This test runs on actual AVR hardware.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289648 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReplace APFloatBase static fltSemantics data members with getter functions
Stephan Bergmann [Wed, 14 Dec 2016 11:57:17 +0000 (11:57 +0000)]
Replace APFloatBase static fltSemantics data members with getter functions

At least the plugin used by the LibreOffice build
(<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly
uses those members (through inline functions in LLVM/Clang include files in turn
using them), but they are not exported by utils/extract_symbols.py on Windows,
and accessing data across DLL/EXE boundaries on Windows is generally
problematic.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289647 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a couple of assertions to the load combine code introduced by r289538
Artur Pilipenko [Wed, 14 Dec 2016 11:55:47 +0000 (11:55 +0000)]
Add a couple of assertions to the load combine code introduced by r289538

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289646 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVR] Add the integrated testing tool to the .gitignore
Dylan McKay [Wed, 14 Dec 2016 11:47:14 +0000 (11:47 +0000)]
[AVR] Add the integrated testing tool to the .gitignore

We build it as an LLVM tool.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289645 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Assembler] Better error messages for .org directive
Oliver Stannard [Wed, 14 Dec 2016 10:43:58 +0000 (10:43 +0000)]
[Assembler] Better error messages for .org directive

Currently, the error messages we emit for the .org directive when the
expression is not absolute or is out of range do not include the line
number of the directive, so it can be hard to track down the problem if
a file contains many .org directives.

This patch stores the source location in the MCOrgFragment, so that it
can be used for diagnostics emitted during layout.

Since layout is an iterative process, and the errors are detected during
each iteration, it would have been possible for errors to be reported
multiple times. To prevent this, I've made the assembler bail out after
each iteration if any errors have been reported. This will still allow
multiple unrelated errors to be reported in the common case where they
are all detected in the first round of layout.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289643 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVR] Add a function instrumentation pass
Dylan McKay [Wed, 14 Dec 2016 10:15:00 +0000 (10:15 +0000)]
[AVR] Add a function instrumentation pass

This will be used for an on-chip test suite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289641 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][InstCombine] Handle demanded elements for operand of AVX-512 scalar floating...
Craig Topper [Wed, 14 Dec 2016 07:46:12 +0000 (07:46 +0000)]
[X86][InstCombine] Handle demanded elements for operand of AVX-512 scalar floating point to integer conversion intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289639 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)
Hal Finkel [Wed, 14 Dec 2016 07:24:50 +0000 (07:24 +0000)]
[PowerPC] Fix logic dealing with nop after calls (and tail-call eligibility)

This change aims to unify and correct our logic for when we need to allow for
the possibility of the linker adding a TOC restoration instruction after a
call. This comes up in two contexts:

 1. When determining tail-call eligibility. If we make a tail call (i.e.
    directly branch to a function) then there is no place for the linker to add
    a TOC restoration.
 2. When determining when we need to add a nop instruction after a call.
    Likewise, if there is a possibility that the linker might need to add a
    TOC restoration after a call, then we need to put a nop after the call
    (the bl instruction).

First problem: We were using similar, but different, logic to decide (1) and
(2). This is just wrong. Both the resideInSameModule function (used when
determining tail-call eligibility) and the isLocalCall function (used when
deciding if the post-call nop is needed) were supposed to be determining the
same underlying fact (i.e. might a TOC restoration be needed after the call).
The same logic should be used in both places.

Second problem: The logic in both places was wrong. We only know that two
functions will share the same TOC when both functions come from the same
section of the same object. Otherwise the linker might cause the functions to
use different TOC base addresses (unless the multi-TOC linker option is
disabled, in which case only shared-library boundaries are relevant). There are
a number of factors that can cause functions to be placed in different sections
or come from different objects (-ffunction-sections, explicitly-specified
section names, COMDAT, weak linkage, etc.). All of these need to be checked.
The existing logic only checked properties of the callee, but the properties of
the caller must also be checked (for example, calling from a function in a
COMDAT section means calling between sections).

There was a conceptual error in the resideInSameModule function in that it
allowed tail calls to functions with weak linkage and protected/hidden
visibility. While protected/hidden visibility does prevent the function
implementation from being replaced at runtime (via interposition), it does not
prevent the linker from using an alternate implementation at link time (i.e.
using some strong definition to replace the provided weak one during linking).
If this happens, then we're still potentially looking at a required TOC
restoration upon return.

Otherwise, in general, the post-call nop is needed wherever ELF interposition
needs to be supported. We don't currently support ELF interposition at the IR
level (see http://lists.llvm.org/pipermail/llvm-dev/2016-November/107625.html
for more information), and I don't think we should try to make it appear to
work in the backend in spite of that fact. This will yield subtle bugs if
interposition is attempted. As a result, regardless of whether we're in PIC
mode, we don't assume that we need to add the nop to support the possibility of
ELF interposition. However, the necessary check is in place (i.e. calling
GV->isInterposable and TM.shouldAssumeDSOLocal) so when we have functions for
which interposition is allowed at the IR level, we'll add the nop as necessary.
In the mean time, we'll generate more tail calls and fewer nops when compiling
position-independent code.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289638 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle masked scalar add/sub...
Craig Topper [Wed, 14 Dec 2016 06:06:58 +0000 (06:06 +0000)]
[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle masked scalar add/sub/mul/div/max/min intrinsics better.

Now we can remove these intrinsics if element 0 isn't used. Also fix undef element tracking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289636 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][InstCombine] Handle scalar fmadd intrinsics correctly in SimplifyDemandedVector...
Craig Topper [Wed, 14 Dec 2016 05:43:05 +0000 (05:43 +0000)]
[X86][InstCombine] Handle scalar fmadd intrinsics correctly in SimplifyDemandedVectorElts.

Now we pass a modified version of DemandedElts to each operand and we calculate undef elts correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289632 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ThinLTO] Add an API to trigger file-based API for returning objects to the linker
Mehdi Amini [Wed, 14 Dec 2016 04:56:42 +0000 (04:56 +0000)]
[ThinLTO] Add an API to trigger file-based API for returning objects to the linker

Summary:
The motivation is to support better the -object_path_lto option on
Darwin. The linker needs to write down the generate object files on
disk for later use by lldb or dsymutil (debug info are not present
in the final binary). We're moving this into libLTO so that we can
be smarter when a cache is enabled and hard-link when possible
instead of duplicating the files.

Reviewers: tejohnson, deadalnix, pcc

Subscribers: dexonsmith, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289631 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle scalar round intrinsics...
Craig Topper [Wed, 14 Dec 2016 03:17:30 +0000 (03:17 +0000)]
[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle scalar round intrinsics more correctly.

Now we only pass bit 0 of the DemandedElts to optimize operand 1 as we recurse since the upper bits are unused. Similarly we clear bit 0 for optimizing operand 0.

Also calculate UndefElts correctly.

Simplify InstCombineCalls for these instrinics to just call SimplifyDemandedVectorElts for the call instrution to reuse this support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289629 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle scalar min/max/cmp...
Craig Topper [Wed, 14 Dec 2016 03:17:27 +0000 (03:17 +0000)]
[X86][InstCombine] Teach SimplifyDemandedVectorElts to handle scalar min/max/cmp intrinsics more correctly.

Now we only pass bit 0 of the DemandedElts to optimize operand 1 as we recurse since the upper bits are unused.

Also calculate UndefElts correctly.

Simplify InstCombineCalls for these instrinics to just call SimplifyDemandedVectorElts for the call instrution to reuse this support.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289628 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't double-initialize cl::opt for iterating in reverse order to uncover non-determi...
Mehdi Amini [Wed, 14 Dec 2016 02:35:32 +0000 (02:35 +0000)]
Don't double-initialize cl::opt for iterating in reverse order to uncover non-determinism in codegen by default

Bots are broken and needs to be fixed before having this on by default.
The feature was committed in r289619.

I tried to disable it in r289624 and failed because it was initialized in two places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289626 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDisable Iterating SmallPtrSet in reverse order to uncover non-determinism in codegen...
Mehdi Amini [Wed, 14 Dec 2016 02:02:28 +0000 (02:02 +0000)]
Disable Iterating SmallPtrSet in reverse order to uncover non-determinism in codegen by default

Bots are broken and needs to be fixed before having this on by default.
The feature was committed in r289619.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289624 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] document one more desired feature of a fuzz target
Kostya Serebryany [Wed, 14 Dec 2016 01:31:21 +0000 (01:31 +0000)]
[libFuzzer] document one more desired feature of a fuzz target

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289622 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Add support for multi-module bitcode files.
Peter Collingbourne [Wed, 14 Dec 2016 01:17:59 +0000 (01:17 +0000)]
LTO: Add support for multi-module bitcode files.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289621 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[DWARF] Preserve column number when emitting 'line 0' record
Paul Robinson [Wed, 14 Dec 2016 00:27:35 +0000 (00:27 +0000)]
[DWARF] Preserve column number when emitting 'line 0' record

Follow-up to r289256, address a FIXME to avoid resetting the column
number. This reduced .debug_line by 2.6% in a RelWithDebInfo
self-build of clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289620 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm] Iterate SmallPtrSet in reverse order to uncover non-determinism in codegen
Mandeep Singh Grang [Wed, 14 Dec 2016 00:15:57 +0000 (00:15 +0000)]
[llvm] Iterate SmallPtrSet in reverse order to uncover non-determinism in codegen

Summary:
Given a flag (-mllvm -reverse-iterate) this patch will enable iteration of SmallPtrSet in reverse order.
The idea is to compile the same source with and without this flag and expect the code to not change.
If there is a difference in codegen then it would mean that the codegen is sensitive to the iteration order of SmallPtrSet.
This is enabled only with LLVM_ENABLE_ABI_BREAKING_CHECKS.

Reviewers: chandlerc, dexonsmith, mehdi_amini

Subscribers: mgorny, emaste, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289619 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fix typo in checking prefix
Evandro Menezes [Wed, 14 Dec 2016 00:02:03 +0000 (00:02 +0000)]
[ARM] Fix typo in checking prefix

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289617 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support for Samsung Exynos M3 (NFC)
Evandro Menezes [Tue, 13 Dec 2016 23:31:41 +0000 (23:31 +0000)]
Add support for Samsung Exynos M3 (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289613 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate the header docs to match a recent checkin.
Greg Clayton [Tue, 13 Dec 2016 23:22:53 +0000 (23:22 +0000)]
Update the header docs to match a recent checkin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289612 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSwitch functions that returned bool and filled in a DWARFFormValue arg with ones...
Greg Clayton [Tue, 13 Dec 2016 23:20:56 +0000 (23:20 +0000)]
Switch functions that returned bool and filled in a DWARFFormValue arg with ones that return Optional<DWARFFormValue>

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289611 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm-cat: Allow bitcode files to be created with no modules.
Peter Collingbourne [Tue, 13 Dec 2016 23:14:55 +0000 (23:14 +0000)]
llvm-cat: Allow bitcode files to be created with no modules.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289610 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-config] Fixing one check where shared libs implied dylib
Chris Bieneman [Tue, 13 Dec 2016 23:08:52 +0000 (23:08 +0000)]
[llvm-config] Fixing one check where shared libs implied dylib

We shouldn't print the dylib if LinkDylib is false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289609 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agollvm-config: Set LinkMode in addition to LinkDyLib when using --ignore-llvm
Derek Schuff [Tue, 13 Dec 2016 23:01:53 +0000 (23:01 +0000)]
llvm-config: Set LinkMode in addition to LinkDyLib when using --ignore-llvm

Summary:
LinkDyLib is only used (before arg processing) to set up the default for
LinkMode. So reset LinkMode as well, and process before --link-shared or
--link-static to allow those flags to continue to override it.

Reviewers: beanz

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289608 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] fix an UB (invalid shift) spotted by ubsan. The code worked fine by luck...
Kostya Serebryany [Tue, 13 Dec 2016 22:49:14 +0000 (22:49 +0000)]
[libFuzzer] fix an UB (invalid shift) spotted by ubsan. The code worked fine by luck, because the way shifts actually work on clang+x86

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289607 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-config] Add --ignore-libllvm
Chris Bieneman [Tue, 13 Dec 2016 22:17:59 +0000 (22:17 +0000)]
[llvm-config] Add --ignore-libllvm

This flag forces off linking libLLVM. This should resolve some issues reported on llvm-commits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289605 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Tue, 13 Dec 2016 22:13:50 +0000 (22:13 +0000)]
[Hexagon] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289604 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoChange CoverageTracker from a global variable to member variable to avoid breaking...
Dehao Chen [Tue, 13 Dec 2016 22:13:18 +0000 (22:13 +0000)]
Change CoverageTracker from a global variable to member variable to avoid breaking thread-safety. (NFC)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289603 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-land "[SCEVExpander] Use llvm data structures; NFC"
Sanjoy Das [Tue, 13 Dec 2016 22:04:58 +0000 (22:04 +0000)]
Re-land "[SCEVExpander] Use llvm data structures; NFC"

This change re-lands r289215, by reverting r289482.  The underlying
issue that caused it to be reverted has been fixed by Tim Northover in
r289496.

Original commit message for r289215:

[SCEVExpander] Use llvm data structures; NFC

Original commit message for r289482:

Revert "[SCEVExpander] Use llvm data structures; NFC"

This reverts r289215 (git SHA1 cb7b86a1).  It breaks the ubsan build
because a DenseMap that keys off of `AssertingVH<T>` will hit UB when it
tries to cast the empty and tombstone keys to `T *` (due to insufficient
alignment).

This is the relevant stack trace (thanks to Mike Aizatsky):

    #0 0x25cf100 in llvm::AssertingVH<llvm::PHINode>::getValPtr() const llvm/include/llvm/IR/ValueHandle.h:212:39
    #1 0x25cea20 in llvm::AssertingVH<llvm::PHINode>::operator=(llvm::AssertingVH<llvm::PHINode> const&) llvm/include/llvm/IR/ValueHandle.h:234:19
    #2 0x25d0092 in llvm::DenseMapBase<llvm::DenseMap<llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >, llvm::AssertingVH<llvm::PHINode>, llvm::detail::DenseSetEmpty, llvm::DenseMapInfo<llvm::AssertingVH<llvm::PHINode> >, llvm::detail::DenseSetPair<llvm::AssertingVH<llvm::PHINode> > >::clear() llvm/include/llvm/ADT/DenseMap.h:113:23

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289602 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IRCE] Avoid loop optimizations on pre and post loops
Anna Thomas [Tue, 13 Dec 2016 21:05:21 +0000 (21:05 +0000)]
[IRCE] Avoid loop optimizations on pre and post loops

Summary:
This patch will add loop metadata on the pre and post loops generated by IRCE.
Currently, we have metadata for disabling optimizations such as vectorization,
unrolling, loop distribution and LICM versioning (and confirmed that these
optimizations check for the metadata before proceeding with the transformation).

The pre and post loops generated by IRCE need not go through loop opts (since
these are slow paths).

Added two test cases as well.

Reviewers: sanjoy, reames

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289588 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LV] Don't vectorize when we have a small static bound on trip count
Michael Kuperstein [Tue, 13 Dec 2016 20:38:18 +0000 (20:38 +0000)]
[LV] Don't vectorize when we have a small static bound on trip count

We currently check if the exact trip count is known and is smaller than the
"tiny loop" bound. We should be checking the maximum bound on the trip count
instead.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289583 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with...
Peter Collingbourne [Tue, 13 Dec 2016 20:30:12 +0000 (20:30 +0000)]
ADT: Use delete[] to delete the array owned by OwningArrayRef, as we created it with new[].

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289582 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoADT: Add OwningArrayRef class.
Peter Collingbourne [Tue, 13 Dec 2016 20:24:24 +0000 (20:24 +0000)]
ADT: Add OwningArrayRef class.

This is a MutableArrayRef that owns its array.
I plan to use this in D22296.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289579 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObject: Make IRObjectFile own multiple modules and enumerate symbols from all modules.
Peter Collingbourne [Tue, 13 Dec 2016 20:20:17 +0000 (20:20 +0000)]
Object: Make IRObjectFile own multiple modules and enumerate symbols from all modules.

This implements multi-module support in IRObjectFile.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289578 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObject: Remove module accessors from IRObjectFile, and hide its constructor.
Peter Collingbourne [Tue, 13 Dec 2016 20:10:22 +0000 (20:10 +0000)]
Object: Remove module accessors from IRObjectFile, and hide its constructor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289577 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Port the legacy LTO API to ModuleSymbolTable.
Peter Collingbourne [Tue, 13 Dec 2016 20:01:58 +0000 (20:01 +0000)]
LTO: Port the legacy LTO API to ModuleSymbolTable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289576 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Port the new LTO API to ModuleSymbolTable.
Peter Collingbourne [Tue, 13 Dec 2016 19:43:49 +0000 (19:43 +0000)]
LTO: Port the new LTO API to ModuleSymbolTable.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289574 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGeneralize strided store pattern in interleave access pass
Alina Sbirlea [Tue, 13 Dec 2016 19:32:36 +0000 (19:32 +0000)]
Generalize strided store pattern in interleave access pass

Summary:
This patch aims to generalize matching of the strided store accesses to more general masks.
The more general rule is to have consecutive accesses based on the stride:
[x, y, ... z, x+1, y+1, ...z+1, x+2, y+2, ...z+2, ...]
All elements in the masks need not form a contiguous space, there may be gaps.
As before, undefs are allowed and filled in with adjacent element loads.

Reviewers: HaoLiu, mssimpso

Subscribers: mkuper, delena, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289573 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "AArch64CollectLOH: Rewrite as block-local analysis."
Matthias Braun [Tue, 13 Dec 2016 19:08:17 +0000 (19:08 +0000)]
Revert "AArch64CollectLOH: Rewrite as block-local analysis."

This is not always behaving as expected as it turns out block live-in
lists are only correct most of the time. Still waiting for reviews on
https://reviews.llvm.org/D27559 to have them correct all of the time.

See also http://llvm.org/PR31361, rdar://25117107

This reverts commit r288567.
This reverts commit r288561.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289570 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[bpf] change llvm-objdump to print dec instead of hex
Alexei Starovoitov [Tue, 13 Dec 2016 19:07:08 +0000 (19:07 +0000)]
[bpf] change llvm-objdump to print dec instead of hex

since bpf instruction stream is multiple of 8 change llvm-objdump
to print decimal instruction number instead of hex address, so that
users don't have to do this math manually to match kernel verifier output

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289569 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoGlobalISel: fix GOT accesses on AArch64.
Tim Northover [Tue, 13 Dec 2016 18:25:38 +0000 (18:25 +0000)]
GlobalISel: fix GOT accesses on AArch64.

We were using the correct pseudo-instruction, but because the operand's flags
weren't set correctly we still ended up emitting incorrect relocations during
MC lowering.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289566 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting...
Greg Clayton [Tue, 13 Dec 2016 18:25:19 +0000 (18:25 +0000)]
Make a DWARFDIE class that can help avoid using the wrong DWARFUnit when extracting attributes

Many places pass around a DWARFDebugInfoEntryMinimal and a DWARFUnit. It is easy to get things wrong by using the wrong DWARFUnit with a DWARFDebugInfoEntryMinimal. This patch creates a DWARFDie class that contains the DWARFUnit and DWARFDebugInfoEntryMinimal objects so that they can't get out of sync. All attribute extraction has been moved out of DWARFDebugInfoEntryMinimal and into DWARFDie. DWARFDebugInfoEntryMinimal was also renamed to DWARFDebugInfoEntry.

DWARFDie objects are temporary objects that are used by clients and contain 2 pointers that you always need to have anyway. Keeping them grouped will avoid errors and simplify many of the attribute extracting APIs by not having to pass in a DWARFUnit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289565 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Add missing header needed for Windows.
Marcos Pividori [Tue, 13 Dec 2016 17:46:48 +0000 (17:46 +0000)]
[libFuzzer] Add missing header needed for Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289564 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Avoid name collision with Windows API.
Marcos Pividori [Tue, 13 Dec 2016 17:46:40 +0000 (17:46 +0000)]
[libFuzzer] Avoid name collision with Windows API.

Windows uses some macros to replace DeleteFile() by DeleteFileA() or
DeleteFileW(). This was causing an error at link time.
DeleteFile was renamed to RemoveFile().

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289563 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Implement DirName() for Windows.
Marcos Pividori [Tue, 13 Dec 2016 17:46:32 +0000 (17:46 +0000)]
[libFuzzer] Implement DirName() for Windows.

Implement DirName from scratch to avoid dependencies on external libraries.
It's based on MSDN documentation for Naming Files, Paths, and Namespaces.

The algorithm can't simply start from the end and look backwards for the
first separator, because we need to preserve the prefix that represent
the root location. We shouldn't remove anything there. In Windows we
have many different options, like:
 \\Server\Share\ , \ , C: , C:\ , \\?\C:\ , \\?\UNC\Server\Share\
We remove the last separator in the rest of the path, if it exists.

It was implemented to have a similar behaviour to dirname() in linux,
removing trailing separators, returning "." when the path doesn't
contain separators, etc.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289562 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Fix bug in detecting timeouts when input string is empty.
Marcos Pividori [Tue, 13 Dec 2016 17:46:25 +0000 (17:46 +0000)]
[libFuzzer] Fix bug in detecting timeouts when input string is empty.

I added a new flag RunningCB to know if the Fuzzer's main thread is
running the CB function, instead of using (!CurrentUnitSize).
(!CurrentUnitSize) doesn't work properly. For example, in FuzzerLoop.cpp,
inside ShuffleAndMinimize() function, we execute the callback with an
empty string (size=0). Previous implementation failed to detect timeouts
in that execution.
Also, I add a regression test for that case.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289561 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Clean up headers and file formatting of LibFuzzer files.
Marcos Pividori [Tue, 13 Dec 2016 17:46:11 +0000 (17:46 +0000)]
[libFuzzer] Clean up headers and file formatting of LibFuzzer files.

Reorganize #includes to follow LLVM Coding Standards.
Include some missing headers. Required to use `Printf()`.

Aside from that, this patch contains no functional change.
It is purely a re-organization.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289560 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Properly use unsigned for workers, jobs and NumberOfCpuCores.
Marcos Pividori [Tue, 13 Dec 2016 17:45:53 +0000 (17:45 +0000)]
[libFuzzer] Properly use unsigned for workers, jobs and NumberOfCpuCores.

std::thread::hardware_concurrency() returns an unsigned, so I modify
NumberOfCpuCores() to return unsigned too.
The number of cpus is used to define the number of workers, so I decided
to update the worker and jobs flags to be declared as unsigned too.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289559 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Properly use unsigned for Process ID.
Marcos Pividori [Tue, 13 Dec 2016 17:45:44 +0000 (17:45 +0000)]
[libFuzzer] Properly use unsigned for Process ID.

Use unsigned for PID instead of signed int. GetCurrentProcessId() returns
an unsigned (DWORD) so we must be sure we can deal with all possible values.
I use a long unsigned to be sure it can hold a 32 bit unsigned (DWORD).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289558 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Improve Signal Handler interface.
Marcos Pividori [Tue, 13 Dec 2016 17:45:20 +0000 (17:45 +0000)]
[libFuzzer] Improve Signal Handler interface.

Add new flags to FuzzingOptions to represent the different conditions
on the signal handling. These options are passed when calling
SetSignalHandler().
This changes simplify the implementation of Windows's exception
handling. Now we can define a unique handler for all the exceptions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289557 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix the test cases committed in r289521.
Rong Xu [Tue, 13 Dec 2016 17:34:29 +0000 (17:34 +0000)]
Fix the test cases committed in r289521.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289556 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][SSE] Regenerate vector of pointers tests
Simon Pilgrim [Tue, 13 Dec 2016 17:22:39 +0000 (17:22 +0000)]
[X86][SSE] Regenerate vector of pointers tests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289555 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ADT] Add llvm::StringLiteral.
Zachary Turner [Tue, 13 Dec 2016 17:03:49 +0000 (17:03 +0000)]
[ADT] Add llvm::StringLiteral.

StringLiteral is a wrapper around a string literal useful for
replacing global tables of char arrays with global tables of
StringRefs that can initialized in a constexpr context, avoiding
the invocation of a global constructor.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289551 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ADCE] Add code to remove dead branches
David Callahan [Tue, 13 Dec 2016 16:42:18 +0000 (16:42 +0000)]
[ADCE] Add code to remove dead branches

Summary:
This is last in of a series of patches to evolve ADCE.cpp to support
removing of unnecessary control flow.

This patch adds the code to update the control and data flow graphs
to remove the dead control flow.

Also update unit tests to test the capability to remove dead,
may-be-infinite loop which is enabled by the switch
-adce-remove-loops.

Previous patches:

D23824 [ADCE] Add handling of PHI nodes when removing control flow
D23559 [ADCE] Add control dependence computation
D23225 [ADCE] Modify data structures to support removing control flow
D23065 [ADCE] Refactor anticipating new functionality (NFC)
D23102 [ADCE] Refactoring for new functionality (NFC)

Reviewers: dberlin, majnemer, nadav, mehdi_amini

Subscribers: llvm-commits, david2050, freik, twoh

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289548 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUse more detailed assertion messages in the code introduced by r289538
Artur Pilipenko [Tue, 13 Dec 2016 16:26:15 +0000 (16:26 +0000)]
Use more detailed assertion messages in the code introduced by r289538

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289545 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix a buildbot failure introduced by r289538
Artur Pilipenko [Tue, 13 Dec 2016 14:55:31 +0000 (14:55 +0000)]
Fix a buildbot failure introduced by r289538

Build failed because of unused variable in product mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289540 91177308-0d34-0410-b5e6-96231b3b80d8