Commit Graph

93634 Commits

Author SHA1 Message Date
David Majnemer
406cfb6253 [CloneFunction] Don't remove side effecting calls
We were able to figure out that the result of a call is some constant.
While propagating that fact, we added the constant to the value map.
This is problematic because it results in us losing the call site when
processing the value map.

This fixes PR28802.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277611 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 17:12:47 +00:00
Weiming Zhao
d619aa8878 [ARM] Constant Materialize: imms with specific value can be encoded into mov.w
Summary: Thumb2 supports encoding immediates with specific patterns into mov.w by splatting the low 8 bits into other bytes.

Reviewers: john.brawn, jmolloy

Subscribers: jmolloy, aemerson, rengolin, samparker, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277610 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 17:05:23 +00:00
Zachary Turner
29b012cdcd [msf] Make FPM reader use MappedBlockStream.
MappedBlockSTream can work with any sequence of block data where
the ordering is specified by a list of block numbers.  So rather
than manually stitch them together in the case of the FPM, reuse
this functionality so that we can treat the FPM as if it were
contiguous.

Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D23066

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277609 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 16:53:21 +00:00
Renato Golin
17638d0519 Revert "Teach CorrelatedValuePropagation to mark adds as no wrap"
This reverts commit r277592, trying to fix the AArch64 42VMA buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277607 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 16:20:48 +00:00
Benjamin Kramer
e7cee5a7a3 Hexagon: Use llvm_unreachable. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277605 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 15:51:10 +00:00
Elliot Colp
305565bab3 Disable shrinking of SNaN constants
When expanding FP constants, we attempt to shrink doubles to floats and perform an extending load.
However, on SystemZ, and possibly on other targets (I've only confirmed the problem on SystemZ), the FP extending load instruction may convert SNaN into QNaN, or may cause an exception. So in the general case, we would still like to shrink FP constants, but SNaNs should be left as doubles.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277602 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 15:09:21 +00:00
Krzysztof Parzyszek
c3332e48f0 [Hexagon] Do not check alignment for unsized types in isLegalAddressingMode
When the same base address is used to load two different data types, LSR
would assume a memory type of "void". This type is not sized and has no
alignment information. Checking for it causes a crash.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277601 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 15:06:18 +00:00
Gil Rapaport
3a37cd24d7 [Loop Vectorizer] Move store-predication into its own function, remove obsolete comment (NFC)
Differential Revision: https://reviews.llvm.org/D23013


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277595 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 13:23:43 +00:00
Artur Pilipenko
5267dec504 Teach CorrelatedValuePropagation to mark adds as no wrap
Use LVI to prove that adds do not wrap. The change is motivated by https://llvm.org/bugs/show_bug.cgi?id=28620 bug and it's the first step to fix that problem.

Reviewed By: sanjoy

Differential Revision: http://reviews.llvm.org/D23059


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277592 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 13:11:39 +00:00
Igor Breger
48f2d1dea0 [AVX512] Add aliases for vcvttss2si{l|q}, vcvttsd2si{l|q}, vcvttss2usi{l|q}, vcvttsd2usi{l|q} instructions.
Differential Revision: http://reviews.llvm.org/D23111

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277586 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 10:58:05 +00:00
Chandler Carruth
d4bcc6c7a1 [PM] Fix a mis-named parameter in parseLoopPass -- the pass manager was
called "FPM" instead of "LPM" in a hold-over from when the code was
modeled on that used to parse function passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277584 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 09:14:03 +00:00
Chandler Carruth
91b6bfa061 [PM] Add a generic 'repeat N times' pass wrapper to the new pass
manager.

While this has some utility for debugging and testing on its own, it is
primarily intended to demonstrate the technique for adding custom
wrappers that can provide more interesting interation behavior in
a nice, orthogonal, and composable layer.

Being able to write these kinds of very dynamic and customized controls
for running passes was one of the motivating use cases of the new pass
manager design, and this gives a hint at how they might look. The actual
logic is tiny here, and most of this is just wiring in the pipeline
parsing so that this can be widely used.

I'm adding this now to show the wiring without a lot of business logic.
This is a precursor patch for showing how a "iterate up to N times as
long as we devirtualize a call" utility can be added as a separable and
composable component along side the CGSCC pass management.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277581 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 07:44:48 +00:00
Dean Michael Berris
d22618589a [XRay] Make the xray_instr_map section specification more correct
Summary:
We also add a test to show what currently happens when we create a
section per function and emit an xray_instr_map. This illustrates the
relationship (or lack thereof) between the per-function section and the
xray_instr_map section.

We also change the code generation slightly so that we don't always
create group sections, but rather only do so if a function where the
table is associated with is in a group.

Also in this change:

  - Remove the "merge" flag on the xray_instr_map section.
  - Test that we're generating the right table for comdat and non-comdat functions.

Reviewers: echristo, majnemer

Subscribers: llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277580 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 07:21:55 +00:00
Jonas Paulsson
26d2b7b824 [IfConversion] Bugfix: Don't use undef flag while adding use operands.
IfConversion used to always add the undef flag when adding a use operand
on a newly predicated instruction. This would be an operand for the register
being conditionally redefined. Due to the undef flag, the liveness of this
register prior to the predicated instruction would get lost.

This patch changes this so that such use operands are added only when the
register is live, without the undef flag.

This was reverted but pushed again now, for details follow link below.

Reviewed by Quentin Colombet.
http://reviews.llvm.org/D209077

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277571 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 05:46:35 +00:00
David Callahan
8843600753 [ADCE] Refactor anticipating new functionality (NFC)
Summary:
This is the first refactoring before adding new functionality.
Add a class wrapper for the functions and container for
state associated with the transformation.

No functional change

Reviewers: majnemer, nadav, mehdi_amini

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277565 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 04:28:39 +00:00
Mehdi Amini
e86c4eb06a RecordStreamer: handle inline asm "lazy_reference" and mark symbols as "used"
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277564 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 03:51:42 +00:00
Chandler Carruth
0f1f98257c [PM] Remove the NDEBUG condition around isModulePassName.
I forgot to do this initially, and added when I saw this fail in
a no-asserts build, but managed to loose the diff from the actual patch
that got submitted. Very sorry.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277562 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 03:26:09 +00:00
Chandler Carruth
3d1a470319 [PM] Significantly refactor the pass pipeline parsing to be easier to
reason about and less error prone.

The core idea is to fully parse the text without trying to identify
passes or structure. This is done with a single state machine. There
were various bugs in the logic around this previously that were repeated
and scattered across the code. Having a single routine makes it much
easier to fix and get correct. For example, this routine doesn't suffer
from PR28577.

Then the actual pass construction is handled using *much* easier to read
code and simple loops, with particular pass manager construction sunk to
live with other pass construction. This is especially nice as the pass
managers *are* in fact passes.

Finally, the "implicit" pass manager synthesis is done much more simply
by forming "pre-parsed" structures rather than having to duplicate tons
of logic.

One of the bugs fixed by this was evident in the tests where we accepted
a pipeline that wasn't really well formed. Another bug is PR28577 for
which I have added a test case.

The code is less efficient than the previous code but I'm really hoping
that's not a priority. ;]

Thanks to Sean for the review!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277561 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 03:21:41 +00:00
George Burgess IV
265028f005 [MSSA] Fix a caching bug.
This fixes a bug where we'd sometimes cache overly-conservative results
with our walker. This bug was made more obvious by r277480, which makes
our cache far more spotty than it was. Test case is llvm-unit, because
we're likely going to use CachingWalker only for def optimization in the
future.

The bug stems from that there was a place where the walker assumed that
`DefNode.Last` was a valid target to cache to when failing to optimize
phis. This is sometimes incorrect if we have a cache hit. The fix is to
use the thing we *can* assume is a valid target to cache to. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277559 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 01:22:19 +00:00
Chandler Carruth
4e5f8f5f46 [Inliner] clang-format various parts of the inliner prior to changes
here. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277557 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 01:02:31 +00:00
Ivan Krasin
2cc035abb5 Add -lowertypetests-bitsets-level to control bitsets generation.
Summary:
Sometimes, bitsets could get really large (>300k entries) and
we might want to drop a check, as it would have a too much cost.

Adding a flag to control how much penalty are we willing to pay
for bitsets.

Reviewers: kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277556 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 00:59:38 +00:00
Daniel Berlin
9d6e4f22e7 Support for lifetime begin/end markers in the MemorySSA use optimizer
Summary: Depends on D23072

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277553 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-03 00:01:46 +00:00
Derek Schuff
d8ef8b0e48 [WebAssembly] Remove unnecessary subtarget checks in peephole pass
Leftover from D22686; the passes can handle all the instructions
unconditionally; only isel needs to care whether to generate them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277549 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 23:31:56 +00:00
Evgeniy Stepanov
66c2ec1bb4 [safestack] Layout large allocas first to reduce fragmentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277544 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 23:21:30 +00:00
Derek Schuff
75834f76b2 [WebAssembly] Initial SIMD128 support.
Kicks off the implementation of wasm SIMD128 support (spec:
https://github.com/stoklund/portable-simd/blob/master/portable-simd.md),
adding support for add, sub, mul for i8x16, i16x8, i32x4, and f32x4.

The spec is WIP, and might change in the near future.

Patch by João Porto

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277543 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 23:16:09 +00:00
Tim Northover
d022ddb138 ARM: only form SMMLS when SUBE flags unused.
In this particular example we wouldn't want the smmls anyway (the value is
actually unused), but in general smmls does not provide the required flags
register so if that SUBE result is used we can't replace it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277541 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 23:12:36 +00:00
Kevin Enderby
d5adfbcabc More fixes to get good error messages for bad archives.
Fixed the last incorrect uses of llvm_unreachable() in the code
which were actually just cases of errors in the input Archives.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277540 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 22:58:55 +00:00
Sanjay Patel
a1c5f9f963 [InstCombine] replace dyn_casts with matches; NFCI
Clean-up before changing this to allow folds for vectors.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277538 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 22:38:33 +00:00
Matt Arsenault
94166e75ac AMDGPU: fdiv -1, x -> rcp -x
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277535 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 22:25:04 +00:00
Piotr Padlewski
c2a3bce22d Imported statistics types changes
Reviewers: tejohnson, eraman

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277534 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 22:18:47 +00:00
George Burgess IV
4968ef3366 [CFLAA] Be more conservative with values we haven't seen.
There were issues with simply reporting AttrUnknown on
previously-unknown values in CFLAnders. So, we now act *entirely*
conservatively for values we haven't seen before. As in the prior patch
(r277362), writing a lit test for this isn't exactly trivial. If someone
wants a test badly, I'm willing to try to write one.

Patch by Jia Chen.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277533 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 22:17:25 +00:00
Daniel Berlin
35142a98ef Move to having a single real instructionClobbersQuery
Summary: We really want to move towards MemoryLocOrCall (or fix AA) everywhere, but for now, this lets us have a single instructionClobbersQuery.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277530 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 21:57:52 +00:00
Rui Ueyama
9222178199 PDB: Mark extended file pages as free by default.
BitVector::extend initializes extended bits as true by default.
That is not desirable because new pages should be initially free.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277529 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 21:56:37 +00:00
Krzysztof Parzyszek
8d96db9629 [Hexagon] Recognize vcombine in copy propagation
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277528 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 21:49:20 +00:00
Michael Zolotukhin
9ef092dcb0 [LoopUnroll] Switch the default value of -unroll-runtime-epilog back to its original value.
As agreed in post-commit review of r265388, I'm switching the flag to
its original value until the 90% runtime performance regression on
SingleSource/Benchmarks/Stanford/Bubblesort is addressed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277524 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 21:24:14 +00:00
Artem Belevich
23d7717d3d [NVPTX] remove unnecessary named metadata update that happens to break debug info.
Also added test case to verify IR changes done by NVPTXGenericToNVVM pass.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277520 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 20:58:24 +00:00
Wei Mi
ba9543ccae [LoopVectorize] Change comment for isOutOfScope in collectLoopUniforms, NFC
Update comment for isOutOfScope and add a testcase for uniform value being used
out of scope.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277515 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 20:27:49 +00:00
Tim Northover
22b561a27e AArch64: properly calculate cmpxchg status in FastISel.
We were relying on the misleadingly-names $status result to actually be the
status. Actually it's just a scratch register that may or may not be valid (and
is the inverse of the real ststus anyway). Success can be determined by
comparing the value loaded against the one we wanted to see for "cmpxchg
strong" loops like this.

Should fix PR28819.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277513 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 20:22:36 +00:00
Daniel Berlin
558bab8534 Fixes for post-commit review comments on r277480
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277510 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 20:02:21 +00:00
Sanjoy Das
55fcee64a9 [IRCE] Rename variable; NFC
There is nothing "Original" about "OriginalLoopInfo".

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277506 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 19:32:01 +00:00
Sanjoy Das
ee53c92338 [IRCE] Preserve DomTree and LCSSA
This changes IRCE to "preserve" LCSSA and DomTree by recomputing them.
It still does not preserve LoopSimplify.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277505 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 19:31:54 +00:00
Nicolai Haehnle
87d298325f AMDGPU: Stay in WQM for non-intrinsic stores
Summary:
Two types of stores are possible in pixel shaders: stores to memory that are
explicitly requested at the API level, and stores that are an implementation
detail of register spilling or lowering of arrays.

For the first kind of store, we must ensure that helper pixels have no effect
and hence WQM must be disabled. The second kind of store must always be
executed, because the written value may be loaded again in a way that is
relevant for helper pixels as well -- and there are no externally visible
effects anyway.

This is a candidate for the 3.9 release branch.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, kzhuravl, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277504 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 19:31:14 +00:00
Michael Zolotukhin
bc280d0f4f [LoopUnroll] Ensure we create prolog loops in simplified form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277502 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 19:19:31 +00:00
Nirav Dave
0fa8922515 Fix handling of end-of-line preprocessor comments Attempt 2
Attempt 2: Retryign after Tsan.mman test fix.

Attempt 1: Recommitting after fixing test.

When parsing assembly where the line comment syntax is not hash, the
lexer cannot distinguish between hash's that start a hash line comment
and one that is part of an assembly statement and must be distinguished
during parsing. Previously, this was incompletely handled by not checking
for EndOfStatement at the end of statements and interpreting hash
prefixed statements as comments.

Change EndOfStatement Parsing to check for Hash comments and reintroduce
Hash statement parsing to catch previously handled cases.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277501 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 19:17:54 +00:00
Nicolai Haehnle
a8461187eb AMDGPU: Track physical registers in SIWholeQuadMode
Summary:
There are cases where uniform branch conditions are computed in VGPRs, and
we didn't correctly mark those as WQM.

The stray change in basic-branch.ll is because invoking the LiveIntervals
analysis leads to the detection of a dead register that would otherwise not
be seen at -O0.

This is a candidate for the 3.9 branch, as it fixes a possible hang.

Reviewers: arsenm, tstellarAMD, mareko

Subscribers: arsenm, llvm-commits, kzhuravl

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277500 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 19:17:37 +00:00
Krzysztof Parzyszek
1b1291fbbb [Hexagon] Prefer _io over _rr for 64-bit store with constant offset
Identify patterns where the address is aligned to an 8-byte boundary,
but both the base address and the constant offset are both proper
multiples of 4. In such cases, extract Base+4 into a separate instruc-
tion, and use S2_storerd_io, instead of using S4_storerd_rr.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277497 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 18:50:05 +00:00
Krzysztof Parzyszek
aeac124408 [Hexagon] Remove unused option
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277496 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 18:39:32 +00:00
Krzysztof Parzyszek
a4e94ebbb2 [Hexagon] Improvements to address mode checks in TargetLowering
- Implement getOptimalMemOpType.
- Check BaseOffset in isLegalAddressingMode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277494 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 18:34:31 +00:00
Nirav Dave
c37e7b92f8 [MC] Fix Intel Operand assembly parsing for .set ids
Recommitting after fixing overaggressive fastpath return in parsing.

Fix intel syntax special case identifier operands that refer to a constant
(e.g. .set <ID> n) to be interpreted as immediate not memory in parsing.

Associated commit to fix clang test commited shortly.

Reviewers: rnk

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277489 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 17:56:03 +00:00
Daniel Berlin
c1f8f3a65f MSVC 2013 does not implement C++11 unions properly, so remove the anoymous union for now,
and leave a FIXME.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277485 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:59:51 +00:00
Ahmed Bougacha
9618468f1c [GlobalISel] Set the Selected MF property.
None of GlobalISel requires the property, but this lets us use the
verifier instead of rolling our own "all instructions selected" check.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277484 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:49:25 +00:00
Ahmed Bougacha
35426be67b [GlobalISel] Verify Selected MF property.
After instruction selection, there should be no pre-isel generic
instructions remaining, nor should generic virtual registers be
used. Verify that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277483 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:49:22 +00:00
Ahmed Bougacha
fc114db3c4 [GlobalISel] Add Selected MachineFunction property.
Selected: the InstructionSelect pass ran and all pre-isel generic
instructions have been eliminated; i.e., all instructions are now
target-specific or non-pre-isel generic instructions (e.g., COPY).

Since only pre-isel generic instructions can have generic virtual register
operands, this also means that all generic virtual registers have been
constrained to virtual registers (assigned to register classes) and that
all sizes attached to them have been eliminated.

This lets us enforce certain invariants across passes.
This property is GlobalISel-specific, but is always available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277482 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:49:19 +00:00
Daniel Berlin
c32071c252 Rewrite the use optimizer to be less memory intensive and 50% faster.
Fixes PR28670

Summary:
Rewrite the use optimizer to be less memory intensive and 50% faster.
Fixes PR28670

The new use optimizer works like a standard SSA renaming pass, storing
all possible versions a MemorySSA use could get in a stack, and just
tracking indexes into the stack.
This uses much less memory than caching N^2 alias query results.
It's also a lot faster.

The current version defers phi node walking to the normal walker.

Reviewers: george.burgess.iv

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277480 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:24:03 +00:00
Artur Pilipenko
e2e5c0738c [LVI] NFC. Sink a condition type check from the caller down to getValueFromCondition
This is a preparatory refactoring to support conditions other than ICmpInst.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277479 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:20:48 +00:00
Ahmed Bougacha
1f82c34de8 [GlobalISel] Verify RegBankSelected MF property.
RegBankSelected functions shouldn't have any generic virtual
register not assigned to a bank. Verify that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277476 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:17:15 +00:00
Ahmed Bougacha
31c3e4f363 [GlobalISel] Add RegBankSelected MachineFunction property.
RegBankSelected: the RegBankSelect pass ran and all generic virtual
registers have been assigned to a register bank.

This lets us enforce certain invariants across passes.
This property is GlobalISel-specific, but is always available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277475 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 16:17:10 +00:00
Matthew Simpson
155b8551c6 [LV] Generate both scalar and vector integer induction variables
This patch enables the vectorizer to generate both scalar and vector versions
of an integer induction variable for a given loop. Previously, we only
generated a scalar induction variable if we knew all its users were going to be
scalar. Otherwise, we generated a vector induction variable. In the case of a
loop with both scalar and vector users of the induction variable, we would
generate the vector induction variable and extract scalar values from it for
the scalar users. With this patch, we now generate both versions of the
induction variable when there are both scalar and vector users and select which
version to use based on whether the user is scalar or vector.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277474 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 15:25:16 +00:00
Ahmed Bougacha
d170182063 [GlobalISel] Set, require, and verify Legalized MF property.
RegBankSelect and InstructionSelect run after the legalizer and
require a Legalized function: check that all instructions are legal.

Note that this should be in the MachineVerifier, but it can't use the
MachineLegalizer as it's currently in the separate GlobalISel library.
Note that the RegBankSelect verifier checks have the same layering
problem, but we only use inline methods so end up not needing to link
against the GlobalISel library.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277472 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 15:10:32 +00:00
Ahmed Bougacha
a877bb83bf [AArch64][GlobalISel] Mark basic binops/memops as legal.
We currently use and test these, and select most of them. Mark them
as legal even though we don't go through the full ir->asm flow yet.

This doesn't currently have standalone tests, but the verifier will
soon learn to check that the regbankselect/select tests are legal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277471 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 15:10:28 +00:00
Ahmed Bougacha
46fe427fc7 [GlobalISel] Add Legalized MachineFunction property.
Legalized: The MachineLegalizer ran; all pre-isel generic instructions
have been legalized, i.e., all instructions are now one of:
  - generic and always legal (e.g., COPY)
  - target-specific
  - legal pre-isel generic instructions.

This lets us enforce certain invariants across passes.
This property is GlobalISel-specific, but is always available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277470 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 15:10:25 +00:00
Nirav Dave
07d957665f Revert "[MC] Fix handling of end-of-line preprocessor comments"
Causes TSan failure on PPC64

This reverts commit r277459.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277468 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 15:08:52 +00:00
Dan Gohman
143e93e010 [WebAssembly] Remove a README.txt entry that is now implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277467 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 14:53:44 +00:00
Artur Pilipenko
e6be5e76b2 [LVI] NFC. Fix a typo getValueFromFromCondition -> getValueFromCondition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277466 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 14:44:32 +00:00
Ahmed Bougacha
3797d93a1e [CodeGen] Generalize MachineFunctionProperties::print comma handling.
This is only used for debug prints, but the previous hardcoded ", "
caused it to be printed unnecessarily when OnlySet, and is annoying
when adding new properties.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277465 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 14:42:57 +00:00
Matthew Simpson
90b7f569d8 [LV] Untangle the concepts of uniform and scalar
This patch refactors the logic in collectLoopUniforms and
collectValuesToIgnore, untangling the concepts of "uniform" and "scalar". It
adds isScalarAfterVectorization along side isUniformAfterVectorization to
distinguish the two. Known scalar values include those that are uniform,
getelementptr instructions that won't be vectorized, and induction variables
and induction variable update instructions whose users are all known to be
scalar.

This patch includes the following functional changes:

- In collectLoopUniforms, we mark uniform the pointer operands of interleaved
  accesses. Although non-consecutive, these pointers are treated like
  consecutive pointers during vectorization.

- In collectValuesToIgnore, we insert a value into VecValuesToIgnore if it
  isScalarAfterVectorization rather than isUniformAfterVectorization. This
  differs from the previous functionaly in that we now add getelementptr
  instructions that will not be vectorized into VecValuesToIgnore.

This patch also removes the ValuesNotWidened set used for induction variable
scalarization since, after the above changes, it is now equivalent to
isScalarAfterVectorization.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277460 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 14:29:41 +00:00
Nirav Dave
22973d396c [MC] Fix handling of end-of-line preprocessor comments
Recommitting after fixing test.

When parsing assembly where the line comment syntax is not hash, the
lexer cannot distinguish between hash's that start a hash line comment
and one that is part of an assembly statement and must be distinguished
during parsing. Previously, this was incompletely handled by not checking
for EndOfStatement at the end of statements and interpreting hash
prefixed statements as comments.

Change EndOfStatement Parsing to check for Hash comments and reintroduce
Hash statement parsing to catch previously handled cases.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277459 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 14:25:49 +00:00
Sam Parker
d18c8aae08 [ARM] Improve smul* and smla* isel for Thumb2
Added (sra (shl x, 16), 16) to the sext_16_node PatLeaf for ARM to
simplify some pattern matching. This has allowed several patterns
for smul* and smla* to be removed as well as making it easier to add
the matching for the corresponding instructions for Thumb2 targets.
Also added two Pat classes that are predicated on Thumb2 with the
hasDSP flag and UseMulOps flags. Updated the smul codegen test with
the wider range of patterns plus the ThumbV6 and ThumbV6T2 targets.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277450 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 12:44:27 +00:00
NAKAMURA Takumi
02c2861750 HexagonVectorPrint.cpp: Fix r277370. Don't use getInstrVecReg() in the expression of assert(). It has side effects.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277448 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 11:59:16 +00:00
Ahmed Bougacha
b48427578b [GlobalISel] Don't RegBankSelect target-specific instructions.
They don't have types and should be using register classes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277447 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 11:41:16 +00:00
Ahmed Bougacha
a124aa1825 [GlobalISel] Don't legalize non-generic instructions.
They don't have types and should be legal.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277446 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 11:41:09 +00:00
Ahmed Bougacha
99853c1c1d [GlobalISel] Const-ify MachineInstrs passed to MachineLegalizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277445 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 11:41:03 +00:00
Simon Dardis
0bdecd2eeb [mips] Update the P5600 scheduler for isComplete = 1
These changes update the schedule model for the P5600 and includes the
rest of the MSA and MIPS32R5 instruction sets.

Reviewers: dsanders, vkalintris

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277441 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 10:32:00 +00:00
Bernard Ogden
921ae8e295 [ARM] Some saturation instructions not DSP-only
Summary:
Commit 276701 requires that targets have the DSP extensions to use
certain saturating instructions. This requires some corrections.

For ARM ISA the instructions in question are available in all v6*
architectures.

For Thumb2, the instructions in question are available from v6T2.
SSAT and USAT are part of the base architecture while SSAT16 and
USAT16 require the DSP extensions.

Reviewers: rengolin

Subscribers: aemerson, rengolin, samparker, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277439 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 10:04:03 +00:00
Benjamin Kramer
df988869b8 [LoadStoreVectorizer] Don't use a linear walk for an existence check in a SmallPtrSet
No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277436 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 09:35:17 +00:00
Igor Breger
0691cf23e8 [AVX512] Don't use i128 masked gather/scatter/load/store. Do more accurately dataWidth check.
Differential Revision: http://reviews.llvm.org/D23055

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277435 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 09:15:28 +00:00
Matt Arsenault
3638aecf0f AArch64: Assert on branch displacement bits
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277434 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 08:56:52 +00:00
Matt Arsenault
08fb6f0810 AArch64: Consolidate branch inversion logic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277431 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 08:30:06 +00:00
Matt Arsenault
1cee04d59a AArch64: BranchRelaxtion cleanups
Move some logic into TII.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277430 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 08:06:17 +00:00
Matt Arsenault
c2fcbdb2b3 AArch64: Fix end iterator dereference
Not all blocks have terminators. I'm not sure how this wasn't
crashing before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277427 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 07:20:09 +00:00
Craig Topper
a99d4e1d68 [AVX-512] Mark VADDPS/PD and VMULPS/PD as commutable. This necessitated adding itineraries to all of the instructions that use the avx512_fp_binop_p class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277422 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 06:16:53 +00:00
Craig Topper
8d6665d783 [AVX-512] Use SSE_MUL_ITINS_S/SSE_DIV_ITINS_S for the scalar FMUL/FDIV instructions to match SSE/AVX.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277421 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 06:16:51 +00:00
Craig Topper
7a4565f0eb [AVX-512] Correct ExeDomain for many AVX-512 instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277416 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 05:11:15 +00:00
Junmo Park
f29090aa9b Minor code cleanups. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277415 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 04:38:27 +00:00
Sanjoy Das
308cf93891 [Verifier] Disallow illegal ptr<->int casts in ConstantExprs
This should have been a part of rL277085, but I hadn't considered this
case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277413 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 02:55:57 +00:00
Bruno Cardoso Lopes
b1fa8fe727 Revert r277408 and r277407
Revert r277408 "Fix test from rL277407."
Revert r277407 "[MC] Fix handling of end-of-line preprocessor comments"

This is currently breaking:
  http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/20731

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277412 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 02:53:59 +00:00
Sean Silva
e9e07465ef CodeExtractor : Add ability to preserve profile data.
Added ability to estimate the entry count of the extracted function and
the branch probabilities of the exit branches.

Patch by River Riddle!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 02:15:45 +00:00
Sanjoy Das
81274146ab Tie the Verifier class to a Module; NFCI
Summary:
This commit changes the Verifier class to accept a Module via the
constructor to make it obvious that a specific instance of the class is
only intended to work with a specific module.  The `updateModule` setter
(despite being private) was making this fact less transparent.

There are fields in the `Verifier` class like `DeoptimizeDeclarations`
and `GlobalValueVisited` which are module specific, so a given
Verifier instance will not in fact work across multiple modules today.
This change just makes that more obvious.

The motivation is to make it easy to get to the datalayout of the
module unambiguously.  That is required to verify that `inttoptr` and
`ptrtoint` constant expressions are well typed in the face of
non-integral pointer types.

Reviewers: dexonsmith, bkramer, majnemer, chandlerc

Subscribers: mehdi_amini, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 01:34:50 +00:00
Nirav Dave
6fc4119b60 [MC] Fix handling of end-of-line preprocessor comments
Summary:
When parsing assembly where the line comment syntax is not hash, the
lexer cannot distinguish between hash's that start a hash line comment
and one that is part of an assembly statement and must be distinguished
during parsing. Previously, this was incompletely handled by not checking
for EndOfStatement at the end of statements and interpreting hash
prefixed statements as comments.

Change EndOfStatement Parsing to check for Hash comments and reintroduce
Hash statement parsing to catch previously handled cases.

Reviewers: rnk, majnemer

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-02 01:05:29 +00:00
Hans Wennborg
0e6a15a292 Revert r276895 "[MC][X86] Fix Intel Operand assembly parsing for .set ids"
This caused PR28805. Adding a regression test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277402 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 23:00:01 +00:00
Tim Shen
a9ed4cc01c [ADT] NFC: Generalize GraphTraits requirement of "NodeType *" in interfaces to "NodeRef", and migrate SCCIterator.h to use NodeRef
Summary: By generalize the interface, users are able to inject more flexible Node token into the algorithm, for example, a pair of vector<Node>* and index integer. Currently I only migrated SCCIterator to use NodeRef, but more is coming. It's a NFC.

Reviewers: dblaikie, chandlerc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277399 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 22:32:20 +00:00
Derek Schuff
23429a5af3 [WebAssembly] Support CFI for WebAssembly target
Summary: This patch implements CFI for WebAssembly. It modifies the
LowerTypeTest pass to pre-assign table indexes to functions that are
called indirectly, and lowers type checks to test against the
appropriate table indexes. It also modifies the WebAssembly backend to
support a special ".indidx" assembly directive that propagates the table
index assignments out to the linker.

Patch by Dominic Chen

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277398 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 22:25:02 +00:00
Lang Hames
f4cfadb9c0 [Orc] Fix common symbol support in ORC.
Common symbol support in ORC was broken in r270716 when the symbol resolution
rules in RuntimeDyld were changed. With the switch to lazily materialized
symbols in r277386, common symbols can be supported by having
RuntimeDyld::emitCommonSymbols search for (but not materialize!) definitions
elsewhere in the logical dylib.

This patch adds the 'Common' flag to JITSymbolFlags, and the necessary check
to RuntimeDyld::emitCommonSymbols.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277397 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 22:23:24 +00:00
David Blaikie
4c028797dc Simplify some code found when it was moved in r277177
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277394 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 21:50:43 +00:00
Michael Kuperstein
3a6d437582 [PM] Port SpeculativeExecution to the new PM
Differential Revision: https://reviews.llvm.org/D23033


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 21:48:33 +00:00
Derek Schuff
6b6b112dba [WebAssembly] Add asm.js-style exception handling support
Summary: This patch includes asm.js-style exception handling support for
WebAssembly. The WebAssembly MVP does not have any support for
unwinding or non-local control flow. In order to support C++ exceptions,
emscripten currently uses JavaScript exceptions along with some support
code (written in JavaScript) that is bundled by emscripten with the
generated code.
This scheme lowers exception-related instructions for wasm such that
wasm modules can be compatible with emscripten's existing scheme and
share the support code.

Patch by Heejin Ahn

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277391 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 21:34:04 +00:00
Zachary Turner
822ef4e420 [msf] Teach LLVM to parse a split Fpm.
The FPM is split at regular intervals across the MSF file, as the MS code
suggests. It turns out that the value of the interval is precisely the
block size. If the block size is 4096, then there are two Fpm pages every
4096 blocks.

So here we teach the PDBFile class to parse a split FPM, and also add more
options when dumping the FPM to display some additional information such
as orphaned pages (pages which the FPM says are allocated, but which
nothing appears to use), use after free pages (pages which the FPM says
are not allocated, but which are referenced by a stream), and multiple use
pages (pages which the FPM says are allocated but are used more than
once).

Reviewed By: ruiu
Differential Revision: https://reviews.llvm.org/D23022

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277388 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 21:19:45 +00:00
Lang Hames
075c1e2e1a [ExecutionEngine][MCJIT][Orc] Replace RuntimeDyld::SymbolInfo with JITSymbol.
This patch replaces RuntimeDyld::SymbolInfo with JITSymbol: A symbol class
that is capable of lazy materialization (i.e. the symbol definition needn't be
emitted until the address is requested). This can be used to support common
and weak symbols in the JIT (though this is not implemented in this patch).

For consistency, RuntimeDyld::SymbolResolver is renamed to JITSymbolResolver.

For space efficiency a new class, JITEvaluatedSymbol, is introduced that
behaves like the old RuntimeDyld::SymbolInfo - i.e. it is just a pair of an
address and symbol flags. Instances of JITEvaluatedSymbol can be used in
symbol-tables to avoid paying the space cost of the materializer.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277386 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:49:11 +00:00
Krzysztof Parzyszek
9296f21a70 [Hexagon] Tidy up some code, NFC: reapply r277372 with a fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277383 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:31:50 +00:00
Xinliang David Li
fa6022726f [Profile] IR profiling minor cleanup /nfc
Differential Revision: http://reviews.llvm.org/D22995



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:25:06 +00:00
Matthew Simpson
8a44831abe [LV] Move isGatherOrScatterLegal into LoopVectorizationLegality (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277376 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:11:25 +00:00
Matthew Simpson
abaa42dca0 [LV] Use getPointerOperand helper where appropriate (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277375 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:08:09 +00:00
Krzysztof Parzyszek
71a7b1e6dc Revert r277372, it is causing buildbot failures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277374 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 20:00:33 +00:00
Krzysztof Parzyszek
d7943136ad [Hexagon] Tidy up some code, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277372 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 19:46:21 +00:00
Michael Kuperstein
8be735fdf7 [DAGCombine] Make sext(setcc) combine respect getBooleanContents
We used to combine "sext(setcc x, y, cc) -> (select (setcc x, y, cc), -1, 0)"
Instead, we should combine to (select (setcc x, y, cc), T, 0) where the value
of T is 1 or -1, depending on the type of the setcc, and getBooleanContents()
for the type if it is not i1.

This fixes PR28504.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 19:39:49 +00:00
Ron Lieberman
16082a39ea [Hexagon] Generate vector printing instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 19:36:39 +00:00
George Burgess IV
4df351da7d [CFLAA] Remove modref queries from CFLAA.
As it turns out, modref queries are broken with CFLAA. Specifically,
the data source we were using for determining modref behaviors
explicitly ignores operations on non-pointer values. So, it wouldn't
note e.g. storing an i32 to an i32* (or loading an i64 from an i64*).
It also ignores external function calls, rather than acting
conservatively for them.

(N.B. These operations, where necessary, *are* tracked by CFLAA; we just
use a different mechanism to do so. Said mechanism is relatively
imprecise, so it's unlikely that we can provide reasonably good modref
answers with it as implemented.)

Patch by Jia Chen.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277366 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 18:47:28 +00:00
Evandro Menezes
665f6036f6 [AArch64] Add support for Samsung Exynos M2 (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 18:39:45 +00:00
George Burgess IV
e0188664fb [CFLAA] Make CFLAnders more conservative with new Values.
Currently, CFLAnders assumes that values it hasn't seen don't alias
anything. This patch fixes that. Given that the only way for this to
happen is to query AA, rely on specific transformations happening, then
query AA again (looking for a specific set of queries), lit testing is a
bit difficult. If someone really wants a test, I'm happy to add one.

Patch by Jia Chen.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277362 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 18:27:33 +00:00
David Majnemer
6687e3a1ed [Verifier] Resume instructions can only be in functions w/ a personality
This fixes PR28799.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 18:06:34 +00:00
Krzysztof Parzyszek
c54b1ec0f8 Replace MachineInstr* with MachineInstr& in TargetInstrInfo, NFC
There were a few cases introduced with the modulo scheduler.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 17:55:48 +00:00
Krzysztof Parzyszek
c765d85307 [Hexagon] Check for offset overflow when reserving scavenging slots
Scavenging slots were only reserved when pseudo-instruction expansion in
frame lowering created new virtual registers. It is possible to still
need a scavenging slot even if no virtual registers were created, in cases
where the stack is large enough to overflow instruction offsets.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277355 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 17:15:30 +00:00
Daniel Sanders
a738e21392 [mips][fastisel] Correct argument lowering for (f64, f64, i32) and similar.
Summary:
Allocating an AFGR64 shadows two GPR32's instead of just one.

This fixes an LNT regression detected by our internal buildbots.

Reviewers: sdardis

Subscribers: dsanders, sdardis, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 15:32:51 +00:00
Valery Pykhtin
1704eb6864 [AMDGPU] refactor DS instruction definitions. NFC.
Differential revision: https://reviews.llvm.org/D22522

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277344 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 14:21:30 +00:00
Simon Pilgrim
f6cf26bc83 [X86] Use implicit masking of SHLD/SHRD shift double instructions
Similar to the regular shift instructions, SHLD/SHRD only use the bottom bits of the shift value


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277341 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 12:11:43 +00:00
Simon Pilgrim
25fd1498fa Fixed MSVC out of range shift warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277333 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 09:40:38 +00:00
James Molloy
a77b56f254 [SimplifyCFG] Fix nasty RAUW bug from r277325
Using RAUW was wrong here; if we have a switch transform such as:
  18 -> 6 then
  6 -> 0

If we use RAUW, while performing the second transform the  *transformed* 6
from the first will be also replaced, so we end up with:
  18 -> 0
  6 -> 0

Found by clang stage2 bootstrap; testcase added.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 09:34:48 +00:00
Diana Picus
deeb6ba1ab [AArch64] Return the correct size for TLSDESC_CALLSEQ
The branch relaxation pass is computing the wrong offsets because it assumes
TLSDESC_CALLSEQ eats up 4 bytes, when in fact it is lowered to an instruction
sequence taking up 16 bytes. This can become a problem in huge files with lots
of TLS accesses, as it may slowly move branch targets out of the range computed
by the branch relaxation pass.

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

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277331 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 08:38:49 +00:00
Craig Topper
6c739fb541 [AVX-512] Fix duplicate column in AVX512 execution dependency table that was preventing VMOVDQU32/VMOVDQA32 from being recognized. Fix a bug in the code that stops execution dependency fix from turning operations on 32-bit integer element types into operations on 64-bit integer element types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277327 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 07:55:33 +00:00
James Molloy
16e549f1c0 [SimplifyCFG] Range reduce switches
If a switch is sparse and all the cases (once sorted) are in arithmetic progression, we can extract the common factor out of the switch and create a dense switch. For example:

    switch (i) {
    case 5: ...
    case 9: ...
    case 13: ...
    case 17: ...
    }

can become:

    if ( (i - 5) % 4 ) goto default;
    switch ((i - 5) / 4) {
    case 0: ...
    case 1: ...
    case 2: ...
    case 3: ...
    }

or even better:

   switch ( ROTR(i - 5, 2) {
   case 0: ...
   case 1: ...
   case 2: ...
   case 3: ...
   }

The division and remainder operations could be costly so we only do this if the factor is a power of two, and emit a right-rotate instead of a divide/remainder sequence. Dense switches can be lowered significantly better than sparse switches and can even be transformed into lookup tables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277325 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 07:45:11 +00:00
Hrvoje Varga
5c02c44a28 [mips] Clang generates unaligned offset for MSA instruction st.d
Differential Revision: https://reviews.llvm.org/D19475



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277323 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 06:46:20 +00:00
Diana Picus
5bfb1b8c4e [AArch64] Register passes so they can be run by llc
Initialize all AArch64-specific passes in the TargetMachine so they can be run
by llc. This can lead to conflicts in opt with some command line options that
share the same name as the pass, so I took this opportunity to do some cleanups:
* rename all relevant command line options from "aarch64-blah" to
  "aarch64-enable-blah" and update the tests accordingly
* run clang-format on their declarations
* move all these declarations to a common place (the TargetMachine) as opposed
  to having them scattered around (AArch64BranchRelaxation and
  AArch64AddressTypePromotion were the only offenders)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277322 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 05:56:57 +00:00
Craig Topper
87efa54747 [AVX-512] Teach X86InstrInfo::getLargestLegalSuperClass to inflate to FR32X/FR64X if AVX512 is supported and VR128X/VR256X if VLX is supported.
Had to update a stack folding test to clobber the other 16 registers since this now made them get used instead of spilling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277321 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 05:31:50 +00:00
Craig Topper
e0f68ac00d [AVX-512] Use FR32X/FR64X/VR128X/VR256X register classes in addRegisterClass if AVX512(for FR32X/FR64) or VLX(for VR128X/VR256) is supported. This is a minimal requirement to be able to allocate all 32 registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 04:29:13 +00:00
Craig Topper
8b3212e29f [X86] Move mask register handling into the main switch of getLoadStoreRegOpcode. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277318 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 04:29:11 +00:00
Sean Silva
04c0c682a2 Revert r277313 and r277314.
They seem to trigger an LSan failure:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/15140/steps/check-llvm%20asan/logs/stdio

Revert "Add the tests for r277313"

This reverts commit r277314.

Revert "CodeExtractor : Add ability to preserve profile data."

This reverts commit r277313.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277317 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 04:16:09 +00:00
Sean Silva
980a4b4d40 Fix - CodeExtractor : Inherit Target Dependent Attributes from the parent function.
When extracting a set of blocks make sure to inherit all of the target
dependent attributes to make sure that the function will be valid for
lowering. One example is the "target-features" attribute for x86, if the
extracted region has functionality that relies on a specific feature it
will fail to be lowered.
This also allows for extracted functions to be valid for inlining, at
least back into the parent function, as the target attributes are tested
when inlining for compatibility.

Patch by River Riddle!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277315 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 03:15:32 +00:00
Sean Silva
0f7cbe185c CodeExtractor : Add ability to preserve profile data.
Added ability to estimate the entry count of the extracted function and
the branch probabilities of the exit branches.

Patch by River Riddle!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277313 91177308-0d34-0410-b5e6-96231b3b80d8
2016-08-01 02:59:26 +00:00
Daniel Berlin
cdbca76b08 Fix the MemorySSA updating API to enable people to create memory accesses before removing old ones
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277309 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 21:08:20 +00:00
Craig Topper
d29f9a0db2 [X86] Simplify code for determing GR or FR reg classes by querying for super classes instead of manually listing individual classes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 20:20:08 +00:00
Craig Topper
4022678c7f [AVX512] Always use EVEX encodings for 128/256-bit move instructions in getLoadStoreRegOpcode if VLX is supported.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277305 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 20:20:05 +00:00
Craig Topper
f015e11376 [AVX512] Add VLX packed move instructions to the execution dependency fix pass and update tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277304 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 20:20:01 +00:00
Craig Topper
64e28736d1 [AVX512] Move FR32X/FR64X handling in getLoadStoreRegOpcode into the main switch. No functional change intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277303 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 20:19:55 +00:00
Craig Topper
b08f1f36a7 [AVX512] Stop treating VR512 specially in getLoadStoreRegOpcode and use the regular switch which already tried to handle it, but was unreachable. This has the added benefit of enabling aligned loads/stores if the stack is aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277302 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 20:19:53 +00:00
Craig Topper
7882ecba2d [AVX512] Add X86::VR512RegClassID to X86RegisterInfo::getLargestLegalSuperClass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277301 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 20:19:50 +00:00
Simon Pilgrim
bc139df3fe [X86] Improve 64-bit shifts on 32-bit targets (PR14593)
As discussed on PR14593, this patch adds support for lowering to SHLD/SHRD from the patterns generated by DAGTypeLegalizer::ExpandShiftWithKnownAmountBit.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277299 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 19:50:45 +00:00
David Majnemer
081d3f18a8 [COFF] Expose iterators for ImportAddressTableRVA
Patch by Bandzi Michal!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277298 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 19:40:02 +00:00
David Majnemer
e2fac43a5a [COFF] Remove a duplicate import_directory_table_entry definition
We had import_directory_table_entry and
coff_import_directory_table_entry, remove one.  Also, factor out the
logic which determins if a descriptor is a terminator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277296 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 19:25:21 +00:00
Craig Topper
ed98854bb4 [AVX-512] Don't let ExeDependencyFix pass convert VPANDD/Q to VPANDPS/PD unless DQI instructions are supported. Same for ANDN, OR, and XOR.
Thanks to Igor Breger for pointing out my mistake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277292 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 17:15:07 +00:00
Amjad Aboud
67b0099873 Fixed "copy-paste" mistake from revision 255245.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277290 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 14:41:50 +00:00
Elena Demikhovsky
d71fdd1359 AVX-512: Removed AssertZext node before TRUNCATE
Removed AssertZext node, which was inserted between X86ISD::SETCC and "truncate to i1".

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277289 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-31 06:48:01 +00:00
Davide Italiano
48f202f23f [HexagonConstPropagation] Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277285 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 22:07:21 +00:00
Davide Italiano
b9766783ad [HexagonBitSimplify] Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277284 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 22:07:18 +00:00
Davide Italiano
f796352534 [ARMConstantIslandPass] Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277283 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 22:07:15 +00:00
Simon Pilgrim
3575d762d7 Strip trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277280 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 20:53:21 +00:00
Simon Pilgrim
ffbeb40500 [X86] Use peekThroughOneUseBitcasts helper function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277279 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 20:51:26 +00:00
Simon Pilgrim
7ee24bd8b6 [X86][SSE] Let 64-bit targets use the fast 2i32-2f32 UINT_TO_FP conversion as well as 32-bit
The 2i32-2i64 legalization means that we can use the slightly quicker double bits + fptrunc approach for the same results



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277271 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 14:06:59 +00:00
Benjamin Kramer
90978a6b8f [Hexagon] Perform bit arithmetic on unsigned to avoid accidentally shifting negative values.
Found by ubsan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277268 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 13:25:37 +00:00
Benjamin Kramer
e4a63cb228 [X86] Fix lifetime of SMRange temporaries.
Found by asan -fsanitize-address-use-after-scope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277266 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 11:31:24 +00:00
Benjamin Kramer
7ed559c109 [AMDGPU] Fix lifetime of SmallVector temporaries.
Found by asan -fsanitize-address-use-after-scope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277265 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 11:31:16 +00:00
Matt Arsenault
4fd45ebabd AMDGPU: Fix shouldConvertConstantLoadToIntImm behavior
This should really be true for any immediate, not just
inline ones.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277260 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 01:40:36 +00:00
Matt Arsenault
40d057e621 AMDGPU: Set s_setpc_b64 as a terminator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277259 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 01:40:34 +00:00
Matt Arsenault
2ce8293945 AMDGPU: Remove unused pattern
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277258 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-30 01:40:30 +00:00
Weiming Zhao
7420263227 DAG: avoid duplicated truncating for sign extended operand
Summary:
When performing cmp for EQ/NE and the operand is sign extended, we can
avoid the truncaton if the bits to be tested are no less than origianl
bits.

Reviewers: eli.friedman

Subscribers: eli.friedman, aemerson, nemanjai, t.p.northover, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277252 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 23:33:48 +00:00
Tim Northover
d6e3a6564c GlobalISel: translate "unreachable" (into nothing)
Easiest instruction ever!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277225 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 22:41:55 +00:00
Tim Northover
0f15518dae GlobalISel: support translation of intrinsic calls.
These come in two variants for now: G_INTRINSIC and G_INTRINSIC_W_SIDE_EFFECTS.
We may decide to split the latter up with finer-grained restrictions later, if
necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277224 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 22:32:36 +00:00
Kevin Enderby
ebd83360ff Think this will fix issues with the error messages generated for malformed-archives.test
in r277177 and added back this test which was deleted in r277196 while
I tracked down these problems.

Changed from constructing Twine's to std::string's as Twine's don't work
across statements.  Also removed a few unneeded Twine() constructions.

Fix the write_escaped() calls to not pass the unintended second argument
fixing the warning on the ld-x86_64-win7 bot.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277223 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 22:32:02 +00:00
Krzysztof Parzyszek
33bf01e7cc [Hexagon] Referencify MachineInstr in HexagonInstrInfo, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277220 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 21:49:42 +00:00
Michael Kuperstein
53c51fa032 [X86] Match PSADBW in straight-line code
Up until now, we only had code to match PSADBW patterns that look like what
comes out of the loop vectorizer - a partial reduction inside the loop body
that gets fed into a horizontal operation in a different basic block.

This adds support for straight-line patterns, like those generated by the
SLP vectorizer.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277219 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 21:45:51 +00:00
Rui Ueyama
a8209f7b0e pdbdump: Dump Free Page Map contents.
Differential Revision: https://reviews.llvm.org/D22974

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277216 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 21:38:00 +00:00
Simon Pilgrim
6b00b5fe86 [X86][AVX] Fix VBROADCASTF128 selection bug (PR28770)
Support for lowering to VBROADCASTF128 etc. in D22460 was not correctly ensuring that the only users of the 128-bit vector load were the insertions of the vector into the lower/upper subvectors.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277214 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 21:05:10 +00:00
Zachary Turner
5e117855c3 [msf] Resubmit "Rename Msf -> MSF".
Previously this change was submitted from a Windows machine, so
changes made to the case of filenames and directory names did
not survive the commit, and as a result the CMake source file
names and the on-disk file names did not match on case-sensitive
file systems.

I'm resubmitting this patch from a Linux system, which hopefully
allows the case changes to make it through unfettered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277213 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 20:56:36 +00:00
Tim Northover
9c9955b41f CodeGen: add new "intrinsic" MachineOperand kind.
This will be used during GlobalISel, where we need a more robust and readable
way to write tests than a simple immediate ID.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277209 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 20:32:59 +00:00
Adam Nemet
c4f6d8cd25 [LoopUnroll] Include hotness of region in opt remark
LoopUnroll is a loop pass, so the analysis of OptimizationRemarkEmitter
is added to the common function analysis passes that loop passes
depend on.

The BFI and indirectly BPI used in this pass is computed lazily so no
overhead should be observed unless -pass-remarks-with-hotness is used.

This is how the patch affects the O3 pipeline:

         Dominator Tree Construction
         Natural Loop Information
         Canonicalize natural loops
         Loop-Closed SSA Form Pass
         Basic Alias Analysis (stateless AA impl)
         Function Alias Analysis Results
         Scalar Evolution Analysis
+        Lazy Branch Probability Analysis
+        Lazy Block Frequency Analysis
+        Optimization Remark Emitter
         Loop Pass Manager
           Rotate Loops
           Loop Invariant Code Motion
           Unswitch loops
         Simplify the CFG
         Dominator Tree Construction
         Basic Alias Analysis (stateless AA impl)
         Function Alias Analysis Results
         Combine redundant instructions
         Natural Loop Information
         Canonicalize natural loops
         Loop-Closed SSA Form Pass
         Scalar Evolution Analysis
+        Lazy Branch Probability Analysis
+        Lazy Block Frequency Analysis
+        Optimization Remark Emitter
         Loop Pass Manager
           Induction Variable Simplification
           Recognize loop idioms
           Delete dead loops
           Unroll loops
...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277203 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 19:29:47 +00:00
Simon Pilgrim
269530183d Fixed (incorrectly firing) MSVC unused variable warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277198 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:57:32 +00:00
David Majnemer
7e8508b6e6 [ConstantFolding] Handle bitcasts of undef fp vector elements
We used the wrong type for constructing a zero vector element which led
to type mismatches.

This fixes PR28771.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277197 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:48:27 +00:00
Simon Pilgrim
72b444d01e Fixed MSVC out of range shift warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277195 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:43:59 +00:00
Zachary Turner
85c3e3ee9c Revert "[msf] Rename Msf to MSF."
This reverts commit 4d1557ffac.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277194 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:38:47 +00:00
Zachary Turner
4d1557ffac [msf] Rename Msf to MSF.
In a previous patch, it was suggested to use all caps instead of
rolling caps for initialisms, so this patch changes everything
to do this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277190 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:24:26 +00:00
Andrew Kaylor
2f75f99d2f Recommitting r275284: add support to inline __builtin_mempcpy
Patch by Sunita Marathe

Third try, now following fixes to MSan to handle mempcy in such a way that this commit won't break the MSan buildbots. (Thanks, Evegenii!)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277189 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:23:18 +00:00
Tim Northover
bbdb447778 GlobalISel: make translate* functions take the most specialized class possible.
NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277188 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:11:21 +00:00
Kyle Butt
9f1f15e084 Codegen: MachineBlockPlacement Improve probability layout.
The following pattern was being layed out poorly:

              A
             / \
            B   C
           / \ / \
          D   E   ? (Doesn't matter)

Where A->B is far more likely than A->C, and prob(B->D) = prob(B->E)

The current algorithm gives:
A,B,C,E (D goes on worklist)

It does this even if C has a frequency count of 0. This patch
adjusts the layout calculation so that if freq(B->E) >> freq(C->E)
then we go ahead and layout E rather than C. Fallthrough half the time
is better than fallthrough never, or fallthrough very rarely. The
resulting layout is:

A,B,E, (C and D are in a worklist)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277187 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 18:09:28 +00:00
Tim Northover
57c3cc8560 GlobalISel: add generic conditional branch.
Just the basic equivalent to DAG's condbr for now, we'll get to things like
br_cc when we start doing more legalization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277184 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 17:58:00 +00:00
Krzysztof Parzyszek
227b764c52 Revert r277178, the actual change had already been applied
Will submit another patch with the testcase only.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277180 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 17:50:47 +00:00
Krzysztof Parzyszek
36b1b46f1c [Hexagon] Misaligned loads and stores are not fast
The DAG combiner tries to merge stores to adjacent vector wide memory
locations by creating stores which are integral multiples of the vector
width. Discourage this by informing it that this is slow. This should
not affect legalization passes, because all of them ignore the "Fast"
argument.

Patch by Pranav Bhandarkar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277178 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 17:45:16 +00:00
Kevin Enderby
2a7151766d The next step along the way to getting good error messages for bad archives.
As mentioned in commit log for r276686 this next step is adding a new
method in the ArchiveMemberHeader class to get the full name that
does proper error checking, and can be use for error messages.

To do this the name of ArchiveMemberHeader::getName() is changed to
ArchiveMemberHeader::getRawName() to be consistent with
Archive::Child::getRawName().  Then the “new” method is the addition
of a new implementation of ArchiveMemberHeader::getName() which gets
the full name and provides proper error checking.  Which is mostly a rewrite
of what was Archive::Child::getName() and cleaning up incorrect uses of
llvm_unreachable() in the code which were actually just cases of errors
in the input Archives.

Then Archive::Child::getName() is changed to return Expected<> and use
the new implementation of ArchiveMemberHeader::getName() .

Also needed to change Archive::getMemoryBufferRef() with these
changes to return Expected<> as well to propagate Errors up.
As well as changing Archive::isThinMember() to return Expected<> .


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277177 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 17:44:13 +00:00
Tim Northover
0c332fd272 CodeGen: improve MachineInstrBuilder & MachineIRBuilder interface
For MachineInstrBuilder, having to manually use RegState::Define is ugly and
makes register definitions clunkier than they need to be, so this adds two
convenience functions: addDef and addUse.

For MachineIRBuilder, we want to avoid BuildMI's first-reg-is-def rule because
it's hidden away and causes bugs. So this patch switches buildInstr to
returning a MachineInstrBuilder and adding *all* operands via addDef/addUse.

NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277176 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 17:43:52 +00:00
Ahmed Bougacha
a4174a215c [AArch64][GlobalISel] Select G_XOR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277173 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 16:56:25 +00:00
Ahmed Bougacha
d8a8826830 [GlobalISel] Add G_XOR.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277172 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 16:56:20 +00:00
Ahmed Bougacha
8d4e8d2a52 [AArch64][GlobalISel] Select G_LOAD/G_STORE.
Mostly straightforward as we ignore addressing modes and just
use the base + unsigned immediate offset (always 0) variants.

This currently fails to select extloads because we have yet to
agree on a representation.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277171 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 16:56:16 +00:00
Brendon Cahoon
c1359c9fbb MachinePipeliner pass that implements Swing Modulo Scheduling
Software pipelining is an optimization for improving ILP by
overlapping loop iterations. Swing Modulo Scheduling (SMS) is
an implementation of software pipelining that attempts to
reduce register pressure and generate efficient pipelines with
a low compile-time cost.

This implementaion of SMS is a target-independent back-end pass.
When enabled, the pass should run just prior to the register
allocation pass, while the machine IR is in SSA form. If the pass
is successful, then the original loop is replaced by the optimized
loop. The optimized loop contains one or more prolog blocks, the
pipelined kernel, and one or more epilog blocks.

This pass is enabled for Hexagon only. To enable for other targets,
a couple of target specific hooks must be implemented, and the
pass needs to be called from the target's TargetMachine
implementation.

Differential Review: http://reviews.llvm.org/D16829


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277169 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 16:44:44 +00:00
Krzysztof Parzyszek
a6ad276d07 [Hexagon] Custom lower VECTOR_SHUFFLE and EXTRACT_SUBVECTOR for HVX
If the mask of a vector shuffle has alternating odd or even numbers
starting with 1 or 0 respectively up to the largest possible index
for the given type in the given HVX mode (single of double) we can
generate vpacko or vpacke instruction respectively.

E.g.
  %42 = shufflevector <32 x i16> %37, <32 x i16> %41,
                      <32 x i32> <i32 1, i32 3, ..., i32 63>
  is %42.h = vpacko(%41.w, %37.w)

Patch by Pranav Bhandarkar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277168 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 16:44:27 +00:00
Matt Masten
bbbcccbfc4 Initial support for vectorization using svml (short vector math library).
Differential Revision: https://reviews.llvm.org/D19544


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277166 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 16:42:44 +00:00
Krzysztof Parzyszek
1f44345f2c [Hexagon] Improve balancing of address calculation
Rebalances address calculation trees and applies Hexagon-specific
optimizations to the trees to improve instruction selection.

Patch by Tobias Edler von Koch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277151 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 15:15:35 +00:00
David L Kreitzer
af3f28bc66 Avoid unnecessary 32-bit to 64-bit zero extensions following
32-bit CMOV instructions on x86_64. The 32-bit CMOV implicitly
zero extends.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277148 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 15:09:54 +00:00
Nirav Dave
9167c0e6d7 [MC] When emitting output hash comments always use standard line comment seperator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277146 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 14:42:00 +00:00
Krzysztof Parzyszek
ee2728bb0c Fix license information in the file header
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277145 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 14:04:17 +00:00
Krzysztof Parzyszek
6b032c682c Add missing files to r277143
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277144 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 13:59:55 +00:00
Krzysztof Parzyszek
4f328be3df [Hexagon] Implement DFA based hazard recognizer
The post register allocator scheduler can generate poor schedules
because the scoreboard hazard recognizer is unable to identify
hazards for Hexagon precisely. Instead, Hexagon should use a DFA
based hazard recognizer.

Patch by Brendon Cahoon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277143 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 13:59:09 +00:00
Daniel Sanders
e2a16fdce2 Re-commit: [mips][fastisel] Handle 0-4 arguments without SelectionDAG.
Summary:
Implements fastLowerArguments() to avoid the need to fall back on
SelectionDAG for 0-4 argument functions that don't do tricky things like
passing double in a pair of i32's.

This allows us to move all except one test to -fast-isel-abort=3. The
remaining one has function prototypes of the form 'i32 (i32, double, double)'
which requires floats to be passed in GPR's.

The previous commit had an uninitialized variable that caused the incoming
argument region to have undefined size. This has been fixed.

Reviewers: sdardis

Subscribers: dsanders, llvm-commits, sdardis

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277136 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 12:27:28 +00:00
Nirav Dave
5b7959028f Cleanup TransferDbgValues
[DAG] Check debug values for invalidation before transferring and mark
old debug values invalid when transferring to another SDValue.

This fixes PR28613.

Reviewers: jyknight, hans, dblaikie, echristo

Subscribers: yaron.keren, ismail, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277135 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 11:49:32 +00:00
Simon Pilgrim
e6abaac391 [X86][SSE] Optimize the truncation of vector comparison results with PACKSS
We currently default to using either generic shuffles or MASK+PACKUS/PACKSS to truncate all integer vectors. For vector comparisons, we know that the result will be either all or zero bits in every element, which can be efficiently truncated by directly using PACKSS to repeatedly halve the size of each element.

Due to the limited input values (-1 or 0) we don't need to account for vector element size, so for simplicity we just use the PACKSS(vXi16,vXi16) implementation in all cases. Additionally for AVX2 PACKSS of 256bit data we must perform a PERMQ shuffle to reorder the data into the correct order. I did investigate performing a single shuffle after all the PACKSS calls but the need to cross 128bit lanes makes this difficult to achieve efficiently.

We avoid performing this on AVX512 as it should have better alternative truncation instructions.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277132 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 10:23:10 +00:00
Simon Pilgrim
bf172ec934 Fixed MSVC out of range shift warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277130 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 10:03:39 +00:00
Sjoerd Meijer
7d72920df2 Fix for commit rL277126 that broke a build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277129 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 09:57:37 +00:00
Prakhar Bahuguna
322f342e82 [Thumb] Emit Thumb move in both Thumb modes for struct_byval predicates
Summary:
The MOV/MOVT instructions being chosen for struct_byval predicates was
conditional only on Thumb2, resulting in an ARM MOV/MOVT instruction
being incorrectly emitted in Thumb1 mode. This is especially apparent
with v8-m.base targets. This patch ensures that Thumb instructions are
emitted in both Thumb modes.

Reviewers: rengolin, t.p.northover

Subscribers: llvm-commits, aemerson, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277128 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 09:16:46 +00:00
Jacques Pienaar
3b7839bf54 [lanai] Update for Target API (TargetRegistry::RegisterMCAsmBackend) change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277127 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 08:50:23 +00:00
Sjoerd Meijer
c46479857e TargetInstrInfo: add virtual function getInstSizeInBytes
This adds a target hook getInstSizeInBytes to TargetInstrInfo that a lot of
subclasses already implement.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277126 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 08:16:16 +00:00
Craig Topper
f7938da3bf [AVX512] Mark EVEX VMOVSSrm and VMOVSDrm as canFoldAsLoad and isReMaterializable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277120 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 06:06:04 +00:00
Craig Topper
8e82677ab6 [AVX512] Copy the patterns that recognize scalar arimetic operations inserting into the lower element of a packed vector from AVX/SSE so that we can use EVEX encoded instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277119 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 06:06:00 +00:00
David Majnemer
b9ddc3df47 [EarlyCSE] Correctly handle simplified, but live, instructions
Some instructions may have their uses replaced with a symbolic constant.
However, the instruction may still have side effects which percludes it
from being removed from the function.  EarlyCSE treated such an
instruction as if it were removed, resulting in PR28763.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@277114 91177308-0d34-0410-b5e6-96231b3b80d8
2016-07-29 05:39:21 +00:00