OSDN Git Service

android-x86/external-llvm.git
7 years agoDisable wrapping llvm-xray YAML output
Dimitry Andric [Tue, 14 Feb 2017 22:49:49 +0000 (22:49 +0000)]
Disable wrapping llvm-xray YAML output

Summary:
The YAML output produced by llvm-xray is supposed to be wrapped at the
arbitrary default of 70 columns set by `yaml:Output`.  Unfortunately,
the wrapping is rather unpredictable, and can easily go past the set
number of columns, depending on the execution environment.

To make the YAML output environment-independent, disable wrapping
instead.

Reviewers: dberris

Reviewed By: dberris

Subscribers: fhahn, llvm-commits

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

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

7 years agoFix a bug in caller's BFI update code after inlining.
Easwaran Raman [Tue, 14 Feb 2017 22:49:28 +0000 (22:49 +0000)]
Fix a bug in caller's BFI update code after inlining.

Multiple blocks in the callee can be mapped to a single cloned block
since we prune the callee as we clone it. The existing code
iterates over the value map and clones the block frequency (and
eventually scales the frequencies of the cloned blocks). Value map's
iteration is not deterministic and so the cloned block might get the
frequency of any of the original blocks. The fix is to set the max of
the original frequencies to the cloned block. The first block in the
sequence must have this max frequency and, in the call context,
subsequent blocks must have its frequency.

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

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

7 years agoUse "%zd" format specifier for printing number of testcases executed.
Kostya Serebryany [Tue, 14 Feb 2017 22:14:36 +0000 (22:14 +0000)]
Use "%zd" format specifier for printing number of testcases executed.

Summary:
This helps to avoid signed integer overflow after running a fast fuzz target for several hours, e.g.:

<...>
Done -1097903291 runs in 54001 second(s)

Reviewers: kcc

Reviewed By: kcc

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

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

7 years ago[LV] Rename Induction to PrimaryInduction. NFC.
Michael Kuperstein [Tue, 14 Feb 2017 22:14:01 +0000 (22:14 +0000)]
[LV] Rename Induction to PrimaryInduction. NFC.

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

7 years agoWholeProgramDevirt: Change internal vcall data structures to match summary.
Peter Collingbourne [Tue, 14 Feb 2017 22:12:23 +0000 (22:12 +0000)]
WholeProgramDevirt: Change internal vcall data structures to match summary.

Group calls into constant and non-constant arguments up front, and use uint64_t
instead of ConstantInt to represent constant arguments. The goal is to allow
the information from the summary to fit naturally into this data structure in
a future change (specifically, it will be added to CallSiteInfo).

This has two side effects:
- We disallow VCP for constant integer arguments of width >64 bits.
- We remove the restriction that the bitwidth of a vcall's argument and return
  types must match those of the vfunc definitions.
I don't expect either of these to matter in practice. The first case is
uncommon, and the second one will lead to UB (so we can do anything we like).

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

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

7 years ago[mips] Correct mips16 return instructions definitions
Simon Dardis [Tue, 14 Feb 2017 21:53:23 +0000 (21:53 +0000)]
[mips] Correct mips16 return instructions definitions

Correct the definition of MIPS16 instructions that act as return instructions
so that isReturn = 1 as expected.

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

7 years ago[BasicBlockUtils] Use getFirstNonPHIOrDbg to set debugloc for instructions created...
Taewook Oh [Tue, 14 Feb 2017 21:10:40 +0000 (21:10 +0000)]
[BasicBlockUtils] Use getFirstNonPHIOrDbg to set debugloc for instructions created in SplitBlockPredecessors

Summary:
When setting debugloc for instructions created in SplitBlockPredecessors, current implementation copies debugloc from the first-non-phi instruction of the original basic block. However, if the first-non-phi instruction is a call for @llvm.dbg.value, the debugloc of the instruction may point the location outside of the block itself. For the example code of

```
  1 typedef struct _node_t {
  2   struct _node_t *next;
  3 } node_t;
  4
  5 extern node_t *root;
  6
  7 int foo() {
  8   node_t *node, *tmp;
  9   int ret = 0;
 10
 11   node = tmp = root->next;
 12   while (node != root) {
 13     while (node) {
 14       tmp = node;
 15       node = node->next;
 16       ret++;
 17     }
 18   }
 19
 20   return ret;
 21 }
```

, below is the basicblock corresponding to line 12 after Reassociate expressions pass:

```
while.cond:                                       ; preds = %while.cond2, %entry
  %node.0 = phi %struct._node_t* [ %1, %entry ], [ null, %while.cond2 ]
  %ret.0 = phi i32 [ 0, %entry ], [ %ret.1, %while.cond2 ]
  tail call void @llvm.dbg.value(metadata i32 %ret.0, i64 0, metadata !19, metadata !20), !dbg !21
  tail call void @llvm.dbg.value(metadata %struct._node_t* %node.0, i64 0, metadata !11, metadata !20), !dbg !31
  %cmp = icmp eq %struct._node_t* %node.0, %0, !dbg !33
  br i1 %cmp, label %while.end5, label %while.cond2, !dbg !35
```

As you can see, the first-non-phi instruction is a call for @llvm.dbg.value, and the debugloc is

```
!21 = !DILocation(line: 9, column: 7, scope: !6)
```

, which is a definition of 'ret' variable and outside of the scope of the basicblock itself. However, current implementation picks up this debugloc for the instructions created in SplitBlockPredecessors. This patch addresses this problem by picking up debugloc from the first-non-phi-non-dbg instruction.

Reviewers: dblaikie, samsonov, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits

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

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

7 years ago[BranchFolding] Tail common all identical unreachable blocks
Reid Kleckner [Tue, 14 Feb 2017 21:02:24 +0000 (21:02 +0000)]
[BranchFolding] Tail common all identical unreachable blocks

Summary:
Blocks ending in unreachable are typically cold because they end the
program or throw an exception, so merging them with other identical
blocks is usually profitable because it reduces the size of cold code.
MachineBlockPlacement generally does not arrange to fall through to such
blocks, so commoning these blocks will not introduce additional
unconditional branches.

Reviewers: hans, iteratee, haicheng

Subscribers: llvm-commits

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

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

7 years agoGlobalISel: deal with new G_PTR_MASK instruction on AArch64.
Tim Northover [Tue, 14 Feb 2017 20:56:29 +0000 (20:56 +0000)]
GlobalISel: deal with new G_PTR_MASK instruction on AArch64.

It's just an AND-immediate instruction for us, surprisingly simple to select.

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

7 years agoGlobalISel: introduce G_PTR_MASK to simplify alloca handling.
Tim Northover [Tue, 14 Feb 2017 20:56:18 +0000 (20:56 +0000)]
GlobalISel: introduce G_PTR_MASK to simplify alloca handling.

This instruction clears the low bits of a pointer without requiring (possibly
dodgy if pointers aren't ints) conversions to and from an integer. Since (as
far as I'm aware) all masks are statically known, the instruction takes an
immediate operand rather than a register to specify the mask.

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

7 years agoRe-apply "[profiling] Remove dead profile name vars after emitting name data"
Vedant Kumar [Tue, 14 Feb 2017 20:03:48 +0000 (20:03 +0000)]
Re-apply "[profiling] Remove dead profile name vars after emitting name data"

This reverts 295092 (re-applies 295084), with a fix for dangling
references from the array of coverage names passed down from frontends.

I missed this in my initial testing because I only checked test/Profile,
and not test/CoverageMapping as well.

Original commit message:

The profile name variables passed to counter increment intrinsics are dead
after we emit the finalized name data in __llvm_prf_nm. However, we neglect to
erase these name variables. This causes huge size increases in the
__TEXT,__const section as well as slowdowns when linker dead stripping is
disabled. Some affected projects are so massive that they fail to link on
Darwin, because only the small code model is supported.

Fix the issue by throwing away the name constants as soon as we're done with
them.

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

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

7 years agoReformat slightly.
Eric Christopher [Tue, 14 Feb 2017 19:43:50 +0000 (19:43 +0000)]
Reformat slightly.

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

7 years agoReapply r294532, reverted in r294787.
Wolfgang Pieb [Tue, 14 Feb 2017 19:08:45 +0000 (19:08 +0000)]
Reapply r294532, reverted in r294787.

Store instructions can have more than one memory operand as a result
of optimizations that fold different stores into one.
When we identify spill instructions to generate DBG_VALUE instructions
to record the spilling of a variable, we disregard stores with
multiple memory operands for now. We may miss some relevant spills but
the handling is a bit more complex, so we'll do it in a different patch.

This fixes PR31935.

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

7 years agoRevert "[profiling] Remove dead profile name vars after emitting name data"
Vedant Kumar [Tue, 14 Feb 2017 19:08:39 +0000 (19:08 +0000)]
Revert "[profiling] Remove dead profile name vars after emitting name data"

This reverts commit r295084. There is a test failure on:

http://lab.llvm.org:8011/builders/clang-atom-d525-fedora-rel/builds/2620/

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

7 years agoallow migrating away from cmake option for LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING
Bob Wilson [Tue, 14 Feb 2017 19:06:43 +0000 (19:06 +0000)]
allow migrating away from cmake option for LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING

In r288754, Mehdi added a cmake option to disable enforcement of the ABI
breaking checks in the "abi-breaking.h" header. We used that when building
Swift and it works, but I think it will be better to control this with a
preprocessor macro instead of a cmake option. That will let us opt out of
the enforcement more selectively.

This change allows skipping the cmake setting if the existing preprocessor
macro is already defined. My intention here is to make this change and get
Swift to use it, and then after a few weeks, we can remove the cmake option.
I want to stage it like that to be less disruptive. I'm not aware of anyone
else using that cmake option.

Mehdi had some initial concern about the impact of using a preprocessor
macro when building with modules enabled. I don't think that will be a
problem if we set the macro on the command line with a -D option in those
contexts where we need to disable the enforcement of the checks.

https://reviews.llvm.org/D29919

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

7 years ago[Support] Add StringRef::getAsDouble.
Zachary Turner [Tue, 14 Feb 2017 19:06:37 +0000 (19:06 +0000)]
[Support] Add StringRef::getAsDouble.

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

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

7 years ago[profiling] Remove dead profile name vars after emitting name data
Vedant Kumar [Tue, 14 Feb 2017 18:48:48 +0000 (18:48 +0000)]
[profiling] Remove dead profile name vars after emitting name data

The profile name variables passed to counter increment intrinsics are
dead after we emit the finalized name data in __llvm_prf_nm. However, we
neglect to erase these name variables. This causes huge size increases
in the __TEXT,__const section as well as slowdowns when linker dead
stripping is disabled. Some affected projects are so massive that they
fail to link on Darwin, because only the small code model is supported.

Fix the issue by throwing away the name constants as soon as we're done
with them.

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

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

7 years ago[Tablegen] Instrumenting table gen DAGGenISelDAG
Aditya Nandakumar [Tue, 14 Feb 2017 18:32:41 +0000 (18:32 +0000)]
[Tablegen] Instrumenting table gen DAGGenISelDAG

To help assist in debugging ISEL or to prioritize GlobalISel backend
work, this patch adds two more tables to <Target>GenISelDAGISel.inc -
one which contains the patterns that are used during selection and the
other containing include source location of the patterns
Enabled through CMake varialbe LLVM_ENABLE_DAGISEL_COV

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

7 years ago[opt-viewer] For single-process, fall back on map instead of Pool.map
Adam Nemet [Tue, 14 Feb 2017 18:18:58 +0000 (18:18 +0000)]
[opt-viewer] For single-process, fall back on map instead of Pool.map

This allows for nicer backtrace and debugging when -j1 is passed:

  $ opt-viewer.py CMakeFiles/LLVMScalarOpts.dir/LoopVersioningLICM.cpp.opt.yaml html
  Traceback (most recent call last):
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 405, in <module>
      generate_report(pmap, all_remarks, file_remarks, args.source_dir, args.output_dir)
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 362, in generate_report
      pmap(_render_file_bound, file_remarks.items())
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 251, in map
      return self.map_async(func, iterable, chunksize).get()
    File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/multiprocessing/pool.py", line 567, in get
      raise self._value
  Exception: blah

  $ opt-viewer.py -j 1 CMakeFiles/LLVMScalarOpts.dir/LoopVersioningLICM.cpp.opt.yaml html
  Traceback (most recent call last):
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 405, in <module>
      generate_report(pmap, all_remarks, file_remarks, args.source_dir, args.output_dir)
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 362, in generate_report
      pmap(_render_file_bound, file_remarks.items())
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 317, in _render_file
      SourceFileRenderer(source_dir, output_dir, filename).render(remarks)
    File "/org/llvm/utils/opt-viewer/opt-viewer.py", line 168, in __init__
      raise Exception("blah")
  Exception: blah

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

7 years ago[Hexagon] Remove leftover debugging code
Krzysztof Parzyszek [Tue, 14 Feb 2017 17:37:44 +0000 (17:37 +0000)]
[Hexagon] Remove leftover debugging code

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

7 years agoDo not apply redundant LastCallToStaticBonus
Taewook Oh [Tue, 14 Feb 2017 17:30:05 +0000 (17:30 +0000)]
Do not apply redundant LastCallToStaticBonus

Summary:
As written in the comments above, LastCallToStaticBonus is already applied to
the cost if Caller has only one user, so it is redundant to reapply the bonus
here.

If the only user is not a caller, TotalSecondaryCost will not be adjusted
anyway because callerWillBeRemoved is false. If there's no caller at all, we
don't need to care about TotalSecondaryCost because
inliningPreventsSomeOuterInline is false.

Reviewers: chandlerc, eraman

Reviewed By: eraman

Subscribers: haicheng, davidxl, davide, llvm-commits, mehdi_amini

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

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

7 years ago[LazyBFI] Fix typos
Adam Nemet [Tue, 14 Feb 2017 17:21:12 +0000 (17:21 +0000)]
[LazyBFI] Fix typos

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

7 years agoAdd new pass LazyMachineBlockFrequencyInfo
Adam Nemet [Tue, 14 Feb 2017 17:21:09 +0000 (17:21 +0000)]
Add new pass LazyMachineBlockFrequencyInfo

And use it in MachineOptimizationRemarkEmitter.  A test will follow on top of
Justin's changes to enable MachineORE in AsmPrinter.

The approach is similar to the IR-level pass.  It's a bit simpler because BPI
is immutable at the Machine level so we don't need to make that lazy.

Because of this, a new function mapping is introduced (BPIPassTrait::getBPI).
This function extracts BPI from the pass.  In case of the lazy pass, this is
when the calculation of the BFI occurs.  For Machine-level, this is the
identity function.

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

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

7 years ago[LazyBFI] Split out and templatize LazyBlockFrequencyInfo, NFC
Adam Nemet [Tue, 14 Feb 2017 17:21:04 +0000 (17:21 +0000)]
[LazyBFI] Split out and templatize LazyBlockFrequencyInfo, NFC

This will be used by the LazyMachineBFI pass.

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

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

7 years agofix documentation comments for Argument; NFC
Sanjay Patel [Tue, 14 Feb 2017 16:43:49 +0000 (16:43 +0000)]
fix documentation comments for Argument; NFC

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

7 years agoCorrect a typo, s/hosting/hoisting/
Brian Cain [Tue, 14 Feb 2017 16:41:10 +0000 (16:41 +0000)]
Correct a typo, s/hosting/hoisting/

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

7 years agoRemove unused variable.
Diego Novillo [Tue, 14 Feb 2017 16:39:54 +0000 (16:39 +0000)]
Remove unused variable.

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

7 years ago[Support] Add formatv support for StringLiteral
Pavel Labath [Tue, 14 Feb 2017 16:35:56 +0000 (16:35 +0000)]
[Support] Add formatv support for StringLiteral

Summary:
This is achieved by generalizing the expression selecting the StringRef
format_provider. Now, anything that can be converted to a StringRef will
use it's formatter.

Reviewers: zturner

Subscribers: llvm-commits

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

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

7 years agoReapply "[LV] Extend trunc optimization to all IVs with constant integer steps"
Matthew Simpson [Tue, 14 Feb 2017 16:28:32 +0000 (16:28 +0000)]
Reapply "[LV] Extend trunc optimization to all IVs with constant integer steps"

This reapplies commit r294967 with a fix for the execution time regressions
caught by the clang-cmake-aarch64-quick bot. We now extend the truncate
optimization to non-primary induction variables only if the truncate isn't
already free.

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

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

7 years ago[X86][SSE] Allow matchVectorShuffleWithUNPCK to recognise UNDEF inputs
Simon Pilgrim [Tue, 14 Feb 2017 16:22:04 +0000 (16:22 +0000)]
[X86][SSE] Allow matchVectorShuffleWithUNPCK to recognise UNDEF inputs

Add support for specifying an UNPCK input as UNDEF

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

7 years ago[SCEV] Cache results during GetMinTrailingZeros query
Igor Laevsky [Tue, 14 Feb 2017 15:53:12 +0000 (15:53 +0000)]
[SCEV] Cache results during GetMinTrailingZeros query

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

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

7 years ago[X86][SSE] Add shuffle combine tests showing missed opportunities to use UNPCK
Simon Pilgrim [Tue, 14 Feb 2017 15:49:37 +0000 (15:49 +0000)]
[X86][SSE] Add shuffle combine tests showing missed opportunities to use UNPCK

Not correctly using UNDEF or ZERO inputs to combine to UNPCK shuffles

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

7 years ago[X86][SSE] Regenerate intrinsic upgrade tests
Simon Pilgrim [Tue, 14 Feb 2017 15:29:50 +0000 (15:29 +0000)]
[X86][SSE] Regenerate intrinsic upgrade tests

Remove excess semicolons

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

7 years ago[SLP] Fix for PR31879: vectorize repeated scalar ops that don't get put
Alexey Bataev [Tue, 14 Feb 2017 15:20:48 +0000 (15:20 +0000)]
[SLP] Fix for PR31879: vectorize repeated scalar ops that don't get put
back into a vector

Previously the cost of the existing ExtractElement/ExtractValue
instructions was considered as a dead cost only if it was detected that
they have only one use. But these instructions may be considered
dead also if users of the instructions are also going to be vectorized,
like:
```
%x0 = extractelement <2 x float> %x, i32 0
%x1 = extractelement <2 x float> %x, i32 1
%x0x0 = fmul float %x0, %x0
%x1x1 = fmul float %x1, %x1
%add = fadd float %x0x0, %x1x1
```
This can be transformed to
```
%1 = fmul <2 x float> %x, %x
%2 = extractelement <2 x float> %1, i32 0
%3 = extractelement <2 x float> %1, i32 1
%add = fadd float %2, %3
```
because though `%x0` and `%x1` have 2 users each other, these users are
part of the vectorized tree and we can consider these `extractelement`
instructions as dead.

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

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

7 years agoRemoving a redundant assignment
Artyom Skrobov [Tue, 14 Feb 2017 14:44:01 +0000 (14:44 +0000)]
Removing a redundant assignment

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

7 years agoRevert "[AMDGPU] Fix for SIMachineScheduler crash. SI Scheduler should track"
Alexander Timofeev [Tue, 14 Feb 2017 14:29:05 +0000 (14:29 +0000)]
Revert "[AMDGPU] Fix for SIMachineScheduler crash. SI Scheduler should track"

This reverts commit ce06d9cb99298eb844b66e117f5108a06747c907.

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

7 years ago[X86][SSE] Move unary inputs handling inside matchVectorShuffleWithUNPCK.
Simon Pilgrim [Tue, 14 Feb 2017 13:47:17 +0000 (13:47 +0000)]
[X86][SSE] Move unary inputs handling inside matchVectorShuffleWithUNPCK.

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

7 years ago[X86][SSE] Tidyup matchVectorShuffleWithUNPCK helper function call.
Simon Pilgrim [Tue, 14 Feb 2017 12:54:39 +0000 (12:54 +0000)]
[X86][SSE] Tidyup matchVectorShuffleWithUNPCK helper function call.

Don't bother setting the V1/V2 operands again for unary shuffles.

Don't bother legalizing the value type unless the match succeeds.

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

7 years ago[SLP] Additional tests for extractelement cost fix.
Alexey Bataev [Tue, 14 Feb 2017 12:52:05 +0000 (12:52 +0000)]
[SLP] Additional tests for extractelement cost fix.

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

7 years ago[X86][SSE] Test case showing missed PSHUFB target shuffle constant fold opportunity.
Simon Pilgrim [Tue, 14 Feb 2017 11:20:11 +0000 (11:20 +0000)]
[X86][SSE] Test case showing missed PSHUFB target shuffle constant fold opportunity.

It also shows an unnecessary pshufb/broadcast being used - the original pshufb mask only requested the lowest byte.

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

7 years agoRevert "[LoopVectorize] Added address space check when analysing interleaved accesses"
Karl-Johan Karlsson [Tue, 14 Feb 2017 10:06:16 +0000 (10:06 +0000)]
Revert "[LoopVectorize] Added address space check when analysing interleaved accesses"

This reverts r295038. The buildbot clang-with-thin-lto-ubuntu failed.
I'm reverting to investigate.

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

7 years ago[LoopVectorize] Added address space check when analysing interleaved accesses
Karl-Johan Karlsson [Tue, 14 Feb 2017 08:14:06 +0000 (08:14 +0000)]
[LoopVectorize] Added address space check when analysing interleaved accesses

Prevent memory objects of different address spaces to be part of
the same load/store groups when analysing interleaved accesses.

This is fixing pr31900.

Reviewers: HaoLiu, mssimpso, mkuper

Reviewed By: mssimpso, mkuper

Subscribers: llvm-commits, efriedma, mzolotukhin

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

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

7 years agoTest commit permission
Karl-Johan Karlsson [Tue, 14 Feb 2017 07:31:36 +0000 (07:31 +0000)]
Test commit permission

Removing whitespace.

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

7 years agoAdd initializer that was missed in r295009.
Daniel Jasper [Tue, 14 Feb 2017 07:10:03 +0000 (07:10 +0000)]
Add initializer that was missed in r295009.

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

7 years ago[AVX-512] Add PAVGB/PAVGW to load folding tables.
Craig Topper [Tue, 14 Feb 2017 06:54:57 +0000 (06:54 +0000)]
[AVX-512] Add PAVGB/PAVGW to load folding tables.

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

7 years ago[LSR] Pointers with different address spaces are considered incompatible.
Mikael Holmen [Tue, 14 Feb 2017 06:37:42 +0000 (06:37 +0000)]
[LSR] Pointers with different address spaces are considered incompatible.

Summary:
Function isCompatibleIVType is already used as a guard before the call to

 SE.getMinusSCEV(OperExpr, PrevExpr);

in LSRInstance::ChainInstruction. getMinusSCEV requires the expressions
to be of the same type, so we now consider two pointers with different
address spaces to be incompatible, since it is possible that the pointers
in fact have different sizes.

Reviewers: qcolombet, eli.friedman

Reviewed By: qcolombet

Subscribers: nhaehnle, Ka-Ka, llvm-commits, mzolotukhin

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

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

7 years ago[Orc][RPC] Remove lanch policies in favor of async handlers.
Lang Hames [Tue, 14 Feb 2017 05:40:01 +0000 (05:40 +0000)]
[Orc][RPC] Remove lanch policies in favor of async handlers.

Launch policies provided a mechanism for running RPC handlers on a background
thread (unblocking the main RPC receiver thread). Async handlers generalize
this by passing the responder function (the function that sends the RPC return
value) as an argument to the handler. The handler can optionally do its work on
a background thread (the same way launch policies do), but can also (a) can
inspect the call arguments before deciding to run the work on a different
thread, or (b) can use the responder in a subsequent RPC call (e.g. in the
handler of a callAsync), allowing the handler to call back to the originator (or
to a 3rd party) without blocking the listener thread, and without launching a
new thread.

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

7 years ago[RISCV] Fix RV32 datalayout string and ensure initAsmInfo is called
Alex Bradbury [Tue, 14 Feb 2017 05:20:20 +0000 (05:20 +0000)]
[RISCV] Fix RV32 datalayout string and ensure initAsmInfo is called

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

7 years ago[RISCV] Pseudo instructions are isCodeGenOnly, have blank asmstr
Alex Bradbury [Tue, 14 Feb 2017 05:17:23 +0000 (05:17 +0000)]
[RISCV] Pseudo instructions are isCodeGenOnly, have blank asmstr

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

7 years ago[RISCV] Fix unused variable in RISCVMCTargetDesc. NFC
Alex Bradbury [Tue, 14 Feb 2017 05:15:24 +0000 (05:15 +0000)]
[RISCV] Fix unused variable in RISCVMCTargetDesc. NFC

Also, for better uniformity use TargetRegistry::RegisterMCAsmInfo rather than
RegisterMCAsmInfoFn. Again, no functional change.

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

7 years agoThinLTOBitcodeWriter: Write available_externally copies of VCP eligible functions...
Peter Collingbourne [Tue, 14 Feb 2017 03:42:38 +0000 (03:42 +0000)]
ThinLTOBitcodeWriter: Write available_externally copies of VCP eligible functions to merged module.

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

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

7 years ago[ThinLTO] Make a copy of buffer identifier in ThinLTOCodeGenerator
Mehdi Amini [Tue, 14 Feb 2017 02:20:51 +0000 (02:20 +0000)]
[ThinLTO] Make a copy of buffer identifier in ThinLTOCodeGenerator

We can't assume that the `const char *` provided through libLTO has a
lifetime that expands beyond the codegenerator itself.

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

7 years ago[LICM] Make store promotion work in the face of unordered atomics
Philip Reames [Tue, 14 Feb 2017 01:38:31 +0000 (01:38 +0000)]
[LICM] Make store promotion work in the face of unordered atomics

Extend our store promotion code to deal with unordered atomic accesses. Ordered atomics continue to be unhandled.

Most of the change is straight-forward, the only complicated bit is in the reasoning around mixing of atomic and non-atomic memory access. Rather than trying to reason about the complex semantics in these cases, I simply disallowed promotion when both atomic and non-atomic accesses are present. This is conservatively correct.

It seems really tempting to just promote all access to atomics, but the original accesses might have been conditional. Since we can't lower an arbitrary atomic type, it might not be safe to promote all access to atomic. Consider a loop like the following:
while(b) {
  load i128 ...
  if (can lower i128 atomic)
    store atomic i128 ...
  else
    store i128
}

It could be there's no race on the location and thus the code is perfectly well defined even if we can't lower a i128 atomically.

It's not clear we need to be this conservative - arguably the program above is brocken since it can't be lowered unless the branch is folded - but I didn't want to have to fix any fallout which might result.

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

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

7 years agoUndef MemoryFence, which is defined to _mm_mfence by winnt.h
Reid Kleckner [Tue, 14 Feb 2017 01:38:14 +0000 (01:38 +0000)]
Undef MemoryFence, which is defined to _mm_mfence by winnt.h

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

7 years agoUse std::call_once on Windows
Reid Kleckner [Tue, 14 Feb 2017 01:21:39 +0000 (01:21 +0000)]
Use std::call_once on Windows

Previously we could not use it because std::once_flag's default
constructor was not constexpr. Today, all supported versions of VS
correctly mark it constexpr. I confirmed that MSVC 2015 does not emit
any problematic racy dynamic initialization code, so we should be safe
to use this now.

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

7 years ago[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 14 Feb 2017 00:33:36 +0000 (00:33 +0000)]
[MC] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

Same changes in files affected by reduced MC headers dependencies.

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

7 years agoFunctionAttrs: Factor out a function for querying memory access of a specific copy...
Peter Collingbourne [Tue, 14 Feb 2017 00:28:13 +0000 (00:28 +0000)]
FunctionAttrs: Factor out a function for querying memory access of a specific copy of a function. NFC.

This will later be used by ThinLTOBitcodeWriter to add copies of readnone
functions to the regular LTO module.

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

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

7 years agoSilence redundant semicolon warnings. NFC.
Michael Kuperstein [Mon, 13 Feb 2017 23:42:27 +0000 (23:42 +0000)]
Silence redundant semicolon warnings. NFC.

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

7 years ago[X86] Add MXCSR register
Andrew Kaylor [Mon, 13 Feb 2017 23:38:52 +0000 (23:38 +0000)]
[X86] Add MXCSR register

This adds MXCSR to the set of recognized registers for X86 targets and updates the instructions that read or write it. I do not intend for all of the various floating point instructions that implicitly use the control bits or update the status bits of this register to ever have that usage modeled by default. However, when constrained floating point modes (such as strict FP exception status modeling or dynamic rounding modes) are enabled, implicit use/def information for MXCSR will be added to those instructions.

Until those additional updates are made this should cause (almost?) no functional changes. Theoretically, this will prevent instructions like LDMXCSR and STMXCSR from being moved past one another, but that should be prevented anyway and I haven't found a case where it is happening now.

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

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

7 years ago[LangRef] Explicitly allow readnone and reaodnly functions to unwind
Sanjoy Das [Mon, 13 Feb 2017 23:19:07 +0000 (23:19 +0000)]
[LangRef] Explicitly allow readnone and reaodnly functions to unwind

Summary:
This change edits the language reference to explicitly allow the
existence of readnone and readonly functions that can throw.  Full
discussion at
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108637.html

Reviewers: dberlin, chandlerc, hfinkel, majnemer

Reviewed By: majnemer

Subscribers: majnemer, mcrosier, llvm-commits

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

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

7 years ago[LangRef] Update the TBAA section
Sanjoy Das [Mon, 13 Feb 2017 23:14:03 +0000 (23:14 +0000)]
[LangRef] Update the TBAA section

Summary:
Update the TBAA section to mention the struct path TBAA that LLVM
implements today.  This is not a proposal or change in semantics -- it
is intended only to **document** what LLVM already does today.

This is related to https://reviews.llvm.org/D26438 where I've tried to
implement some of the constraints as verifier checks.

Reviewers: anna, reames, rsmith, chandlerc, hfinkel, rjmccall, mehdi_amini, dexonsmith, manmanren

Reviewed By: manmanren

Subscribers: dberlin, dberris, mcrosier, llvm-commits

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

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

7 years ago[FunctionAttrs] try to extend nonnull-ness of arguments from a callsite back to its...
Sanjay Patel [Mon, 13 Feb 2017 23:10:51 +0000 (23:10 +0000)]
[FunctionAttrs] try to extend nonnull-ness of arguments from a callsite back to its parent function

As discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-December/108182.html
...we should be able to propagate 'nonnull' info from a callsite back to its parent.

The original motivation for this patch is our botched optimization of "dyn_cast" (PR28430),
but this won't solve that problem.

The transform is currently disabled by default while we wait for clang to work-around
potential security problems:
http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html

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

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

7 years agoRevert autogenerated check result for test/CodeGen/X86/atomic-minmax-i6432.ll as...
Amaury Sechet [Mon, 13 Feb 2017 23:00:23 +0000 (23:00 +0000)]
Revert autogenerated check result for test/CodeGen/X86/atomic-minmax-i6432.ll as they don't regenerate cleanly.

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

7 years agoGlobalISel: represent atomic loads & stores via the MachineMemOperand.
Tim Northover [Mon, 13 Feb 2017 22:14:16 +0000 (22:14 +0000)]
GlobalISel: represent atomic loads & stores via the MachineMemOperand.

Also make sure the AArch64 backend doesn't try to convert them into normal
loads and stores.

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

7 years agoMIR: parse & print the atomic parts of a MachineMemOperand.
Tim Northover [Mon, 13 Feb 2017 22:14:08 +0000 (22:14 +0000)]
MIR: parse & print the atomic parts of a MachineMemOperand.

We're going to need them very soon for GlobalISel.

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

7 years ago[CodeGen] Use bitfields instead of manual masks in ArgFlagsTy, NFC
Reid Kleckner [Mon, 13 Feb 2017 21:33:26 +0000 (21:33 +0000)]
[CodeGen] Use bitfields instead of manual masks in ArgFlagsTy, NFC

This revealed that we actually have 8 more unused flag bits, and byval
size doesn't need to be a bitfield at all.

This came up during code review here:
https://reviews.llvm.org/D29668#inline-258469

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

7 years agoAddress post-commit comments for https://reviews.llvm.org/D29596. NFCI.
Taewook Oh [Mon, 13 Feb 2017 21:12:27 +0000 (21:12 +0000)]
Address post-commit comments for https://reviews.llvm.org/D29596. NFCI.

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

7 years agoswiftcc: Don't emit tail calls from callers with swifterror parameters
Arnold Schwaighofer [Mon, 13 Feb 2017 19:58:28 +0000 (19:58 +0000)]
swiftcc: Don't emit tail calls from callers with swifterror parameters

Backends don't support this yet. They would have to move to the swifterror
register before the tail call to make sure it is live-in to the call.

rdar://30495920

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

7 years agoIR: Type ID summary extensions for WPD; thread summary into WPD pass.
Peter Collingbourne [Mon, 13 Feb 2017 19:26:18 +0000 (19:26 +0000)]
IR: Type ID summary extensions for WPD; thread summary into WPD pass.

Make the whole thing testable by adding YAML I/O support for the WPD
summary information and adding some negative tests that exercise the
YAML support.

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

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

7 years ago[SLP] Test for extractelement cost fix.
Alexey Bataev [Mon, 13 Feb 2017 19:08:19 +0000 (19:08 +0000)]
[SLP] Test for extractelement cost fix.

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

7 years agoMake MachineBasicBlock::updateTerminator to update DebugLoc as well
Taewook Oh [Mon, 13 Feb 2017 18:15:31 +0000 (18:15 +0000)]
Make MachineBasicBlock::updateTerminator to update DebugLoc as well

Summary:
Currently MachineBasicBlock::updateTerminator simply drops DebugLoc for newly created branch instructions, which may cause incorrect stepping and/or imprecise sample profile data. Below is an example:

```
  1 extern int bar(int x);
  2
  3 int foo(int *begin, int *end) {
  4   int *i;
  5   int ret = 0;
  6   for (
  7       i = begin ;
  8       i != end ;
  9       i++)
 10   {
 11       ret += bar(*i);
 12   }
 13   return ret;
 14 }
```

Below is a bitcode of 'foo' at the end of LLVM-IR level optimizations with -O3:

```
define i32 @foo(i32* readonly %begin, i32* readnone %end) !dbg !4 {
entry:
  %cmp6 = icmp eq i32* %begin, %end, !dbg !9
  br i1 %cmp6, label %for.end, label %for.body.preheader, !dbg !12

for.body.preheader:                               ; preds = %entry
  br label %for.body, !dbg !13

for.body:                                         ; preds = %for.body.preheader, %for.body
  %ret.08 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
  %i.07 = phi i32* [ %incdec.ptr, %for.body ], [ %begin, %for.body.preheader ]
  %0 = load i32, i32* %i.07, align 4, !dbg !13, !tbaa !15
  %call = tail call i32 @bar(i32 %0), !dbg !19
  %add = add nsw i32 %call, %ret.08, !dbg !20
  %incdec.ptr = getelementptr inbounds i32, i32* %i.07, i64 1, !dbg !21
  %cmp = icmp eq i32* %incdec.ptr, %end, !dbg !9
  br i1 %cmp, label %for.end.loopexit, label %for.body, !dbg !12, !llvm.loop !22

for.end.loopexit:                                 ; preds = %for.body
  br label %for.end, !dbg !24

for.end:                                          ; preds = %for.end.loopexit, %entry
  %ret.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.end.loopexit ]
  ret i32 %ret.0.lcssa, !dbg !24
}
```

where

```
!12 = !DILocation(line: 6, column: 3, scope: !11)
```

. As you can see, the terminator of 'entry' block, which is a loop control branch, has a DebugLoc of line 6, column 3. Howerver, after the execution of 'MachineBlock::updateTerminator' function, which is triggered by MachineSinking pass, the DebugLoc info is dropped as below (see there's no debug-location for JNE_1):

```
  bb.0.entry:
    successors: %bb.4(0x30000000), %bb.1.for.body.preheader(0x50000000)
    liveins: %rdi, %rsi

    %6 = COPY %rsi
    %5 = COPY %rdi
    %8 = SUB64rr %5, %6, implicit-def %eflags, debug-location !9
    JNE_1 %bb.1.for.body.preheader, implicit %eflags
```

This patch addresses this issue and make newly created branch instructions to keep debug-location info.

Reviewers: aprantl, MatzeB, craig.topper, qcolombet

Reviewed By: qcolombet

Subscribers: qcolombet, llvm-commits

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

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

7 years agoRevert "[LV] Extend trunc optimization to all IVs with constant integer steps"
Matthew Simpson [Mon, 13 Feb 2017 18:02:35 +0000 (18:02 +0000)]
Revert "[LV] Extend trunc optimization to all IVs with constant integer steps"

This reverts commit r294967. This patch caused execution time slowdowns in a
few LLVM test-suite tests, as reported by the clang-cmake-aarch64-quick bot.
I'm reverting to investigate.

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

7 years ago[FastISel] Add a diagnostic to warm on fallback.
Quentin Colombet [Mon, 13 Feb 2017 17:38:59 +0000 (17:38 +0000)]
[FastISel] Add a diagnostic to warm on fallback.

This is consistent with what we do for GlobalISel. That way, it is easy
to see whether or not FastISel is able to fully select a function.
At some point we may want to switch that to an optimization remark.

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

7 years ago[ARM] Fix crash caused by r294945
James Molloy [Mon, 13 Feb 2017 17:18:00 +0000 (17:18 +0000)]
[ARM] Fix crash caused by r294945

I'd missed a creator of FCMP nodes - duplicateCmp().

Kindly and promptly reported by Gabor Ballabas, due to his CSiBE test suite.

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

7 years ago[LV] Extend trunc optimization to all IVs with constant integer steps
Matthew Simpson [Mon, 13 Feb 2017 16:48:00 +0000 (16:48 +0000)]
[LV] Extend trunc optimization to all IVs with constant integer steps

This patch extends the optimization of truncations whose operand is an
induction variable with a constant integer step. Previously we were only
applying this optimization to the primary induction variable. However, the cost
model assumes the optimization is applied to the truncation of all integer
induction variables (even regardless of step type). The transformation is now
applied to the other induction variables, and I've updated the cost model to
ensure it is better in sync with the transformation we actually perform.

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

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

7 years ago[mips] Fix failing test.
Simon Dardis [Mon, 13 Feb 2017 16:42:35 +0000 (16:42 +0000)]
[mips] Fix failing test.

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

7 years agofix documentation comments; NFC
Sanjay Patel [Mon, 13 Feb 2017 16:17:29 +0000 (16:17 +0000)]
fix documentation comments; NFC

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

7 years ago[llvm-lto2] Fix typo spotted by Teresa (r294885 post-commit review).
Davide Italiano [Mon, 13 Feb 2017 16:08:36 +0000 (16:08 +0000)]
[llvm-lto2] Fix typo spotted by Teresa (r294885 post-commit review).

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

7 years ago[mips] divide macro instruction cleanup.
Simon Dardis [Mon, 13 Feb 2017 16:06:48 +0000 (16:06 +0000)]
[mips] divide macro instruction cleanup.

Clean up the implementation of divide macro expansion by getting rid of a
FIXME regarding magic numbers and branch instructions. Match GAS' behaviour
for expansion of ddiv / div in the two and three operand cases. Add the two
operand alias for MIPSR6. Finally, optimize macro expansion cases where the
divisior is the $zero register.

Reviewers: slthakur

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

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

7 years agoFix indentation. NFCI.
Simon Pilgrim [Mon, 13 Feb 2017 15:31:08 +0000 (15:31 +0000)]
Fix indentation. NFCI.

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

7 years ago[PM] Hook up the instrumented PGO machinery in the new PM.
Davide Italiano [Mon, 13 Feb 2017 15:26:22 +0000 (15:26 +0000)]
[PM] Hook up the instrumented PGO machinery in the new PM.

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

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

7 years ago[LTO] Make sure we flush buffers to work around linker shenanigans.
Davide Italiano [Mon, 13 Feb 2017 14:39:51 +0000 (14:39 +0000)]
[LTO] Make sure we flush buffers to work around linker shenanigans.

lld, at least, doesn't call global destructors by default (unless
--full-shutdown is passed) because it's, allegedly, expensive.

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

7 years ago[X86][SSE] Add v4f32 and v2f64 extract to store tests
Simon Pilgrim [Mon, 13 Feb 2017 14:20:13 +0000 (14:20 +0000)]
[X86][SSE] Add v4f32 and v2f64 extract to store tests

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

7 years ago[CodeGen] fix alignment of JUMPTABLE_INSTS on v8M.base
Sanne Wouda [Mon, 13 Feb 2017 14:07:45 +0000 (14:07 +0000)]
[CodeGen] fix alignment of JUMPTABLE_INSTS on v8M.base

Summary:
The attached test case fails with "fatal error: error in backend:
misaligned pc-relative fixup value" as the jump table is misaligned.
The EmitAlignment existed already for ARM and Thumb-1 code, but was
missing for Thumb-2.

The test checks that the fatal error disappears when generating an obj
file, as well as checking the align directive is there when producing an
asm file.

Reviewers: rengolin, grosbach, t.p.northover, jmolloy, SjoerdMeijer, samparker

Reviewed By: samparker

Subscribers: samparker, aemerson, llvm-commits

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

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

7 years ago[Thumb-1] TBB generation: spot redefinitions of index register
James Molloy [Mon, 13 Feb 2017 14:07:39 +0000 (14:07 +0000)]
[Thumb-1] TBB generation: spot redefinitions of index register

We match a sequence of 3-4 instructions into a tTBB pseudo. One of our checks is that
a particular register in that sequence is killed (so it can be clobbered by the pseudo).

We weren't noticing if an errant MOV or other instruction had infiltrated the
sequence we were walking. If it had, and it defined the register we've already
identified as killed, it makes it live across the tBR_JT and thus unclobberable.

Notice this case and bail out.

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

7 years ago[ARM] Register ConstantIslands with the pass manager
James Molloy [Mon, 13 Feb 2017 14:07:25 +0000 (14:07 +0000)]
[ARM] Register ConstantIslands with the pass manager

This allows us to use -stop-before/-stop-after/-run-pass - we can now write
.mir tests.

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

7 years ago[Assembler] Improve diagnostics for inline assembly.
Sanne Wouda [Mon, 13 Feb 2017 13:58:00 +0000 (13:58 +0000)]
[Assembler] Improve diagnostics for inline assembly.

Summary:
Keep a vector of LocInfos around; one for each call to EmitInlineAsm.
Since each call to EmitInlineAsm creates a new buffer in the inline asm
SourceMgr, we can use the buffer number to map to the right LocInfo.

Reviewers: rengolin, grosbach, rnk, echristo

Reviewed By: rnk

Subscribers: mehdi_amini, llvm-commits

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

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

7 years ago[X86][SSE] Add more thorough extract to store tests
Simon Pilgrim [Mon, 13 Feb 2017 13:40:12 +0000 (13:40 +0000)]
[X86][SSE] Add more thorough extract to store tests

Added v4i32 and v2i64 tests and test on i686 as well as x86_64.

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

7 years ago[ARM] Use VCMP, not VCMPE, for floating point equality comparisons
James Molloy [Mon, 13 Feb 2017 12:32:47 +0000 (12:32 +0000)]
[ARM] Use VCMP, not VCMPE, for floating point equality comparisons

When generating a floating point comparison we currently unconditionally
generate VCMPE. This has the sideeffect of setting the cumulative Invalid
bit in FPSCR if any of the operands are QNaN.

It is expected that use of a relational predicate on a QNaN value should
raise Invalid. Quoting from the C standard:

  The relational and equality operators support the usual mathematical
  relationships between numeric values. For any ordered pair of numeric
  values exactly one of relationships the less, greater, equal and is true.
  Relational operators may raise the floating-point exception when argument
  values are NaNs.

The standard doesn't explicitly state the expectation for equality operators,
but the implication and obvious expectation is that equality operators
should not raise Invalid on a QNaN input, as those predicates are wholly
defined on unordered inputs (to return not equal).

Therefore, add a new operand to ARMISD::FPCMP and FPCMPZ indicating if
QNaN should raise Invalid, and pipe that through to TableGen.

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

7 years ago[X86][SSE] Create matchVectorShuffleWithUNPCK helper function.
Simon Pilgrim [Mon, 13 Feb 2017 11:52:58 +0000 (11:52 +0000)]
[X86][SSE] Create matchVectorShuffleWithUNPCK helper function.

Currently only used by target shuffle combining - will use it for lowering as well in a future patch.

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

7 years ago[X86] Improve readability of test/CodeGen/X86/lzcnt-zext-cmp.ll by adding a common...
Pierre Gousseau [Mon, 13 Feb 2017 09:57:17 +0000 (09:57 +0000)]
[X86] Improve readability of test/CodeGen/X86/lzcnt-zext-cmp.ll by adding a common check prefix ALL. NFC.

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

7 years ago[X86][AVX512] Fix operand classes for some AVX512 instructions to keep consistency...
Ayman Musa [Mon, 13 Feb 2017 09:55:48 +0000 (09:55 +0000)]
[X86][AVX512] Fix operand classes for some AVX512 instructions to keep consistency between VEX/EVEX versions of the same instruction.

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

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

7 years agoCompile time decreasing in the case we're dealing with Machine Combiner.
Andrew V. Tischenko [Mon, 13 Feb 2017 09:43:37 +0000 (09:43 +0000)]
Compile time decreasing in the case we're dealing with Machine Combiner.
Before this patch compile time was about 21s (see below). After this patch
we have less than 2s (see bellow).

  Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz

    DAGCombiner - trunk
        time ./llc spill_fdiv.ll -o /dev/null -enable-unsafe-fp-math
        real  0m1.685s

    DAGCombiner + Speed patch
        time ./llc spill_fdiv.ll -o /dev/null -enable-unsafe-fp-math
        real  0m1.655s

    MachineCombiner w/o Speed patch
        time ./llc spill_fdiv.ll -o /dev/null -enable-unsafe-fp-math
        real  0m21.614s

    MachineCombiner + Speed patch
        time ./llc spill_fdiv.ll -o /dev/null -enable-unsafe-fp-math
        real  0m1.593s

The test spill_fdiv.ll  is attached to D29627
D29627 should be closed.

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

7 years ago[SLP] Fix for PR31690: Allow using of extra values in horizontal
Alexey Bataev [Mon, 13 Feb 2017 08:01:26 +0000 (08:01 +0000)]
[SLP] Fix for PR31690: Allow using of extra values in horizontal
reductions.

Currently, LLVM supports vectorization of horizontal reduction
instructions with initial value set to 0. Patch supports vectorization
of reduction with non-zero initial values. Also, it supports a
vectorization of instructions with some extra arguments, like:
```
float f(float x[], int a, int b) {
  float p = a % b;
  p += x[0] + 3;
  for (int i = 1; i < 32; i++)
    p += x[i];
  return p;
}
```
Patch allows vectorization of this kind of horizontal reductions.

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

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

7 years ago[DAGCombiner] Teach DAG combine that inserting an extract_subvector result into the...
Craig Topper [Mon, 13 Feb 2017 04:53:33 +0000 (04:53 +0000)]
[DAGCombiner] Teach DAG combine that inserting an extract_subvector result into the same location of a an undef vector can just use the original input to the extract.

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

7 years ago[X86] Genericize the handling of INSERT_SUBVECTOR from an EXTRACT_SUBVECTOR to suppor...
Craig Topper [Mon, 13 Feb 2017 04:53:29 +0000 (04:53 +0000)]
[X86] Genericize the handling of INSERT_SUBVECTOR from an EXTRACT_SUBVECTOR to support 512-bit vectors with 128-bit or 256-bit subvectors.

We now detect that both the extract and insert indices are non-zero and convert to a shuffle. This will be lowered as a blend for 256-bit vectors or as a vshuf operations for 512-bit vectors.

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

7 years ago[DAGCombiner] Remove the half vector width check for the combine of EXTRACT_SUBVECTOR...
Craig Topper [Sun, 12 Feb 2017 23:49:49 +0000 (23:49 +0000)]
[DAGCombiner] Remove the half vector width check for the combine of EXTRACT_SUBVECTOR from an INSERT_SUBVECTOR.

This gives more parallelism opportunities for AVX-512 when dealing with 128-bit extracts from 512-bit vectors.

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

7 years ago[X86] Don't let LowerEXTRACT_SUBVECTOR call getNode for EXTRACT_SUBVECTOR.
Craig Topper [Sun, 12 Feb 2017 23:49:46 +0000 (23:49 +0000)]
[X86] Don't let LowerEXTRACT_SUBVECTOR call getNode for EXTRACT_SUBVECTOR.

This results in the simplifications inside of getNode running while we're legalizing nodes popped off the worklist during the final DAG combine. This basically makes a DAG combine like operation occur during this legalize step, but we don't handle something quite the same way. I think we don't recursively added the removed nodes to the DAG combiner worklist.

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

7 years agoNewGVN: Update a number of xfailed tests to either be correct or note
Daniel Berlin [Sun, 12 Feb 2017 23:28:06 +0000 (23:28 +0000)]
NewGVN: Update a number of xfailed tests to either be correct or note
why they fail.

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

7 years agoNewGVN: We really pass TBAA if we enable DCE and fix the test. Note that GVN eliminat...
Daniel Berlin [Sun, 12 Feb 2017 23:24:47 +0000 (23:24 +0000)]
NewGVN: We really pass TBAA if we enable DCE and fix the test. Note that GVN eliminates no-use readonly/readnone calls, even if they are not marked nounwind. NewGVN only eliminates them if they are marked nounwind, and thus, trivially dead.

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