History log of /external/llvm/lib/CodeGen/SplitKit.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4eed756153b84c211114a3e9186bf0cb55d4b394 17-Jun-2013 Benjamin Kramer <benny.kra@googlemail.com> Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo.

The main advantages here are way better heuristics, taking into account not
just loop depth but also __builtin_expect and other static heuristics and will
eventually learn how to use profile info. Most of the work in this patch is
pushing the MachineBlockFrequencyInfo analysis into the right places.

This is good for a 5% speedup on zlib's deflate (x86_64), there were some very
unfortunate spilling decisions in its hottest loop in longest_match(). Other
benchmarks I tried were mostly neutral.

This changes register allocation in subtle ways, update the tests for it.
2012-02-20-MachineCPBug.ll was deleted as it's very fragile and the instruction
it looked for was gone already (but the FileCheck pattern picked up unrelated
stuff).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184105 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1ead68d769f27f6d68d4aaeffe4199fa2cacbc95 28-Nov-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Make the LiveRegMatrix analysis available to targets.

No functional change, just moved header files.

Targets can inject custom passes between register allocation and
rewriting. This makes it possible to tweak the register allocation
before rewriting, using the full global interference checking available
from LiveRegMatrix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168806 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b720be6a50f4e1b3280d2b029ee38dda14577525 12-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with
"#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"

No functional change. Update r163339.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163653 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
77e300e8f0b8db8eec448cae9c87d7c5bfad9757 06-Sep-2012 Manman Ren <mren@apple.com> Release build: guard dump functions with "ifndef NDEBUG"

No functional change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1599a64277f3a01619b5614974be9bec662c7ec0 03-Aug-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix a couple of loops that were processing unused value numbers.

Unused VNInfos should be left alone. Their def SlotIndex doesn't point
to anything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b18d779b35909cd5b753871f8bf2ff4f6c17ace1 27-Jul-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Eliminate the IS_PHI_DEF flag and VNInfo::setIsPHIDef().

A value number is a PHI def if and only if it begins at a block
boundary. This can be derived from the def slot, a separate flag is not
necessary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
631390e3c26fe5581ee9468b04593cedf48cc908 04-Jun-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Pass context pointers to LiveRangeCalc::reset().

Remove the same pointers from all the other LiveRangeCalc functions,
simplifying the interface.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
789d5d85ba6e9259a8e0f0bcfbd06a59ad164512 03-Apr-2012 Pete Cooper <peter_cooper@apple.com> Moved LiveRangeEdit.h so that it can be called from other parts of the backend, not just libCodeGen

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153906 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8a06af96698537377275dd7848db69915638dd26 03-Apr-2012 Pete Cooper <peter_cooper@apple.com> Refactored the LiveRangeEdit interface so that MachineFunction, TargetInstrInfo, MachineRegisterInfo, LiveIntervals, and VirtRegMap are all passed into the constructor and stored as members instead of passed in to each method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
3b1088a2cc15a39c7a7b8dd95a56143f1dda6863 04-Feb-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't store COPY pointers in VNInfo.

If a value is defined by a COPY, that instuction can easily and cheaply
be found by getInstructionFromIndex(VNI->def).

This reduces the size of VNInfo from 24 to 16 bytes, and improves
llc compile time by 3%.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149763 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4d6ccb5f68cd7c6418a209f1fa4dbade569e4493 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2aad2f6e601328d15033944ea51ad6f66a7f3c0a 11-Jan-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Detect when a value is undefined on an edge to a landing pad.

Consider this code:

int h() {
int x;
try {
x = f();
g();
} catch (...) {
return x+1;
}
return x;
}

The variable x is undefined on the first edge to the landing pad, but it
has the f() return value on the second edge to the landing pad.

SplitAnalysis::getLastSplitPoint() would assume that the return value
from f() was live into the landing pad when f() throws, which is of
course impossible.

Detect these cases, and treat them as if the landing pad wasn't there.
This allows spill code to be inserted after the function call to f().

<rdar://problem/10664933>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
74c4f97a466513e45e66e04469973fdcd5865300 11-Jan-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Exclusively use SplitAnalysis::getLastSplitPoint().

Delete the alternative implementation in LiveIntervalAnalysis.

These functions computed the same thing, but SplitAnalysis caches the
result.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5a96b3dad2f634c9081c8b2b6c2575441dc5a2bd 07-Dec-2011 Evan Cheng <evan.cheng@apple.com> Add bundle aware API for querying instruction properties and switch the code
generator to it. For non-bundle instructions, these behave exactly the same
as the MC layer API.

For properties like mayLoad / mayStore, look into the bundle and if any of the
bundled instructions has the property it would return true.
For properties like isPredicable, only return true if *all* of the bundled
instructions have the property.
For properties like canFoldAsLoad, isCompare, conservatively return false for
bundles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146026 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
194eb71a11a77c7fb576780783a77e64924dfb10 14-Nov-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Use getVNInfoBefore() when it makes sense.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1f81e316b042c02c841801a71e7439e166ffa2a0 13-Nov-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Terminate all dead defs at the dead slot instead of the 'next' slot.

This makes no difference for normal defs, but early clobber dead defs
now look like:

[Slot_EarlyClobber; Slot_Dead)

instead of:

[Slot_EarlyClobber; Slot_Register).

Live ranges for normal dead defs look like:

[Slot_Register; Slot_Dead)

as before.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144512 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2debd48ca790ac01be6e12e094fdf4fdcadc8364 13-Nov-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rename SlotIndexes to match how they are used.

The old naming scheme (load/use/def/store) can be traced back to an old
linear scan article, but the names don't match how slots are actually
used.

The load and store slots are not needed after the deferred spill code
insertion framework was deleted.

The use and def slots don't make any sense because we are using
half-open intervals as is customary in C code, but the names suggest
closed intervals. In reality, these slots were used to distinguish
early-clobber defs from normal defs.

The new naming scheme also has 4 slots, but the names match how the
slots are really used. This is a purely mechanical renaming, but some
of the code makes a lot more sense now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ebac0c1747d20e48f359d76dd454444107080d83 16-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Spill mode: Hoist back-copies locally.

The leaveIntvAfter() function normally inserts a back-copy after the
requested instruction, making the back-copy kill the live range.

In spill mode, try to insert the back-copy before the last use instead.
That means the last use becomes the kill instead of the back-copy. This
lowers the register pressure because the last use can now redefine the
same register it was reading.

This will also improve compile time: The back-copy isn't a kill, so
hoisting it in hoistCopiesForSize() won't force a recomputation of the
source live range. Similarly, if the back-copy isn't hoisted by the
splitter, the spiller will not attempt hoisting it locally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c4c633852fbb8ab9ef2679b679d2862746d2fa3e 14-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Hoist back-copies to the least busy dominator.

When a back-copy is hoisted to the nearest common dominator, keep
looking up the dominator tree for a less loopy dominator, and place the
back-copy there instead.

Don't do this when a single existing back-copy dominates all the others.
Assume the client knows what he is doing, and keep the dominating
back-copy.

This prevents us from hoisting back-copies into loops in most cases. If
a value is defined in a loop with multiple exits, we may still hoist
back-copies into that loop. That is the speed/size tradeoff.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
393bfcb263fa46e4badc73c6aa56306986f94dcf 14-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Distinguish complex mapped values from forced recomputation.

When a ParentVNI maps to multiple defs in a new interval, its live range
may still be derived directly from RegAssign by transferValues().

On the other hand, when instructions have been rematerialized or
hoisted, it may be necessary to completely recompute live ranges using
LiveRangeCalc::extend() to all uses.

Use a bit in the value map to indicate that a live range must be
recomputed. Rename markComplexMapped() to forceRecompute().

This fixes some live range verification errors when
-split-spill-mode=size hoists back-copies by recomputing source ranges
when RegAssign kills can't be moved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139660 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b21abfed813fa46976f896439ca2f9fbd2eba9ba 14-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Implement -split-spill-mode=size.

Whenever the complement interval is defined by multiple copies of the
same value, hoist those back-copies to the nearest common dominator.

This ensures that at most one copy is inserted per value in the
complement inteval, and no phi-defs are needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139651 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
e5a2e366322ef5f0d597b1fb8dbf55f2cf36cf15 13-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add SplitEditor::markOverlappedComplement().

This function is used to flag values where the complement interval may
overlap other intervals. Call it from overlapIntv, and use the flag to
fully recompute those live ranges in transferValues().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139612 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
abcc73e8ba3131c7c4f198840ece31453a0101ac 13-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Eliminate the extendRange() wrapper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ee5655dca467d3812145a2f965c31edf4875c93e 13-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Switch extendInBlock() to take a kill slot instead of the last use slot.

Three out of four clients prefer this interface which is consistent with
extendIntervalEndTo() and LiveRangeCalc::extend().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139604 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c1c622ef0dd29d1bafd580790aec5231af50abf2 13-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Use a separate LiveRangeCalc for the complement in spill modes.

The complement interval may overlap the other intervals created, so use
a separate LiveRangeCalc instance to compute its live range.

A LiveRangeCalc instance can only be shared among non-overlapping
intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139603 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b5a457c4cbc71db6ae313ef1bf8eadac65767ab0 13-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Extract live range calculations from SplitKit.

SplitKit will soon need two copies of these data structures, and the
algorithms will also be useful when LiveIntervalAnalysis becomes
independent of LiveVariables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
708d06f7fb5dfd9c8559aea07b042a88c65645f8 12-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add an interface for SplitKit complement spill modes.

SplitKit always computes a complement live range to cover the places
where the original live range was live, but no explicit region has been
allocated.

Currently, the complement live range is created to be as small as
possible - it never overlaps any of the regions. This minimizes
register pressure, but if the complement is going to be spilled anyway,
that is not very important. The spiller will eliminate redundant
spills, and hoist others by making the spill slot live range overlap
some of the regions created by splitting. Stack slots are cheap.

This patch adds the interface to enable spill modes in SplitKit. In
spill mode, SplitKit will assume that the complement is going to spill,
so it will allow it to overlap regions in order to avoid back-copies.
By doing some of the spiller's work early, the complement live range
becomes simpler. In some cases, it can become much simpler because no
extra PHI-defs are required. This will speed up both splitting and
spilling.

This is only the interface to enable spill modes, no implementation yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
75e28f74b051e72ca3fc1aa38e5e43a5204a65ce 06-Aug-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Delete getMultiUseBlocks and splitSingleBlocks.

These functions are no longer used, and they are easily replaced with a
loop calling shouldSplitSingleBlock and splitSingleBlock.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2d6d86be84ee355223ccd20b7f87a0c9971c50c9 06-Aug-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Split around single instructions to enable register class inflation.

Normally, we don't create a live range for a single instruction in a
basic block, the spiller does that anyway. However, when splitting a
live range that belongs to a proper register sub-class, inserting these
extra COPY instructions completely remove the constraints from the
remainder interval, and it may be allocated from the larger super-class.

The spiller will mop up these small live ranges if we end up spilling
anyway. It calls them snippets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136989 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fe62d92b7bbaf73e576bec0c0b11cfa6c191aa87 03-Aug-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rename {First,Last}Use to {First,Last}Instr.

With a 'FirstDef' field right there, it is very confusing that FirstUse
refers to an instruction that may be a def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136739 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
77ee1140a3297e6fbd6cb7cf586872af6d00d07e 03-Aug-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add a BlockInfo::FirstDef field.

This is either an invalid SlotIndex, or valno->def for the first value
defined inside the block. PHI values are not counted as defined inside
the block.

The FirstDef field will be used when estimating the cost of spilling
around a block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136736 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4751eb760e7f4e51cfd594cbe46c7d0d7865d693 03-Aug-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Delete BlockInfo::LiveThrough. It wasn't used any more.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136735 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
81d686edbe6effe624add9394673bd571d89bfb7 24-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Never extend live ranges for <undef> uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b09701db9e74298912164d988ddf40bb1b5ec19b 24-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Correctly handle <undef> tied uses when rewriting after a split.

This fixes PR10463. A two-address instruction with an <undef> use
operand was incorrectly rewritten so the def and use no longer used the
same register, violating the tie constraint.

Fix this by always rewriting <undef> operands with the register a def
operand would use.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fe9b2d142a0feb87b06579509479957f25d7d0a4 23-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix bug in SplitEditor::splitLiveThroughBlock when switching registers.

If there is no interference and no last split point, we cannot
enterIntvBefore(Stop) - that function needs a real instruction.

Use enterIntvAtEnd instead for that very easy case.

This code doesn't currently run, it is needed by multi-way splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135846 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fc47933db5c8fea9bc89470d83cc5af7ca36f2a3 18-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix a crash when building 177.mesa for armv6.

When splitting a live range immediately before an LDR_POST instruction
that redefines the address register, make sure to use the correct value
number in leaveIntvBefore.

We need the value number entering the instruction.

<rdar://problem/9793765>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f9d7fb6b3c45abc64ad52cd8a9a8a7dd5aa9f4bb 16-Jul-2011 Matt Beaumont-Gay <matthewbg@google.com> Silence unused variable warning

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135339 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
af4e40c2f41a7d60b86958e034b00542d551b5f2 16-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> He said *before* the last split point.

This should unbreak the build-self-4-mingw32 tester. I have a very
complicated test case that I will try to clean up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135329 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b4ddedce599183362b0f0333922c2fe0e163a129 15-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Extract parts of RAGreedy::splitAroundRegion as SplitKit methods.

This gets rid of some of the gory splitting details in RAGreedy and
makes them available to future SplitKit clients.

Slightly generalize the functionality to support multi-way splitting.
Specifically, SplitEditor::splitLiveThroughBlock() supports switching
between different register intervals in a block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135307 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
87360f73ae205854f100ba5fb7eef7b90ac3bc27 30-Jun-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Reapply r134047 now that the world is ready for it.

This patch will sometimes choose live range split points next to
interference instead of always splitting next to a register point. That
means spill code can now appear almost anywhere, and it was necessary
to fix code that didn't expect that.

The difficult places were:

- Between a CALL returning a value on the x87 stack and the
corresponding FpPOP_RETVAL (was FpGET_ST0). Probably also near x87
inline assembly, but that didn't actually show up in testing.

- Between a CALL popping arguments off the stack and the corresponding
ADJCALLSTACKUP.

Both are fixed now. The only place spill code can't appear is after
terminators, see SplitAnalysis::getLastSplitPoint.

Original commit message:

Rewrite RAGreedy::splitAroundRegion, now with cool ASCII art.

This function has to deal with a lot of special cases, and the old
version got it wrong sometimes. In particular, it would sometimes leave
multiple uses in the stack interval in a single block. That causes bad
code with multiple reloads in the same basic block.

The new version handles block entry and exit in a single pass. It first
eliminates all the easy cases, and then goes on to create a local
interval for the blocks with difficult interference. Previously, we
would only create the local interval for completely isolated blocks.

It can happen that the stack interval becomes completely empty because
we could allocate a register in all edge bundles, and the new local
intervals deal with the interference. The empty stack interval is
harmless, but we need to remove a SplitKit assertion that checks for
empty intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134125 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2c0cbce763a258ac58590a8ca3c28ff722093fef 29-Jun-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Revert r134047 while investigating a llvm-gcc-i386-linux-selfhost
miscompile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134053 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4d517e34e5c8431adb724c94a14b02362a9cfe67 29-Jun-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rewrite RAGreedy::splitAroundRegion, now with cool ASCII art.

This function has to deal with a lot of special cases, and the old
version got it wrong sometimes. In particular, it would sometimes leave
multiple uses in the stack interval in a single block. That causes bad
code with multiple reloads in the same basic block.

The new version handles block entry and exit in a single pass. It first
eliminates all the easy cases, and then goes on to create a local
interval for the blocks with difficult interference. Previously, we
would only create the local interval for completely isolated blocks.

It can happen that the stack interval becomes completely empty because
we could allocate a register in all edge bundles, and the new local
intervals deal with the interference. The empty stack interval is
harmless, but we need to remove a SplitKit assertion that checks for
empty intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134047 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1e0bd63477da6e9b1dc5111bafba2b1cf143bfba 28-Jun-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix a bad iterator dereference that Evan uncovered.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133978 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5b220213bfe9c37c2bb41a7ae0804e06a14f1007 27-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> There is only one register coalescer. Merge it into the base class and
remove the analysis group.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133899 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
a2e79ef908e0f4179cda9e85e2f75057181bf321 30-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Reapply r132245 with a fix for the bug that broke the darwin9/i386 build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132309 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
626d6fb1903e74337b257c5e165944bcd1273e65 29-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Revert r132245, "Create two BlockInfo entries when a live range is discontinuous through a block."

This commit seems to have broken a darwin 9 tester.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c9cf9e94ec4daca659e2eb4e30d3f7d7f9b6b067 28-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Create two BlockInfo entries when a live range is discontinuous through a block.

Delete the Kill and Def markers in BlockInfo. They are no longer
necessary when BlockInfo describes a continuous live range.

This only affects the relatively rare kind of basic block where a live
range looks like this:

|---x o---|

Now live range splitting can pretend that it is looking at two blocks:

|---x
o---|

This allows the code to be simplified a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132245 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b2abfa0bf30edf292a27a06e091d03983e644c9b 28-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add SplitAnalysis::getNumLiveBlocks().

It is important that this function returns the same number of live blocks as
countLiveBlocks(CurLI) because live range splitting uses the number of live
blocks to ensure it is making progress.

This is in preparation of supporting duplicate UseBlock entries for basic blocks
that have a virtual register live-in and live-out, but not live-though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132244 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
bdda37d7fbafe6876f248341837423a4100f95a5 10-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix PR9883. Make sure all caches are invalidated when a live range is repaired.

The previous invalidation missed the alias interference caches.

Also add a stats counter for the number of repaired ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
e9bd4ea5fda4957c373a3bbc14803d9670041dcc 05-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add some statistics to the splitting and spilling frameworks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130931 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
7d6b6a05b549da70b4473f015c97954c2a422724 03-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Gracefully handle invalid live ranges. Fix PR9831.

Register coalescing can sometimes create live ranges that end in the middle of a
basic block without any killing instruction. When SplitKit detects this, it will
repair the live range by shrinking it to its uses.

Live range splitting also needs to know about this. When the range shrinks so
much that it becomes allocatable, live range splitting fails because it can't
find a good split point. It is paranoid about making progress, so an allocatable
range is considered an error.

The coalescer should really not be creating these bad live ranges. They appear
when coalescing dead copies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
bb30dd40ed0873e39fec4dfa321091a0c8d1abfc 02-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Minimize the slot indexes spanned by register ranges created when splitting.

When an interfering live range ends at a dead slot index between two
instructions, make sure that the inserted copy instruction gets a slot index
after the dead ones. This makes it possible to avoid the interference.

Ideally, there shouldn't be interference ending at a deleted instruction, but
physical register coalescing can sometimes do that to sub-registers.

This fixes PR9823.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9f4b893b84d9c2b56aa2abc3c96ce1e5ccc465e5 27-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add a safe-guard against repeated splitting for some rare cases.

The number of blocks covered by a live range must be strictly decreasing when
splitting, otherwise we can't allow repeated splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130249 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ae5fbeec23cff833cad9e6b2a638efd1f48bef49 21-Apr-2011 Matt Beaumont-Gay <matthewbg@google.com> Don't recycle loop variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5928046306d8bbe7db35707c294689f515f90e56 21-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Allow allocatable ranges from global live range splitting to be split again.

These intervals are allocatable immediately after splitting, but they may be
evicted because of later splitting. This is rare, but when it happens they
should be split again.

The remainder intervals that cannot be allocated after splitting still move
directly to spilling.

SplitEditor::finish can optionally provide a mapping from new live intervals
back to the original interval indexes returned by openIntv().

Each original interval index can map to multiple new intervals after connected
components have been separated. Dead code elimination may also add existing
intervals to the list.

The reverse mapping allows the SplitEditor client to treat the new intervals
differently depending on the split region they came from.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
cbc5f407eff618225a2fd4363f67d660607e6c2d 16-Apr-2011 Francois Pichet <pichet2000@gmail.com> Unbreak the MSVC 2010 build.
For further information on this particular issue see: http://connect.microsoft.com/VisualStudio/feedback/details/520043/error-converting-from-null-to-a-pointer-type-in-std-pair

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129642 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
44b7ae2355a32035ea286555736d173755a1c5e2 15-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Teach the SplitKit blitter to handle multiply defined values as well.

The transferValues() function can now handle both singly and multiply defined
values, as long as the resulting live range is known. Only rematerialized values
have their live range recomputed by extendRange().

The updateSSA() function can now insert PHI values in bulk across multiple
values in multiple target registers in one pass. The list of blocks received
from transferValues() is in layout order which seems to work well for the
iterative algorithm. Blocks from extendRange() are still in reverse BFS order,
but this function is used so rarely now that it doesn't matter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129580 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fd1cced726469e83915f428877a521ba737d35f3 13-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Stop using dead function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129442 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fd5c51342a429ecab86a645282d0b36b216c0256 12-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Create new intervals for isolated blocks during region splitting.

This merges the behavior of splitSingleBlocks into splitAroundRegion, so the
RS_Region and RS_Block register stages can be coalesced. That means the leftover
intervals after region splitting go directly to spilling instead of a second
pass of per-block splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129379 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
e1b43c3b4000ee7201fcac8d1c8e75bb9fb547e3 12-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add SplitKit API to query and select the current interval being worked on.

This makes it possible to target multiple registers in one pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129374 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f4afdfc501b7185d24a0ef184fe3d0c0bbe22e0c 09-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Build the Hopfield network incrementally when splitting global live ranges.

It is common for large live ranges to have few basic blocks with register uses
and many live-through blocks without any uses. This approach grows the Hopfield
network incrementally around the use blocks, completely avoiding checking
interference for some through blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129188 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
db529a8a5d071610f3a8b467693bc40b073e68ef 06-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Analyze blocks with uses separately from live-through blocks without uses.

About 90% of the relevant blocks are live-through without uses, and the only
information required about them is their number. This saves memory and enables
later optimizations that need to look at only the use-blocks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128985 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
71d9e65ee71712b965c79739e63de94fbb8078ad 06-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Sign error

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128963 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b3dd82670aa60cacba81f090d292722c3ef44354 06-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't crash when a value is defined after the last split point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128962 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
a2948ef5accab638371615f539ea9f9ec5ff5d03 05-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Use std::unique instead of a SmallPtrSet to ensure unique instructions in UseSlots.

This allows us to always keep the smaller slot for an instruction which is what
we want when a register has early clobber defines.

Drop the UsingInstrs set and the UsingBlocks map. They are no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128886 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
612f7807c581eafb7c8105e1a55c8d839033bfb3 05-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Stop precomputing last split points, query the SplitAnalysis cache on demand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128875 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1a7744501a80351ce31fcecad42c8e35823bc081 05-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Cache the fairly expensive last split point computation and provide a fast
inlined path for the common case.

Most basic blocks don't contain a call that may throw, so the last split point
os simply the first terminator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128874 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6c8afd728eb02742ce320ecd39bcf3774d8423b7 04-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Stop caching basic block index ranges now that SlotIndexes can keep up.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6094bd87d845afabba5b99ec4848fa6116bac682 29-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Recompute register class and hint for registers created during spilling.

The spill weight is not recomputed for an unspillable register - it stays infinite.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128490 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c8ec765551119d5bdcfeebdaeb869242c098bdc5 29-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Handle the special case when all uses follow the last split point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ef1f5ccca7efaa18209523b31019d356d302f635 28-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Amend debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128398 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2dc455a366e26d8c1085ef617651232304ee097e 20-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Process all dead defs after rematerializing during splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127973 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
7cec179a647bff132d7af36d91df877056880c5e 18-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Be more accurate about the slot index reading a register when dealing with defs
and early clobbers.

Assert when trying to find an undefined value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127856 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6a3dbd3b25bbc99bd1a233d6a74ddea3493ba6ac 17-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Dead code elimination may separate the live interval into multiple connected components.

I have convinced myself that it can only happen when a phi value dies. When it
happens, allocate new virtual registers for the components.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127827 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2254227791ea267426b9ac674fc6d87decb65bc1 17-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rewrite instructions as part of ConnectedVNInfoEqClasses::Distribute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
29ef87599c86b28db94d57705ab2901768253cad 15-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Preserve both isPHIDef and isDefByCopy bits when copying parent values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127697 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5881799d0cccbd814ec1b0f0509df9be1f63c6cb 08-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Delete dead code after rematerializing.

LiveRangeEdit::eliminateDeadDefs() will eventually be used by coalescing,
splitting, and spilling for dead code elimination. It can delete chains of dead
instructions as long as there are no dependency loops.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127287 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2b0f9e73d8623b21fc14335ef6208deab2629cdf 05-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Work around a coalescer bug.

The coalescer can in very rare cases leave too large live intervals around after
rematerializing cheap-as-a-move instructions.

Linear scan doesn't really care, but live range splitting gets very confused
when a live range is killed by a ghost instruction.

I will fix this properly in the coalescer after 2.9 branches.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127096 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fb69810a2b617d888b6ea7c6a69fee7364fe233b 04-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Tweak debug output. No functional changes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
13ba2dab631636e525a44bb259aaea56a860d1c7 04-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Use an IndexedMap instead of a DenseMap for the live-out cache.

This speeds up updateSSA() so it only accounts for 5% of the live range
splitting time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126972 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
36d61863bc83bd2301e0224adc560098b35ec0dc 03-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Cache basic block bounds instead of asking SlotIndexes::getMBBRange all the time.

This speeds up the greedy register allocator by 15%.
DenseMap is not as fast as one might hope.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126921 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
bece06f0c6936527e2b1c72d09f7d3a949af9a47 03-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Change the SplitEditor interface to a single instance can be shared for multiple splits.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126912 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8701768ae2e93e8741106acfa4a29959e1439487 03-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Only run the updateSSA loop when we have actually seen multiple values.

When only a single value has been seen, new PHIDefs are never needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126911 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
a2cae58411b36a58f658f9402e8d039add31ae4d 03-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Turn the Edit member into a pointer so it can change dynamically.

No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126898 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4670353a21fbc6e8159a129cda965f256e73a451 03-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Transfer simply defined values directly without recomputing liveness and SSA.

Values that map to a single new value in a new interval after splitting don't
need new PHIDefs, and if the parent value was never rematerialized the live
range will be the same.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
e2dc0c978e2435dbbb55cb7fca7750034c3e292a 03-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Extract a method. No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126893 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1c38ba6355a019b7fc3baa0d0ab31e8ba11f7db1 02-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Move extendRange() into SplitEditor and delete the LiveRangeMap class.

Extract the updateSSA() method from the too long extendRange().

LiveOutCache can be shared among all the new intervals since there is at most
one of the new ranges live out from each basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126818 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
d3fdaeb69a25bcd21914b80f75606e2c2f1b35c8 02-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rename mapValue to extendRange because that is its function now.

Simplify the signature - The return value and ParentVNI are no longer needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126809 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9763e2bf39b84f18bd464b0cda61fe1cd98dcaae 02-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Move LiveIntervalMap::extendTo into LiveInterval itself.

This method could probably be used by LiveIntervalAnalysis::shrinkToUses, and
now it can use extendIntervalEndTo() which coalesces ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126803 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
edb87555e466e781087e18936f427816c952f3e7 02-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Delete dead code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126801 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
670ccd18ae1ecec3b3c92885d5b64b21859001c4 02-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Move the value map from LiveIntervalMap to SplitEditor.

The value map is currently not used, all values are 'complex mapped' and
LiveIntervalMap::mapValue is used to dig them out.

This is the first step in a series changes leading to the removal of
LiveIntervalMap. Its data structures can be shared among all the live intervals
created by a split, so it is wasteful to create a copy for each.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126800 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
3afab9c57e1afb0b7a4a9fe25a74117461bc0e69 02-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Delete dead code.

Local live range splitting is better driven by interference. This code was just
guessing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126799 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c70f687dce99ea48ca779e6767006f6663781132 23-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> It is safe to ignore LastSplitPoint when the variable is not live out.

No code will be inserted after the split point anyway.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126319 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
06c0f25499fd502668ca720b0fea4a4dfe6eb44a 22-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add SplitKit::isOriginalEndpoint and use it to force live range splitting to terminate.

An original endpoint is an instruction that killed or defined the original live
range before any live ranges were split.

When splitting global live ranges, avoid creating local live ranges without any
original endpoints. We may still create global live ranges without original
endpoints, but such a range won't be split again, and live range splitting still
terminates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126151 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1b847deb26b52051de39f4cbecd224c9fbd0d1c2 19-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Give SplitAnalysis a VRM member to access VirtRegMap::getOriginal().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126005 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
0eeca440469e23f2db2bea3d7b136f0f95f6ff1d 19-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Missed member rename for naming convention.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126003 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4f5c9d206139f946ae4bb5ee7e3ddb1714057cdb 10-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
9b057771ba22441b8d312404204433477b4be657 10-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
f0ac26c51173a9a1d6e5b5794107dccc4c5b5792 09-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
a372d16f92392bb4cd4184783466f0300a51a9ae 09-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Ignore <undef> uses when analyzing and rewriting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125226 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5c716bdccce2fa504e1aa0b67226165d181d2459 08-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
01cb34b0111a1e8792f327b56c51bc3bbaf83aca 08-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add assertion.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125101 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
cb6404711b7fe6f583480adce8d7e9d5e4b99ae6 04-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
9ecd1e71973f555cab00ee862b6f509d0126025a 04-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Skip unused values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c50f077b065a328a7ce21d97cfc0a21e5059f735 03-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
08eb8dd616bb4d4213f2ebda1de56b45bb88b6d9 03-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
207c868c9210663d401b7f5ce5cae7c3e0943849 03-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
0f43811903f10394f7088f4634c0b4f9668cbac0 03-Feb-2011 Eric Christopher <echristo@apple.com> Reapply this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
463a2977b1d9e6679f859db9f32e9e783b075c10 03-Feb-2011 Eric Christopher <echristo@apple.com> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
2cd21119593becfa1962cfaca0319fd67913f545 03-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/SplitKit.cpp
078628465b73348b5608ec6aa2d7181679543903 26-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rename member variables to follow the rest of LLVM.
No functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
d7ca57705e7ccc19245b8b3d6fc271562366bf92 20-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add LiveIntervalMap::dumpCache() to print out the cache used by the ssa update algorithm.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123925 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ccdb3fcef9aeb9f683cd738afbe1cd961bb0c1ef 19-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Implement RAGreedy::splitAroundRegion and remove loop splitting.

Region splitting includes loop splitting as a subset, and it is more generic.
The splitting heuristics for variables that are live in more than one block are
now:

1. Try to create a region that covers multiple basic blocks.
2. Try to create a new live range for each block with multiple uses.
3. Spill.

Steps 2 and 3 are similar to what the standard spiller is doing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b5fa9333431673aac2ced8dea80152349a85cf6f 18-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add RAGreedy methods for splitting live ranges around regions.

Analyze the live range's behavior entering and leaving basic blocks. Compute an
interference pattern for each allocation candidate, and use SpillPlacement to
find an optimal region where that register can be live.

This code is still not enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123774 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8dd070edc2209ecfdae49780ec1596b349e2cbd1 04-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Turn the EdgeBundles class into a stand-alone machine CFG analysis pass.

The analysis will be needed by both the greedy register allocator and the
X86FloatingPoint pass. It only needs to be computed once when the CFG doesn't
change.

This pass is very fast, usually showing up as 0.0% wall time.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122832 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c64379da075a59bd5178c62c970c8d2b84457ab2 22-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Include a shadow of the original CFG edges in the edge bundle graph.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122444 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8d0963f72c8922bafffb36ff49b18064098a3cab 21-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add EdgeBundles to SplitKit.

Edge bundles is an annotation on the CFG that turns it into a bipartite directed
graph where each basic block is connected to an outgoing and an ingoing bundle.
These bundles are useful for identifying regions of the CFG for live range
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122301 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
dfe3b6d2a9a452f2fd748416cd8e4c2583e0e8c5 18-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Check that the register is live-in to the loop header before inserting copies in
the loop predecessors.

The register can be live-out from a predecessor without being live-in to the
loop header if there is a critical edge from the predecessor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122123 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6203295473f158bff892ae6659cb8f7fdb0a47b2 15-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121872 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
697483addf056595c997302f1316cc59244eefaa 15-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Detect and enumerate bypass loops.

Bypass loops have the current live range live through, but contain no uses or
defs. Splitting around a bypass loop can free registers for other uses inside
the loop by spilling the split range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121871 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
521a453721aeefbb6783b6acc8ea36b3c18b4931 15-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Separate SplitAnalysis::getSplitLoops().

This method returns the set of loops with uses that are candidates for
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121870 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b5f327b30f048b989c6f08d3bf84568d541b7644 11-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> No need to add liveness that's already there.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118742 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
cfa7134a9c33c0c7f8dda359c89dc6763a258e07 10-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Basic rematerialization during splitting.

Whenever splitting wants to insert a copy, it checks if the value can be
rematerialized cheaply instead.

Missing features:
- Delete instructions when all uses have been rematerialized.
- Truncate live ranges to the remaining uses after rematerialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118702 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
376dcbd6c2c7adb8281f89d045b307eee7bd682a 03-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Tag debug output as regalloc

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118193 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
3d4114c464d1ec6c9a6088e04d2156f72c4b42ce 02-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> When inserting copies during splitting, always use the parent register as the
source, and let rewrite() clean it up.

This way, kill flags on the inserted copies are fixed as well during rewrite().

We can't just assume that all the copies we insert are going to be kills since
critical edges into loop headers sometimes require both source and dest to be
live out of a block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117980 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
79cb53ce9563fff74605454560e98ea0aa4b523f 01-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Update kill flags while rewriting instructions after splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5b4bb218d1fb248474c997b865491182bad6ff61 30-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Make sure copies are inserted after any exception handling labels at the top of
a basic block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117764 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
3ccfce0e35371d20fb84f65185f7f0126d072461 29-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't transfer unused values to the new intervals formed by splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8a8e26fb1867b45ab7c5832dc3f509127d6624b8 29-Oct-2010 Benjamin Kramer <benny.kra@googlemail.com> Silence Release build warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117671 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c94fcb1507db5c043558f3f58d389e774bc2f71d 29-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Never propagate the idom value out of a block that defines its own value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117669 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
e1dde7b05a83438eeba4bd83f8cf080f56d22c5b 28-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Replace SplitKit SSA update with an iterative algorithm very similar to the one
in SSAUpdaterImpl.h

Verifying live intervals revealed that the old method was completely wrong, and
we need an iterative approach to calculating PHI placemant. Fortunately, we have
MachineDominators available, so we don't have to compute that over and over
like SSAUpdaterImpl.h must.

Live-out values are cached between calls to mapValue() and computed in a greedy
way, so most calls will be working with very small block sets.

Thanks to Bob for explaining how this should work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117599 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
d68f458244b9d9a6644a9550dd5cee60331c9e7d 28-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Make MachineDominators available for SplitEditor. We are going to need it for
proper SSA updating.

This doesn't cause MachineDominators to be recomputed since we are already
requiring MachineLoopInfo which uses dominators as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117598 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
c95c1465fdba059f6cbf24d1d9fd84f442c60fe4 27-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Handle critical loop predecessors by making both inside and outside registers
live out.

This doesn't prevent us from inserting a loop preheader later on, if that is
better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117424 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
0960a650b7047373da25bee6ec2eb73889c3b7bb 27-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Compute critical loop predecessors in the same way as critical loop exits.

Critical edges going into a loop are not as bad as critical exits. We can handle
them by splitting the critical edge, or by having both inside and outside
registers live out of the predecessor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117423 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
3a0e0715a5691e26ca70bc853d6d3d116e5949b8 27-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> After splitting, compute connected components of all new registers, not just for
the remainder register.

Example:

bb0:
x = 1
bb1:
use(x)
...
x = 2
jump bb1

When x is isolated in bb1, the inner part breaks into two components, x1 and x2:

bb0:
x0 = 1
bb1:
x1 = x0
use(x1)
...
x2 = 2
x0 = x2
jump bb1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117408 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f1354ae95ac6d7a2f31452301ccce46b6c116e37 27-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Call RenumberValues for all new registers created during splitting. This is
necessary to get correct hasPHIKill flags.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117406 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
79c0262fa8516d0b673b2fcacff920dcc62a9b94 27-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Preserve PHIDef bits in cloned values during splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117405 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2bfb32468404eb68dcc1b69a34336794b20e3f33 23-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Be more strict about detecting multi-use blocks for isolation.

When a block has exactly two uses and the register is both live-in and live-out,
don't isolate the block. We would be inserting two copies, so we haven't really
made any progress.

If the live-in and live-out values separate into disconnected components after
splitting, we would be making progress. We can't detect that for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117169 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2c1442e1b2ea874a8766025e2ccff96e87879c2b 22-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Be more strict when detecting critical edges before loop splitting.

An exit block with a critical edge must only have predecessors in the loop, or
just before the loop. This guarantees that the inserted copies in the loop
predecessors dominate the exit block.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117144 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
532de3dc6ea98387368954c0ac0e07b0adca8b62 22-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add print methods

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117143 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9d999772df3a7fd96857bb9155e1e9ab5fee7a13 21-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't include the destination interval in the union when computing
Parent - union(Y, ...). Doh.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117042 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9d5d48bc41b182a1b76b1df25069ad4fb6fc45a7 15-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Eliminate curli from SplitEditor. Use the LiveRangeEdit reference instead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116547 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2a0180fbff4870995482d96986ad780ab9de8af4 15-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Move stack slot assignments into LiveRangeEdit.

All registers created during splitting or spilling are assigned to the same
stack slot as the parent register.

When splitting or rematting, we may not spill at all. In that case the stack
slot is still assigned, but it will be dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116546 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
a17768f5822ab62bc18608e5ba473187bf726b84 15-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Create a new LiveRangeEdit class to keep track of the new registers created when
splitting or spillling, and to help with rematerialization.

Use LiveRangeEdit in InlineSpiller and SplitKit. This will eventually make it
possible to share remat code between InlineSpiller and SplitKit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116543 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ab00e9f498a23a511a06d9fcd33e7232e9a3f916 14-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Only split around a loop if the live range has uses outside the loop periphery.

Before we would also split around a loop if any peripheral block had multiple
uses. This could cause repeated splitting when splitting a different live range
would insert uses into the periphery.

Now -spiller=inline passes the nightly test suite again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116494 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
7466927b1af264b359c860cb9f7d1f3b275cc5cd 09-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Rename SplitEditor::rewrite to finish() and break it out into a couple of new
functions: computeRemainder and rewrite.

When the remainder breaks up into multiple components, remember to rewrite those
uses as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116121 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
0253df9a897ce541d56146699cedd79c464bda5e 08-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> After splitting, the remaining LiveInterval may be fragmented into multiple
connected components. These components should be allocated different virtual
registers because there is no reason for them to be allocated together.

Add the ConnectedVNInfoEqClasses class to calculate the connected components,
and move values to new LiveIntervals.

Use it from SplitKit::rewrite by creating new virtual registers for the
components.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116006 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
452a9fdf541413d76d9ea1d91e1702aaf2f651c7 07-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Print more loop info.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8fc3d1187ce547f42a43ec6adb229c8d2423a6b1 07-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Print out MBB number when rewriting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115950 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4b3041c43e8134d0f2471255c736745f2eb3214d 07-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Cache interval iterators in SplitEditor::addTruncSimpleRange so we only have to
do one find().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115929 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9b24afe41e06572f901edf2e78ef71fb228db29e 07-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Clean up debug printing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115928 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9b90d7eae2e72ee3f816194b6b6f9af94fb0fd0b 06-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Count uses in all nested loops, not just the deepest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115710 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fc3ef3c2e9e1a01f19aaf1e362d8d2f209c09a46 06-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Remove SplitAnalysis::removeUse. It was only used to make SplitAnalysis
reusable, but that is no longer relevant since a split will always replace the
original.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115709 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
d00f7e0c76d997b6b685ea66ba78aba2b952cd92 06-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> dupli always has an interval now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115708 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2e2be60e0386c33b3e28a29af3ddfbafafc45aea 06-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> We can split around loops with multiple exits now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115696 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
57d0f2deb0afefe69770a28937a4363e7b1f9753 06-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Update SplitEditor API to reflect the fact that the original live interval is
never kept after splitting.

Keeping the original interval made sense when the split region doesn't modify
the register, and the original is spilled. We can get the same effect by
detecting reloaded values when spilling around copies.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115695 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
dbc36091ff7be76d22105b67db73e18224bebb2f 06-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Intervals are half-open.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
984a7fc32ce2df9deb4bde8ddd086185b91bb358 05-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> When we find a reaching definition, make sure it is visited from all paths by
erasing it from the visited set. That ensures we create the right phi defs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115666 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fc60d7729bb5b63b7d61e370e51bd05e9a18b8bc 05-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't use nextIndex to check for live out of instruction.
Insert copy after defining instruction.

Fix LiveIntervalMap::extendTo to properly handle live segments starting before
the current basic block.

Make sure the open live range is extended to the inserted copy's use slot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6e2968c85c1e162ee5bc813769eab223e3df0f15 25-Sep-2010 Lang Hames <lhames@gmail.com> Removed VNInfo::isDefAccurate(). Def "accuracy" can be checked by testing whether LiveIntervals::getInstructionFromIndex(def) returns NULL.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114791 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5fa42a45a1845046dde84089fb4d8e1e1b329b65 22-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Build the complement interval dupli after the split intervals instead of
creating it before and subtracting split ranges.

This way, the SSA update code in LiveIntervalMap can properly create and use new
phi values in dupli. Now it is possible to create split regions where a value
escapes along two different CFG edges, creating phi values outside the split
region.

This is a work in progress and probably quite broken.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f6a129a24b866635c3c51edf08749755f952b5f2 16-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Use the value mapping provided by LiveIntervalMap. This simplifies the code a
great deal because we don't have to worry about maintaining SSA form.

Unconditionally copy back to dupli when the register is live out of the split
range, even if the live-out value was defined outside the range. Skipping the
back-copy only makes sense when the live range is going to spill outside the
split range, and we don't know that it will. Besides, this was a hack to avoid
SSA update issues.

Clear up some confusion about the end point of a half-open LiveRange. Methinks
LiveRanges need to be closed so both start and end are included in the range.
The low bits of a SlotIndex are symbolic, so a half-open range doesn't really
make sense. This would be a pervasive change, though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
dd9f3fdc77b77b10710c27050d508d7c7fb40c25 14-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Mechanically replace LiveInterval* with LiveIntervalMap for intervals being
edited without actually using LiveIntervalMap functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113816 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9ca2aeb2d223d11fd01b0bb8f13fe7f3a969714d 14-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Allow LiveIntervalMap to be reused by resetting the current live interval.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b3e9681cc0ea2d52a1f8cd09880656780dce4073 13-Sep-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Let's just declare that it is impossible to construct a std::pair from a null
pointer and work around that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113788 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6715be20e23ac19efd20e16d43fdd1f608e3e415 19-Aug-2010 Michael J. Spencer <bigcheesegs@gmail.com> Fix the msvc 2010 build.

The Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01
implements parts of C++0x based on the draft standard. An old version of
the draft had a bug that makes std::pair<T1*, T2*>(something, 0) fail to
compile. This is because the template<class U, class V> pair(U&& x, V&& y)
constructor is selected, even though it later fails to implicitly convert
U and V to frist_type and second_type.

This has been fixed in n3090, but it seems that Microsoft is not going to
update msvc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111535 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
ff3ae8691c18c4c40d09fb21ecac880aea9a536b 18-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Thinking about it, we don't need MachineDominatorTree after all. The DomValue
map discovers the iterated dominance frontier for free.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111400 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
cf16bea74e3a6f84af914520562e9f9c5dfa0fad 18-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Revert r111394. It was too aggressive.

We must complete the DFS, otherwise we might miss needed phi-defs, and
prematurely color live ranges with a non-dominating value.

This is not a big deal since we get to color more of the CFG and the next
mapValue call will be faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
4d440bd786ae4dad7035c30fd09044a9efc8dccd 18-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Aggressively prune the DFS when inserting phi-defs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
1407c84242688dbcdbaa5b0296c18f46d102f25a 18-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add the LiveIntervalMap class. Don't hook it up yet.

LiveIntervalMap maps values from a parent LiveInterval to a child interval that
is a strict subset. It will create phi-def values as needed to preserve the
VNInfo SSA form in the child interval.

This leads to an algorithm very similar to the one in SSAUpdaterImpl.h, but with
enough differences that the code can't be reused:

- We don't need to manipulate PHI instructions.
- LiveIntervals have kills.
- We have MachineDominatorTree.
- We can use df_iterator.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111393 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
0a2b2a1497a77f1db281d4dc9f21d01fe48f6ec6 14-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Clean up the Spiller.h interface.

The earliestStart argument is entirely specific to linear scan allocation, and
can be easily calculated by RegAllocLinearScan.

Replace std::vector with SmallVector.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111055 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fc412d85c46a8656361fe1e9197ea85922e2cd61 13-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Implement splitting inside a single block.

When a live range is contained a single block, we can split it around
instruction clusters. The current approach is very primitive, splitting before
and after the largest gap between uses.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111043 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2780d3ca8114ae11fb43f61655a5ddde22518fb8 13-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Let LiveInterval::addRange extend existing ranges, it will verify that value
numbers match. The old check could accidentally leave holes in openli.

Also let useIntv add all ranges for the phi-def value inserted by
enterIntvAtEnd. This works as long at the value mapping is established in
enterIntvAtEnd.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
00667a54f21f2d58382ac2eed973706332ed5817 13-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Remember to actually update SplitAnalysis statistics now that we have a fancy
function to do it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110994 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
09c45d2fe8fb0564ea2095f77fc79e184aa0a1a7 13-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Handle an empty dupli.

This can happen if the original interval has been broken into two disconnected
parts. Ideally, we should be able to detect when the graph is disconnected and
create separate intervals, but that code is not implemented yet.

Example:

Two basic blocks are both branching to a loop header. Our interval is defined in
both basic blocks, and live into the loop along both edges.

We decide to split the interval around the loop. The interval is split into an
inside part and an outside part. The outside part now has two disconnected
segments, one in each basic block.

If we later decide to split the outside interval into single blocks, we get one
interval per basic block and an empty dupli for the remainder.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110976 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
2dee7a527b083e259f9e826c57c1e5dab9540798 13-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Update the SplitAnalysis statistics as uses are moved from curli to the new
split intervals. THis means the analysis can be used for multiple splits as long
as curli doesn't shrink.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
fff2c4726baa0d6c9cb184c815677e33c0357c93 12-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Also recompute HasPHIKill flags in LiveInterval::RenumberValues.

If a phi-def value were removed from the interval, the phi-kill flags are no
longer valid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110949 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
e1f543fbb338ea80cdac021fcb09230ad86896c6 12-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Clean up debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110940 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f1b05f2b0ef48cb80b064e2f792b38c626822fc0 12-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Implement single block splitting.

Before spilling a live range, we split it into a separate range for each basic
block where it is used. That way we only get one reload per basic block if the
new smaller ranges can allocate to a register.

This type of splitting is already present in the standard spiller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110934 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
987eeccb61bc9c155057453b23980e39de71ff8e 10-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> More debug spew

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110720 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
9db3ea46cb7bd6bdf108d314daffd0dfd50a73fe 10-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Implement register class inflation.

When splitting a live range, the new registers have fewer uses and the
permissible register class may be less constrained. Recompute the register class
constraint from the uses of new registers created for a split. This may let them
be allocated from a larger set, possibly avoiding a spill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110703 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
08e93b14c37277ab40b835de340f89ba357d3332 10-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Recalculate the spill weight and allocation hint for virtual registers created
during live range splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110686 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
5eb308b9448ee5b14fac26c0533eac481bc28471 07-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Lazily defer duplicating the live interval we are splitting until we know it is
necessary.

Sometimes, live range splitting doesn't shrink the current interval, but simply
changes some instructions to use a new interval. That makes the original more
suitable for spilling. In this case, we don't need to duplicate the original.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110481 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
23436597a8efad427059f2a6db5264e6a40d2dc7 06-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add LiveInterval::RenumberValues - Garbage collection for VNInfos.

After heavy editing of a live interval, it is much easier to simply renumber the
live values instead of trying to keep track of the unused ones.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
b85f5388a969706f517723bcac94f7af4b2a1870 06-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix swapped COPY operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
7536f72a97ad25c3652fdfe26d392fd78b6ea7b9 05-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Checkpoint SplitKit progress.

We are now at a point where we can split around simple single-entry, single-exit
loops, although still with some bugs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f0179004e94259a8adab6c48f295ea9ab18af4c3 27-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add SplitEditor to SplitKit. This class will be used to edit live intervals and
rewrite instructions for live range splitting.

Still work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
f2c6e367c1c0d8797e62e58a3ccdb8cceee27987 21-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Change the createSpiller interface to take a MachineFunctionPass argument.

The spillers can pluck the analyses they need from the pass reference.

Switch some never-null pointers to references.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
6a0dc079efe7acf7e71cc4c0948fe814f35ba091 20-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Implement loop splitting analysis.
Determine which loop exit blocks need a 'pre-exit' block inserted.
Recognize when this would be impossible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108941 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
abff28087fd6be8150ff0e69def7de7312b2f76b 20-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Appease the colonials.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp
8ae0263471cc29c5f8278ee1ea5b678042ec6dce 20-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Beginning SplitKit - utility classes for live range splitting.

This is a work in progress. So far we have some basic loop analysis to help
determine where it is useful to split a live range around a loop.

The actual loop splitting code from Splitter.cpp is also going to move in here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108842 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/SplitKit.cpp