platform/upstream/llvm.git
6 years ago[X86] Remove unnecessary InstAliases. NFCI
Craig Topper [Sun, 29 Apr 2018 04:06:02 +0000 (04:06 +0000)]
[X86] Remove unnecessary InstAliases. NFCI

These used to disambiguate MOV16ms/MOV16sm from other size instructions that no longer exist.

llvm-svn: 331134

6 years agoAdd -warn-backrefs (r329636) to lld's man page
Ed Maste [Sun, 29 Apr 2018 02:18:48 +0000 (02:18 +0000)]
Add -warn-backrefs (r329636) to lld's man page

llvm-svn: 331133

6 years ago[LLVM-C] Eliminate an unused variable in a test.
whitequark [Sun, 29 Apr 2018 02:01:34 +0000 (02:01 +0000)]
[LLVM-C] Eliminate an unused variable in a test.

This was introduced in r331123 and broke -Werror bots.

llvm-svn: 331132

6 years agoUpdate my email address and description.
Rafael Espindola [Sun, 29 Apr 2018 01:13:57 +0000 (01:13 +0000)]
Update my email address and description.

llvm-svn: 331131

6 years agoRemove keep/take/give from isl C++ bindings
Tobias Grosser [Sun, 29 Apr 2018 00:57:43 +0000 (00:57 +0000)]
Remove keep/take/give from isl C++ bindings

These functions have been legacy leftovers which we used before the
official C++ bindings existed. As all uses of these legacy functions
have been removed, this polly-specific extension can also be dropped.

llvm-svn: 331130

6 years agoRemove another set or release() calls
Tobias Grosser [Sun, 29 Apr 2018 00:57:38 +0000 (00:57 +0000)]
Remove another set or release() calls

llvm-svn: 331129

6 years ago[X86] Use getX86SubSuperRegister in addGR32orGR64Operands in the AsmParser instead...
Craig Topper [Sun, 29 Apr 2018 00:53:10 +0000 (00:53 +0000)]
[X86] Use getX86SubSuperRegister in addGR32orGR64Operands in the AsmParser instead of duplicating its functionality. NFC

llvm-svn: 331128

6 years agos/LLVM_ON_WIN32/_WIN32/, llvm
Nico Weber [Sun, 29 Apr 2018 00:45:03 +0000 (00:45 +0000)]
s/LLVM_ON_WIN32/_WIN32/, llvm

LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the
default macro instead of a reinvented one.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.

This moves over all uses of the macro, but doesn't remove the definition
of it in (llvm-)config.h yet.

llvm-svn: 331127

6 years agoRemove the last uses of isl::give and isl::take
Tobias Grosser [Sun, 29 Apr 2018 00:28:26 +0000 (00:28 +0000)]
Remove the last uses of isl::give and isl::take

llvm-svn: 331126

6 years agoFix one unit test
Tobias Grosser [Sun, 29 Apr 2018 00:28:14 +0000 (00:28 +0000)]
Fix one unit test

llvm-svn: 331125

6 years agoRemove unused includes of clang/Config/config.h
Nico Weber [Sat, 28 Apr 2018 23:48:36 +0000 (23:48 +0000)]
Remove unused includes of clang/Config/config.h

Found by opening config.h.cmake in vim, finding all defined macros with

  /define\(01\)\? \zs[A-Za-z0-9_]*<cr>
  :%s//\=setreg('A', submatch(0), 'V')/gn<cr>
  :put A<cr>

and then joining them all with |, and passing that to

  git grep -E that_pattern 'clang/*.h' 'clang/*.cpp' 'clang/*.c'

and diffing that output with the result of

  git grep Config/config.h 'clang/*.h' 'clang/*.cpp' 'clang/*.c'

No intended behavior change.

llvm-svn: 331124

6 years ago[LLVM-C] Add DIBuilder bindings to create import declarations
Robert Widmann [Sat, 28 Apr 2018 22:32:07 +0000 (22:32 +0000)]
[LLVM-C] Add DIBuilder bindings to create import declarations

Summary: Add bindings to create import declarations for modules, functions, types, and other entities.  This wraps the conveniences available in the existing DIBuilder API, but these seem C++-specific.

Reviewers: whitequark, harlanhaskins, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 331123

6 years ago[DeLICM] Remove uses of isl::give
Tobias Grosser [Sat, 28 Apr 2018 22:11:55 +0000 (22:11 +0000)]
[DeLICM] Remove uses of isl::give

llvm-svn: 331122

6 years ago[ZoneAlgo] Remove uses of isl::give - II
Tobias Grosser [Sat, 28 Apr 2018 22:11:48 +0000 (22:11 +0000)]
[ZoneAlgo] Remove uses of isl::give - II

llvm-svn: 331121

6 years ago[ZoneAlgo] Remove uses of isl::give
Tobias Grosser [Sat, 28 Apr 2018 21:22:17 +0000 (21:22 +0000)]
[ZoneAlgo] Remove uses of isl::give

This moves more of Polly to islpp.

llvm-svn: 331120

6 years ago[islpp] Remove use of isl::give from unittests
Tobias Grosser [Sat, 28 Apr 2018 21:06:14 +0000 (21:06 +0000)]
[islpp] Remove use of isl::give from unittests

We do this mostly by just moving directly to pure C++ code.

llvm-svn: 331119

6 years ago[MaximalStaticExpansion] Replace copied function with version from ISLTools
Tobias Grosser [Sat, 28 Apr 2018 20:42:35 +0000 (20:42 +0000)]
[MaximalStaticExpansion] Replace copied function with version from ISLTools

llvm-svn: 331118

6 years ago[X86] Restrict many of the InstAliases to either to only att or intel syntax. NFCI
Craig Topper [Sat, 28 Apr 2018 18:46:11 +0000 (18:46 +0000)]
[X86] Restrict many of the InstAliases to either to only att or intel syntax. NFCI

Many of these aliases exist to give one syntax or the other a slightly different mnemonic and the other variant gets a duplicate of its normal mnemonic

This patch restricts a lot of these to only one variant so we don't get the duplication.

This removes a lot of duplicate entries from the matcher table. It also reduces the number of warnings printed when you enable the ambiguous match warning in tablegen.

llvm-svn: 331117

6 years ago[X86] Remove unnecessary rotate-carry folded InstRW overrides.
Simon Pilgrim [Sat, 28 Apr 2018 18:45:16 +0000 (18:45 +0000)]
[X86] Remove unnecessary rotate-carry folded InstRW overrides.

Merge some remaining instregex entries.

llvm-svn: 331116

6 years ago[globalisel][legalizerinfo] Introduce dedicated extending loads and add lowerings...
Daniel Sanders [Sat, 28 Apr 2018 18:14:50 +0000 (18:14 +0000)]
[globalisel][legalizerinfo] Introduce dedicated extending loads and add lowerings for them

Summary:
Previously, a extending load was represented at (G_*EXT (G_LOAD x)).
This had a few drawbacks:
* G_LOAD had to be legal for all sizes you could extend from, even if
  registers didn't naturally hold those sizes.
* All sizes you could extend from had to be allocatable just in case the
  extend went missing (e.g. by optimization).
* At minimum, G_*EXT and G_TRUNC had to be legal for these sizes. As we
  improve optimization of extends and truncates, this legality requirement
  would spread without considerable care w.r.t when certain combines were
  permitted.
* The SelectionDAG importer required some ugly and fragile pattern
  rewriting to translate patterns into this style.

This patch begins changing the representation to:
* (G_[SZ]EXTLOAD x)
* (G_LOAD x) any-extends when MMO.getSize() * 8 < ResultTy.getSizeInBits()
which resolves these issues by allowing targets to work entirely in their
native register sizes, and by having a more direct translation from
SelectionDAG patterns.

This patch introduces the new generic instructions and new variation on
G_LOAD and adds lowering for them to convert back to the existing
representations.

Depends on D45466

Reviewers: ab, aditya_nandakumar, bogner, rtereshin, volkan, rovka, aemerson, javed.absar

Reviewed By: aemerson

Subscribers: aemerson, kristof.beyls, javed.absar, llvm-commits

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

llvm-svn: 331115

6 years ago[LLVM-C] Miscellaneous Cleanups in DIBuilder Bindings
Robert Widmann [Sat, 28 Apr 2018 18:13:39 +0000 (18:13 +0000)]
[LLVM-C] Miscellaneous Cleanups in DIBuilder Bindings

Summary:
* rL328953 does not include bindings for LLVMDIBuilderCreateClassType and LLVMDIBuilderCreateBitFieldMemberType despite declaring their prototypes.  Provide these bindings now.
* Switch to more precise types with specific numeric limits matching the DIBuilder's C++ API.

Reviewers: harlanhaskins, whitequark, deadalnix

Reviewed By: whitequark

Subscribers: llvm-commits

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

llvm-svn: 331114

6 years agoUpdate to latest version of the isl c++ bindings
Tobias Grosser [Sat, 28 Apr 2018 16:02:30 +0000 (16:02 +0000)]
Update to latest version of the isl c++ bindings

The delta to the previous version is rather small, but a change in brace
placement makes this a rather noisy commit.

llvm-svn: 331113

6 years ago[InstCombine] Canonicalize variable mask in masked merge
Roman Lebedev [Sat, 28 Apr 2018 15:45:07 +0000 (15:45 +0000)]
[InstCombine] Canonicalize variable mask in masked merge

Summary:
Masked merge has a pattern of: `((x ^ y) & M) ^ y`.
But, there is no difference between `((x ^ y) & M) ^ y` and `((x ^ y) & ~M) ^ x`,
We should canonicalize the pattern to non-inverted mask.

https://rise4fun.com/Alive/Yol

Reviewers: spatel, craig.topper

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 331112

6 years ago[InstCombine][NFC] Add tests for variable mask canonicalization in masked merge
Roman Lebedev [Sat, 28 Apr 2018 15:45:00 +0000 (15:45 +0000)]
[InstCombine][NFC] Add tests for variable mask canonicalization in masked merge

Summary:
Masked merge has a pattern of: `((x ^ y) & M) ^ y`.
But, there is no difference between `((x ^ y) & M) ^ y` and `((x ^ y) & ~M) ^ x`,
We should canonicalize the pattern to non-inverted mask.

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

llvm-svn: 331111

6 years ago[X86] Remove unnecessary shift/rotate folded InstRW overrides.
Simon Pilgrim [Sat, 28 Apr 2018 15:32:19 +0000 (15:32 +0000)]
[X86] Remove unnecessary shift/rotate folded InstRW overrides.

llvm-svn: 331110

6 years ago[llvm-mca][X86] Add double shift resource tests to all relevant models
Simon Pilgrim [Sat, 28 Apr 2018 15:18:49 +0000 (15:18 +0000)]
[llvm-mca][X86] Add double shift resource tests to all relevant models

llvm-svn: 331109

6 years ago[llvm-mca][X86] Add shift/rotate resource tests to all relevant models
Simon Pilgrim [Sat, 28 Apr 2018 14:56:18 +0000 (14:56 +0000)]
[llvm-mca][X86] Add shift/rotate resource tests to all relevant models

I intend to add further instruction tests to the resources-x86_64.s test file as required, but this initial commit is to help remove a load of unnecessary InstRW overrides in a future patch

llvm-svn: 331108

6 years ago[X86][SSE] Stop hard coding some instruction scheduler classes.
Simon Pilgrim [Sat, 28 Apr 2018 14:08:51 +0000 (14:08 +0000)]
[X86][SSE] Stop hard coding some instruction scheduler classes.

Make these arguments to the multiclass to allow easier specialization.

llvm-svn: 331107

6 years ago[X86][HW] Cleanup Haswell model. NFCI.
Simon Pilgrim [Sat, 28 Apr 2018 14:06:28 +0000 (14:06 +0000)]
[X86][HW] Cleanup Haswell model. NFCI.

Moved LAHF/SAHF to instrs instead of instregex.

Removed some unnecessary instregex entries.

llvm-svn: 331106

6 years ago[X86] Remove mayLoad flag from BNDMK/BNDCL/BNDCN/BNDCU.
Craig Topper [Sat, 28 Apr 2018 06:58:27 +0000 (06:58 +0000)]
[X86] Remove mayLoad flag from BNDMK/BNDCL/BNDCN/BNDCU.

The instruction documentation specifically says that these instruction don't access memory.

llvm-svn: 331105

6 years ago[X86] Change memory operand of BNDMK/BNDCL/BNDCU/BNDCN/BNDST to anymem.
Craig Topper [Sat, 28 Apr 2018 06:58:26 +0000 (06:58 +0000)]
[X86] Change memory operand of BNDMK/BNDCL/BNDCU/BNDCN/BNDST to anymem.

These instruction don't use their memory operands as normal memory operands. They're just used as addresses. They don't have a size because they aren't directly representing a load or store.

llvm-svn: 331104

6 years ago[SCEV] Touch the unsused stats variables for product build.
Serguei Katkov [Sat, 28 Apr 2018 06:41:35 +0000 (06:41 +0000)]
[SCEV] Touch the unsused stats variables for product build.

This is a fix by elimination compiler warnings considered as errors.

llvm-svn: 331103

6 years ago[X86] Remove REX.W from 64-bit mode BND instructions.
Craig Topper [Sat, 28 Apr 2018 06:02:40 +0000 (06:02 +0000)]
[X86] Remove REX.W from 64-bit mode BND instructions.

As far as I can tell from the docs, the instructions are automatically 64-bit in 64-bit mode. We don't need REX.W.

llvm-svn: 331102

6 years ago[X86] Rename BNDMOV instructions and hide redundant instruction encoding from the...
Craig Topper [Sat, 28 Apr 2018 06:02:39 +0000 (06:02 +0000)]
[X86] Rename BNDMOV instructions and hide redundant instruction encoding from the assembler.

Favor the 0x1a encoding for register/register move to match gas.

The instructions used RM and MR in their name along with rr/rm/mr at the end. To make more consistent with other instructions remove the RM/MR and use rr/rm/mr/rr_REV.

Hide the _REV encoding from the assembler but leave it for the disassembler.

llvm-svn: 331101

6 years ago[NFC] Add some tests that demonstrate unrecognized three-way comparison patterns
Max Kazantsev [Sat, 28 Apr 2018 04:38:21 +0000 (04:38 +0000)]
[NFC] Add some tests that demonstrate unrecognized three-way comparison patterns

llvm-svn: 331100

6 years ago[SCEV] Reduce the number of invocation to non trivial getExact function
Serguei Katkov [Sat, 28 Apr 2018 03:53:36 +0000 (03:53 +0000)]
[SCEV] Reduce the number of invocation to non trivial getExact function

The invocation of getExact in ScalarEvolution::getBackedgeTakenInfo is used
only for getting statistic and for assert.
Even if statistics is disabled, the code related to it will be eliminated
the invocation to getExact itself will not be eliminated
because it may have side-effects like creation of new SCEVs.

So do invocation only when we collect statistics or executes asserts.

Reviewers: mkazantsev, sanjoy, javed.absar
Reviewed By: javed.absar
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46178

llvm-svn: 331099

6 years ago[ItaniumMangle] Undeduced auto type shouldn't be substitutable.
Erik Pilkington [Sat, 28 Apr 2018 02:40:28 +0000 (02:40 +0000)]
[ItaniumMangle] Undeduced auto type shouldn't be substitutable.

We still support the old mangling if we're trying to be ABI-compatible with
Clang 6.0, though.

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

llvm-svn: 331098

6 years agoMigrate from std::pointer_to_unary_function as it is removed in C++17
Fangrui Song [Sat, 28 Apr 2018 00:12:02 +0000 (00:12 +0000)]
Migrate from std::pointer_to_unary_function as it is removed in C++17

llvm-svn: 331097

6 years ago[analyzer] CStringChecker: Add support for BSD strlcpy() and strlcat().
Artem Dergachev [Fri, 27 Apr 2018 23:50:55 +0000 (23:50 +0000)]
[analyzer] CStringChecker: Add support for BSD strlcpy() and strlcat().

Patch by David Carlier!

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

llvm-svn: 331096

6 years ago[MachineOutliner] Add defs to calls + don't track liveness on outlined functions
Jessica Paquette [Fri, 27 Apr 2018 23:36:35 +0000 (23:36 +0000)]
[MachineOutliner] Add defs to calls + don't track liveness on outlined functions

This commit makes it so that if you outline a def of some register, then the
call instruction created by the outliner actually reflects that the register
is defined by the call. It also makes it so that outlined functions don't
have the TracksLiveness property.

Outlined calls shouldn't break liveness assumptions that someone might make.

This also un-XFAILs the noredzone test, and updates the calls test.

llvm-svn: 331095

6 years ago[LoopGuardWidening] Make PostDomTree optional
Philip Reames [Fri, 27 Apr 2018 23:15:56 +0000 (23:15 +0000)]
[LoopGuardWidening] Make PostDomTree optional

The effect of doing so is not disrupting the LoopPassManager when mixing this pass with other loop passes.  This should help locality of access substaintially and avoids the cost of computing PostDom.

The assumption here is that the full GuardWidening (which does use PostDom) is run as a canonicalization before loop opts and that this version is just catching cases exposed by other loop passes.  (i.e. LoopPredication, IndVarSimplify, LoopUnswitch, etc..)

llvm-svn: 331094

6 years agoFix diag-format test to not care about what cl.exe is on path
Reid Kleckner [Fri, 27 Apr 2018 22:32:21 +0000 (22:32 +0000)]
Fix diag-format test to not care about what cl.exe is on path

llvm-svn: 331093

6 years ago[DAGCombiner] Fix a case of 1 in non-splat vector pow2 divisor
Heejin Ahn [Fri, 27 Apr 2018 22:23:11 +0000 (22:23 +0000)]
[DAGCombiner] Fix a case of 1 in non-splat vector pow2 divisor

Summary:
D42479 (rL329525) enabled SDIV combine for pow2 non-splat vector
dividers. But when there is a 1 in a vector, the instruction sequence to
be generated involves shifting a value by the number of its bit widths,
which is undefined
(https://github.com/llvm-mirror/llvm/blob/c64f4dbfe31e509f9c1092b951e524b056245af8/lib/CodeGen/SelectionDAG/DAGCombiner.cpp#L6000-L6006).

Especially, in architectures that do not support vector instructions,
each of element in a vector will be computed separately using scalar
operations, and then the resulting value will be undef for '1' values
in a vector.

(All 1's vector is fine; only vectors mixed with 1 and others will be
affected.)

Reviewers: RKSimon, jgravelle-google

Subscribers: jfb, dschuff, sbc100, jgravelle-google, llvm-commits

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

llvm-svn: 331092

6 years ago[X86] Make the STTNI flag intrinsics use the flags from pcmpestrm/pcmpistrm if the...
Craig Topper [Fri, 27 Apr 2018 22:15:33 +0000 (22:15 +0000)]
[X86] Make the STTNI flag intrinsics use the flags from pcmpestrm/pcmpistrm if the mask instrinsics are also used in the same basic block.

Summary:
Previously the flag intrinsics always used the index instructions even if a mask instruction also exists.

To fix fix this I've created a single ISD node type that returns index, mask, and flags. The SelectionDAG CSE process will merge all flavors of intrinsics with the same inputs to a s ingle node. Then during isel we just have to look at which results are used to know what instruction to generate. If both mask and index are used we'll need to emit two instructions. But for all other cases we can emit a single instruction.

Since I had to do manual isel anyway, I've removed the pseudo instructions and custom inserter code that was working around tablegen limitations with multiple implicit defs.

I've also renamed the recently added sse42.ll test case to sttni.ll since it focuses on that subset of the sse4.2 instructions.

Reviewers: chandlerc, RKSimon, spatel

Reviewed By: chandlerc

Subscribers: llvm-commits

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

llvm-svn: 331091

6 years agoFix a bug that prevents global variables from having a DW_OP_deref.
Adrian Prantl [Fri, 27 Apr 2018 22:05:31 +0000 (22:05 +0000)]
Fix a bug that prevents global variables from having a DW_OP_deref.

For local variables the first DW_OP_deref is consumed by turning the
location kind into a memeory location, but that only makes sense for
values that are in a register to begin with, which cannot happen for
global variables that are attached to a symbol.

rdar://problem/39741860

This reapplies r330970 after fixing an uncovered bug in r331086 and
working around the situation caused by it.

llvm-svn: 331090

6 years ago[analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.
Artem Dergachev [Fri, 27 Apr 2018 22:00:51 +0000 (22:00 +0000)]
[analyzer] ObjCAutoreleaseWrite: Support a few more APIs and fix warning text.

API list and improved warning text composed by Devin Coughlin.

llvm-svn: 331089

6 years ago[FastISel] Actually enable local value sinking by default
Reid Kleckner [Fri, 27 Apr 2018 21:51:25 +0000 (21:51 +0000)]
[FastISel] Actually enable local value sinking by default

llvm-svn: 331088

6 years ago[FastISel] Fix local value sinking algorithmic complexity
Reid Kleckner [Fri, 27 Apr 2018 21:48:51 +0000 (21:48 +0000)]
[FastISel] Fix local value sinking algorithmic complexity

Now local value sinking only scans and numbers instructions added
between the current flush point and the last flush point. This ensures
that ISel is overall linear in the size of the BB.

Fixes PR37010 and re-enables local value sinking by default.

llvm-svn: 331087

6 years agoFix a bug in GlobalOpt's handling of DIExpressions.
Adrian Prantl [Fri, 27 Apr 2018 21:41:36 +0000 (21:41 +0000)]
Fix a bug in GlobalOpt's handling of DIExpressions.

This patch adds support for fragment expressions
TryToShrinkGlobalToBoolean() which were previously just dropped.

Thanks to Reid Kleckner for providing me a reproducer!

llvm-svn: 331086

6 years ago[PatternMatch] Stabilize the matching order of commutative matchers
Roman Lebedev [Fri, 27 Apr 2018 21:23:20 +0000 (21:23 +0000)]
[PatternMatch] Stabilize the matching order of commutative matchers

Summary:
Currently, we
1. match `LHS` matcher to the `first` operand of binary operator,
2. and then match `RHS` matcher to the `second` operand of binary operator.
If that does not match, we swap the `LHS` and `RHS` matchers:
1. match `RHS` matcher to the `first` operand of binary operator,
2. and then match `LHS` matcher to the `second` operand of binary operator.

This works ok.
But it complicates writing of commutative matchers, where one would like to match
(`m_Value()`) the value on one side, and use (`m_Specific()`) it on the other side.

This is additionally complicated by the fact that `m_Specific()` stores the `Value *`,
not `Value **`, so it won't work at all out of the box.

The last problem is trivially solved by adding a new `m_c_Specific()` that stores the
`Value **`, not `Value *`. I'm choosing to add a new matcher, not change the existing
one because i guess all the current users are ok with existing behavior,
and this additional pointer indirection may have performance drawbacks.
Also, i'm storing pointer, not reference, because for some mysterious-to-me reason
it did not work with the reference.

The first one appears trivial, too.
Currently, we
1. match `LHS` matcher to the `first` operand of binary operator,
2. and then match `RHS` matcher to the `second` operand of binary operator.
If that does not match, we swap the ~~`LHS` and `RHS` matchers~~ **operands**:
1. match ~~`RHS`~~ **`LHS`** matcher to the ~~`first`~~ **`second`** operand of binary operator,
2. and then match ~~`LHS`~~ **`RHS`** matcher to the ~~`second`~ **`first`** operand of binary operator.

Surprisingly, `$ ninja check-llvm` still passes with this.
But i expect the bots will disagree..

The motivational unittest is included.
I'd like to use this in D45664.

Reviewers: spatel, craig.topper, arsenm, RKSimon

Reviewed By: craig.topper

Subscribers: xbolva00, wdng, llvm-commits

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

llvm-svn: 331085

6 years ago[X86] Merge some x87 instruction instregex single matches. NFCI.
Simon Pilgrim [Fri, 27 Apr 2018 21:14:19 +0000 (21:14 +0000)]
[X86] Merge some x87 instruction instregex single matches. NFCI.

llvm-svn: 331084

6 years ago[Reassociate] add a test with debug info; NFC
Sanjay Patel [Fri, 27 Apr 2018 21:14:15 +0000 (21:14 +0000)]
[Reassociate] add a test with debug info; NFC

As suggested in D45842
(although still not sure if we're going to advance that),
we must invalidate references to instructions that have
been recycled (operands were changed, so result is different).

llvm-svn: 331083

6 years agoFix build bots after r331049 broke them.
Greg Clayton [Fri, 27 Apr 2018 21:10:07 +0000 (21:10 +0000)]
Fix build bots after r331049 broke them.

llvm-svn: 331082

6 years agoAttempt to fix remaining build failures after r331071 by changing the tuple to a...
Daniel Sanders [Fri, 27 Apr 2018 21:03:27 +0000 (21:03 +0000)]
Attempt to fix remaining build failures after r331071 by changing the tuple to a struct

Some of the bots were failing in a different way to the others. These were
unable to compare tuples. Fix this by changing to a struct, thereby avoiding
the quirks of tuples.

llvm-svn: 331081

6 years ago[LICM] Reduce nesting with an early return [NFC]
Philip Reames [Fri, 27 Apr 2018 20:58:30 +0000 (20:58 +0000)]
[LICM] Reduce nesting with an early return [NFC]

llvm-svn: 331080

6 years ago[MustExecute/LICM] Special case first instruction in throwing header
Philip Reames [Fri, 27 Apr 2018 20:44:01 +0000 (20:44 +0000)]
[MustExecute/LICM] Special case first instruction in throwing header

We currently have a hard to solve analysis problem around the order of instructions within a potentially throwing block.  We can't cheaply determine whether a given instruction is before the first potential throw in the block.  While we're working on that in the background, special case the first instruction within the header.

why this particular special case?  Well, headers are guaranteed to execute if the loop does, and it turns out we tend to produce this form in practice.

In a follow on patch, I tend to extend LICM with an alternate approach which works for any instruction in the header before the first throw, but this is the best I can come up with other users of the analysis (such as store promotion.)

Note: I can't show the difference in the analysis result since we're ORing in the expensive instruction walk used by SCEV.  Using the full walk is not suitable for a general solution.
llvm-svn: 331079

6 years agoELFObjectWriter: Allow one unique symver per symbol
Vlad Tsyrklevich [Fri, 27 Apr 2018 20:32:34 +0000 (20:32 +0000)]
ELFObjectWriter: Allow one unique symver per symbol

Summary:
Only allow a single unique .symver alias per symbol. This matches the
behavior of gas. I noticed that we ignored multiple mismatched symver
directives looking at https://reviews.llvm.org/D45798

Reviewers: pcc, tejohnson, espindola

Reviewed By: pcc

Subscribers: emaste, arichardson, llvm-commits, kcc

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

llvm-svn: 331078

6 years agoRevert r329698 (and r329702).
Nico Weber [Fri, 27 Apr 2018 20:29:57 +0000 (20:29 +0000)]
Revert r329698 (and r329702).

Speculative. ClangMoveTests started failing on
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9958
after this change. I can't reproduce on my machine, let's see
if it was due to this change.

llvm-svn: 331077

6 years ago[LV] Common duplicate vector load/store address calculation (NFC)
Daniel Neilson [Fri, 27 Apr 2018 20:29:18 +0000 (20:29 +0000)]
[LV] Common duplicate vector load/store address calculation (NFC)

Summary:
Commoning some obviously copy/paste code in
InnerLoopVectorizer::vectorizeMemoryInstruction

llvm-svn: 331076

6 years agoDon't create a temporary DenseMap for each input .eh_frame.
Rafael Espindola [Fri, 27 Apr 2018 20:19:28 +0000 (20:19 +0000)]
Don't create a temporary DenseMap for each input .eh_frame.

These maps are small, but we are creating an destroying one for each
input .eh_frame.

This patch reduces the total memory allocation from 765.54MB to
749.19MB. The peak is still the same: 563.7MB.

llvm-svn: 331075

6 years agoAttempt to fix build failure after r331071 using std::make_tuple
Daniel Sanders [Fri, 27 Apr 2018 20:17:44 +0000 (20:17 +0000)]
Attempt to fix build failure after r331071 using std::make_tuple

llvm-svn: 331074

6 years ago[debugserver] Fix the G packet handling.
Frederic Riss [Fri, 27 Apr 2018 19:59:42 +0000 (19:59 +0000)]
[debugserver] Fix the G packet handling.

Of course r331004 needed a counterpart on the write side.

llvm-svn: 331073

6 years ago[PostRASink] extend the live-in check for all aliased registers
Jun Bum Lim [Fri, 27 Apr 2018 19:59:20 +0000 (19:59 +0000)]
[PostRASink] extend the live-in check for all aliased registers

Extend the live-in check for all aliased registers so that we can
allow sinking Copy instructions when only implicit def is in successor's
live-in.

llvm-svn: 331072

6 years ago[globalisel][legalizerinfo] Add support for legalization based on the MachineMemOperand
Daniel Sanders [Fri, 27 Apr 2018 19:48:53 +0000 (19:48 +0000)]
[globalisel][legalizerinfo] Add support for legalization based on the MachineMemOperand

Summary:
Currently only the memory size is supported but others can be added as
needed.

narrowScalar for G_LOAD and G_STORE now correctly update the
MachineMemOperand and will refuse to legalize atomics since those need more
careful expansions to maintain atomicity.

Reviewers: ab, aditya_nandakumar, bogner, rtereshin, aemerson, javed.absar

Reviewed By: aemerson

Subscribers: aemerson, rovka, kristof.beyls, javed.absar, llvm-commits

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

llvm-svn: 331071

6 years ago[llvm-objcopy] Add --weaken-symbol (-W) option
Paul Semel [Fri, 27 Apr 2018 19:16:27 +0000 (19:16 +0000)]
[llvm-objcopy] Add --weaken-symbol (-W) option

llvm-svn: 331070

6 years agos/LLVM_ON_WIN32/_WIN32/, clang
Nico Weber [Fri, 27 Apr 2018 19:11:14 +0000 (19:11 +0000)]
s/LLVM_ON_WIN32/_WIN32/, clang

LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in
HandleLLVMOptions.cmake, which is where _WIN32 defined too.  Just use the
default macro instead of a reinvented one.

See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev.
No intended behavior change.

llvm-svn: 331069

6 years ago[llvm-objcopy] Add --globalize-symbol option
Paul Semel [Fri, 27 Apr 2018 19:09:44 +0000 (19:09 +0000)]
[llvm-objcopy] Add --globalize-symbol option

llvm-svn: 331068

6 years ago[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier
Ben Hamilton [Fri, 27 Apr 2018 18:51:12 +0000 (18:51 +0000)]
[clang-format/ObjC] Use getIdentifierInfo() instead of tok::identifier

Summary:
Previously, we checked tokens for `tok::identifier` to see if they
were identifiers inside an Objective-C selector.

However, this missed C++ keywords like `new` and `delete`.

To fix this, this diff uses `getIdentifierInfo()` to find
identifiers or keywords inside Objective-C selectors.

Test Plan: New tests added. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

llvm-svn: 331067

6 years ago[CodeGen] Use RegUnits to track register aliases (NFC)
Jun Bum Lim [Fri, 27 Apr 2018 18:44:37 +0000 (18:44 +0000)]
[CodeGen] Use RegUnits to track register aliases (NFC)

Summary: Use RegUnits to track register aliases in PostRASink and AArch64LoadStoreOptimizer.

Reviewers: thegameg, mcrosier, gberry, qcolombet, sebpop, MatzeB, t.p.northover, javed.absar

Reviewed By: thegameg, sebpop

Subscribers: javed.absar, llvm-commits, kristof.beyls

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

llvm-svn: 331066

6 years ago[X86] Split WriteFBlend/WriteFVarBlend/WriteFVarShuffle into XMM and YMM/ZMM schedule...
Simon Pilgrim [Fri, 27 Apr 2018 18:19:48 +0000 (18:19 +0000)]
[X86] Split WriteFBlend/WriteFVarBlend/WriteFVarShuffle into XMM and YMM/ZMM scheduler classes

This removes all the WriteFBlend/WriteFVarBlend InstRW overrides - some WriteFVarShuffle remain to be fixed.

llvm-svn: 331065

6 years agoSplit .eh_frame sections in parellel.
Rafael Espindola [Fri, 27 Apr 2018 18:17:36 +0000 (18:17 +0000)]
Split .eh_frame sections in parellel.

We can now split them in the same spot we split merge sections.

llvm-svn: 331064

6 years ago[Modules][ObjC] ASTReader should add protocols for class extensions
Bruno Cardoso Lopes [Fri, 27 Apr 2018 18:01:23 +0000 (18:01 +0000)]
[Modules][ObjC] ASTReader should add protocols for class extensions

During deserialization clang is currently missing the merging of
protocols into the canonical interface for the class extension.

This merging only currently happens during parsing and should also
be considered during deserialization.

rdar://problem/38724303

llvm-svn: 331063

6 years ago[AMDGPU][Waitcnt] Update a few tests to use default waitcnt pass (si-insert-waitcnts...
Mark Searles [Fri, 27 Apr 2018 17:59:15 +0000 (17:59 +0000)]
[AMDGPU][Waitcnt] Update a few tests to use default waitcnt pass (si-insert-waitcnts) rather than old pass (si-insert-waits); this is a small step towards the overall goal of removing the old waitcnt pass, which is no longer maintained.

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

llvm-svn: 331062

6 years ago[GuardWidening] Add some clarifying comments about heuristics [NFC]
Philip Reames [Fri, 27 Apr 2018 17:41:37 +0000 (17:41 +0000)]
[GuardWidening] Add some clarifying comments about heuristics [NFC]

llvm-svn: 331061

6 years ago[LoopGuardWidening] Split out a loop pass version of GuardWidening
Philip Reames [Fri, 27 Apr 2018 17:29:10 +0000 (17:29 +0000)]
[LoopGuardWidening] Split out a loop pass version of GuardWidening

The idea is to have a pass which performs the same transformation as GuardWidening, but can be run within a loop pass manager without disrupting the pass manager structure.  As demonstrated by the test case, this doesn't quite get there because of issues with post dom, but it gives a good step in the right direction.  the motivation is purely to reduce compile time since we can now preserve locality during the loop walk.

This patch only includes a legacy pass.  A follow up will add a new style pass as well.

llvm-svn: 331060

6 years ago[docs] add fp-cast-overflow-workaround options to release notes
Sanjay Patel [Fri, 27 Apr 2018 16:33:35 +0000 (16:33 +0000)]
[docs] add fp-cast-overflow-workaround options to release notes

llvm-svn: 331059

6 years agoSplit merge sections early.
Rafael Espindola [Fri, 27 Apr 2018 16:29:57 +0000 (16:29 +0000)]
Split merge sections early.

Now that getSectionPiece is fast (uses a hash) it is probably OK to
split merge sections early.

The reason I want to do this is to split eh_frame sections in the same
place.

This does mean that we have to decompress early. Given that the only
compressed sections are debug info, I don't think we are missing much.

It is a small improvement: 0.5% on the geometric mean.

llvm-svn: 331058

6 years ago[docs] more dashes
Sanjay Patel [Fri, 27 Apr 2018 16:24:39 +0000 (16:24 +0000)]
[docs] more dashes

llvm-svn: 331057

6 years ago[docs] add -ffp-cast-overflow-workaround to the release notes
Sanjay Patel [Fri, 27 Apr 2018 16:21:22 +0000 (16:21 +0000)]
[docs] add -ffp-cast-overflow-workaround to the release notes

This option was added with:
D46135
rL331041
...copying the text from UsersManual.rst for more exposure.

llvm-svn: 331056

6 years ago[MC] Undo spurious commit added into r331052.
Nirav Dave [Fri, 27 Apr 2018 16:16:06 +0000 (16:16 +0000)]
[MC] Undo spurious commit added into r331052.

llvm-svn: 331055

6 years ago[X86] Split WriteFHadd into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Fri, 27 Apr 2018 16:11:57 +0000 (16:11 +0000)]
[X86] Split WriteFHadd into XMM and YMM/ZMM scheduler classes

This removes all the HADD/HSUB PS/PD InstRW overrides.

llvm-svn: 331054

6 years agoTest commit removing trailing whitespace
Stuart Brady [Fri, 27 Apr 2018 16:11:56 +0000 (16:11 +0000)]
Test commit removing trailing whitespace

llvm-svn: 331053

6 years ago[MC] Provide default value for IsResolved.
Nirav Dave [Fri, 27 Apr 2018 16:11:24 +0000 (16:11 +0000)]
[MC] Provide default value for IsResolved.

llvm-svn: 331052

6 years ago[X86][AVX] Split WriteFLogic into XMM and YMM/ZMM scheduler classes
Simon Pilgrim [Fri, 27 Apr 2018 15:50:33 +0000 (15:50 +0000)]
[X86][AVX] Split WriteFLogic into XMM and YMM/ZMM scheduler classes

This removes all the AND/ANDN/OR/XOR PS/PD InstRW overrides.

llvm-svn: 331051

6 years ago[mips] Analyze and provide selection patterns microMIPSR6 branches
Simon Dardis [Fri, 27 Apr 2018 15:49:49 +0000 (15:49 +0000)]
[mips] Analyze and provide selection patterns microMIPSR6 branches

These branches were previously unanalyzable and unselectable. Add them and
recognize how to generate their inverses.

Reviewers: smaksimovic, atanasyan, abeserminji

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

llvm-svn: 331050

6 years agoAlways normalize FileSpec paths.
Greg Clayton [Fri, 27 Apr 2018 15:45:58 +0000 (15:45 +0000)]
Always normalize FileSpec paths.

Always normalizing lldb_private::FileSpec paths will help us get a consistent results from comparisons when setting breakpoints and when looking for source files. This also removes a lot of complexity from the comparison routines. Modified the DWARF line table parser to use the normalized compile unit directory if needed.

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

llvm-svn: 331049

6 years ago[MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.
Nirav Dave [Fri, 27 Apr 2018 15:45:54 +0000 (15:45 +0000)]
[MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.

llvm-svn: 331048

6 years ago[MC] Allow MCAssembler to be constructed without all subcomponents. NFCI.
Nirav Dave [Fri, 27 Apr 2018 15:45:27 +0000 (15:45 +0000)]
[MC] Allow MCAssembler to be constructed without all subcomponents. NFCI.

llvm-svn: 331047

6 years ago[PPC64] Add offset to local entry point when calling functions without plt
Zaara Syeda [Fri, 27 Apr 2018 15:41:19 +0000 (15:41 +0000)]
[PPC64] Add offset to local entry point when calling functions without plt

PPC64 V2 ABI describes two entry points to a function. The global entry point
sets up the TOC base pointer. When calling a local function, the call should
branch to the local entry point rather than the global entry point.
Section 3.4.1 describes using the 3 most significant bits of the st_other
field to find out how many instructions there are between the local and global
entry point. This patch adds the correct offset required to branch to the local
entry point of a function.

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

llvm-svn: 331046

6 years agoDo not set RequiresNullTerminator. NFC.
Rui Ueyama [Fri, 27 Apr 2018 15:32:04 +0000 (15:32 +0000)]
Do not set RequiresNullTerminator. NFC.

When reading object files, we don't need '\0' at end of each file.

llvm-svn: 331045

6 years ago[AArch64] Place the first ldp at the end when ReverseCSRRestoreSeq is true
Francis Visoiu Mistrih [Fri, 27 Apr 2018 15:30:54 +0000 (15:30 +0000)]
[AArch64] Place the first ldp at the end when ReverseCSRRestoreSeq is true

Put the first ldp at the end, so that the load-store optimizer can run
and merge the ldp and the add into a post-index ldp.

This didn't work in case no frame was needed and resulted in code size
regressions.

llvm-svn: 331044

6 years agoMark test as @skipIfOutOfTreeDebugserver
Frederic Riss [Fri, 27 Apr 2018 15:30:09 +0000 (15:30 +0000)]
Mark test as @skipIfOutOfTreeDebugserver

This test will currently fail for people using the system debugserver.

llvm-svn: 331043

6 years ago[CMake] Enable warnings for runtimes
Kostya Kortchinsky [Fri, 27 Apr 2018 15:10:50 +0000 (15:10 +0000)]
[CMake] Enable warnings for runtimes

Summary:
`HandleLLVMOptions` adds `-w` to the cflags if `LLVM_ENABLE_WARNINGS` is not on.
With `-w`, `check_cxx_compiler_flag` doesn't error out for unsupported flags
(for example `-mcrc` on x86_64), and those flags end up being detected as
working - and really they aren't.

I am not entirely sure what the best way to solve this is, but setting
`LLVM_ENABLE_WARNINGS` prior to including `HandleLLVMOptions` does the job.

Reviewers: phosek, beanz

Reviewed By: phosek

Subscribers: mgorny, llvm-commits

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

llvm-svn: 331042

6 years ago[Driver, CodeGen] add options to enable/disable an FP cast optimization
Sanjay Patel [Fri, 27 Apr 2018 14:22:48 +0000 (14:22 +0000)]
[Driver, CodeGen] add options to enable/disable an FP cast optimization

As discussed in the post-commit thread for:
rL330437 ( http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180423/545906.html )

We need a way to opt-out of a float-to-int-to-float cast optimization because too much
existing code relies on the platform-specific undefined result of those casts when the
float-to-int overflows.

The LLVM changes associated with adding this function attribute are here:
rL330947
rL330950
rL330951

Also as suggested, I changed the LLVM doc to mention the specific sanitizer flag that
catches this problem:
rL330958

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

llvm-svn: 331041

6 years ago[SystemZ] Remove scheduling info from some Pseudo instructions (NFC).
Jonas Paulsson [Fri, 27 Apr 2018 14:09:03 +0000 (14:09 +0000)]
[SystemZ]  Remove scheduling info from some Pseudo instructions (NFC).

If the MachineInstr uses a custom inserter and is then erased after
instruction selection, there is no use for mapping it to a sched class.

Review: Ulrich Weigand
llvm-svn: 331040

6 years ago[ARM,AArch64] Add intrinsics for dot product instructions
Oliver Stannard [Fri, 27 Apr 2018 14:03:32 +0000 (14:03 +0000)]
[ARM,AArch64] Add intrinsics for dot product instructions

The ACLE spec which describes these intrinsics hasn't been published yet, but
this is based on the final draft which will be published soon, and these have
already been implemented by GCC.

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

llvm-svn: 331039

6 years ago[ARM] Add __ARM_FEATURE_DOTPROD pre-defined macro
Oliver Stannard [Fri, 27 Apr 2018 13:56:02 +0000 (13:56 +0000)]
[ARM] Add __ARM_FEATURE_DOTPROD pre-defined macro

This adds a pre-defined macro to test if the compiler has support for the
v8.2-A dot rpoduct intrinsics in AArch32 mode.

The AAcrh64 equivalent has already been added by rL330229.

The ACLE spec which describes this macro hasn't been published yet, but this is
based on the final internal draft, and GCC has already implemented this.

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

llvm-svn: 331038

6 years ago[LoopInterchange] Allow some loops with PHI nodes in the exit block.
Florian Hahn [Fri, 27 Apr 2018 13:52:51 +0000 (13:52 +0000)]
[LoopInterchange] Allow some loops with PHI nodes in the exit block.

We currently support LCSSA PHI nodes in the outer loop exit, if their
incoming values do not come from the outer loop latch or if the
outer loop latch has a single predecessor. In that case, the outer loop latch
will be executed only if the inner loop gets executed. If we have multiple
predecessors for the outer loop latch, it may be executed even if the inner
loop does not get executed.

This is a first step to support the case described in
https://bugs.llvm.org/show_bug.cgi?id=30472

Reviewers: efriedma, karthikthecool, mcrosier

Reviewed By: efriedma

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

llvm-svn: 331037

6 years ago[AArch64] Codegen for v8.2A dot product intrinsics
Oliver Stannard [Fri, 27 Apr 2018 13:45:32 +0000 (13:45 +0000)]
[AArch64] Codegen for v8.2A dot product intrinsics

This adds IR intrinsics for the AArch64 dot-product instructions introduced in
v8.2-A.

Differential revisioon: https://reviews.llvm.org/D46107

llvm-svn: 331036

6 years ago[NVPTX] Turn on Loop/SLP vectorization
Benjamin Kramer [Fri, 27 Apr 2018 13:36:05 +0000 (13:36 +0000)]
[NVPTX] Turn on Loop/SLP vectorization

Since PTX has grown a <2 x half> datatype vectorization has become more
important. The late LoadStoreVectorizer intentionally only does loads
and stores, but now arithmetic has to be vectorized for optimal
throughput too.

This is still very limited, SLP vectorization happily creates <2 x half>
if it's a legal type but there's still a lot of register moving
happening to get that fed into a vectorized store. Overall it's a small
performance win by reducing the amount of arithmetic instructions.

I haven't really checked what the loop vectorizer does to PTX code, the
cost model there might need some more tweaks. I didn't see it causing
harm though.

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

llvm-svn: 331035