Commit Graph

144830 Commits

Author SHA1 Message Date
Marcos Pividori
d9191ae5c6 [libFuzzer] Use dynamic loading for External Functions on Windows.
Replace weak aliases with dynamic loading.
Weak aliases were generating some problems when linking for MT on Windows. For
MT, compiler-rt's libraries are statically linked to the main executable the
same than libFuzzer, so if we use weak aliases, we are providing two different
default implementations for the same weak function and the linker fails.

In this diff I re implement ExternalFunctions() using dynamic loading, so it
works in both cases (MD and MT). Also, dynamic loading is simpler, since we are
not defining any auxiliary external function, and we don't need to deal with
weak aliases.
This is equivalent to the implementation using dlsym(RTLD_DEFAULT, FnName) for
Posix.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294687 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:35:46 +00:00
David L. Jones
49d8fa0feb Update test/CodeGen/X86/sse-align-10.ll to use FileCheck instead of grep
Patch by Jorge Gorbe (lethalantidote).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294686 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:35:31 +00:00
Eugene Zelenko
c51124b83c [MC] 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@294685 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 01:33:54 +00:00
Michael J. Spencer
c45aa0f9ae [LoadCombine] Change test to not use instcombine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294682 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:44:08 +00:00
Dan Gohman
897444660d [WebAssembly] Pass an MCContext to WebAssemblyMCCodeEmitter. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294679 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:14:42 +00:00
Matthias Braun
fdb50b2962 Fix syntax error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294678 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:09:20 +00:00
Matthias Braun
48a1daa806 ARMSubtarget.h: Change to one line per enum element; NFC
Change syntax to have enum elements sorted alphabetically and one per
line as that is more merge/cherry pick friendly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294677 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:06:44 +00:00
Dan Gohman
911ee030f0 [Support] Extend SLEB128 encoding support.
Add support for padded SLEB128 values, and support for writing SLEB128
values to buffers rather than to ostreams, similar to the existing
ULEB128 support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294675 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:02:58 +00:00
Eric Christopher
2d1415be5b Add an additional set of braces to deal with subobject initialization.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294674 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:02:09 +00:00
Matthias Braun
05638abb6d docs/conf.py: Suppress sphinx highlighting failure warnings
The pygments syntax highlighting package used by sphinx fails to parse
newer LLVM constructs or valid (at least to me) gas constructs like
`.secrel32 _function_name + 0`.

Disable this particular warning so the build doesn't abort as fixing
pygments doesn't seem a workable option here.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294672 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-10 00:00:22 +00:00
Chandler Carruth
88c0fa92a7 [PM] Add Argument Promotion to the pass pipeline.
This needs explicit requires of the optimization remark emission before
loop pass pipelines containing LICM as we no longer get it from the
inliner -- Argument Promotion may invalidate it. Technically the inliner
could also have broken this, but it never came up in testing.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294670 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:54:57 +00:00
Davide Italiano
4f223ecabe [NewGVN] Fix test so that it doesn't rely on InstCombine anymore.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294668 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:48:10 +00:00
Chandler Carruth
1648ceaabc [PM] Port ArgumentPromotion to the new pass manager.
Now that the call graph supports efficient replacement of a function and
spurious reference edges, we can port ArgumentPromotion to the new pass
manager very easily.

The old PM-specific bits are sunk into callbacks that the new PM simply
doesn't use. Unlike the old PM, the new PM simply does argument
promotion and afterward does the update to LCG reflecting the promoted
function.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294667 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:46:27 +00:00
Peter Collingbourne
ae2612e12e WholeProgramDevirt: Check that VCP candidate functions are defined before evaluating them.
This was crashing before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294666 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:46:26 +00:00
Matthias Braun
f5ea571cad LowerMemIntrinsics: Fix include guard
I hope this fixes the clang-stage2-cmake-modules jenkins build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294665 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:43:28 +00:00
Chandler Carruth
cfe129ba52 [PM/LCG] Teach LCG to support spurious reference edges.
Somewhat amazingly, this only requires teaching it to clean them up when
deleting a dead function from the graph. And we already have exactly the
necessary data structures to do that in the parent RefSCCs.

This allows ArgPromote to work in a much simpler way be merely letting
reference edges linger in the graph after the causing IR is deleted. We
will clean up these edges when we run any function pass over the IR, but
don't remove them eagerly.

This avoids all of the quadratic update issues both in the current pass
manager and in my previous attempt with the new pass manager.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294663 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:30:14 +00:00
George Burgess IV
e79ec29260 [ARM] Add support for armv7ve triple in llvm (PR31358).
Gcc supports target armv7ve which is armv7-a with virtualization
extensions. This change adds support for this in llvm for gcc
compatibility.

Also remove redundant FeatureHWDiv, FeatureHWDivARM for a few models as
this is specified automatically by FeatureVirtualization.

Patch by Manoj Gupta.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294661 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:29:14 +00:00
Chandler Carruth
396f7202af [PM/LCG] Teach the LazyCallGraph how to replace a function without
disturbing the graph or having to update edges.

This is motivated by porting argument promotion to the new pass manager.
Because of how LLVM IR Function objects work, in order to change their
signature a new object needs to be created. This is efficient and
straight forward in the IR but previously was very hard to implement in
LCG. We could easily replace the function a node in the graph
represents. The challenging part is how to handle updating the edges in
the graph.

LCG previously used an edge to a raw function to represent a node that
had not yet been scanned for calls and references. This was the core
of its laziness. However, that model causes this kind of update to be
very hard:
1) The keys to lookup an edge need to be `Function*`s that would all
   need to be updated when we update the node.
2) There will be some unknown number of edges that haven't transitioned
   from `Function*` edges to `Node*` edges.

All of this complexity isn't necessary. Instead, we can always build
a node around any function, always pointing edges at it and always using
it as the key to lookup an edge. To maintain the laziness, we need to
sink the *edges* of a node into a secondary object and explicitly model
transitioning a node from empty to populated by scanning the function.
This design seems much cleaner in a number of ways, but importantly
there is now exactly *one* place where the `Function*` has to be
updated!

Some other cleanups that fall out of this include having something to
model the *entry* edges more accurately. Rather than hand rolling parts
of the node in the graph itself, we have an explicit `EdgeSequence`
object that gives us exactly the functionality needed. We also have
a consistent place to define the edge iterators and can use them for
both the entry edges and the internal edges of the graph.

The API used to model the separation between a node and its edges is
intentionally very thin as most clients are expected to deal with nodes
that have populated edges. We model this exactly as an optional does
with an additional method to populate the edges when that is
a reasonable thing for a client to do. This is based on API design
suggestions from Richard Smith and David Blaikie, credit goes to them
for helping pick how to model this without it being either too explicit
or too implicit.

The patch is somewhat noisy due to shifting around iterator types and
new syntax for walking the edges of a node, but most of the
functionality change is in the `Edge`, `EdgeSequence`, and `Node` types.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294653 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:24:13 +00:00
Dan Gohman
629186061b [WebAssembly] Refactor void return peephole using MaybeRewriteToFallthrough. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294652 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:19:03 +00:00
Sanjay Patel
49a435a455 [InstCombine] allow (X * C2) << C1 --> X * (C2 << C1) for vectors
This fold already existed for vectors but only when 'C1' was a splat
constant (but 'C2' could be any constant). 

There were no tests for any vector constants, so I'm adding a test
that shows non-splat constants for both operands.  


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294650 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:13:04 +00:00
Peter Collingbourne
54ad54e5f8 De-duplicate some code for creating an AARGetter suitable for the legacy PM.
I'm about to use this in a couple more places.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294648 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:11:52 +00:00
Hans Wennborg
07a58ad1e0 Don't try to link to the 4.0 release notes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294647 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:03:34 +00:00
Matthias Braun
9e6fc42f4f lit.rst: Fix sphinx complaint about multiple option definitions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294646 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:03:22 +00:00
Jonathan Roelofs
65b9667f0a [docs] Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294645 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 23:02:37 +00:00
Adrian McCarthy
a787c7d2ac Fix build break from r294633.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294642 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 22:49:35 +00:00
Simon Pilgrim
161421e702 [X86] Remove duplicate call to getValueType. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294640 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 22:35:59 +00:00
Peter Collingbourne
cdf1f7092e X86: Introduce relocImm-based patterns for cmp.
Differential Revision: https://reviews.llvm.org/D28690

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294636 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 22:02:28 +00:00
Matt Arsenault
13384c6c8a AMDGPU: Add pass to expand memcpy/memmove/memset
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294635 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 22:00:42 +00:00
Peter Collingbourne
ce00de82c2 X86: Teach X86InstrInfo::analyzeCompare to recognize compares of symbols.
This requires that we communicate to X86InstrInfo::optimizeCompareInstr
that the second operand is neither a register nor an immediate. The way we
do that is by setting CmpMask to zero.

Note that there were already instructions where the second operand was not a
register nor an immediate, namely X86::SUB*rm, so also set CmpMask to zero
for those instructions. This seems like a latent bug, but I was unable to
trigger it.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294634 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:58:24 +00:00
Adrian McCarthy
bf8cee85a5 Introduce NativeRawSymbol for PDB reading.
This is a stub for a new concrete implementation of IPDBRawSymbol.
Nothing uses this uses this implementation yet.  My plan is to
locally switch lldb-pdbdump from the DIA reader to the Native one
and flesh out the implementations of these method stubs in the order
they're needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294633 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:51:19 +00:00
Michael J. Spencer
c32a9dfd33 [LoadCombine] Fix combining of loads which span an aliasing store.
Fixes PR31517

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294632 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:46:49 +00:00
Peter Collingbourne
637c07c74b Rename LowerTypeTestsSummaryAction to PassSummaryAction. NFCI.
I intend to use the same type with the same semantics in the WholeProgramDevirt
pass.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294629 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:45:01 +00:00
Sanjay Patel
5a764b03c6 [InstCombine] use m_APInt to allow demanded bits analysis on splat constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294628 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:43:06 +00:00
Konstantin Zhuravlyov
6270090e5c [AMDGPU] Calculate number of min/max SGPRs/VGPRs for WavesPerEU instead of using switch statement
Differential Revision: https://reviews.llvm.org/D29741


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294627 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:33:23 +00:00
Sanjay Patel
4dc55bcb30 [InstCombine] add test for demanded bits with splat vector constants; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294625 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:33:19 +00:00
Tom Stellard
3af2f3b521 CODE_OWNERS: Update email address
Also clean up description.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294624 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 21:29:12 +00:00
Daniel Berlin
61d13b1c02 Drop graph_ prefix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294621 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 20:37:46 +00:00
Daniel Berlin
c0fb95811a GraphTraits: Add range versions of graph traits functions (graph_nodes, graph_children, inverse_graph_nodes, inverse_graph_children).
Summary:
Convert all obvious node_begin/node_end and child_begin/child_end
pairs to range based for.

Sending for review in case someone has a good idea how to make
graph_children able to be inferred. It looks like it would require
changing GraphTraits to be two argument or something. I presume
inference does not happen because it would have to check every
GraphTraits in the world to see if the noderef types matched.

Note: This change was 3-staged with clang as well, which uses
Dominators/etc from LLVM.

Reviewers: chandlerc, tstellarAMD, dblaikie, rsmith

Subscribers: arsenm, llvm-commits, nhaehnle

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294620 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 20:37:24 +00:00
Saleem Abdulrasool
4c5e9062fd test: adjust the test for the BSD format
The padding for ld64 changes the header to include the padding.  Adjust
the test to account for this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294619 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 20:06:30 +00:00
Frederic Riss
909a321521 [dsymutil] Fix handling of empty CUs in LTO links.
r288399 introduced the DIEUnit class, and in the process broke
the corner case where dsymutil generates an empty CU during an
LTO link. This restores the logic and adds a test for the corner
case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294618 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 19:41:55 +00:00
Sanjoy Das
f206bf2145 [JumpThreading] Thread through guards
Summary:
This patch allows JumpThreading also thread through guards.
Virtually, guard(cond) is equivalent to the following construction:

  if (cond) { do something } else {deoptimize}

Yet it is not explicitly converted into IFs before lowering.
This patch enables early threading through guards in simple cases.
Currently it covers the following situation:

  if (cond1) {
    // code A
  } else {
    // code B
  }
  // code C
  guard(cond2)
  // code D

If there is implication cond1 => cond2 or !cond1 => cond2, we can transform
this construction into the following:

  if (cond1) {
    // code A
    // code C
  } else {
    // code B
    // code C
    guard(cond2)
  }
  // code D

Thus, removing the guard from one of execution branches.

Patch by Max Kazantsev!

Reviewers: reames, apilipenko, igor-laevsky, anna, sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294617 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 19:40:22 +00:00
Vedant Kumar
162e055c2b [utils] coverage: Add help text about the --restrict flag (NFC)
Passing the --restrict flag to the coverage prep script before other
positional arguments is wrong, because it prevents the argparse module
from telling apart arguments to --restrict versus positional arguments.

Pointed out by Sean Callanan!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294616 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 19:37:18 +00:00
Saleem Abdulrasool
3e83030148 Object: pad out BSD archive members to 8-bytes
ld64 requires its archive members to be 8-byte aligned for 64-bit
content and 4-byte aligned for 32-bit content.  Opt for the larger
alignment requirement.  This ensures that ld64 can consume archives
generated by llvm-ar.

Thanks to Kevin Enderby for the hint about the ld64/cctools behaviours!

Resolves PR28361!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294615 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 19:29:35 +00:00
Simon Pilgrim
06f2b29f82 Convert to for-range loop. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294610 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 18:52:24 +00:00
Geoff Berry
e22db94a8f [SelectionDAG] Fix bugs in inverted condition splitting code.
Summary:
Fix two bugs in SelectionDAGBuilder::FindMergedConditions reported by
Mikael Holmen.  Handle non-canonicalized xor not operation
correctly (was assuming operand 0 was always the non-constant operand)
and check that the negated condition is also in the same block as the
original and/or instruction (as is done for and/or operands already)
before proceeding with optimization.

Reviewers: bogner, MatzeB, qcolombet

Subscribers: mcrosier, uabelho, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294605 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 18:28:17 +00:00
Chris Bieneman
606c50d357 [CMake] Fix standalone project builds broken in r294514
This patch sets the global property indicating that target registration is complete for standalone sub-project builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294602 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 18:14:12 +00:00
Sanjay Patel
f1a93a4c4e [InstCombine] add tests for icmp with add nsw; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294601 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 18:12:39 +00:00
Kevin Enderby
d6747d6ba9 Tweak the implementation of llvm-objdump’s -objc-meta-data option so
that it works when the ObjC metadata sections end up in the
__DATA_CONST or __DATA_DIRTY segments.

rdar://26315238


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294599 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 17:56:26 +00:00
Simon Pilgrim
e6a7e1ebf9 [X86][BMI2] Regenerate mulx tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294598 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 17:54:51 +00:00
Simon Pilgrim
0a41afd896 [X86][MMX] Remove the (long time) unused MMX_PINSRW ISD opcode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294596 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-09 17:08:47 +00:00