Commit Graph

11326 Commits

Author SHA1 Message Date
Chris Lattner
463b3c2a99 fix two comment thinkos
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125481 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 06:14:42 +00:00
Cameron Zwarich
1a73cedca0 Add some statistics to StrongPHIElimination.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125477 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 02:09:18 +00:00
Cameron Zwarich
117be03cc6 Add a statistic to PHIElimination tracking the number of critical edges split.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125476 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 02:09:11 +00:00
Chris Lattner
0a9481f44f Enhance ComputeMaskedBits to know that aligned frameindexes
have their low bits set to zero.  This allows us to optimize
out explicit stack alignment code like in stack-align.ll:test4 when
it is redundant.

Doing this causes the code generator to start turning FI+cst into
FI|cst all over the place, which is general goodness (that is the
canonical form) except that various pieces of the code generator
don't handle OR aggressively.  Fix this by introducing a new
SelectionDAG::isBaseWithConstantOffset predicate, and using it
in places that are looking for ADD(X,CST).  The ARM backend in
particular was missing a lot of addressing mode folding opportunities
around OR.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125470 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13 22:25:43 +00:00
Chris Lattner
e075118489 Revisit my fix for PR9028: the issue is that DAGCombine was
generating i8 shift amounts for things like i1024 types.  Add
an assert in getNode to prevent this from occuring in the future,
fix the buggy transformation, revert my previous patch, and
document this gotcha in ISDOpcodes.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125465 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13 19:09:16 +00:00
Chris Lattner
915eeb4887 when legalizing extremely wide shifts, make sure that
the shift amounts are in a suitably wide type so that
we don't generate out of range constant shift amounts.

This fixes PR9028.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125458 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13 09:10:56 +00:00
Chris Lattner
d302773885 fix visitShift to properly zero extend the shift amount if the provided operand
is narrower than the shift register.  Doing an anyext provides undefined bits in
the top part of the register.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125457 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-13 09:02:52 +00:00
Nadav Rotem
609d54ee1e A fix for 9165.
The DAGCombiner created illegal BUILD_VECTOR operations.
The patch added a check that either illegal operations are
allowed or that the created operation is legal.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125435 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-12 14:40:33 +00:00
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