Commit Graph

98589 Commits

Author SHA1 Message Date
Juergen Ributzka
aaecc0fc08 [Stackmap] Liveness Analysis Pass
This optional register liveness analysis pass can be enabled with either
-enable-stackmap-liveness, -enable-patchpoint-liveness, or both. The pass
traverses each basic block in a machine function. For each basic block the
instructions are processed in reversed order and if a patchpoint or stackmap
instruction is encountered the current live-out register set is encoded as a
register mask and attached to the instruction.

Later on during stackmap generation the live-out register mask is processed and
also emitted as part of the stackmap.

This information is optional and intended for optimization purposes only. This
will enable a client of the stackmap to reason about the registers it can use
and which registers need to be preserved.

Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197317 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:53:06 +00:00
Juergen Ributzka
cdeccb0c22 [Stackmap] Only the AnyReg calling convention should preserve all registers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197316 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:52:59 +00:00
Juergen Ributzka
57c38e3faa Convert register liveness tracking to work on a sub-register level instead of just register units.
Reviewed by Andy

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197315 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:52:56 +00:00
Rafael Espindola
f562e09c9f Refactor NVPTX's computeDataLayout.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197312 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:42:48 +00:00
Rafael Espindola
1d9c819c28 Turn NVPTXSubtarget::getDataLayout into a static function.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197311 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:36:30 +00:00
Rafael Espindola
ff0b475d92 Turn AMDGPUSubtarget::getDataLayout into a static function.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197310 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 06:13:44 +00:00
Michael Gottesman
523823b897 [block-freq] Rename getEntryFrequency() -> getEntryFreq() to match getBlockFreq() in all *BlockFrequencyInfo*.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197304 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 02:37:38 +00:00
Michael Gottesman
b68ca3e9c5 [block-freq] Teach branch probability how to return the edge weight in between a BasicBlock and one of its successors.
IMHO At some point BasicBlock should be refactored along the lines of
MachineBasicBlock so that successors/weights are actually embedded within the
block. Now is not that time though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197303 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 02:24:25 +00:00
Michael Gottesman
1b98ef1c19 [block-freq] Add a right shift to BlockFrequency that saturates at 1.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197302 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 02:24:22 +00:00
Michael Gottesman
7cc5f793bc [block-freq] Remove old BlockFrequency entry frequency and printing code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197297 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:57:18 +00:00
Michael Gottesman
f392e88e18 [block-freq] Refactor LiveInterals::getSpillWeight to use the new MachineBlockFrequencyInfo methods.
This is slightly more interesting than the previous batch of changes.
Specifically:

1. We refactor getSpillWeight to take a MachineBlockFrequencyInfo (MBFI)
object. This enables us to completely encapsulate the actual manner we
use the MachineBlockFrequencyInfo to get our spill weights. This yields
cleaner code since one does not need to fetch the actual block frequency
before getting the spill weight if all one wants it the spill weight. It
also gives us access to entry frequency which we need for our
computation.

2. Instead of having getSpillWeight take a MachineBasicBlock (as one
might think) to look up the block frequency via the MBFI object, we
instead take in a MachineInstr object. The reason for this is that the
method is supposed to return the spill weight for an instruction
according to the comments around the function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197296 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:53:32 +00:00
Matt Arsenault
530c0b8862 R600/SI: Minor improvements to test.
Use CHECK-LABEL, add an i64 version, check store instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197293 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:38:04 +00:00
Matt Arsenault
1e80bef896 Teach MemoryBuiltins about address spaces
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197292 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:27:48 +00:00
Michael Gottesman
1a938c2beb [block-freq] Store MBFI as a field on SpillPlacement so we can access it to get the entry frequency while processing data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197291 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:25:47 +00:00
Michael Gottesman
c1b4dfd345 [block-freq] Update MachineBlockPlacement and RegAllocGreedy to use the new MachineBlockFrequencyInfo methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197290 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:25:45 +00:00
Michael Gottesman
b8c5cfb130 [block-freq] Update BlockFrequencyInfo/MachineBlockFrequencyInfo to use the new print methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197289 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:25:42 +00:00
Matt Arsenault
9bd42e3fab Print the address space of a MachineMemOperand
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197288 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:24:02 +00:00
Michael Gottesman
a73959a988 [block-freq] Add the equivalent methods to MachineBlockFrequencyInfo and BlockFrequencyInfo that were added to BlockFrequencyImpl in r197285 and r197284.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197287 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:06:03 +00:00
Michael Gottesman
d443867089 [block-freq] Convert BlockFrequencyImpl to use the new printing functionality from r197285.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197286 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-14 00:05:59 +00:00
Michael Gottesman
5efbda1437 [block-freq] Add a print method on BlockFrequencyImpl for printing block frequencies and a convenience method for the common case of getting/printing a basic block.
BlockFrequencies can only be printed relative to their entry frequency. Thus
since the entry frequency is no longer necessarily a static constant on the
BlockFrequency class and is instead a potentially dynamic value taken from
BlockFrequencyImpl, we must necessarily print it via a method on
BlockFrequencyImpl.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197285 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 23:59:44 +00:00
Michael Gottesman
ccf34d2295 [block-freq] Begin move of BlockFrequency::EntryFreq -> BlockFrequencyImpl::EntryFreq.
This is a property associated with a function, not with BlockFrequency data.
Additionally it loosens the artifical requirement that the entry frequency
arbitrarily be the same for every function.

There is a series of patches forthcoming updating various code that uses the old
way of getting a block frequency to the new location.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197284 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 23:44:36 +00:00
Rafael Espindola
5e7d241791 Pointer sizes are stored in Bytes. Fix variables names to say so.
Also update for the current naming style.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197283 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 23:15:20 +00:00
Kevin Enderby
303a00ec48 Fixed a bug in getARMFixupKindMachOInfo() where three ARM fixup kinds
were falling into the cases for 24-bit branch kinds which are not 24-bit
branches.  The routine is to return false for fixups are expected to always
be resolvable at assembly time. Which these three fixups are as they have
limited displacement and are for local references within a function.

rdar://15586725


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197282 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 22:46:54 +00:00
Andrew Trick
e670304f64 comment typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197278 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 22:23:54 +00:00
Michael Gottesman
cadf450e17 Remove APInt::extractBit since it is already implemented via operator[]. Change tests for extractBit to test operator[].
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197277 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 22:00:19 +00:00
David Blaikie
5c9e0e52da DebugInfo: Move type units into the debug_types section with appropriate comdat grouping and type unit headers
This commit does not complete the type units feature - there are issues
around fission support (skeletal type units, pubtypes/pubnames) and
hashing of some types including those containing references to types in
other type units.

Originally committed as r197073 and reverted in r197079.
Recommitted as r197197 to reproduce the failure and reverted as r197199

Turns out there was unstable ordering in the type unit dumping code.
Fixed by using MapVector in DWARFContext to store the debug_types
comdat sections.

Recommitted as r197210 with a fix to dumping and reverted as r197211
because I was a bit gun shy and thought I saw a failure that turned out
to be unrelated.

So here we go - once more with feeling! \o/

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197275 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 21:33:40 +00:00
Michael Gottesman
46f829ee25 [block-freq] Add the method APInt::nearestLogBase2().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197272 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 20:47:37 +00:00
Michael Gottesman
5bb504f4ea [block-freq] Add the APInt method extractBit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197271 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 20:47:34 +00:00
Andrew Trick
a23bd2e761 Revert "Convert liveness tracking to work on a sub-register level instead of just register units."
This reverts commit r197253.

This was a great change, but Juergen should be the commit author.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197262 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 19:04:08 +00:00
Andrew Trick
38c9ecda9b Revert "Liveness Analysis Pass"
This reverts commit r197254.

This was an accidental merge of Juergen's patch. It will be checked in
shortly, but wasn't meant to go in quite yet.

Conflicts:
	include/llvm/CodeGen/StackMaps.h
	lib/CodeGen/StackMaps.cpp
	test/CodeGen/X86/stackmap-liveness.ll

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197260 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 18:57:20 +00:00
Rafael Espindola
f343bc9956 Use a: and s: instead of a0: and s0: in the DataLayout strings.
They are equivalent and the size of 'a' and 's' is unused.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197259 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 18:56:34 +00:00
Andrew Trick
cd8314d63c Grow the stackmap/patchpoint format to hold 64-bit IDs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197255 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 18:37:10 +00:00
Andrew Trick
539e93120c Liveness Analysis Pass
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197254 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 18:37:03 +00:00
Andrew Trick
edf1070ca7 Convert liveness tracking to work on a sub-register level instead of just register units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 18:36:56 +00:00
Chad Rosier
513a00db78 [AArch64] Simplify the Neon Scalar3Same patterns for floating-point reciprocal
step, floating-point reciprocal square root step, floating-point absolute
difference, and integer/floating-point compare instructions.  Also, move the
scalar general arithmetic operation patterns closer to similar code.  No
functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 17:56:44 +00:00
Rafael Espindola
48c2927021 Assume defaults to produce smaller datalayout strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197249 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 17:56:11 +00:00
Rafael Espindola
7b3aa0356d Fix pr18235.
The cpp backend is not a reasonable fallback for a missing target. It is a
very special backend, so it is reasonable to use it only if explicitly
requested.

While at it, simplify the interface a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197241 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 16:05:32 +00:00
Richard Sandiford
584940e3c6 [SystemZ] Optimize X [!=]= Y in cases where X - Y or Y - X is also computed
In those cases it's better to compare the result of the subtraction
against zero.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197239 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 15:50:30 +00:00
Richard Sandiford
5f65b24e4d [SystemZ] Make more use of TMHH
This originally came about after noticing that InstCombine turns
some of the TMHH (icmp (and...), ...) tests into plain comparisons.
Since there is no instruction to compare with a 64-bit immediate,
TMHH is generally better than an ordered comparison for the cases
that it can handle.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197238 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 15:46:55 +00:00
Iain Sandoe
8adb31eb3e test commit.
Amend a comment.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197237 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 15:46:48 +00:00
Richard Sandiford
193bf3171f [SystemZ] Extend integer absolute selection
This patch makes more use of LPGFR and LNGFR.  It builds on top of
the LTGFR selection from r197234.  Most of the tests are motivated
by what InstCombine would produce.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197236 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 15:35:00 +00:00
Richard Sandiford
467a3f9b3f [SystemZ] Add a structure to represent a selected comparison
...in an attempt to rein back the increasingly complex selection code.
A knock-on effect is that ICmpType is exposed from the outset, which
slightly simplifies adjustSubwordCmp.

The code is no piece of art even after this change, but at least it should
be slightly better.  No behavioral change intended.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197235 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 15:28:45 +00:00
Richard Sandiford
204537e25e [SystemZ] Make more use of LTGFR
InstCombine turns (sext (trunc)) into (ashr (shl)), then converts any
comparison of the ashr against zero into a comparison of the shl against zero.
This makes sense in itself, but we want to undo it for z, since the sign-
extension instruction has a CC-setting form.

I've included tests for both the original and InstCombined variants,
but the former already worked.  The patch fixes the latter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197234 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 15:07:39 +00:00
Benjamin Kramer
fd2b2bd6b3 X86: When lowering shl_parts, don't emit shift amounts larger than the bit width.
While it's safe for the X86-specific shift nodes, dag combining will
kill generic nodes. Insert an AND to make it safe, isel will nuke it
as x86's shift instructions have an implicit AND.

Fixes PR16108, which contains a contraption to hit this case in between
constant folders.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197228 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 13:40:24 +00:00
Joerg Sonnenberger
aca2998f14 Enabling thumb2 mode used to force support for armv6t2. Replace this
with a temporary assertion and adjust the various test cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197224 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 11:16:00 +00:00
Matheus Almeida
b90ed644fc [mips] Add checks for alignment and maximum displacements for most of the
branch instructions for mips and micromips instruction sets thus avoiding
the situation of generating branches to undesired locations if offsets
cannot be encoded.

This patch also checks if a fixup cannot be applied and returns a fatal error
if that's the case.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197223 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 11:11:02 +00:00
Renato Golin
09b3900206 Add ARM to release instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197220 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 09:39:36 +00:00
Chandler Carruth
a7e2ef7e6e [inliner] Fix PR18206 by preventing inlining functions that call setjmp
through an invoke instruction.

The original patch for this was written by Mark Seaborn, but I've
reworked his test case into the existing returns_twice test case and
implemented the fix by the prior refactoring to actually run the cost
analysis over invoke instructions, and then here fixing our detection of
the returns_twice attribute to work for both calls and invokes. We never
noticed because we never saw an invoke. =[

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197216 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 08:00:01 +00:00
Chandler Carruth
0bdc7cd5de [inliner] Completely change (and fix) how the inline cost analysis
handles terminator instructions.

The inline cost analysis inheritted some pretty rough handling of
terminator insts from the original cost analysis, and then made it much,
much worse by factoring all of the important analyses into a separate
instruction visitor. That instruction visitor never visited the
terminator.

This works fine for things like conditional branches, but for many other
things we simply computed The Wrong Value. First example are
unconditional branches, which should be free but were counted as full
cost. This is most significant for conditional branches where the
condition simplifies and folds during inlining. We paid a 1 instruction
tax on every branch in a straight line specialized path. =[

Oh, we also claimed that the unreachable instruction had cost.

But it gets worse. Let's consider invoke. We never applied the call
penalty. We never accounted for the cost of the arguments. Nope. Worse
still, we didn't handle the *correctness* constraints of not inlining
recursive invokes, or exception throwing returns_twice functions. Oops.
See PR18206. Sadly, PR18206 requires yet another fix, but this
refactoring is at least a huge step in that direction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197215 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 07:59:56 +00:00
David Blaikie
2d39ad82bc Revert "DebugInfo: Move type units into the debug_types section with appropriate comdat grouping and type unit headers"
This reverts commit r197210.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197211 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-13 06:43:32 +00:00