Commit Graph

11318 Commits

Author SHA1 Message Date
Nadav Rotem
f94fdb6f57 SimplifySelectOps can only handle selects with a scalar condition. Add a check
that the condition is not a vector.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125398 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 19:57:47 +00:00
Nadav Rotem
5a4552ca42 Fix #9190
The bug happens when the DAGCombiner attempts to optimize one of the patterns
of the SUB opcode. It tries to create a zero of type v2i64. This type is legal
on 32bit machines, but the initializer of this vector (i64) is target dependent.
Currently, the initializer attempts to create an i64 zero constant, which fails.
Added a flag to tell the DAGCombiner to create a legal zero, if we require that
the pass would generate legal types.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125391 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-11 19:20:37 +00:00
Evan Cheng
4d96c638af After 3-addressifying a two-address instruction, update the register maps; add a missing check when considering whether it's profitable to commute. rdar://8977508.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125259 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 02:20:55 +00:00
Jakob Stoklund Olesen
4f5c9d2061 Delete unused code for analyzing and splitting around loops.
Loop splitting is better handled by the more generic global region splitting
based on the edge bundle graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125243 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:56:18 +00:00
Jakob Stoklund Olesen
23cd57c299 Simplify using the new leaveIntvBefore()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125238 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:33:02 +00:00
Jakob Stoklund Olesen
9b057771ba Use the LiveBLocks array for SplitEditor::splitSingleBlocks() as well.
This fixes a bug where splitSingleBlocks() could split a live range after a
terminator instruction.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125237 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 23:30:25 +00:00
Mikhail Glushenkov
35edc42f98 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125232 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 22:55:48 +00:00
Jakob Stoklund Olesen
f0ac26c511 Move calcLiveBlockInfo() and the BlockInfo struct into SplitAnalysis.
No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125231 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 22:50:26 +00:00
Jakob Stoklund Olesen
a372d16f92 Ignore <undef> uses when analyzing and rewriting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125226 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 21:52:09 +00:00
Jakob Stoklund Olesen
e5005d0062 Assert on bad jump tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125225 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 21:52:06 +00:00
Jakob Stoklund Olesen
4f6364fd3f Add tags to live interval unions to avoid using stale queries.
The tag is updated whenever the live interval union is changed, and it is tested
before using cached information.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125224 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 21:52:03 +00:00
Jakob Stoklund Olesen
2710638db2 Evict a lighter single interference before attempting to split a live range.
Registers are not allocated strictly in spill weight order when live range
splitting and spilling has created new shorter intervals with higher spill
weights.

When one of the new heavy intervals conflicts with a single lighter interval,
simply evict the old interval instead of trying to split the heavy one.

The lighter interval is a better candidate for splitting, it has a smaller use
density.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125151 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 01:14:03 +00:00
Jakob Stoklund Olesen
c3dca3f9d4 Set an allocation hint when rematting before a COPY.
This almost guarantees that the COPY will be coalesced.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125140 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-09 00:25:36 +00:00
Jakob Stoklund Olesen
8a2bbdeee2 Fix one more case of splitting after the last split point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 23:26:48 +00:00
Jakob Stoklund Olesen
a50c539b7a Reorganize interference code to check LastSplitPoint first.
The last split point can be anywhere in the block, so it interferes with the
strictly monotonic requirements of advanceTo().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125132 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 23:02:58 +00:00
Jakob Stoklund Olesen
d08d77318a Also handle the situation where an indirect branch is the first (and last)
instruction in a basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125116 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 21:46:11 +00:00
Jakob Stoklund Olesen
8a61da8a68 Add LiveIntervals::addKillFlags() to recompute kill flags after register allocation.
This is a lot easier than trying to get kill flags right during live range
splitting and rematerialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125113 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 21:13:03 +00:00
Jakob Stoklund Olesen
124e423cce Trim debug spew
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125109 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 19:33:58 +00:00
Jakob Stoklund Olesen
7b1f498a76 Avoid folding a load instruction into an instruction that redefines the register.
The target hook doesn't know how to do that. (Neither do I).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125108 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 19:33:55 +00:00
Jakob Stoklund Olesen
5c716bdccc Add SplitEditor::overlapIntv() to create small ranges where both registers are live.
If a live range is used by a terminator instruction, and that live range needs
to leave the block on the stack or in a different register, it can be necessary
to have both sides of the split live at the terminator instruction.

Example:

  %vreg2 = COPY %vreg1
  JMP %vreg1

Becomes after spilling %vreg2:

  SPILL %vreg1
  JMP %vreg1

The spill doesn't kill the register as is normally the case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125102 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 18:50:21 +00:00
Jakob Stoklund Olesen
01cb34b011 Add assertion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125101 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 18:50:18 +00:00
Andrew Trick
bc4bd92d52 Fix PostRA antidependence breaker.
Avoid using the same register for two def operands or and earlyclobber
def and use operand. This fixes PR8986 and improves on the prior fix
for rdar://problem/8959122.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125089 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 17:39:46 +00:00
Jakob Stoklund Olesen
11513e5d1e Add LiveIntervals::shrinkToUses().
After uses of a live range are removed, recompute the live range to only cover
the remaining uses. This is necessary after rematerializing the value before
some (but not all) uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125058 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-08 00:03:05 +00:00
Devang Patel
480d1e3a67 Remove comment about an argument that was removed couple of years ago.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-07 21:58:52 +00:00
Andrew Trick
278ba1f9b6 Fix an anti-dep breaker corner case.
<rdar://problem/8959122> illegal register operands for UMULL instruction in cfrac nightly test
I'm stil working on a unit test, but the case is:
rx = movcc rx, r3
r2 = ldr
r2, r3 = umull r2, r2

The anti-dep breaker should not convert this into an illegal instruction:
r2, r2 = umull


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124932 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 02:58:46 +00:00
Jakob Stoklund Olesen
fe3f99f95c Be more strict about the first/last interference-free use.
If the interference overlaps the instruction, we cannot separate it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124918 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 01:06:39 +00:00
Jakob Stoklund Olesen
de71095a1a Add assertions to verify that the new interval is clear of the interference.
If these inequalities don't hold, we are creating a live range split that won't
allocate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-05 01:06:36 +00:00
Jakob Stoklund Olesen
45e53975f8 Apparently, it is possible for a block with a landing pad successor to have no calls.
In that case we simply ignore the landing pad and split live ranges before the
first terminator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 23:11:13 +00:00
Devang Patel
6c3ea9012e Merge .debug_loc entries whenever possible to reduce debug_loc size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124904 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 22:57:18 +00:00
Nick Lewycky
c57ef56142 Mark that the return is using EAX so that we don't use it for some other
purpose. Fixes PR9080!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124903 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 22:44:08 +00:00
Jakob Stoklund Olesen
63935420ef Be more accurate about live range splitting at the end of blocks.
If interference reaches the last split point, it is effectively live out and
should be marked as 'MustSpill'.

This can make a difference when the terminator uses a register. There is no way
that register can be reused in the outgoing CFG bundle, even if it isn't live
out.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124900 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 21:42:06 +00:00
Jakob Stoklund Olesen
cb6404711b Add LiveIntervals::getLastSplitPoint().
A live range cannot be split everywhere in a basic block. A split must go before
the first terminator, and if the variable is live into a landing pad, the split
must happen before the call that can throw.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124894 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 19:33:11 +00:00
Jakob Stoklund Olesen
9b3d24bf3d Verify that one of the ranges produced by region splitting is allocatable.
We should not be attempting a region split if it won't lead to at least one
directly allocatable interval. That could cause infinite splitting loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 19:33:07 +00:00
Andrew Trick
92e946630d Introducing a new method of tracking register pressure. We can't
precisely track pressure on a selection DAG, but we can at least keep
it balanced. This design accounts for various interesting aspects of
selection DAGS: register and subregister copies, glued nodes, dead
nodes, unused registers, etc.

Added SUnit::NumRegDefsLeft and ScheduleDAGSDNodes::RegDefIter.

Note: I disabled PrescheduleNodesWithMultipleUses when register
pressure is enabled, based on no evidence other than I don't think it
makes sense to have both enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124853 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 03:18:17 +00:00
Devang Patel
f827cd717b DebugLoc associated with a machine instruction is used to emit location entries. DebugLoc associated with a DBG_VALUE is used to identify lexical scope of the variable. After register allocation, while inserting DBG_VALUE remember original debug location for the first instruction and reuse it, otherwise dwarf writer may be mislead in identifying the variable's scope.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124845 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 01:43:25 +00:00
Evan Cheng
c8b90e22a8 Update comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124843 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 01:10:12 +00:00
Jakob Stoklund Olesen
9ecd1e7197 Skip unused values.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124842 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 00:59:23 +00:00
Jakob Stoklund Olesen
45139874a7 Also compute interference intervals for blocks with no uses.
When the live range is live through a block that doesn't use the register, but
that has interference, region splitting wants to split at the top and bottom of
the basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124839 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 00:39:20 +00:00
Jakob Stoklund Olesen
a7b586ba74 Verify kill flags conservatively.
Allow a live range to end with a kill flag, but don't allow a kill flag that
doesn't end the live range.

This makes the machine code verifier more useful during register allocation when
kill flag computation is deferred.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124838 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-04 00:39:18 +00:00
Andrew Trick
cd5af07c45 whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124827 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 23:00:17 +00:00
Jakob Stoklund Olesen
2dfbb3e912 Ensure that the computed interference intervals actually overlap their basic blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124815 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 20:29:43 +00:00
Jakob Stoklund Olesen
97af98678c Tweak debug output from SlotIndexes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124814 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 20:29:41 +00:00
Jakob Stoklund Olesen
c50f077b06 Add debug output and asserts to the phi-connecting code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 20:29:39 +00:00
Jakob Stoklund Olesen
08eb8dd616 Fix coloring bug when mapping values in the middle of a live-through block.
If the found value is not live-through the block, we should only add liveness up
to the requested slot index. When the value is live-through, the whole block
should be colored.

Bug found by SSA verification in the machine code verifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124812 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 20:29:36 +00:00
Jakob Stoklund Olesen
207c868c92 Return live range end points from SplitEditor::enter*/leave*.
These end points come from the inserted copies, and can be passed directly to
useIntv. This simplifies the coloring code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124799 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 17:04:16 +00:00
Jakob Stoklund Olesen
9590c7fbca Silence an MSVC warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124798 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 17:04:12 +00:00
Eric Christopher
0f43811903 Reapply this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124779 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 06:18:29 +00:00
Eric Christopher
463a2977b1 Temporarily revert 124765 in an attempt to find the cycle breaking bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124778 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 05:40:54 +00:00
Jakob Stoklund Olesen
2cd2111959 Defer SplitKit value mapping until all defs are available.
The greedy register allocator revealed some problems with the value mapping in
SplitKit. We would sometimes start mapping values before all defs were known,
and that could change a value from a simple 1-1 mapping to a multi-def mapping
that requires ssa update.

The new approach collects all defs and register assignments first without
filling in any live intervals. Only when finish() is called, do we compute
liveness and mapped values. At this time we know with certainty which values map
to multiple values in a split range.

This also has the advantage that we can compute live ranges based on the
remaining uses after rematerializing at split points.

The current implementation has many opportunities for compile time optimization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124765 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-03 00:54:23 +00:00
Devang Patel
e7d93877c6 Add support to describe template value parameter in debug info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124755 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 22:35:53 +00:00