OSDN Git Service

android-x86/external-llvm.git
6 years ago[SelectionDAG] Fix typo in comment. NFC
Craig Topper [Tue, 7 Nov 2017 16:32:31 +0000 (16:32 +0000)]
[SelectionDAG] Fix typo in comment. NFC

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

6 years ago[AArch64][SVE] Asm: Set SVE as unsupported feature for existing scheduler models.
Florian Hahn [Tue, 7 Nov 2017 15:03:11 +0000 (15:03 +0000)]
[AArch64][SVE] Asm: Set SVE as unsupported feature for existing scheduler models.

Patch [4/5] in a series to add assembler/disassembler support for AArch64 SVE unpredicated ADD/SUB instructions.

We add SVE as unsupported feature for CPUs that don't have SVE to prevent errors from scheduler models saying it lacks information for these instructions.

Patch by Sander De Smalen.

Reviewed by: rengolin

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

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

6 years agoReland "Correct dwarf unwind information in function epilogue for X86"
Petar Jovanovic [Tue, 7 Nov 2017 14:40:27 +0000 (14:40 +0000)]
Reland "Correct dwarf unwind information in function epilogue for X86"

Reland r317100 with minor fix regarding ComputeCommonTailLength function in
BranchFolding.cpp. Skipping top CFI instructions block needs to executed on
several more return points in ComputeCommonTailLength().

Original r317100 message:

"Correct dwarf unwind information in function epilogue for X86"

This patch aims to provide correct dwarf unwind information in function
epilogue for X86.

It consists of two parts. The first part inserts CFI instructions that set
appropriate cfa offset and cfa register in emitEpilogue() in
X86FrameLowering. This part is X86 specific.

The second part is platform independent and ensures that:

- CFI instructions do not affect code generation
- Unwind information remains correct when a function is modified by
  different passes. This is done in a late pass by analyzing information
  about cfa offset and cfa register in BBs and inserting additional CFI
  directives where necessary.

Changed CFI instructions so that they:

- are duplicable
- are not counted as instructions when tail duplicating or tail merging
- can be compared as equal

Added CFIInstrInserter pass:

- analyzes each basic block to determine cfa offset and register valid at
  its entry and exit
- verifies that outgoing cfa offset and register of predecessor blocks match
  incoming values of their successors
- inserts additional CFI directives at basic block beginning to correct the
  rule for calculating CFA

Having CFI instructions in function epilogue can cause incorrect CFA
calculation rule for some basic blocks. This can happen if, due to basic
block reordering, or the existence of multiple epilogue blocks, some of the
blocks have wrong cfa offset and register values set by the epilogue block
above them.

CFIInstrInserter is currently run only on X86, but can be used by any target
that implements support for adding CFI instructions in epilogue.

Patch by Violeta Vukobrat.

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

6 years agoSilence MSVC error C2398
Kristof Beyls [Tue, 7 Nov 2017 14:37:01 +0000 (14:37 +0000)]
Silence MSVC error C2398

Reported by http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/6000/steps/build-unified-tree/logs/stdio
The error messages were all similar to:
llvm\unittests\CodeGen\GlobalISel\LegalizerInfoTest.cpp(54): error C2398: Element '1': conversion from '' to 'unsigned int' requires a narrowing conversion

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

6 years ago[SLP] Fix PR35047: Fix default cost model for cast op in X86.
Alexey Bataev [Tue, 7 Nov 2017 14:23:44 +0000 (14:23 +0000)]
[SLP] Fix PR35047: Fix default cost model for cast op in X86.

Summary:
The cost calculation for default case on X86 target does not always
follow correct wayt because of missing 4-th argument in
`BaseT::getCastInstrCost()` call. Added this missing parameter.

Reviewers: hfinkel, mkuper, RKSimon, spatel

Subscribers: llvm-commits

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

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

6 years agoMark intentional fall-through with LLVM_FALLTHROUGH.
Kristof Beyls [Tue, 7 Nov 2017 13:31:52 +0000 (13:31 +0000)]
Mark intentional fall-through with LLVM_FALLTHROUGH.

... to silence gcc 7's default -Wimplicit-fallthrough.

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

6 years agoAdd a -D flag to FileCheck to define variables
Alexander Richardson [Tue, 7 Nov 2017 13:24:44 +0000 (13:24 +0000)]
Add a -D flag to FileCheck to define variables

Summary:
This makes it very easy to test files that only differ in a constant
value somewhere in the test case.

Reviewers: jlebar, hfinkel, chandlerc, probinson

Reviewed By: probinson

Subscribers: probinson, llvm-commits

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

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

6 years ago[X86] Regenerate select tests
Simon Pilgrim [Tue, 7 Nov 2017 13:21:02 +0000 (13:21 +0000)]
[X86] Regenerate select tests

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

6 years ago[AArch64][SVE] Asm: Replace 'IsVector' by 'RegKind' in AArch64AsmParser (NFC)
Florian Hahn [Tue, 7 Nov 2017 13:07:50 +0000 (13:07 +0000)]
[AArch64][SVE] Asm: Replace 'IsVector' by 'RegKind' in AArch64AsmParser (NFC)

Patch [2/5] in a series to add assembler/disassembler support for AArch64 SVE unpredicated ADD/SUB instructions.

This change is a non functional change that adds RegKind as an alternative to 'isVector' to prepare it for newer types (SVE data vectors and predicate vectors) that will be added in next patches (where the SVE data vector is added as part of this patch set)

Patch by Sander De Smalen.

Reviewed by: rengolin

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

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

6 years agoSilence C4715 warning from MSVC (NFC).
Kristof Beyls [Tue, 7 Nov 2017 11:54:00 +0000 (11:54 +0000)]
Silence C4715 warning from MSVC (NFC).

The warning started triggering after r317560.
This commit silences it in the same way as previously done in a similar
situation, see
http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20140915/236088.html

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

6 years ago[AArch64][SVE] Asm: Extend EnforceVectorSubVectorTypeIs to distinguish Scalable Vectors
Florian Hahn [Tue, 7 Nov 2017 10:43:56 +0000 (10:43 +0000)]
[AArch64][SVE] Asm: Extend EnforceVectorSubVectorTypeIs to distinguish Scalable Vectors

Patch [1/5] in a series to add assembler/disassembler support for AArch64 SVE
unpredicated ADD/SUB instructions.

Patch by Sander De Smalen.

Reviewed by: rengolin

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

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

6 years ago[GlobalISel] Enable legalizing non-power-of-2 sized types.
Kristof Beyls [Tue, 7 Nov 2017 10:34:34 +0000 (10:34 +0000)]
[GlobalISel] Enable legalizing non-power-of-2 sized types.

This changes the interface of how targets describe how to legalize, see
the below description.

1. Interface for targets to describe how to legalize.

In GlobalISel, the API in the LegalizerInfo class is the main interface
for targets to specify which types are legal for which operations, and
what to do to turn illegal type/operation combinations into legal ones.

For each operation the type sizes that can be legalized without having
to change the size of the type are specified with a call to setAction.
This isn't different to how GlobalISel worked before. For example, for a
target that supports 32 and 64 bit adds natively:

  for (auto Ty : {s32, s64})
    setAction({G_ADD, 0, s32}, Legal);

or for a target that needs a library call for a 32 bit division:

  setAction({G_SDIV, s32}, Libcall);

The main conceptual change to the LegalizerInfo API, is in specifying
how to legalize the type sizes for which a change of size is needed. For
example, in the above example, how to specify how all types from i1 to
i8388607 (apart from s32 and s64 which are legal) need to be legalized
and expressed in terms of operations on the available legal sizes
(again, i32 and i64 in this case). Before, the implementation only
allowed specifying power-of-2-sized types (e.g. setAction({G_ADD, 0,
s128}, NarrowScalar).  A worse limitation was that if you'd wanted to
specify how to legalize all the sized types as allowed by the LLVM-IR
LangRef, i1 to i8388607, you'd have to call setAction 8388607-3 times
and probably would need a lot of memory to store all of these
specifications.

Instead, the legalization actions that need to change the size of the
type are specified now using a "SizeChangeStrategy".  For example:

   setLegalizeScalarToDifferentSizeStrategy(
       G_ADD, 0, widenToLargerAndNarrowToLargest);

This example indicates that for type sizes for which there is a larger
size that can be legalized towards, do it by Widening the size.
For example, G_ADD on s17 will be legalized by first doing WidenScalar
to make it s32, after which it's legal.
The "NarrowToLargest" indicates what to do if there is no larger size
that can be legalized towards. E.g. G_ADD on s92 will be legalized by
doing NarrowScalar to s64.

Another example, taken from the ARM backend is:
   for (unsigned Op : {G_SDIV, G_UDIV}) {
     setLegalizeScalarToDifferentSizeStrategy(Op, 0,
         widenToLargerTypesUnsupportedOtherwise);
     if (ST.hasDivideInARMMode())
       setAction({Op, s32}, Legal);
     else
       setAction({Op, s32}, Libcall);
   }

For this example, G_SDIV on s8, on a target without a divide
instruction, would be legalized by first doing action (WidenScalar,
s32), followed by (Libcall, s32).

The same principle is also followed for when the number of vector lanes
on vector data types need to be changed, e.g.:

   setAction({G_ADD, LLT::vector(8, 8)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(16, 8)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(4, 16)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(8, 16)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(2, 32)}, LegalizerInfo::Legal);
   setAction({G_ADD, LLT::vector(4, 32)}, LegalizerInfo::Legal);
   setLegalizeVectorElementToDifferentSizeStrategy(
       G_ADD, 0, widenToLargerTypesUnsupportedOtherwise);

As currently implemented here, vector types are legalized by first
making the vector element size legal, followed by then making the number
of lanes legal. The strategy to follow in the first step is set by a
call to setLegalizeVectorElementToDifferentSizeStrategy, see example
above.  The strategy followed in the second step
"moreToWiderTypesAndLessToWidest" (see code for its definition),
indicating that vectors are widened to more elements so they map to
natively supported vector widths, or when there isn't a legal wider
vector, split the vector to map it to the widest vector supported.

Therefore, for the above specification, some example legalizations are:
  * getAction({G_ADD, LLT::vector(3, 3)})
    returns {WidenScalar, LLT::vector(3, 8)}
  * getAction({G_ADD, LLT::vector(3, 8)})
    then returns {MoreElements, LLT::vector(8, 8)}
  * getAction({G_ADD, LLT::vector(20, 8)})
    returns {FewerElements, LLT::vector(16, 8)}

2. Key implementation aspects.

How to legalize a specific (operation, type index, size) tuple is
represented by mapping intervals of integers representing a range of
size types to an action to take, e.g.:

       setScalarAction({G_ADD, LLT:scalar(1)},
                       {{1, WidenScalar},  // bit sizes [ 1, 31[
                        {32, Legal},       // bit sizes [32, 33[
                        {33, WidenScalar}, // bit sizes [33, 64[
                        {64, Legal},       // bit sizes [64, 65[
                        {65, NarrowScalar} // bit sizes [65, +inf[
                       });

Please note that most of the code to do the actual lowering of
non-power-of-2 sized types is currently missing, this is just trying to
make it possible for targets to specify what is legal, and how non-legal
types should be legalized.  Probably quite a bit of further work is
needed in the actual legalizing and the other passes in GlobalISel to
support non-power-of-2 sized types.

I hope the documentation in LegalizerInfo.h and the examples provided in the
various {Target}LegalizerInfo.cpp and LegalizerInfoTest.cpp explains well
enough how this is meant to be used.

This drops the need for LLT::{half,double}...Size().

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

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

6 years ago[CGP] Disable Select instruction handling in optimizeMemoryInst. NFC
Serguei Katkov [Tue, 7 Nov 2017 09:43:08 +0000 (09:43 +0000)]
[CGP] Disable Select instruction handling in optimizeMemoryInst. NFC

This patch disables the handling of selects in optimization
extensing scope of optimizeMemoryInst.

The optimization itself is disable by default.
The idea here is just to switch optimiztion level step by step.

Specifically, first optimization will be enabled only for Phi nodes,
then select instructions will be added.

In case someone will complain about perfromance it will be easier to
detect what part of optimizations is responsible for that.

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

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

6 years ago[docs][ARM] Add HowTo for cross compiling and testing compiler-rt builtins
Peter Smith [Tue, 7 Nov 2017 09:40:05 +0000 (09:40 +0000)]
[docs][ARM] Add HowTo for cross compiling and testing compiler-rt builtins

This document contains information on how to cross-compile the compiler-rt
builtins library for several flavours of Arm target and how to test the
libraries using qemu.

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

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

6 years ago[X86] Don't clobber reserved registers with stack adjustments
Bjorn Steinbrink [Tue, 7 Nov 2017 08:50:21 +0000 (08:50 +0000)]
[X86] Don't clobber reserved registers with stack adjustments

Summary:
Calls using invoke in funclet based functions are assumed to clobber
all registers, which causes the stack adjustment using pops to consider
all registers not defined by the call to be undefined, which can
unfortunately include the base pointer, if one is needed.

To prevent this (and possibly other hazards), skip reserved registers
when looking for candidate registers.

This fixes issue #45034 in the Rust compiler.

Reviewers: mkuper

Subscribers: llvm-commits

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

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

6 years ago[X86] Add patterns to fold a 64-bit load into the EVEX vcvtph2ps instructions.
Craig Topper [Tue, 7 Nov 2017 07:13:07 +0000 (07:13 +0000)]
[X86] Add patterns to fold a 64-bit load into the EVEX vcvtph2ps instructions.

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

6 years ago[X86] Add patterns for folding a v16i8 with the VEX vcvtph2ps intrinsics.
Craig Topper [Tue, 7 Nov 2017 07:13:06 +0000 (07:13 +0000)]
[X86] Add patterns for folding a v16i8 with the VEX vcvtph2ps intrinsics.

Disable the peephole pass to prove that the pattern is working.

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

6 years ago[X86] Add a test for a 128-bit vector load feeding a cvtph2ps intrinsic.
Craig Topper [Tue, 7 Nov 2017 07:13:05 +0000 (07:13 +0000)]
[X86] Add a test for a 128-bit vector load feeding a cvtph2ps intrinsic.

The instruction only loads 64-bits, but we should be able to fold a wider load and let it be narrowed.

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

6 years ago[X86] Remove alignment from a load in the f16c intrinsic test. The alignment shouldn...
Craig Topper [Tue, 7 Nov 2017 07:13:04 +0000 (07:13 +0000)]
[X86] Remove alignment from a load in the f16c intrinsic test. The alignment shouldn't be required for load folding.

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

6 years ago[X86] Add support for using EVEX instructions for the legacy vcvtph2ps intrinsics.
Craig Topper [Tue, 7 Nov 2017 07:13:03 +0000 (07:13 +0000)]
[X86] Add support for using EVEX instructions for the legacy vcvtph2ps intrinsics.

Looks like there's some missed load folding opportunities for i64 loads.

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

6 years ago[X86] Add AVX512VL command line to f16c intrinsic test to show missed EVEX opportunit...
Craig Topper [Tue, 7 Nov 2017 07:13:01 +0000 (07:13 +0000)]
[X86] Add AVX512VL command line to f16c intrinsic test to show missed EVEX opportunities for the legacy intrinsics.

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

6 years ago[X86] Use IMPLICIT_DEF in VEX/EVEX vcvtss2sd/vcvtsd2ss patterns instead of a COPY_TO_...
Craig Topper [Tue, 7 Nov 2017 04:44:22 +0000 (04:44 +0000)]
[X86] Use IMPLICIT_DEF in VEX/EVEX vcvtss2sd/vcvtsd2ss patterns instead of a COPY_TO_REGCLASS.

ExeDepsFix pass should take care of making the registers match.

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

6 years ago[X86] Remove 'Requires' from instructions with no patterns. NFC
Craig Topper [Tue, 7 Nov 2017 04:44:21 +0000 (04:44 +0000)]
[X86] Remove 'Requires' from instructions with no patterns. NFC

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

6 years ago[Support/UNIX] posix_fallocate() can fail with EINVAL.
Davide Italiano [Tue, 7 Nov 2017 00:47:04 +0000 (00:47 +0000)]
[Support/UNIX] posix_fallocate() can fail with EINVAL.

According to the docs on opegroup.org, the function can return
EINVAL if:

The len argument is less than zero, or the offset argument is less
than zero, or the underlying file system does not support this
operation.

I'd say it's a peculiar choice (when EONOTSUPP is right there), but
let's keep POSIX happy for now. This was independently discovered
by Mark Millard (on FreeBSD/ZFS).

Quickly ack'ed by Rui on IRC.

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

6 years agoMake DIExpression::createFragmentExpression() return an Optional.
Adrian Prantl [Tue, 7 Nov 2017 00:45:34 +0000 (00:45 +0000)]
Make DIExpression::createFragmentExpression() return an Optional.

We can't safely split arithmetic into multiple fragments because we
can't express carry-over between fragments.

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

6 years ago[XRay] Minimal tool to convert xray traces to Chrome's Trace Event Format.
Keith Wyss [Tue, 7 Nov 2017 00:28:28 +0000 (00:28 +0000)]
[XRay] Minimal tool to convert xray traces to Chrome's Trace Event Format.

Minimal tool to convert xray traces to Chrome's Trace Event Format.

Summary:
Make use of Chrome Trace Event format's Duration events and stack frame dict to
produce Json files that chrome://tracing can visualize from xray function call
traces. Trace Event format is more robust and has several features like
argument logging, function categorization, multi process traces, etc. that we
can add as needed. Duration events cover an important base case.

Part of this change is rearranging the code so that the TrieNode data structure
can be used from multiple tools and can carry parameterized baggage on the
nodes. I put the actual behavior changes in llvm-xray convert exclusively.

Exploring the trace of instrumented llc was pretty nifty if overwhelming.
I can envision this being very useful for analyzing contention scenarios or
tuning parameters like batch sizes in a producer consumer queue. For more
targeted traces likemthis, let's talk about how we want to approach trace
pruning.

Reviewers: dberris, pelikan

Subscribers: llvm-commits

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

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

6 years ago[IPO/LowerTypesTest] Skip blockaddress(es) when replacing uses.
Davide Italiano [Tue, 7 Nov 2017 00:09:25 +0000 (00:09 +0000)]
[IPO/LowerTypesTest] Skip blockaddress(es) when replacing uses.

Blockaddresses refer to the function itself, therefore replacing them
would cause an assertion in doRAUW.

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

This was found when trying CFI on a proprietary kernel by Dmitry Mikulin.

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

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

6 years agoAMDGPU: Remove redundant combine
Matt Arsenault [Tue, 7 Nov 2017 00:06:32 +0000 (00:06 +0000)]
AMDGPU: Remove redundant combine

This combine was already done in two places. The
generic combiner already has done this since
r217610, for adds (with a single use).

This one was added in r303641, and added support for handling
or as well. r313251 later added support to the generic
combine for or. It also turns out the isOrEquivalentToAdd
check is not necessary for this combine.

Additionally, we already reproduce this combine in yet
another place in the backend, although in that version
multiple uses of the add are still folded if it will
allow a fold into the addressing mode. That version needs
to be improved to understand ors though, as well as the
correct legal offsets for private.

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

6 years ago[DebugInfo] Unify logic to merge DILocations. NFC.
Vedant Kumar [Mon, 6 Nov 2017 23:15:21 +0000 (23:15 +0000)]
[DebugInfo] Unify logic to merge DILocations. NFC.

This makes DILocation::getMergedLocation() do what its comment says it
does when merging locations for an Instruction: set the common inlineAt
scope. This simplifies Instruction::applyMergedLocation() a bit.

Testing: check-llvm, check-clang

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

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

6 years ago[Support][Chrono] Use explicit cast of text output of time values.
Simon Dardis [Mon, 6 Nov 2017 23:01:46 +0000 (23:01 +0000)]
[Support][Chrono] Use explicit cast of text output of time values.

rL316419 exposed a platform specific issue where the type of the values
passed to llvm::format could be different to the format string.

Debian unstable for mips uses long long int for std::chrono:duration,
while x86_64 uses long int.

For mips, this resulted in the value being corrupted when rendered to a
string. Address this by explicitly casting the result of the duration_cast
to the type specified in the format string.

Reviewers: sammccall

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

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

6 years agoInstCombine: salvage the debug info of DCE'ed add instructions.
Adrian Prantl [Mon, 6 Nov 2017 22:49:39 +0000 (22:49 +0000)]
InstCombine: salvage the debug info of DCE'ed add instructions.

rdar://problem/31209283

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

6 years ago[X86] Make FeatureAVX512 imply FeatureF16C.
Craig Topper [Mon, 6 Nov 2017 22:49:04 +0000 (22:49 +0000)]
[X86] Make FeatureAVX512 imply FeatureF16C.

The EVEX to VEX pass is already assuming this is true under AVX512VL. We had special patterns to use zmm instructions if VLX and F16C weren't available.

Instead just make AVX512 imply F16C to make the EVEX to VEX behavior explicitly legal and remove the extra patterns.

All known CPUs with AVX512 have F16C so this should safe for now.

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

6 years ago[X86] Make FeatureAVX512 imply FeatureFMA.
Craig Topper [Mon, 6 Nov 2017 22:49:01 +0000 (22:49 +0000)]
[X86] Make FeatureAVX512 imply FeatureFMA.

Previously our VEX patterns were checking Subtarget.hasFMA() which checked FMA || AVX512. So we were behaving as if AVX512 implied it anyway. Which means we'd allow VEX encoded 128/256 FMA when AVX512F was enabled but AVX512VL is off. Regardless of the FMA flag.

EVEX to VEX also transforms scalar EVEX FMA instructions to their VEX versions even without the FMA flag. Similarly for 128/256 under AVX512VL.

So this makes AVX512 imply FeatureFMA to make our current behavior explicit.

All known CPUs that support AVX512 have VEX FMA instructions.

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

6 years ago[ValueTracking] readonly (const) is a requirement for converting sqrt to llvm.sqrt...
Sanjay Patel [Mon, 6 Nov 2017 22:40:09 +0000 (22:40 +0000)]
[ValueTracking] readonly (const) is a requirement for converting sqrt to llvm.sqrt; nnan is not

As discussed in D39204, this is effectively a revert of rL265521 which required nnan
to vectorize sqrt libcalls based on the old LangRef definition of llvm.sqrt. Now that
the definition has been updated so the libcall and intrinsic have the same semantics
apart from potentially setting errno, we can remove the nnan requirement.

We have the right check to know that errno is not set:

if (!ICS.onlyReadsMemory())

...ahead of the switch.

This will solve https://bugs.llvm.org/show_bug.cgi?id=27435 assuming that's being
built for a target with -fno-math-errno.

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

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

6 years agoRevert r317510 "[InstCombine] Pull shifts through a select plus binop with constant"
Hans Wennborg [Mon, 6 Nov 2017 22:28:02 +0000 (22:28 +0000)]
Revert r317510 "[InstCombine] Pull shifts through a select plus binop with constant"

This broke the CodeGen/Hexagon/loop-idiom/pmpy-mod.ll test on a bunch of buildbots.

> This pulls shifts through a select+binop with a constant where the select conditionally executes the binop. We already do this for just the binop, but not with the select.
>
> This can allow us to get the select closer to other selects to enable removing one.
>
> Differential Revision: https://reviews.llvm.org/D39222
>
> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317510 91177308-0d34-0410-b5e6-96231b3b80d8

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

6 years agoRevert r316064 "Fix the incorrect detection of ICONV_LIBRARY_PATH"
Hans Wennborg [Mon, 6 Nov 2017 22:17:23 +0000 (22:17 +0000)]
Revert r316064 "Fix the incorrect detection of ICONV_LIBRARY_PATH"

This broke the use of libxml2 on machines where iconv() is provided by libc.
I'll follow up on the mailing list to discuss how to fix this properly.

> This is introduced in rL308711.
> Check for c library is incorrect here just because libc will be found always
> and it does not mean that iconv is presented.
>
> Thank to Andrew Krasny for narrowing down the root cause.
>
> Reviewers: ecbeckmann
> Reviewed By: ecbeckmann
> Subscribers: mgorny, llvm-commits
> Differential Revision: https://reviews.llvm.org/D38875

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

6 years agoFix comment /NFC
Xinliang David Li [Mon, 6 Nov 2017 21:57:51 +0000 (21:57 +0000)]
Fix comment /NFC

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

6 years ago[MIRPrinter] Use %subreg.xxx syntax for subregister index operands
Bjorn Pettersson [Mon, 6 Nov 2017 21:46:06 +0000 (21:46 +0000)]
[MIRPrinter] Use %subreg.xxx syntax for subregister index operands

Summary:
Print %subreg.<subregidxname> instead of just the subregister
index when printing immediate operands corresponding to subreg
indices in INSERT_SUBREG, EXTRACT_SUBREG, SUBREG_TO_REG and
REG_SEQUENCE.

Reviewers: qcolombet, MatzeB

Reviewed By: MatzeB

Subscribers: nhaehnle, javed.absar, llvm-commits

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

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

6 years ago[InstCombine] Pull shifts through a select plus binop with constant
Craig Topper [Mon, 6 Nov 2017 21:07:22 +0000 (21:07 +0000)]
[InstCombine] Pull shifts through a select plus binop with constant

This pulls shifts through a select+binop with a constant where the select conditionally executes the binop. We already do this for just the binop, but not with the select.

This can allow us to get the select closer to other selects to enable removing one.

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

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

6 years agoupdate_mir_test_checks: Be careful about replacing entire vregs
Justin Bogner [Mon, 6 Nov 2017 21:06:09 +0000 (21:06 +0000)]
update_mir_test_checks: Be careful about replacing entire vregs

Previously, this could end up replacing a vreg like %14 with
[[VREG1]]4, where VREG1 was the match for %1. That's obviously not
correct, though it hasn't actually come up in any tests I've converted
so far.

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

6 years agoFix buildbot breakages from r317503. Add parentheses to assignment when using result...
Graham Yiu [Mon, 6 Nov 2017 21:04:19 +0000 (21:04 +0000)]
Fix buildbot breakages from r317503.  Add parentheses to assignment when using result as a condition.

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

6 years agoAdds code to PPC ISEL lowering to recognize byte inserts from vector_shuffles, and...
Graham Yiu [Mon, 6 Nov 2017 20:18:30 +0000 (20:18 +0000)]
Adds code to PPC ISEL lowering to recognize byte inserts from vector_shuffles, and use P9 shift and vector insert byte instructions instead of vperm. Extends tests from vector insert half-word.

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

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

6 years agoInclude already promoted counts when computing SUM for VP.
Dehao Chen [Mon, 6 Nov 2017 19:52:49 +0000 (19:52 +0000)]
Include already promoted counts when computing SUM for VP.

Summary: When computing the SUM for indirect call promotion, if the callsite is already promoted in the profile, it will be promoted before ICP. In the current implementation, ICP only sees remaining counts in SUM. This may cause extra indirect call targets being promoted. This patch updates the SUM to include the counts already promoted earlier. This way we do not end up promoting too many indirect call targets.

Reviewers: tejohnson

Reviewed By: tejohnson

Subscribers: llvm-commits, sanjoy

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

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

6 years ago[cfi-verify] Added a simple check that stops division-by-zero error when no indirect...
Mitch Phillips [Mon, 6 Nov 2017 19:14:09 +0000 (19:14 +0000)]
[cfi-verify] Added a simple check that stops division-by-zero error when no indirect CF instructions are found in the provided file.

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

6 years ago[PPC] Use xxbrd to speed up bswap64
Guozhi Wei [Mon, 6 Nov 2017 19:09:38 +0000 (19:09 +0000)]
[PPC] Use xxbrd to speed up bswap64

Power doesn't have bswap instructions, so llvm generates following code sequence for bswap64.

  rotldi   5, 3, 16
  rotldi   4, 3, 8
  rotldi   9, 3, 24
  rotldi   10, 3, 32
  rotldi   11, 3, 48
  rotldi   12, 3, 56
  rldimi 4, 5, 8, 48
  rldimi 4, 9, 16, 40
  rldimi 4, 10, 24, 32
  rldimi 4, 11, 40, 16
  rldimi 4, 12, 48, 8
  rldimi 4, 3, 56, 0

But Power9 has vector bswap instructions, they can also be used to speed up scalar bswap intrinsic. With this patch, bswap64 can be translated to:

  mtvsrdd 34, 3, 3
  xxbrd 34, 34
  mfvsrld 3, 34

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

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

6 years agoMake MCAsmBackend and MCCodeEmiiter passed by unique_ptr rval
Mitch Phillips [Mon, 6 Nov 2017 18:56:36 +0000 (18:56 +0000)]
Make MCAsmBackend and MCCodeEmiiter passed by unique_ptr rval

Summary: Fixes build breakage of llvm-mc-assemble-fuzzer introduced by rL315531.

Reviewers: lhames

Subscribers: llvm-commits

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

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

6 years agoAMDGPU: Select v_mad_u64_u32 and v_mad_i64_i32
Matt Arsenault [Mon, 6 Nov 2017 17:04:37 +0000 (17:04 +0000)]
AMDGPU: Select v_mad_u64_u32 and v_mad_i64_i32

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

6 years agoCanonicalize spelling of long-form-options in dsymutil.rst
Adrian Prantl [Mon, 6 Nov 2017 16:52:05 +0000 (16:52 +0000)]
Canonicalize spelling of long-form-options in dsymutil.rst

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

6 years ago[IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' fast-math...
Sanjay Patel [Mon, 6 Nov 2017 16:27:15 +0000 (16:27 +0000)]
[IR] redefine 'UnsafeAlgebra' / 'reassoc' fast-math-flags and add 'trans' fast-math-flag

As discussed on llvm-dev:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/107104.html
and again more recently:
http://lists.llvm.org/pipermail/llvm-dev/2017-October/118118.html

...this is a step in cleaning up our fast-math-flags implementation in IR to better match
the capabilities of both clang's user-visible flags and the backend's flags for SDNode.

As proposed in the above threads, we're replacing the 'UnsafeAlgebra' bit (which had the
'umbrella' meaning that all flags are set) with a new bit that only applies to algebraic
reassociation - 'AllowReassoc'.

We're also adding a bit to allow approximations for library functions called 'ApproxFunc'
(this was initially proposed as 'libm' or similar).

...and we're out of bits. 7 bits ought to be enough for anyone, right? :) FWIW, I did
look at getting this out of SubclassOptionalData via SubclassData (spacious 16-bits),
but that's apparently already used for other purposes. Also, I don't think we can just
add a field to FPMathOperator because Operator is not intended to be instantiated.
We'll defer movement of FMF to another day.

We keep the 'fast' keyword. I thought about removing that, but seeing IR like this:
%f.fast = fadd reassoc nnan ninf nsz arcp contract afn float %op1, %op2
...made me think we want to keep the shortcut synonym.

Finally, this change is binary incompatible with existing IR as seen in the
compatibility tests. This statement:
"Newer releases can ignore features from older releases, but they cannot miscompile
them. For example, if nsw is ever replaced with something else, dropping it would be
a valid way to upgrade the IR."
( http://llvm.org/docs/DeveloperPolicy.html#ir-backwards-compatibility )
...provides the flexibility we want to make this change without requiring a new IR
version. Ie, we're not loosening the FP strictness of existing IR. At worst, we will
fail to optimize some previously 'fast' code because it's no longer recognized as
'fast'. This should get fixed as we audit/squash all of the uses of 'isFast()'.

Note: an inter-dependent clang commit to use the new API name should closely follow
commit.

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

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

6 years ago[X86][SSE] Merge combineExtractVectorElt_SSE into combineExtractVectorElt. NFCI.
Simon Pilgrim [Mon, 6 Nov 2017 15:28:25 +0000 (15:28 +0000)]
[X86][SSE] Merge combineExtractVectorElt_SSE into combineExtractVectorElt. NFCI.

We still early-out for X86ISD::PEXTRW/X86ISD::PEXTRB so no actual change in behaviour, but it'll make it easier to add support in a future patch.

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

6 years ago[SLP] Test for PR35047, NFC.
Alexey Bataev [Mon, 6 Nov 2017 14:52:57 +0000 (14:52 +0000)]
[SLP] Test for PR35047, NFC.

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

6 years ago[X86][SSE] Combine EXTRACT_VECTOR_ELT with combineExtractWithShuffle before XFormVExt...
Simon Pilgrim [Mon, 6 Nov 2017 14:34:19 +0000 (14:34 +0000)]
[X86][SSE] Combine EXTRACT_VECTOR_ELT with combineExtractWithShuffle before XFormVExtractWithShuffleIntoLoad

combineExtractWithShuffle can handle more complex shuffles/bitcasts than we can with the equivalent code in XFormVExtractWithShuffleIntoLoad.

Mainly a compile time improvement now (combineExtractWithShuffle combines will have always failed late on inside XFormVExtractWithShuffleIntoLoad), and will let us merge combineExtractVectorElt_SSE in a future commit.

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

6 years ago[AMDGPU] Change alloca addr space of r600 to 5 for amdgiz environment
Yaxun Liu [Mon, 6 Nov 2017 14:32:33 +0000 (14:32 +0000)]
[AMDGPU] Change alloca addr space of r600 to 5 for amdgiz environment

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

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

6 years ago[SystemZ] implement hasDivRemOp()
Jonas Paulsson [Mon, 6 Nov 2017 13:10:31 +0000 (13:10 +0000)]
[SystemZ]  implement hasDivRemOp()

SystemZ can do division and remainder in a single instruction for scalar
integer types, which are now reflected by returning true in this hook for
those cases.

Review: Ulrich Weigand

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

6 years ago[AMDGPU] Fix assertion due to assuming pointer in default addr space is 32 bit
Yaxun Liu [Mon, 6 Nov 2017 13:01:33 +0000 (13:01 +0000)]
[AMDGPU] Fix assertion due to assuming pointer in default addr space is 32 bit

The backend assumes pointer in default addr space is 32 bit, which is not
true for the new addr space mapping and causes assertion for unresolved
functions.

This patch fixes that.

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

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

6 years ago[mips] Add movep for microMIPS32R6 and fix microMIPS32r3 version
Simon Dardis [Mon, 6 Nov 2017 12:59:53 +0000 (12:59 +0000)]
[mips] Add movep for microMIPS32R6 and fix microMIPS32r3 version

Previously, the 'movep' instruction was defined for microMIPS32r3 and
shared that definition with microMIPS32R6. 'movep' was re-encoded for
microMIPS32r6, so this patch provides the correct encoding.

Secondly, correct the encoding of the 'rs' and 'rt' operands which have
an instruction specific encoding for the registers those operands accept.

Finally, correct the decoding of the 'dst_regs' operand which was extracting
the relevant field from the instruction, but was actually extracting the
field from the alreadly extracted field.

Reviewers: atanasyan

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

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

6 years ago[docs] Update code block for compatibility with Sphinx 1.5.1
Jonas Devlieghere [Mon, 6 Nov 2017 11:47:24 +0000 (11:47 +0000)]
[docs] Update code block for compatibility with Sphinx 1.5.1

It is currently not possible to build the documentation with cmake and
the same version of Sphinx (1.5.1) used to generate the public facing
documentation on llvm.org. When code blocks cannot be parsed by
Pygments, it generates a warning which is treated as an error.

In addition to being annoying and confusing for developers, this
needlessly increases the bar for newcomers that want to get involved.

This patch removes the language specifier from the affected block. The
result is the same as when parsing fails: the block are not highlighted.

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

6 years ago[LV][X86] update the cost of interleaving mem. access of floats
Mohammed Agabaria [Mon, 6 Nov 2017 10:56:20 +0000 (10:56 +0000)]
[LV][X86] update the cost of interleaving mem. access of floats

Recommit:
This patch contains update of the costs of interleaved loads of v8f32 of stride 3 and 8.
fixed the location of the lit test it works with make check-all.

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

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

6 years ago[mips] Fix PR35140
Simon Dardis [Mon, 6 Nov 2017 10:50:04 +0000 (10:50 +0000)]
[mips] Fix PR35140

Mark all symbols involved with TLS relocations as being TLS symbols.

This resolves PR35140.

Thanks to Alex Crichton for reporting the issue!

Reviewers: atanasyan

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

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

6 years agoFixed dead links in WritingAnLLVMPass.rst
Raphael Isemann [Mon, 6 Nov 2017 09:51:39 +0000 (09:51 +0000)]
Fixed dead links in WritingAnLLVMPass.rst

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

6 years ago[X86][AVX512] Improve lowering of AVX512 test intrinsics
Uriel Korach [Mon, 6 Nov 2017 09:22:38 +0000 (09:22 +0000)]
[X86][AVX512] Improve lowering of AVX512 test intrinsics

Added TESTM and TESTNM to the list of instructions that already zeroing unused upper bits
and does not need the redundant shift left and shift right instructions afterwards.
Added a pattern for TESTM and TESTNM in iselLowering, so now icmp(neq,and(X,Y), 0) goes folds into TESTM
and icmp(eq,and(X,Y), 0) goes folds into TESTNM
This commit is a preparation for lowering the test and testn X86 intrinsics to IR.

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

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

6 years ago[X86] Replace duplicate function call with variable. NFC
Uriel Korach [Mon, 6 Nov 2017 08:32:45 +0000 (08:32 +0000)]
[X86] Replace duplicate function call with variable. NFC

Change from:
if (N->getOperand(0).getValueType() == MVT::v8i32 ||
    N->getOperand(0).getValueType() == MVT::v8f32)

to:
EVT OpVT = N->getOperand(0).getValueType();
if (OpVT == MVT::v8i32 || OpVT == MVT::v8f32)

Change-Id: I5a105f8710b73a828e6cfcd55fac2eae6153ce25

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

6 years agoX86 ISel: Basic support for variable-index vector permutations
Zvi Rackover [Mon, 6 Nov 2017 08:25:46 +0000 (08:25 +0000)]
X86 ISel: Basic support for variable-index vector permutations

Summary:
Try to lower a BUILD_VECTOR composed of extract-extract chains that can be
reasoned to be a permutation of a vector by indices in a non-constant vector.

We saw this pattern created by ISPC, which resolts to creating it due to the
requirement that shufflevector's mask operand be a *constant* vector.
I didn't check this but we could possibly use this pattern for lowering the X86 permute
C-instrinsics instead of llvm.x86 instrinsics.

This change can be followed by more improvements:
1. Handle vectors with undef elements.
2. Utilize pshufb and zero-mask-blending to support more effiecient
   construction of vectors with constant-0 elements.
3. Use smaller-element vectors of same width, and "interpolate" the indices,
   when no native operation available.

Reviewers: RKSimon, craig.topper

Reviewed By: RKSimon

Subscribers: chandlerc, DavidKreitzer

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

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

6 years agoRevert "adding a pattern for broadcastm"
Jina Nahias [Mon, 6 Nov 2017 07:48:58 +0000 (07:48 +0000)]
Revert "adding a pattern for broadcastm"

This reverts commit r317457.

Change-Id: If07f1fca1e3453d16c1dac906e87768661384e91

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

6 years ago[test] Add test files that were missed from SVN r317459
Martin Storsjo [Mon, 6 Nov 2017 07:36:17 +0000 (07:36 +0000)]
[test] Add test files that were missed from SVN r317459

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

6 years ago[ObjectYAML] Map relocation types for COFF ARMNT and ARM64
Martin Storsjo [Mon, 6 Nov 2017 07:20:58 +0000 (07:20 +0000)]
[ObjectYAML] Map relocation types for COFF ARMNT and ARM64

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

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

6 years ago[x86][AVX512] Lowering Broadcastm intrinsics to LLVM IR
Jina Nahias [Mon, 6 Nov 2017 07:09:24 +0000 (07:09 +0000)]
[x86][AVX512] Lowering Broadcastm intrinsics to LLVM IR

This patch, together with a matching clang patch (https://reviews.llvm.org/D38683), implements the lowering of X86 broadcastm intrinsics to IR.

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

Change-Id: I709ac0b34641095397e994c8ff7e15d1315b3540

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

6 years agoadding a pattern for broadcastm
Jina Nahias [Mon, 6 Nov 2017 07:09:09 +0000 (07:09 +0000)]
adding a pattern for broadcastm

Change-Id: I6551fb13879e098aed74de410e29815cf37d9ab5

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

6 years ago[X86] Use EVEX encoded intrinsics for legacy FMA intrinsics when possible.
Craig Topper [Mon, 6 Nov 2017 05:48:26 +0000 (05:48 +0000)]
[X86] Use EVEX encoded intrinsics for legacy FMA intrinsics when possible.

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

6 years ago[X86] Add scalar FMA ISD nodes without rounding mode. NFC
Craig Topper [Mon, 6 Nov 2017 05:48:25 +0000 (05:48 +0000)]
[X86] Add scalar FMA ISD nodes without rounding mode. NFC

Next step is to use them for the legacy FMA scalar intrinsics as well. This will enable the legacy intrinsics to use EVEX encoded opcodes and the extended registers.

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

6 years ago[X86] Add avx512vl command line to fma-instrinsics-x86.ll
Craig Topper [Mon, 6 Nov 2017 05:48:24 +0000 (05:48 +0000)]
[X86] Add avx512vl command line to fma-instrinsics-x86.ll

Some of these demonstrate a missed EVEX to VEX compression because we aren't prefering EVEX instructions during isel.

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

6 years ago[X86] Simplify command lines on the fma-instrinsics-x86.ll test and add -show-mc...
Craig Topper [Mon, 6 Nov 2017 05:48:23 +0000 (05:48 +0000)]
[X86] Simplify command lines on the fma-instrinsics-x86.ll test and add -show-mc-encoding.

Use feature names instead of CPU names.

A future commit will add avx512vl command lines to demonstrate missed use of EVEX instructions.

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

6 years ago[X86] Use EVEX encoded instructions for legacy scalar sqrt intrinsics.
Craig Topper [Mon, 6 Nov 2017 04:04:01 +0000 (04:04 +0000)]
[X86] Use EVEX encoded instructions for legacy scalar sqrt intrinsics.

Fixes PR35161.

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

6 years ago[PassManager, SimplifyCFG] Revert r316908 and r316869.
David L. Jones [Mon, 6 Nov 2017 00:32:01 +0000 (00:32 +0000)]
[PassManager, SimplifyCFG] Revert r316908 and r316869.

These cause Clang to crash with a segfault. See PR35210 for details.

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

6 years ago[X86] Add missing predicate to a pattern. NFC
Craig Topper [Sun, 5 Nov 2017 21:14:06 +0000 (21:14 +0000)]
[X86] Add missing predicate to a pattern. NFC

Other patterns had higher priority so this wasn't noticed. But we shouldn't be dependent on pattern order.

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

6 years ago[X86] Remove some more RCP and RSQRT patterns from InstrAVX512.td that I missed in...
Craig Topper [Sun, 5 Nov 2017 21:14:05 +0000 (21:14 +0000)]
[X86] Remove some more RCP and RSQRT patterns from InstrAVX512.td that I missed in r317413.

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

6 years ago[X86] Fix outdated comment. NFC
Craig Topper [Sun, 5 Nov 2017 21:14:04 +0000 (21:14 +0000)]
[X86] Fix outdated comment. NFC

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

6 years ago[X86][SSE] Tests for integer min/max horizontal reductions
Simon Pilgrim [Sun, 5 Nov 2017 19:48:24 +0000 (19:48 +0000)]
[X86][SSE] Tests for integer min/max horizontal reductions

Matching patterns that vectorizers should have created for us.

The experimental intrinsics should probably be added as well.

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

6 years ago[LV/LAA] Avoid specializing a loop for stride=1 when this predicate implies a
Dorit Nuzman [Sun, 5 Nov 2017 16:53:15 +0000 (16:53 +0000)]
[LV/LAA] Avoid specializing a loop for stride=1 when this predicate implies a
single-iteration loop

This fixes PR34681. Avoid adding the "Stride == 1" predicate when we know that
Stride >= Trip-Count. Such a predicate will effectively optimize a single
or zero iteration loop, as Trip-Count <= Stride == 1.

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

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

6 years ago[SLPVectorizer] minimize tests and auto-generate full checks; NFC
Sanjay Patel [Sun, 5 Nov 2017 16:11:01 +0000 (16:11 +0000)]
[SLPVectorizer] minimize tests and auto-generate full checks; NFC

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

6 years ago[REVERT][LV][X86] update the cost of interleaving mem. access of floats
Mohammed Agabaria [Sun, 5 Nov 2017 09:36:54 +0000 (09:36 +0000)]
[REVERT][LV][X86] update the cost of interleaving mem. access of floats

reverted my changes will be committed later after fixing the failure
This patch contains update of the costs of interleaved loads of v8f32 of stride 3 and 8.

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

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

6 years ago[LV][X86] update the cost of interleaving mem. access of floats
Mohammed Agabaria [Sun, 5 Nov 2017 09:06:23 +0000 (09:06 +0000)]
[LV][X86] update the cost of interleaving mem. access of floats

This patch contains update of the costs of interleaved loads of v8f32 of stride 3 and 8.

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

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

6 years ago[CGP] Fix the bug found by asan.
Serguei Katkov [Sun, 5 Nov 2017 07:59:02 +0000 (07:59 +0000)]
[CGP] Fix the bug found by asan.

Try to fix the asan failure introduced by r317429.

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

6 years ago[CGP] Extends the scope of optimizeMemoryInst optimization. NFC
Serguei Katkov [Sun, 5 Nov 2017 05:51:44 +0000 (05:51 +0000)]
[CGP] Extends the scope of optimizeMemoryInst optimization. NFC

Commit tests for previous commit.

Reviewers: efriedma, dberlin, mkazantsev, reames, john.brawn
Reviewed By: john.brawn
Subscribers: javed.absar, john.brawn, dneilson, llvm-commits
Differential Revision: https://reviews.llvm.org/D36073

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

6 years ago[CGP] Extends the scope of optimizeMemoryInst optimization
Serguei Katkov [Sun, 5 Nov 2017 05:50:33 +0000 (05:50 +0000)]
[CGP] Extends the scope of optimizeMemoryInst optimization

This is an implementation of PR26223.

Currently optimizeMemoryInst optimization tries to fold address computation
if all possible way to get compute the address are of the form

baseGV + base + scale * Index + offset
where scale and offset are constants and baseGV, base and Index are exactly
the same instructions if defined.

The patch extends this optimization to allow different bases. In this case
it tries to find/build a Phi node merging all possible bases and use this Phi node
as a base for sunk address computation. Also it supports Select instruction on
the way.

The main motivation for this scope extension is GCRelocateInst.
If there is a relocation of derived pointer it will be represented as relocation of base + offset.
Also there will be a Phi node merging address computation for relocated derived pointer
and derived pointer itself. If we have a Phi node merging original base and relocated base
and can fold the address computation of derived pointer then we can potentially reduce
the code size and Phi node for derived pointer. The later can have a positive impact to
register allocator.

Reviewers: efriedma, dberlin, mkazantsev, reames, john.brawn
Reviewed By: john.brawn
Subscribers: javed.absar, john.brawn, dneilson, llvm-commits
Differential Revision: https://reviews.llvm.org/D36073

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

6 years ago[X86][AVX] Regenerate test. NFCI.
Simon Pilgrim [Sat, 4 Nov 2017 21:18:06 +0000 (21:18 +0000)]
[X86][AVX] Regenerate test. NFCI.

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

6 years agoUse code voice for DIBuilder in LLVM C API
Harlan Haskins [Sat, 4 Nov 2017 20:31:20 +0000 (20:31 +0000)]
Use code voice for DIBuilder in LLVM C API

(This is a test commit)

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

6 years agoMove the llvm-tblgen project into the Tablegenning folder on IDEs like Visual Studio...
Aaron Ballman [Sat, 4 Nov 2017 20:07:16 +0000 (20:07 +0000)]
Move the llvm-tblgen project into the Tablegenning folder on IDEs like Visual Studio rather than leave it in the root directory. NFC.

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

6 years agoMove the srpm, ocaml_make_directory, llvm_vcsrevision_h, and llvm-headers projects...
Aaron Ballman [Sat, 4 Nov 2017 19:59:14 +0000 (19:59 +0000)]
Move the srpm, ocaml_make_directory, llvm_vcsrevision_h, and llvm-headers projects into the Misc folder on IDEs like Visual Studio rather than leave them in the root directory. NFC.

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

6 years agoMove the LLVMCFIVerify project into the Libraries folder on IDEs like Visual Studio...
Aaron Ballman [Sat, 4 Nov 2017 19:48:17 +0000 (19:48 +0000)]
Move the LLVMCFIVerify project into the Libraries folder on IDEs like Visual Studio rather than leave it in the root directory. NFC.

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

6 years agoMove these CMake projects into the Tests folder on IDEs like Visual Studio rather...
Aaron Ballman [Sat, 4 Nov 2017 19:39:14 +0000 (19:39 +0000)]
Move these CMake projects into the Tests folder on IDEs like Visual Studio rather than leave it in the root directory. NFC.

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

6 years ago[X86] Don't use RCP14 and RSQRT14 for reciprocal estimations or for legacy SSE rcp...
Craig Topper [Sat, 4 Nov 2017 18:26:41 +0000 (18:26 +0000)]
[X86] Don't use RCP14 and RSQRT14 for reciprocal estimations or for legacy SSE rcp/rsqrt intrinsics when AVX512 features are enabled.

Summary:
AVX512 added RCP14 and RSQRT instructions which improve accuracy over the legacy RCP and RSQRT instruction, but not enough accuracy to remove the need for a Newton Raphson refinement.

Currently we use these new instructions for the legacy packed SSE instrinics, but not the scalar instrinsics. And we use it for fast math optimization of division and reciprocal sqrt.

I think switching the legacy instrinsics maybe surprising to the user since it changes the answer based on which processor you're using regardless of any fastmath settings. It's also weird that we did something different between scalar and packed.

As far at the reciprocal estimation, I think it creates unnecessary deltas in our output behavior (and prevents EVEX->VEX). A little playing around with gcc and icc and godbolt suggest they don't change which instructions they use here.

This patch adds new X86ISD nodes for the RCP14/RSQRT14 and uses those for the new intrinsics. Leaving the old intrinsics to use the old instructions.

Going forward I think our focus should be on
-Supporting 512-bit vectors, which will have to use the RCP14/RSQRT14.
-Using RSQRT28/RCP28 to remove the Newton Raphson step on processors with AVX512ER
-Supporting double precision.

Reviewers: zvi, DavidKreitzer, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

6 years ago[X86] Regenerate a couple more tests that I missed in r317410.
Craig Topper [Sat, 4 Nov 2017 18:26:39 +0000 (18:26 +0000)]
[X86] Regenerate a couple more tests that I missed in r317410.

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

6 years ago[X86] Teach EVEX->VEX pass to turn SHUFI32X4/SHUFF32X4/SHUFI64X/SHUFF64X2 into VPERM2...
Craig Topper [Sat, 4 Nov 2017 18:10:03 +0000 (18:10 +0000)]
[X86] Teach EVEX->VEX pass to turn SHUFI32X4/SHUFF32X4/SHUFI64X/SHUFF64X2 into VPERM2F128/VPERM2I128.

This recovers some of the tests that were changed by r317403.

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

6 years ago[AMDGPU] Remove hardcoded address space value from AMDGPULibFunc
Yaxun Liu [Sat, 4 Nov 2017 17:37:43 +0000 (17:37 +0000)]
[AMDGPU] Remove hardcoded address space value from AMDGPULibFunc

AMDGPULibFunc hardcodes address space values of the old address space mapping,
which causes invalid addrspacecast instructions and undefined functions in
APPSDK sample MonteCarloAsianDP.

This patch fixes that.

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

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

6 years ago[LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.
Sean Fertile [Sat, 4 Nov 2017 17:04:39 +0000 (17:04 +0000)]
[LTO][ThinLTO] Use the linker resolutions to mark global values as dso_local.

Now that we have a way to mark GlobalValues as local we can use the symbol
resolutions that the linker plugin provides as part of lto/thinlto link
step to refine the compilers view on what symbols will end up being local.

Originally commited as r317374, but reverted in r317395 to update some missed
tests.

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

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

6 years agollvm/test/lit.cfg.py: Don't set the feature "llvm-64-bits" if -m32 is specified.
NAKAMURA Takumi [Sat, 4 Nov 2017 06:55:55 +0000 (06:55 +0000)]
llvm/test/lit.cfg.py: Don't set the feature "llvm-64-bits" if -m32 is specified.

FIXME: LLVM_BUILD_32_BITS should modify host_triple.

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

6 years ago[X86] Teach shuffle lowering to use 256-bit SHUF128 when possible.
Craig Topper [Sat, 4 Nov 2017 06:44:47 +0000 (06:44 +0000)]
[X86] Teach shuffle lowering to use 256-bit SHUF128 when possible.

This allows masked operations to be used and allows the register allocator to use YMM16-31 if necessary.

As a follow up I'll look into teaching EVEX->VEX how to turn this back into PERM2X128 if any of the additional features don't work out.

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

6 years agoCMake: Let LLVM_BUILD_32_BITS aware of large file.
NAKAMURA Takumi [Sat, 4 Nov 2017 06:03:29 +0000 (06:03 +0000)]
CMake: Let LLVM_BUILD_32_BITS aware of large file.

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

6 years agollvm/test/Object/archive-SYM64-write.test: Delete large temp files. They are 8GiB...
NAKAMURA Takumi [Sat, 4 Nov 2017 06:00:11 +0000 (06:00 +0000)]
llvm/test/Object/archive-SYM64-write.test: Delete large temp files. They are 8GiB total.

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