Commit Graph

127958 Commits

Author SHA1 Message Date
Benjamin Kramer
c377b3ca43 [LVI] Move ConstantRanges instead of copying.
No functional change intended. Copying small (<= 64 bits) APInts isn't
expensive but bloats code by generating the slow path everywhere. Moving
doesn't care about the size of the value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261426 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 10:40:34 +00:00
David Majnemer
92a8732c27 Move some code from doInitialization to runOnFunction
This has no observable behavior change, it just makes the state
insertion pass look a little more like normal passes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261420 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 07:34:21 +00:00
Craig Topper
f150810c18 [X86] Remove some unused encoding checks from the disassembler table building.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261418 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 06:20:21 +00:00
Craig Topper
b9e9ffa3b0 [X86] Add some missing reversed forms of XOP instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261417 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 06:20:17 +00:00
Chandler Carruth
3b19409119 [PM/AA] Wire up TBAA to the new pass manager's registry and test it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261411 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 04:04:52 +00:00
Chandler Carruth
580e466253 [PM/AA] Wire up the scoped-no-alias AA to the new pass manager's
registry and test it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261410 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 04:03:06 +00:00
Chandler Carruth
10ab5d9cac [PM/AA] Wire up SCEVAA to the new pass manager's registry and test it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261409 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 04:01:45 +00:00
Matthias Braun
3883deb9ef MachineCopyPropagation: Introduce Reg2MIMap typedef; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261408 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:56:41 +00:00
Matthias Braun
4f08db2396 MachineCopyPropagation: Move variables from function to pass
This avoids unnecessarily passing them around when calling helper
functions. It may also be slightly faster to call clear() on the
datastructures instead of freshly initializing them for each block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261407 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:56:39 +00:00
Matthias Braun
4d44c95a15 MachineCopyPropagation: Use ranged for, cleanup; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261406 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:56:36 +00:00
Matthias Braun
7975e02298 MachineCopyPropagation: Use assert() instead of if{report_error()} for 'impossible' condition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261405 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:56:33 +00:00
Chandler Carruth
10d9c2cec2 [PM/AA] Wire up CFLAA to the new pass manager fully, and port one of its
tests over to exercise this code.

This uncovered a few missing bits here and there in the analysis, but
nothing interesting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261404 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:52:02 +00:00
Chandler Carruth
89a08aa76a [PM/AA] Port alias analysis evaluator to the new pass manager, and use
it to actually test the new pass manager AA wiring.

This patch was extracted from the (somewhat too large) D12357 and
rebosed on top of the slightly different design of the new pass manager
AA wiring that I just landed. With this we can start testing the AA in
a thorough way with the new pass manager.

Some minor cleanups to the code in the pass was necessitated here, but
otherwise it is a very minimal change.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261403 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 03:46:03 +00:00
Mike Aizatsky
6e95686683 fixing msvc warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261396 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 02:11:49 +00:00
Sanjoy Das
3deef964da [SCEV] Don't spell SCEV * variables as Scev; NFC
I missed a spot in rL261393.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261395 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 01:59:15 +00:00
Sanjoy Das
2ed41bce79 [SCEV] Don't spell SCEV * variables as Scev; NFC
It reads odd since most other places name a `SCEV *` as `S`.  Pure
renaming change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261393 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 01:44:10 +00:00
Sanjoy Das
8736e2205d [SCEV] Don't use std::make_pair; NFC
`{A, B}` reads cleaner than `std::make_pair(A, B)`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261392 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 01:35:56 +00:00
David Majnemer
1f296bf0b8 [SimplifyCFG] Merge together cleanuppads
Cleanuppads may be merged together if one is the only predecessor of the
other in which case a simple transform can be performed: replace the
a cleanupret with a branch and remove an unnecessary cleanuppad.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261390 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 01:07:45 +00:00
Davide Italiano
7ed6f01c5d [X86ISelLowering] Fix TLSADDR lowering when shrink-wrapping is enabled.
TLSADDR nodes are lowered into actuall calls inside MC. In order to prevent
shrink-wrapping from pushing prologue/epilogue past them (which result
in TLS variables being accessed before the stack frame is set up), we 
put markers, so that the stack gets adjusted properly.
Thanks to Quentin Colombet for guidance/help on how to fix this problem!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261387 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 00:44:47 +00:00
Tom Stellard
090553bea6 AMDGPU/SI: Use v_readfirstlane to legalize SMRD with VGPR base pointer
Summary:
Instead of trying to replace SMRD instructions with a VGPR base pointer
with an equivalent MUBUF instruction, we now copy the base pointer to
SGPRs using v_readfirstlane.

This is safe to do, because any load selected as an SMRD instruction
has been proven to have a uniform base pointer, so each thread in the
wave will have the same pointer value in VGPRs.

This will fix some errors on VI from trying to replace SMRD instructions
with addr64-enabled MUBUF instructions that don't exist.

Reviewers: arsenm, cfang, nhaehnle

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261385 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 00:37:25 +00:00
Quentin Colombet
8e5d9d27a5 [RegAllocFast] Properly track the physical register definitions on calls.
PR26485


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261384 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-20 00:32:29 +00:00
Reid Kleckner
ac038d9c24 [codeview] Fix emission of file changes in inline line tables
These are supposed to be file checksum table offsets, not file ids.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261379 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 23:55:38 +00:00
Mike Aizatsky
78fadfc347 [sancov] sanitizer html report cosmetic improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261375 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 22:55:08 +00:00
Davide Italiano
de72bf5c21 [X86ISelLowering] Provide a more informative assert message.
I stumbled upon this while debugging a lowering bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261371 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 22:18:49 +00:00
Davide Italiano
1d49a01300 [X86ISelLowering] Merge two conditions inside a single if.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261370 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 22:01:07 +00:00
Hans Wennborg
1836552368 Revert r255691 "[LoopVectorizer] Refine loop vectorizer's register usage calculator by ignoring specific instructions."
It caused PR26509.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261368 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 21:40:12 +00:00
Hans Wennborg
dfd6975254 Revert r253557 "Alternative to long nops for X86 CPUs, by Andrey Turetsky"
Turns out the new nop sequences aren't actually nops on x86_64 (PR26554).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261365 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 21:26:31 +00:00
David Blaikie
ff94d6e4ff llvm-dwp: Improve performance (N^2 to amortized N) by using a MapVector instead of linear searches through a vector
Figured this would be a problem, but didn't want to jump the gun - large
inputs demonstrate it pretty easily (mostly for type units, but might as
well do the same for CUs too). A random sample 6m27s -> 27s change.

Also, by checking this up-front for CUs (rather than when building the
cu_index) we can probably provide better error messages (see FIXMEs),
hopefully providing the name of the CUs rather than just their
signature.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261364 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 21:09:26 +00:00
Dimitry Andric
af4a98fed6 Fix incorrect selection of AVX512 sqrt when OptForSize is on
Summary:
When optimizing for size, sqrt calls can be incorrectly selected as
AVX512 VSQRT instructions.  This is because X86InstrAVX512.td has a
`Requires<[OptForSize]>` in its `avx512_sqrt_scalar` multiclass
definition.  Even if the target does not support AVX512, the class can
apparently still be chosen, leading to an incorrect selection of
`vsqrtss`.

In PR26625, this lead to an assertion: Reg >= X86::FP0 && Reg <=
X86::FP6 && "Expected FP register!", because the `vsqrtss` instruction
requires an XMM register, which is not available on i686 CPUs.

Reviewers: grosbach, resistor, joker.eph

Subscribers: spatel, emaste, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261360 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 20:14:11 +00:00
Sanjoy Das
8ba7696b97 [StatepointLowering] Minor non-semantic cleanups
Use auto, bring file up to coding standards etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261358 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 19:37:07 +00:00
Dan Gohman
1b96a6c875 [WebAssembly] Add another optimization idea to README.txt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261354 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 19:22:44 +00:00
Geoff Berry
bc147ab945 [AArch64][ShrinkWrap] Fix bug in prolog clobbering live reg when shrink wrapping.
Summary: See bug https://llvm.org/bugs/show_bug.cgi?id=26642

Reviewers: qcolombet, t.p.northover

Subscribers: aemerson, rengolin, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261349 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 18:27:32 +00:00
Sanjoy Das
5a8841daf3 [StatepointLowering] Update StatepointMaxSlotsRequired correctly
Now that we don't always add an element to AllocatedStackSlots if we
don't find a pre-existing unallocated stack slot, bumping
StatepointMaxSlotsRequired to `NumSlots + 1` is not correct.  Instead
bump the statistic near the push_back, to
Builder.FuncInfo.StatepointStackSlots.size().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261348 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 18:15:56 +00:00
Sanjoy Das
2ad23171bd [StatepointLowering] Fix a mistake in rL261336
The check on MFI->getObjectSize() has to be on the FrameIndex, not on
the index of the FrameIndex in AllocatedStackSlots.  Weirdly, the tests
I added in rL261336 didn't catch this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261347 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 18:15:53 +00:00
Matthew Simpson
3dd74513a8 [LV] Vectorize first-order recurrences
This patch enables the vectorization of first-order recurrences. A first-order
recurrence is a non-reduction recurrence relation in which the value of the
recurrence in the current loop iteration equals a value defined in the previous
iteration. The load PRE of the GVN pass often creates these recurrences by
hoisting loads from within loops.

In this patch, we add a new recurrence kind for first-order phi nodes and
attempt to vectorize them if possible. Vectorization is performed by shuffling
the values for the current and previous iterations. The vectorization cost
estimate is updated to account for the added shuffle instruction.

Contributed-by: Matthew Simpson and Chad Rosier <mcrosier@codeaurora.org>
Differential Revision: http://reviews.llvm.org/D16197

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261346 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 17:56:08 +00:00
Sanjoy Das
d3b66593b0 [StatepointLowering] Change AllocatedStackSlots to use SmallBitVector
NFCI.  They key motivation here is that I'd like to use
SmallBitVector::all() in a later change.  Also, using a bit vector here
seemed better in general.

The only interesting change here is that in the failure case of
allocateStackSlot, we no longer (the equivalent of) push_back(true) to
AllocatedStackSlots.  As far as I can tell, this is fine, since we'd
never re-use those slots in the same StatepointLoweringState instance.

Technically there was no need to change the operator[] type accesses to
set() and test(), but I thought it'd be nice to make it obvious that
we're using something other than a std::vector like thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261337 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 17:15:26 +00:00
Sanjoy Das
fffaef16a2 [StatepointLowering] Fix bug in allocateStackSlot
allocateStackSlot did not consider the size of the value to be spilled
before deciding to re-use a spill slot.  This was originally okay (since
originally we'd only ever spill pointers), but it became not okay when
we changed our scheme to directly spill vectors of pointers.

While this change fixes the bug pointed out, it has two performance
caveats:

 - It matches spill slot and spillee size exactly, while in theory we
   can spill, e.g., an 8 byte pointer into a 16 byte slot.  This is
   slightly complicated to fix since in the stackmaps section, we report
   the size of the spill slot as the size of the "indirect value"; and
   if they're no longer equivalent, we'll have to keep track of the
   (indirect) value size separately from the stack slot size.

 - It will "spuriously run out" of reusable slots, since we now have an
   second check in the search loop in addition to the availablity
   check (e.g. you had two free scalar slots, and you first ask for a
   vector slot followed by a scalar slot).  I'll fix this in a later
   commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261336 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 17:15:22 +00:00
Sanjoy Das
f08995153b [StatepointLowering] Clean up allocateStackSlot
This removes the unusual loop structure in allocateStackSlot in favor of
something more straightforward.  I've also removed the cautionary
comment in the function, which I suspect is historical cruft now, and
confuses more than it enlightens.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261335 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 17:15:17 +00:00
Kevin B. Smith
ffe13b0d29 [X86] Change fixup-bw-inst.ll to test output with this optimization on and off.
Differential Revision: http://reviews.llvm.org/D17415


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261332 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 16:20:48 +00:00
Silviu Baranga
865db3895b [LV] Fix PR26600: avoid out of bounds loads for interleaved access vectorization
Summary:
If we don't have the first and last access of an interleaved load group,
the first and last wide load in the loop can do an out of bounds
access. Even though we discard results from speculative loads,
this can cause problems, since it can technically generate page faults
(or worse).

We now discard interleaved load groups that don't have the first and
load in the group.

Reviewers: hfinkel, rengolin

Subscribers: rengolin, llvm-commits, mzolotukhin, anemet

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261331 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 15:46:10 +00:00
Tom Stellard
aced110517 AMDGPU/SI: Fix s_waitcnt insertion for flat instructions
Summary:
This was broken in r260694 which swapped the address and data operands
for flat store instructions.  The code in SIInsertWaits assumes
that the data operand always comes before the address operand, so
we need to add a special case for flat.

Reviewers: arsenm

Subscribers: arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261330 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 15:33:13 +00:00
Simon Pilgrim
38c5292f83 [X86][AVX] Added fast-isel intrinsics tests
As discussed on PR24580, this patch adds some (more to come) initial fast-isel codegen tests to match the IR generated in clang/test/CodeGen/avx-builtins.c

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261329 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 14:38:09 +00:00
Rafael Espindola
3e185f6a14 Add support for merging strings with alignment larger than one char.
This will be used in a lld patch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261326 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 14:13:52 +00:00
Ulrich Weigand
c80aad901b [SystemZ] Fix ABI for i128 argument and return types
According to the SystemZ ABI, 128-bit integer types should be
passed and returned via implicit reference.  However, this is
not currently implemented at the LLVM IR level for the i128
type.  This does not matter when compiling C/C++ code, since
clang will implement the implicit reference itself.

However, it turns out that when calling libgcc helper routines
operating on 128-bit integers, LLVM will use i128 argument and
return value types; the resulting code is not compatible with
the ABI used in libgcc, leading to crashes (see PR26559).

This should be simple to fix, except that i128 currently is not
even a legal type for the SystemZ back end.  Therefore, common
code will already split arguments and return values into multiple
parts.  The bulk of this patch therefore consists of detecting
such parts, and correctly handling passing via implicit reference
of a value split into multiple parts.  If at some time in the
future, i128 becomes a legal type, this code can be removed again.

This fixes PR26559.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261325 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 14:10:21 +00:00
Chandler Carruth
fe6345c537 [LPM] Document the new helpers to make it easy to get consistent require
and preserve behavior from loop passes.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261319 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 10:59:43 +00:00
Chandler Carruth
eca46e623a [LPM] Factor all of the loop analysis usage updates into a common helper
routine.

We were getting this wrong in small ways and generally being very
inconsistent about it across loop passes. Instead, let's have a common
place where we do this. One minor downside is that this will require
some analyses like SCEV in more places than they are strictly needed.
However, this seems benign as these analyses are complete no-ops, and
without this consistency we can in many cases end up with the legacy
pass manager scheduling deciding to split up a loop pass pipeline in
order to run the function analysis half-way through. It is very, very
annoying to fix these without just being very pedantic across the board.

The only loop passes I've not updated here are ones that use
AU.setPreservesAll() such as IVUsers (an analysis) and the pass printer.
They seemed less relevant.

With this patch, almost all of the problems in PR24804 around loop pass
pipelines are fixed. The one remaining issue is that we run simplify-cfg
and instcombine in the middle of the loop pass pipeline. We've recently
added some loop variants of these passes that would seem substantially
cleaner to use, but this at least gets us much closer to the previous
state. Notably, the seven loop pass managers is down to three.

I've not updated the loop passes using LoopAccessAnalysis because that
analysis hasn't been fully wired into LoopSimplify/LCSSA, and it isn't
clear that those transforms want to support those forms anyways. They
all run late anyways, so this is harmless. Similarly, LSR is left alone
because it already carefully manages its forms and doesn't need to get
fused into a single loop pass manager with a bunch of other loop passes.

LoopReroll didn't use loop simplified form previously, and I've updated
the test case to match the trivially different output.

Finally, I've also factored all the pass initialization for the passes
that use this technique as well, so that should be done regularly and
reliably.

Thanks to James for the help reviewing and thinking about this stuff,
and Ben for help thinking about it as well!

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261316 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 10:45:18 +00:00
Craig Topper
1458b1471a [X86] Remove unused entries from the disassembler type enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261311 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 06:57:40 +00:00
David Majnemer
be78872b7a Shuffle header file as per the Coding Standards
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261308 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 04:46:48 +00:00
David Majnemer
ff574052f7 [SjLjEHPrepare] Simplify/cleanup code
No functional change is intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261307 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 04:46:06 +00:00
Matthias Braun
4f298ff508 LegalizeDAG: Fix ExpandFCOPYSIGN assuming the same type on both inputs
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261306 91177308-0d34-0410-b5e6-96231b3b80d8
2016-02-19 04:44:19 +00:00