140241 Commits

Author SHA1 Message Date
Simon Pilgrim
4864d89aff [X86][SSE] Added vector srem combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285121 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:14:11 +00:00
Simon Pilgrim
b4f0b6e6d3 [X86][SSE] Added vector urem combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285119 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 21:10:12 +00:00
Simon Pilgrim
baad275225 [DAGCombiner] Enable sdiv(x.y) -> udiv(x,y) combine for vectors
SelectionDAG::SignBitIsZero (via SelectionDAG::computeKnownBits) has supported vectors since rL280927

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285118 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:56:42 +00:00
Guozhi Wei
413fdf3b7f [InstCombine] Resubmit the combine of A->B->A BitCast and fix for pr27996
The original patch of the A->B->A BitCast optimization was reverted by r274094 because it may cause infinite loop inside compiler https://llvm.org/bugs/show_bug.cgi?id=27996.

The problem is with following code

xB = load (type B); 
xA = load (type A); 
+yA = (A)xB; B -> A
+zAn = PHI[yA, xA]; PHI 
+zBn = (B)zAn; // A -> B
store zAn;
store zBn;

optimizeBitCastFromPhi generates

+zBn = (B)zAn; // A -> B

and expects it will be combined with the following store instruction to another

store zAn 

Unfortunately before combineStoreToValueType is called on the store instruction, optimizeBitCastFromPhi is called on the new BitCast again, and this pattern repeats indefinitely.

optimizeBitCastFromPhi only generates BitCast for load/store instructions, only the BitCast before store can cause the reexecution of optimizeBitCastFromPhi, and BitCast before store can easily be handled by InstCombineLoadStoreAlloca.cpp. So the solution to the problem is if all users of a CI are store instructions, we should not do optimizeBitCastFromPhi on it. Then optimizeBitCastFromPhi will not be called on the new BitCast instructions.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285116 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:43:42 +00:00
Simon Pilgrim
09845fdead [X86][SSE] Added vector sdiv combine tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285112 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:25:47 +00:00
Robert Lougher
59a91134b9 revert: "Remove debug location from common tail when tail-merging"
This reverts r285093, as it caused unexpected buildbot failures on
clang-ppc64le-linux, clang-ppc64be-linux, clang-ppc64be-linux-multistage
and clang-ppc64be-linux-lnt.  Failing test ubsan/TestCases/TypeCheck/vptr.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285110 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:17:58 +00:00
Kostya Serebryany
0895ad474e [libFuzzer] when mutating based on CMP traces also try adding +/- 1 to the desired bytes. Add another test for use_cmp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285109 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:15:15 +00:00
Sanjay Patel
20cfefb146 [InstCombine] Ensure that truncated int types are legal.
Fixes the FIXMEs in D25952 and rL285075.

Patch by bryant!

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285108 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:11:47 +00:00
Evandro Menezes
41a1a9b457 [AArch64] Adjust the cost model for Exynos M1.
Modify the maximum jump table size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285106 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 20:05:42 +00:00
Tim Shen
6141ab42f4 [APFloat] Make APFloat an interface class to the internal IEEEFloat. NFC.
Summary:
The intention is to make APFloat an interface class, so that later I can add a second implementation class DoubleAPFloat to correctly implement PPCDoubleDouble semantic. The interface of IEEEFloat is not public, and can be simplified (currently it's exactly the same as the old APFloat), but that belongs to a separate patch.

DoubleAPFloat should look like:
class DoubleAPFloat {
  const fltSemantics *Semantics;
  std::unique_ptr<APFloat> APFloats;  // Two heap-allocated APFloats.
};

There is no functional change, nor public interface change.

Reviewers: hfinkel, chandlerc, iteratee, echristo, kbarton

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285105 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:55:59 +00:00
Evandro Menezes
9d6f1231e9 Add option to specify minimum number of entries for jump tables
Add an option to allow easier experimentation by target maintainers with the
minimum number of entries to create jump tables.  Also clarify the name of
the other existing option governing the creation of jump tables.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285104 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:53:51 +00:00
Vedant Kumar
1fc13ff445 [llvm-cov] Don't use colored output until we know it's supported
CodeCoverageTool::error() depends on CoverageViewOptions::Colors being
initialized. Should fix:

  http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/56

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285103 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:52:57 +00:00
Evandro Menezes
301f71ecd1 Switch lowering: improve partitioning of jump tables
When there's a tie between partitionings of jump tables, consider also cases
that result in no jump tables, but in one or a few cases.  The motivation is
that many contemporary processors typically perform case switches fairly
quickly.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285099 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 19:11:43 +00:00
Matthew Simpson
da24afa31c [LV] Sink scalar operands of predicated instructions
When we predicate an instruction (div, rem, store) we place the instruction in
its own basic block within the vectorized loop. If a predicated instruction has
scalar operands, it's possible to recursively sink these scalar expressions
into the predicated block so that they might avoid execution. This patch sinks
as much scalar computation as possible into predicated blocks. We previously
were able to sink such operands only if they were extractelement instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285097 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 18:59:45 +00:00
Sanjay Patel
5a313363f4 [InstCombine] add tests for missing icmp + shl nuw fold
Patch by bryant!

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285095 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 18:47:56 +00:00
Michael Ilseman
5bd98bf7d6 Add -strip-nonlinetable-debuginfo capability
This adds a new function to DebugInfo.cpp that takes an llvm::Module
as input and removes all debug info metadata that is not directly
needed for line tables, thus effectively stripping all type and
variable information from the module.

The primary motivation for this feature was the bitcode work flow
(cf. http://lists.llvm.org/pipermail/llvm-dev/2016-June/100643.html
for more background). This is not wired up yet, but will be in
subsequent patches.  For testing, the new functionality is exposed to
opt with a -strip-nonlinetable-debuginfo option.

The secondary use-case (and one that works right now!) is as a
reduction pass in bugpoint. I added two new bugpoint options
(-disable-strip-debuginfo and -disable-strip-debug-types) to control
the new features. By default it will first attempt to remove all debug
information, then only the type info, and then proceed to hack at any
remaining MDNodes.

Thanks to Adrian Prantl for stewarding this patch!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285094 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 18:44:13 +00:00
Robert Lougher
e05a7ffa08 Remove debug location from common tail when tail-merging
The branch folding pass tail merges blocks into a common-tail.  However, the
tail retains the debug information from one of the original inputs to the
merge (chosen randomly).  This is a problem for sampled-based PGO, as hits
on the common-tail will be attributed to whichever block was chosen,
irrespective of which path was actually taken to the common-tail.

This patch fixes the issue by nulling the debug location for the common-tail.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285093 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 18:44:07 +00:00
Michael Kuperstein
0e4bd938f4 Fix 80-char violations. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285092 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 18:31:23 +00:00
Vedant Kumar
59b2213d86 [unittests] STLExtrasTest: Remove an MSVC 2013 workaround, NFCI.
Let's see what the bots have to say about this...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285091 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 18:11:17 +00:00
Vedant Kumar
a69463c75b [unittests] Remove an MSVC 2013 workaround, NFCI.
Let's see what the bots have to say about this...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285090 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 17:58:25 +00:00
Nico Weber
c31e4b540a Revert 285087.
The sanitizer-windows bot turned red with:

FAILED: utils/TableGen/CMakeFiles/obj.llvm-tblgen.dir/IntrinsicEmitter.cpp.obj
C:\PROGRA~2\MICROS~1.0\VC\bin\AMD64_~2\cl.exe ... -c
    C:\...\llvm\utils\TableGen\IntrinsicEmitter.cpp
c:\...\llvm\utils\tablegen\intrinsicemitter.cpp(254) :
  fatal error C1001: An internal error has occurred in the compiler.
http://lab.llvm.org:8011/builders/sanitizer-windows/builds/114/steps/build%20clang%20lld/logs/stdio


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285089 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 17:46:29 +00:00
Vedant Kumar
d4998ec16b [llvm-cov] Add support for loading coverage from multiple objects
Differential Revision: https://reviews.llvm.org/D25086

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285088 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 17:40:55 +00:00
Nico Weber
3089ab81dc Try removing an MSVC2010 workaround.
Things seem to build fine locally without this, so let's
see what the bots think.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285087 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 17:35:00 +00:00
Dan Gohman
d29493db4e [WebAssembly] Add immediate fields to call_indirect and memory operators.
call_indirect, grow_memory, and current_memory now have immediate
operands in the 0xd binary encoding.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285085 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:55:52 +00:00
Dehao Chen
f4b759332e Move discriminator assignment to where it is used. (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285084 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:50:27 +00:00
Andrea Di Biagio
da33b856cf [IndVarSimplify][Dwarf] When widening the IV increment, correctly set the debug loc.
When indvars widened an induction variable, the debug location for the loop
increment computation was incorrectly set equal to the debug loc of the loop
latch terminator.

This patch fixes the issue by propagating the correct location from the
original loop increment instruction to the new widened increment.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285083 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:45:17 +00:00
Pavel Labath
515a7235ef Replace TimeValue by TimePoint in LegacyPassManager. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285081 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:20:07 +00:00
Geoff Berry
9511e49eba [EarlyCSE] Make MemorySSA memory dependency check more aggressive.
Now that MemorySSA keeps track of whether MemoryUses are optimized, use
getClobberingMemoryAccess() to check MemoryUse memory dependencies since
it should no longer be so expensive.

This is a follow-up change to https://reviews.llvm.org/D25881

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285080 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:18:47 +00:00
Sanjay Patel
614c32bf11 fix formatting; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285078 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 16:12:31 +00:00
Ulrich Weigand
2677f9fdf7 [SystemZ] Do not use LOC(G) for volatile loads
It is not safe to use LOAD ON CONDITION to implement access to a memory
location marked "volatile", since the architecture leaves it unspecified
whether or not an access happens if the condition is false.

The current code already appears to care about that:
  def LOC  : CondUnaryRSY<"loc",  0xEBF2, nonvolatile_load, GR32, 4>;

Unfortunately, that "nonvolatile_load" operator is simply ignored
by the CondUnaryRSY class, and there was no test to catch it.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285077 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 15:39:15 +00:00
Sanjay Patel
ce0f082662 [InstCombine] add test and code comment to show potentially misguided icmp trunc transform
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285075 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 15:16:39 +00:00
Simon Pilgrim
16ce778275 [X86][SSE] Add support for (V)PMOVSX* constant folding
We already have (V)PMOVZX* combining support, this is the beginning of handling (V)PMOVSX* similarly - other combines in combineVSZext can be generalized in future patches.

This unearthed an interesting bug in that we were generating illegal build vectors on 32-bit targets - it was proving difficult to create a test for it from PMOVZX, but it fired immediately with PMOVSX. I've created a more general form of the existing getConstVector to handle these cases - ideally this should be handled in non-target-specific code but I couldn't find an equivalent.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285072 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 14:29:25 +00:00
Sanjay Patel
618621d3d0 [InstCombine] fix checks for previous commit (r285069)
Accidentally put in the hoped-for checks ahead of the transform!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285070 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 13:30:19 +00:00
Sanjay Patel
d50540f8ea [InstCombine] add tests for bitcast interference with min/max (PR28001)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285069 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 13:27:56 +00:00
Rafael Espindola
4fd12996bc fix warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285064 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 12:28:26 +00:00
Zvi Rackover
3ed32c90ce [DAGCombine] Preserve shuffles when one of the vector operands is constant
Summary:
Do *not* perform combines such as:

    vector_shuffle<4,1,2,3>(build_vector(Ud, C0, C1 C2), scalar_to_vector(X))
    ->
    build_vector(X, C0, C1, C2)

Keeping the shuffle allows lowering the constant build_vector to a materialized
constant vector (such as a vector-load from the constant-pool or some other idiom).

Reviewers: delena, igorb, spatel, mkuper, andreadb, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285063 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 12:14:19 +00:00
Rafael Espindola
050bf6c22b Make the LTO comdat api more symbol table friendly.
In an IR symbol table I would expect the comdats to be represented as:

- A table of strings, one for each comdat name.
- Each symbol has an optional index into that table.

The natural api for accessing that would be

InputFile:
ArrayRef<StringRef> getComdatTable() const;

Symbol:
int getComdatIndex() const;

This patch implements an API as close to that as possible.  The
implementation on top of the current IRObjectFile is a bit hackish,
but should map just fine over a symbol table and is very convenient to
use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285061 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 12:02:03 +00:00
Benjamin Kramer
797783eda8 Fix an unused warning in WebAssemblyInstPrinter with NDEBUG.
Patch by Sam McCall!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285055 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 09:08:50 +00:00
Craig Topper
53bf46f680 [AVX-512] Add support for creating SIGN_EXTEND_VECTOR_INREG and ZERO_EXTEND_VECTOR_INREG for 512-bit vectors to support vpmovzxbq and vpmovsxbq.
Summary: The one tricky thing about this is that the sign/zero_extend_inreg uses v64i8 as an input type which isn't legal without BWI support. Though the vpmovsxbq and vpmovzxbq instructions themselves don't require BWI. To support this we need to add custom lowering for ZERO_EXTEND_VECTOR_INREG with v64i8 input. This can mostly reuse the existing sign extend code with a couple checks for sign extend vs zero extend added.

Reviewers: delena, RKSimon

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285053 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 04:00:29 +00:00
Peter Collingbourne
2c3f1a7cd5 GlobalDCE: Restore a statement accidentally removed in r285048.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285052 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 02:57:27 +00:00
Matthias Braun
4e3c65d0e2 MachineInstrBundle: Pass iterators to getBundle(Start|End); NFC
This is a function to go backwards in a block to find the first
instruction in a bundle, so iterator is a more natural choice for
parameter/return rather than a reference to a MachineInstruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285051 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 02:55:17 +00:00
Peter Collingbourne
6ff6048618 IR: Deduplicate getParent() functions on derived classes of GlobalValue into the base class. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285050 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 02:54:08 +00:00
Kostya Serebryany
d2c91bff2f [libFuzzer] simplify the code for use_cmp, also use the position hint when available, add a test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285049 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 02:04:43 +00:00
Peter Collingbourne
598979983f GlobalDCE: Deduplicate code. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285048 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 01:58:26 +00:00
Sanjay Patel
8f808de831 [InstCombine] auto-generate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285046 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 00:44:02 +00:00
Sanjay Patel
5aa57a1a64 [InstCombine] auto-generate checks
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285045 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 00:41:00 +00:00
Dan Gohman
12e2f72b91 [WebAssembly] Reorder load/store operands to match binary encoding.
The p2align operand of a load/store is encoded before the offset
operand; reorder the MachineInstr operands accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285044 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 00:17:11 +00:00
Vedant Kumar
5b5c5e7555 [llvm-cov] Do not print out the filename of the object file
When we load coverage data from multiple objects, we don't have a way to
attribute a source object to a function record. Printing out the object
filename next to the source filename is already not very useful: soon,
it'll actually become misleading. Stop printing out the filename now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285043 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-25 00:08:33 +00:00
Dan Gohman
01b89435ec [WebAssembly] Implement more WebAssembly binary encoding.
This changes locals from being declared by the emitLocal hook in
WebAssemblyTargetStreamer, rather than with an instruction. After exploring
the infastructure in LLVM more, this seems to make more sense since
declaring locals doesn't use an encoded opcode.

This also adds more 0xd opcodes, type encodings, and miscellaneous
binary encoding bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285040 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 23:27:49 +00:00
Matthias Braun
cc928287e4 CodeGen/Passes: Pass MachineFunction as functor arg; NFC
Passing a MachineFunction as argument is more natural and avoids an
unnecessary round-trip through the logic determining the correct
Subtarget because MachineFunction already has a reference anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@285039 91177308-0d34-0410-b5e6-96231b3b80d8
2016-10-24 23:23:02 +00:00