summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/InlineSpiller.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Trace through sibling PHIs in bulk.Jakob Stoklund Olesen2011-09-151-23/+50
| | | | | | | | | | | | | | | 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. llvm-svn: 139797
* Reapply r139247: Cache intermediate results during traceSiblingValue.Jakob Stoklund Olesen2011-09-091-82/+239
| | | | | | | | | | | | | | | | | 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. llvm-svn: 139378
* Revert r139247 "Cache intermediate results during traceSiblingValue."Jakob Stoklund Olesen2011-09-071-221/+82
| | | | | | It broke the self host and clang-x86_64-darwin10-RA. llvm-svn: 139259
* Cache intermediate results during traceSiblingValue.Jakob Stoklund Olesen2011-09-071-82/+221
| | | | | | | | | | | | | | 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. llvm-svn: 139247
* Revert r138794, "Do not try to rematerialize a value from a partial definition."Jakob Stoklund Olesen2011-09-011-22/+1
| | | | | | | | | The problem is fixed for all register allocators by r138944, so this patch is no longer necessary. <rdar://problem/10032939> llvm-svn: 138945
* Do not try to rematerialize a value from a partial definition.Bob Wilson2011-08-301-1/+22
| | | | | | | I don't currently have a good testcase for this; will try to get one tomorrow. <rdar://problem/10032939> llvm-svn: 138794
* Fix PR10387.Jakob Stoklund Olesen2011-07-181-1/+1
| | | | | | | | | | | | | 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. llvm-svn: 135378
* Oops, didn't mean to commit that.Jakob Stoklund Olesen2011-07-091-1/+1
| | | | | | | | 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. llvm-svn: 134782
* Hoist spills within a basic block.Jakob Stoklund Olesen2011-07-091-3/+28
| | | | | | | | | | 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. llvm-svn: 134776
* Fix PR10277.Jakob Stoklund Olesen2011-07-051-0/+1
| | | | | | | | | | | | | | | 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. llvm-svn: 134413
* Create a isFullCopy predicate.Rafael Espindola2011-06-301-5/+1
| | | | llvm-svn: 134189
* Avoid hoisting spills when looking at a copy from another register that is alsoJakob Stoklund Olesen2011-05-111-7/+16
| | | | | | | | | | | | | 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> llvm-svn: 131192
* Add some statistics to the splitting and spilling frameworks.Jakob Stoklund Olesen2011-05-051-5/+32
| | | | llvm-svn: 130931
* Avoid using stale entries form the sibling value map.Jakob Stoklund Olesen2011-04-301-5/+21
| | | | | | | This could happen when trying to use a value that had been eliminated after dead code elimination and folding loads. llvm-svn: 130597
* Add debug output for rematerializable instructions.Jakob Stoklund Olesen2011-04-201-2/+4
| | | | llvm-svn: 129883
* Handle spilling around an instruction that has an early-clobber re-definition ofJakob Stoklund Olesen2011-04-181-14/+15
| | | | | | | | the spilled register. This is quite common on ARM now that some stores have early-clobber defines. llvm-svn: 129714
* Pick a conservative register class when creating a small live range for remat.Jakob Stoklund Olesen2011-03-311-1/+1
| | | | | | | | | | | | 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. llvm-svn: 128610
* Recompute register class and hint for registers created during spilling.Jakob Stoklund Olesen2011-03-291-33/+41
| | | | | | The spill weight is not recomputed for an unspillable register - it stays infinite. llvm-svn: 128490
* Remember to use the correct register when rematerializing for snippets.Jakob Stoklund Olesen2011-03-291-6/+6
| | | | llvm-svn: 128469
* Run dead code elimination immediately after rematerialization.Jakob Stoklund Olesen2011-03-291-9/+24
| | | | | | | This may eliminate some uses of the spilled registers, and we don't want to insert reloads for that. llvm-svn: 128468
* Properly enable rematerialization when spilling after live range splitting.Jakob Stoklund Olesen2011-03-291-60/+102
| | | | | | | | 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. llvm-svn: 128449
* Use individual register classes when spilling snippets.Jakob Stoklund Olesen2011-03-261-21/+25
| | | | | | | | | 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. llvm-svn: 128351
* Also eliminate redundant spills downstream of inserted reloads.Jakob Stoklund Olesen2011-03-201-9/+17
| | | | | | | This can happen when multiple sibling registers are spilled after live range splitting. llvm-svn: 127965
* Change an argument to a LiveInterval instead of a register number to save ↵Jakob Stoklund Olesen2011-03-201-13/+13
| | | | | | some redundant lookups. llvm-svn: 127964
* Add debug output.Jakob Stoklund Olesen2011-03-191-0/+4
| | | | llvm-svn: 127959
* Hoist spills when the same value is known to be in less loopy sibling registers.Jakob Stoklund Olesen2011-03-181-22/+148
| | | | | | | | | | | | | | 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. llvm-svn: 127868
* Dead code elimination may separate the live interval into multiple connected ↵Jakob Stoklund Olesen2011-03-171-2/+2
| | | | | | | | | 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. llvm-svn: 127827
* Trace back through sibling copies to hoist spills and find rematerializable ↵Jakob Stoklund Olesen2011-03-151-10/+208
| | | | | | | | | | | | | 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. llvm-svn: 127698
* Rename members to match LLVM naming conventions more closely.Jakob Stoklund Olesen2011-03-141-111/+109
| | | | | | | | Remove the unused reserved_ bit vector, no functional change intended. This doesn't break 'svn blame', this file really is all my fault. llvm-svn: 127607
* Tell the register allocator about new unused virtual registers.Jakob Stoklund Olesen2011-03-131-1/+2
| | | | | | | This allows the allocator to free any resources used by the virtual register, including physical register assignments. llvm-svn: 127560
* Include snippets in the live stack interval.Jakob Stoklund Olesen2011-03-121-1/+3
| | | | llvm-svn: 127530
* Spill multiple registers at once.Jakob Stoklund Olesen2011-03-121-48/+203
| | | | | | | | | | | 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. llvm-svn: 127529
* Change the Spiller interface to take a LiveRangeEdit reference.Jakob Stoklund Olesen2011-03-101-19/+0
| | | | | | | This makes it possible to register delegates and get callbacks when the spiller edits live ranges. llvm-svn: 127389
* Make SpillIs an optional pointer. Avoid creating a bunch of temporary ↵Jakob Stoklund Olesen2011-03-101-3/+3
| | | | | | SmallVectors. llvm-svn: 127388
* Add a LiveRangeEdit::Delegate protocol.Jakob Stoklund Olesen2011-03-091-1/+1
| | | | | | | This will we used for keeping register allocator data structures up to date while LiveRangeEdit is trimming live intervals. llvm-svn: 127300
* Make the UselessRegs argument optional in the LiveRangeEdit constructor.Jakob Stoklund Olesen2011-03-071-1/+1
| | | | llvm-svn: 127181
* Use the same spill slot for all live ranges that descend form the same originalJakob Stoklund Olesen2011-02-241-4/+13
| | | | | | | | | register. This avoids some silly stack slot shuffling when both sides of a copy get spilled. llvm-svn: 126353
* 80 Col.Jakob Stoklund Olesen2011-02-221-2/+1
| | | | llvm-svn: 126258
* Set an allocation hint when rematting before a COPY.Jakob Stoklund Olesen2011-02-091-0/+4
| | | | | | This almost guarantees that the COPY will be coalesced. llvm-svn: 125140
* Avoid folding a load instruction into an instruction that redefines the ↵Jakob Stoklund Olesen2011-02-081-1/+5
| | | | | | | | register. The target hook doesn't know how to do that. (Neither do I). llvm-svn: 125108
* Teach TargetRegisterInfo how to cram stack slot indexes in with the virtual andJakob Stoklund Olesen2011-01-091-1/+2
| | | | | | | | | | | | | 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. llvm-svn: 123128
* Apparently, operandices is not a word.Jakob Stoklund Olesen2010-12-181-1/+1
| | | | llvm-svn: 122135
* Teach the inline spiller to attempt folding a load instruction into its singleJakob Stoklund Olesen2010-12-181-5/+21
| | | | | | | | | | | | | | | | | | 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. llvm-svn: 122133
* Pass a Banner argument to the machine code verifier both fromJakob Stoklund Olesen2010-12-181-2/+2
| | | | | | | | createMachineVerifierPass and MachineFunction::verify. The banner is printed before the machine code dump, just like the printer pass. llvm-svn: 122113
* Rip out live range splitting support from the inline spiller.Jakob Stoklund Olesen2010-12-101-56/+1
| | | | | | | | The spiller should only spill. The register allocator will drive live range splitting, it has the needed information about register pressure and interferences. llvm-svn: 121590
* When spilling a register defined by an early clobber, make sure that the newJakob Stoklund Olesen2010-11-151-0/+6
| | | | | | | | | | | | | 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. llvm-svn: 119182
* Hook up AliasAnalysis in InlineSpiller. This is used for rematerializingJakob Stoklund Olesen2010-11-101-1/+4
| | | | | | constant loads. llvm-svn: 118741
* RABasic is nearly functionally complete. There are a few remainingAndrew Trick2010-11-101-2/+2
| | | | | | | | | benchmarks hitting an assertion. Adds LiveIntervalUnion::collectInterferingVRegs. Fixes "late spilling" by checking for any unspillable live vregs among all physReg aliases. llvm-svn: 118701
* Simplify the LiveRangeEdit::canRematerializeAt() interface a bit.Jakob Stoklund Olesen2010-11-101-3/+2
| | | | llvm-svn: 118661
* Disable fancy splitting during spilling unless -extra-spiller-splits is given.Jakob Stoklund Olesen2010-11-041-8/+18
| | | | | | | | 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. llvm-svn: 118216
OpenPOWER on IntegriCloud