History log of /external/llvm/lib/CodeGen/InlineSpiller.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/CodeGen/InlineSpiller.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/CodeGen/InlineSpiller.cpp
bb756ca24401e190e3b704e5d92759c7a79cc6b7 17-Nov-2013 Andrew Trick <atrick@apple.com> Added a size field to the stack map record to handle subregister spills.

Implementing this on bigendian platforms could get strange. I added a
target hook, getStackSlotRange, per Jakob's recommendation to make
this as explicit as possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194942 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
03d9609c6154ed91daefb4e4f89b7298c11961f3 10-Oct-2013 Matthias Braun <matze@braunis.de> Print register in LiveInterval::print()

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192398 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
4f3b5e8c9232e43d1291aab8db5f5698d7ee0ea4 10-Oct-2013 Matthias Braun <matze@braunis.de> Represent RegUnit liveness with LiveRange instance

Previously LiveInterval has been used, but having a spill weight and
register number is unnecessary for a register unit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192397 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
5649e25ce86b9d89d228ae7c392413571b0f8c19 10-Oct-2013 Matthias Braun <matze@braunis.de> Pass LiveQueryResult by value

This makes the API a bit more natural to use and makes it easier to make
LiveRanges implementation details private.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192394 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
331de11a0acc6a095b98914b5f05ff242c9d7819 10-Oct-2013 Matthias Braun <matze@braunis.de> Rename LiveRange to LiveInterval::Segment

The Segment struct contains a single interval; multiple instances of this struct
are used to construct a live range, but the struct is not a live range by
itself.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192392 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
818833f27929d650b4323774cd3660860588f687 17-Sep-2013 Adrian Prantl <aprantl@apple.com> Debug info: Fix PR16736 and rdar://problem/14990587.
A DBG_VALUE is register-indirect iff the first operand is a register
_and_ the second operand is an immediate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e742d687369f79702894b6cf302e1f222c5d7432 15-Aug-2013 Mark Lacey <mark.lacey@apple.com> Auto-compute live intervals on demand.

When new virtual registers are created during splitting/spilling, defer
creation of the live interval until we need to use the live interval.

Along with the recent commits to notify LiveRangeEdit when new virtual
registers are created, this makes it possible for functions like
TargetInstrInfo::loadRegFromStackSlot() and
TargetInstrInfo::storeRegToStackSlot() to create multiple virtual
registers as part of the process of generating loads/stores for
different register classes, and then have the live intervals for those
new registers computed when they are needed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188437 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
4759f26c31d5544c5e1c13edb8ab013be9a95338 10-Jul-2013 Adrian Prantl <aprantl@apple.com> Safeguard DBG_VALUE handling. Unbreaks the ASAN buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186014 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
c12c880998a0be9de2d20f7855029ef743570a06 21-Jun-2013 Andrew Trick <atrick@apple.com> Update physreg live intervals during remat.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184574 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
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/InlineSpiller.cpp
6d9dbd5526e3161db884fc4fe99c278bb59ccc19 16-Jun-2013 David Blaikie <dblaikie@gmail.com> Debug Info: Simplify Frame Index handling in DBG_VALUE Machine Instructions

Rather than using the full power of target-specific addressing modes in
DBG_VALUEs with Frame Indicies, simply use Frame Index + Offset. This
reduces the complexity of debug info handling down to two
representations of values (reg+offset and frame index+offset) rather
than three or four.

Ideally we could ensure that frame indicies had been eliminated by the
time we reached an assembly or dwarf generation, but I haven't spent the
time to figure out where the FIs are leaking through into that & whether
there's a good place to convert them. Some FI+offset=>reg+offset
conversion is done (see PrologEpilogInserter, for example) which is
necessary for some SelectionDAG assumptions about registers, I believe,
but it might be possible to make this a more thorough conversion &
ensure there are no remaining FIs no matter how instruction selection
is performed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
2db14ba90cf5696414e909468001a2f6c8f8f780 23-May-2013 Benjamin Kramer <benny.kra@googlemail.com> InlineSpiller: Store bucket pointers instead of iterators.

Lets us use a SetVector instead of an explicit set + vector combination.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182586 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e210df20d3b69beaa3e83a6088b6bafb9f00bcfe 05-May-2013 Benjamin Kramer <benny.kra@googlemail.com> InlineSpiller: Remove quadratic behavior.

No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181149 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
b17cf29784ad526f3adfc20c5aa1b0de5c57033e 12-Sep-2012 James Molloy <james.molloy@arm.com> Add an analyzePhysReg() function to MachineOperandIteratorBase that analyses an instruction's use of a physical register, analogous to analyzeVirtReg.

Rename RegInfo to VirtRegInfo so as not to be confused with the new PhysRegInfo.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163694 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e2ac55242179382ba86215206072ea0d9be4ff5d 01-Sep-2012 Logan Chien <tzuhsiang.chien@gmail.com> Fix typo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163059 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
27982e110817e373ed85064eb844bbaec0fe6771 14-Jul-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Account for early-clobber reload instructions.

No test case, there are no in-tree targets that require this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
127cdba3eb78240e727dda4e62b05393d7a938e6 16-Jun-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Print out register number in InlineSpiller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158575 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
95a9d937728ca9cf2bf44f86ff1184df318b3bd7 06-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Round 2 of dead private variable removal.

LLVM is now -Wunused-private-field clean except for
- lib/MC/MCDisassembler/Disassembler.h. Not sure why it keeps all those unaccessible fields.
- gtest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158096 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
92a05fa4507102e1891f1de3523fb5aaf0d9398c 20-May-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Use LiveRangeQuery instead of getLiveRangeContaining().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157142 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.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/InlineSpiller.cpp
66c994c2dbd1a76418fdd0acb138aa029538ffe5 01-Mar-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Make InlineSpiller bundle-aware.

Simply treat bundles as instructions. Spill code is inserted between
bundles, never inside a bundle. Rewrite all operands in a bundle at
once.

Don't attempt and memory operand folding inside bundles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151787 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
4777ebb767d1b590c05d502c4a7f6adef4e6d5d1 12-Dec-2011 Pete Cooper <peter_cooper@apple.com> Fixed register allocator splitting a live range on a spilling variable.

If we create new intervals for a variable that is being spilled, then those new intervals are not guaranteed to also spill. This means that anything reading from the original spilling value might not get the correct value if spills were missed.

Fixes <rdar://problem/10546864>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@146428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.cpp
cb39064e7aee2273da1d00e6b800db84ddc34b6b 13-Nov-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Stop tracking spill slot uses in VirtRegMap.

Nobody cared, StackSlotColoring scans the instructions to find used stack
slots.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144485 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
17afb0664861507c9bd968f1678d8cca69b2851d 10-Nov-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Strip old implicit operands after foldMemoryOperand.

The TII.foldMemoryOperand hook preserves implicit operands from the
original instruction. This is not what we want when those implicit
operands refer to the register being spilled.

Implicit operands referring to other registers are preserved.

This fixes PR11347.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
a80444f88d88d88513b096c97474c453a4c3bcf6 14-Oct-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add value numbers when spilling dead defs.

When spilling around an instruction with a dead def, remember to add a
value number for the def.

The missing value number wouldn't normally create problems since there
would be an incoming live range as well. However, due to another bug
we could spill a dead V_SET0 instruction which doesn't read any values.

The missing value number caused an empty live range to be created which
is dangerous since it doesn't interfere with anything.

This fixes part of PR11125.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141923 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
69cf1cac3f62e60a50ff0aa9808ea4d317e273ef 16-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Disable local spill hoisting for non-killing copies.

If the source register is live after the copy being spilled, there is no
point to hoisting it. Hoisting inside a basic block only serves to
resolve interferences by shortening the live range of the source.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139882 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
b9edad0163296e02f7b4dbbc22b50615dede357c 15-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add an option to disable spill hoisting.

When -split-spill-mode is enabled, spill hoisting is performed by
SplitKit instead of by InlineSpiller. This hidden command line option
is for testing the splitter spill mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139845 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
d205f7a940dd38480ff6283328c7d429201cdf27 15-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Count correctly when a COPY turns into a spill or reload.

The number of spills could go negative since a folded COPY is just a
spill, and it may be eliminated.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139815 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
79c40a011b15f59e5b128c870c04893c3f1eddf9 15-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Count inserted spills and reloads more accurately.

Adjust counters when removing spill and reload instructions.

We still don't account for reloads being removed by eliminateDeadDefs().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139806 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
6b6e32d954233ddeeae7f99e358ff85059f1176a 15-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Trace through sibling PHIs in bulk.

When traceSiblingValue() encounters a PHI-def value created by live
range splitting, don't look at all the predecessor blocks. That can be
very expensive in a complicated CFG.

Instead, consider that all the non-PHI defs jointly dominate all the
PHI-defs. Tracing directly to all the non-PHI defs is much faster that
zipping around in the CFG when there are many PHIs with many
predecessors.

This significantly improves compile time for indirectbr interpreters.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139797 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
1ab7c8ea03d52c6fdae6fe0efae57a36c2f701c3 09-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Reapply r139247: Cache intermediate results during traceSiblingValue.

In some cases such as interpreters using indirectbr, the CFG can be very
complicated, and live range splitting may be forced to insert a large
number of phi-defs. When that happens, traceSiblingValue can spend a
lot of time zipping around in the CFG looking for defs and reloads.

This patch causes more information to be cached in SibValues, and the
cached values are used to terminate searches early. This speeds up
spilling by 20x in one interpreter test case. For more typical code,
this is just a 10% speedup of spilling.

The previous version had bugs that caused miscompilations. They have
been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
0472e040cba6d15ff3810685c3bd1bbdade3e568 07-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Revert r139247 "Cache intermediate results during traceSiblingValue."

It broke the self host and clang-x86_64-darwin10-RA.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139259 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
2c207a0f677a2d78b768acb559e6b9f6f112a50d 07-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Cache intermediate results during traceSiblingValue.

In some cases such as interpreters using indirectbr, the CFG can be very
complicated, and live range splitting may be forced to insert a large
number of phi-defs. When that happens, traceSiblingValue can spend a
lot of time zipping around in the CFG looking for defs and reloads.

This patch causes more information to be cached in SibValues, and the
cached values are used to terminate searches early. This speeds up
spilling by 20x in one interpreter test case. For more typical code,
this is just a 10% speedup of spilling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139247 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
ae779eea27f41d31268931a6508bd0536cfbc724 01-Sep-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Revert r138794, "Do not try to rematerialize a value from a partial definition."

The problem is fixed for all register allocators by r138944, so this
patch is no longer necessary.

<rdar://problem/10032939>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e497906e87c8dcf79bfd2f283679da9d99718861 30-Aug-2011 Bob Wilson <bob.wilson@apple.com> Do not try to rematerialize a value from a partial definition.
I don't currently have a good testcase for this; will try to get one
tomorrow. <rdar://problem/10032939>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138794 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
7941350101bdfa3b016dd8a5347a92064947dd31 18-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix PR10387.

When trying to rematerialize a value before an instruction that has an
early-clobber redefine of the virtual register, make sure to look up the
correct value number.

Early-clobber defs are moved one slot back, so getBaseIndex is needed to
find the used value number.

Bugpoint was unable to reduce the test case for this, see PR10388.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
4f4a6fcd165293c347a42b543e5e55aa42a09bb2 09-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Oops, didn't mean to commit that.

Spills should be hoisted out of loops, but we don't want to hoist them
to dominating blocks at the same loop depth. That could cause the spills
to be executed more often.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134782 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
56573cc1aee419b5cc9e3446a59a73577bf26fac 09-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Hoist spills within a basic block.

Try to move spills as early as possible in their basic block. This can
help eliminate interferences by shortening the live range being
spilled.

This fixes PR10221.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134776 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
9693d4c3f0d0e8c91e4748eb1c18799b1de7551c 05-Jul-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix PR10277.

Remat during spilling triggers dead code elimination. If a phi-def
becomes unused, that may also cause live ranges to split into separate
connected components.

This type of splitting is different from normal live range splitting. In
particular, there may not be a common original interval.

When the split range is its own original, make sure that the new
siblings are also their own originals. The range being split cannot be
used as an original since it doesn't cover the new siblings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134413 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
cfe5254cd34d9414d9f6b8aa02dc1239d71a703f 30-Jun-2011 Rafael Espindola <rafael.espindola@gmail.com> Create a isFullCopy predicate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134189 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
443443cc8399d6753cac828516ea27531e296769 11-May-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Avoid hoisting spills when looking at a copy from another register that is also
about to be spilled.

This can only happen when two extra snippet registers are included in the spill,
and there is a copy between them. Hoisting the spill creates problems because
the hoist will mark the copy for later dead code elimination, and spilling the
second register will turn the copy into a spill.

<rdar://problem/9420853>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
6ee56e658a6f676e01a06d7a53d1d5c87710f3c3 30-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Avoid using stale entries form the sibling value map.

This could happen when trying to use a value that had been eliminated after dead
code elimination and folding loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
3b7d917dec53a742fcb14802557ee75d35185968 21-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add debug output for rematerializable instructions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129883 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
5d5ef4a886290565570703747264cd47800765fc 18-Apr-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Handle spilling around an instruction that has an early-clobber re-definition of
the spilled register.

This is quite common on ARM now that some stores have early-clobber defines.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129714 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
312babc93ff837d268b83ae829fdb122f40c34c8 31-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Pick a conservative register class when creating a small live range for remat.

The rematerialized instruction may require a more constrained register class
than the register being spilled. In the test case, the spilled register has been
inflated to the DPR register class, but we are rematerializing a load of the
ssub_0 sub-register which only exists for DPR_VFP2 registers.

The register class is reinflated after spilling, so the conservative choice is
only temporary.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
cf610d07de3ba4929bb5d00e084877dd974b44a1 29-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Remember to use the correct register when rematerializing for snippets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128469 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
c1d22d8adbd40c3e5d704fdae90f9ed2089bb67e 29-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Run dead code elimination immediately after rematerialization.

This may eliminate some uses of the spilled registers, and we don't want to
insert reloads for that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128468 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
2ef661b0e8de0d4186c5f9cc990adce0a2493b17 29-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Properly enable rematerialization when spilling after live range splitting.

The instruction to be rematerialized may not be the one defining the register
that is being spilled. The traceSiblingValue() function sees through sibling
copies to find the remat candidate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128449 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e9c50732f71a6c2f6813f6c40743a9bfa3791ca8 26-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Use individual register classes when spilling snippets.

The main register class may have been inflated by live range splitting, so that
register class is not necessarily valid for the snippet instructions.

Use the original register class for the stack slot interval.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
682eed0da8e42770a0e694390ba929fd4d241657 20-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Also eliminate redundant spills downstream of inserted reloads.

This can happen when multiple sibling registers are spilled after live range
splitting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127965 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
01a46c82e0b58f6c2d562282538556159806c4fe 20-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Change an argument to a LiveInterval instead of a register number to save some redundant lookups.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127964 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
c1655e1a3c3a566b91b0513b56d61b58da1e36ba 20-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add debug output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127959 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
2a72bfa1b1a634ef6c5aa866cac1c0afda4534e4 18-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Hoist spills when the same value is known to be in less loopy sibling registers.

Stack slot real estate is virtually free compared to registers, so it is
advantageous to spill earlier even though the same value is now kept in both a
register and a stack slot.

Also eliminate redundant spills by extending the stack slot live range
underneath reloaded registers.

This can trigger a dead code elimination, removing copies and even reloads that
were only feeding spills.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
13ba2527f73554fff39ca31250803b253076afba 15-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Trace back through sibling copies to hoist spills and find rematerializable defs.

After live range splitting, an original value may be available in multiple
registers. Tracing back through the registers containing the same value, find
the best place to insert a spill, determine if the value has already been
spilled, or discover a reaching def that may be rematerialized.

This is only the analysis part. The information is not used for anything yet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127698 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
766faf4b2b7fe2835181777fb50d9f4d1814aba5 14-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Rename members to match LLVM naming conventions more closely.

Remove the unused reserved_ bit vector, no functional change intended.

This doesn't break 'svn blame', this file really is all my fault.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127607 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
7792e980c43536814ea42448db9799b4da32fef6 13-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Tell the register allocator about new unused virtual registers.

This allows the allocator to free any resources used by the virtual register,
including physical register assignments.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127560 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
b1adbd1f67125668ef1a87be62553e0f95cbc4d9 12-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Include snippets in the live stack interval.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127530 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
10a433238fe4679c8da17f3eb19611466332e312 12-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Spill multiple registers at once.

Live range splitting can create a number of small live ranges containing only a
single real use. Spill these small live ranges along with the large range they
are connected to with copies. This enables memory operand folding and maximizes
the spill to fill distance.

Work in progress with known bugs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127529 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
47dbf6cef761c25cfeb0aa7d624a6f98288bb96a 10-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Change the Spiller interface to take a LiveRangeEdit reference.

This makes it possible to register delegates and get callbacks when the spiller
edits live ranges.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127389 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
38f6bd0fc8095ef79a89b3db15ff6dc734ac90e7 10-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Make SpillIs an optional pointer. Avoid creating a bunch of temporary SmallVectors.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127388 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
92a55f4bdd120cdd3bb5a004c792d4d24a940311 09-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Add a LiveRangeEdit::Delegate protocol.

This will we used for keeping register allocator data structures up to date
while LiveRangeEdit is trimming live intervals.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
1973b3e2541f95c87e4acb7e134362ff306ec9ed 07-Mar-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Make the UselessRegs argument optional in the LiveRangeEdit constructor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127181 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
b2597268c215e2349905c81bfc22f69849b5ab18 24-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Use the same spill slot for all live ranges that descend form the same original
register.

This avoids some silly stack slot shuffling when both sides of a copy get
spilled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126353 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
75b5409d3a9eb9b7dadcd13fff69590df94122dd 23-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 80 Col.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126258 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
c3dca3f9d4a049102fa985aedbc65e53f4cf6c0d 09-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/InlineSpiller.cpp
7b1f498a7648b790929a4f97fd82228aa7ac7bea 08-Feb-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> 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
/external/llvm/lib/CodeGen/InlineSpiller.cpp
be97e906e03dd9b22e14f6749157c9d5f9701dd5 09-Jan-2011 Jakob Stoklund Olesen <stoklund@2pi.dk> Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual and
physical register numbers.

This makes the hack used in LiveInterval official, and lets LiveInterval be
oblivious of stack slots.

The isPhysicalRegister() and isVirtualRegister() predicates don't know about
this, so when a variable may contain a stack slot, isStackSlot() should always
be tested first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123128 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
390482569c2446a05518034c891fcfb378079a80 18-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Apparently, operandices is not a word.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
83d1ba572815c92a74817cc68e2bb48c59a87b5d 18-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Teach the inline spiller to attempt folding a load instruction into its single
use before rematerializing the load.

This allows us to produce:

addps LCPI0_1(%rip), %xmm2

Instead of:

movaps LCPI0_1(%rip), %xmm3
addps %xmm3, %xmm2

Saving a register and an instruction. The standard spiller already knows how to
do this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
89cab93fe999f6d81b4b99a71ac797b7ecfec277 18-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Pass a Banner argument to the machine code verifier both from
createMachineVerifierPass and MachineFunction::verify.

The banner is printed before the machine code dump, just like the printer pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122113 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
3bda29eb4f111015974d3f07675a26ec980e4a45 10-Dec-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Rip out live range splitting support from the inline spiller.

The spiller should only spill. The register allocator will drive live range
splitting, it has the needed information about register pressure and
interferences.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121590 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
68257e61eb6e7d528759bd7830db47d409dace89 15-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> When spilling a register defined by an early clobber, make sure that the new
live ranges for the spill register are also defined at the use slot instead of
the normal def slot.

This fixes PR8612 for the inline spiller. A use was being allocated to the same
register as a spilled early clobber def.

This problem exists in all the spillers. A fix for the standard spiller is
forthcoming.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119182 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e93198af07517b92f276192c974ce3a6006ce998 11-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Hook up AliasAnalysis in InlineSpiller. This is used for rematerializing
constant loads.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118741 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
f4baeaf8485f01beda46d29fd55753199dc68070 10-Nov-2010 Andrew Trick <atrick@apple.com> RABasic is nearly functionally complete. There are a few remaining
benchmarks hitting an assertion.
Adds LiveIntervalUnion::collectInterferingVRegs.
Fixes "late spilling" by checking for any unspillable live vregs among
all physReg aliases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118701 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
b80e973c95034e5754d888140497a9658a7c1ded 10-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Simplify the LiveRangeEdit::canRematerializeAt() interface a bit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118661 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
8c42f48d023c4b9164b3c39ad0513b53f1cc1e91 04-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Disable fancy splitting during spilling unless -extra-spiller-splits is given.

This way, InlineSpiller does the same amount of splitting as the standard
spiller. Splitting should really be guided by the register allocator, and
doesn't belong in the spiller at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118216 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
a37d5cf3425eb93a25cc5da2bbf9b6a47c757b45 01-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't assign new registers created during a split to the same stack slot, but
give them individual stack slots once the are actually spilled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117945 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
7d57753df3bbad14e3e3ddf396b4edbdc4c55d7d 30-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Print out register class of spilled register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117761 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
1f46a0ac6611b2811084bb8f9bf884733bcfd2b0 29-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Run a verification pass before any splitting to better distribute blame.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117629 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
26b92be9222e267447efe943f12848775075e22f 28-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add a temporary command line option to verify machine code after each spill or
split.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117597 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
0a12b801b546269b87c3806c6d4606cf2b287daa 26-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> InlineSpiller can also update LiveStacks.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117338 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
080c316ff8a066cd164d9a8f92df509d8cb63110 21-Oct-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Move some of the InlineSpiller rematerialization code into LiveRangeEdit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.cpp
cec2945f3092c4d087716eb96062d7c7ef6fe60c 26-Sep-2010 Lang Hames <lhames@gmail.com> Fixed some tests to avoid LiveIntervals::getInstructionFromIndex(..) overhead where possible. Thanks to Jakob for the suggestions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114798 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.cpp
b67b12ea64aed7651960dff5444c25d2d0c156b2 10-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Avoid editing the current live interval during remat.

The live interval may be used for a spill slot as well, and that spill slot
could be shared by split registers. We cannot shrink it, even if we know the
current register won't need the spill slot in that range.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110721 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.cpp
6d108e2cb59a3fe4d71bbde41416b55fc7c31d22 06-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Keep the MachiuneFunctionPass pointer around. It is useful for verification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110464 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
1a0f91b7c56fb49be0c5914333363320ac2a5f46 05-Aug-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Coalesce stack slot accesses that arise when spilling both sides of a COPY.
This helps avoid silly code:

%R0<def = LOAD <fi#5>
STORE <fi#5>, %R0<kill>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110266 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.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/InlineSpiller.cpp
9529a1c3dd9946c1e63075f4bf146a731769ebe2 19-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Spillers may alter MachineLoopInfo when breaking critical edges, so make it
non-const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108734 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e05442d50806e2850eae1571958816028093df85 09-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Change TII::foldMemoryOperand API to require the machine instruction to be
inserted in a MBB, and return an already inserted MI.

This target API change is necessary to allow foldMemoryOperand to call
storeToStackSlot and loadFromStackSlot when folding a COPY to a stack slot
reference in a target independent way.

The foldMemoryOperandImpl hook is going to change in the same way, but I'll wait
until COPY folding is actually implemented. Most targets only fold copies and
won't need to specialize this hook at all.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107991 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
6bae55017c49e59746a65cef2513f031bbcebfce 02-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Remove invalid assert

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107505 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
3b9c7ebc444ccc311a5e4125b904f9767244577a 02-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Properly handle debug values during inline spilling.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
8de3b1eb868fc5e9b6acb334ee487d943863f810 02-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Rematerialize as much as possible before inserting spills and reloads.

This allows us to recognize the common case where all uses could be
rematerialized, and no stack slot allocation is necessary.

If some values could be fully rematerialized, remove them from the live range
before allocating a stack slot for the rest.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
e72a5c5e2e3d09ef02bae00620d499d3e59c8a7f 01-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add memory operand folding support to InlineSpiller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
9e55afbf88f4853ac94b6a0ac021a89c5c929d6b 01-Jul-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add support for rematerialization to InlineSpiller.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107351 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
61e4a0bc10fa1d36d58935d42d248180993d65bb 30-Jun-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Remember to track spill slot uses in VirtRegMap when inserting loads and stores.
LocalRewriter::runOnMachineFunction uses this information to mark dead spill
slots.

This means that InlineSpiller now also works for functions that spill.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107302 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/CodeGen/InlineSpiller.cpp
914f2ff9e6969214d84a75745ec2851f045000f7 30-Jun-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Begin implementation of an inline spiller.

InlineSpiller inserts loads and spills immediately instead of deferring to
VirtRegMap. This is possible now because SlotIndexes allows instructions to be
inserted and renumbered.

This is work in progress, and is mostly a copy of TrivialSpiller so far. It
works very well for functions that don't require spilling.

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