summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SimpleRegisterCoalescing.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Deal with a few remaining spots that assume physical registers have live ↵Jakob Stoklund Olesen2010-07-091-2/+4
| | | | | | | | intervals. This fixes PR7601. llvm-svn: 107955
* Fix broken isCopy handling in TrimLiveIntervalToLastUse.Jakob Stoklund Olesen2010-07-091-3/+7
| | | | llvm-svn: 107950
* Revert "Fix broken isCopy handling in TrimLiveIntervalToLastUse"Jakob Stoklund Olesen2010-07-081-7/+3
| | | | | | This reverts commit 107921. It broke the clang self host. llvm-svn: 107926
* Fix broken isCopy handling in TrimLiveIntervalToLastUseJakob Stoklund Olesen2010-07-081-3/+7
| | | | llvm-svn: 107921
* Convert EXTRACT_SUBREG to COPY when emitting machine instrs.Jakob Stoklund Olesen2010-07-081-3/+7
| | | | | | | | | EXTRACT_SUBREG no longer appears as a machine instruction. Use COPY instead. Add isCopy() checks in many places using isMoveInstr() and isExtractSubreg(). The isMoveInstr hook will be removed later. llvm-svn: 107879
* Remove references to INSERT_SUBREG after de-SSA.Jakob Stoklund Olesen2010-07-081-6/+1
| | | | | | | Fix X86InstrInfo::convertToThreeAddressWithLEA to generate COPY instead of INSERT_SUBREG. llvm-svn: 107878
* Fix more places assuming subregisters have live intervalsJakob Stoklund Olesen2010-07-071-1/+6
| | | | llvm-svn: 107780
* Revert "Remove references to INSERT_SUBREG after de-SSA" r107725.Jakob Stoklund Olesen2010-07-071-1/+6
| | | | | | Buildbot breakage. llvm-svn: 107744
* Remove references to INSERT_SUBREG after de-SSAJakob Stoklund Olesen2010-07-061-6/+1
| | | | llvm-svn: 107732
* One more case assuming that subregs have live ranges.Jakob Stoklund Olesen2010-07-061-2/+2
| | | | llvm-svn: 107700
* Fix buildbot breakage where a def is missing.Jakob Stoklund Olesen2010-07-061-0/+2
| | | | llvm-svn: 107698
* Be more forgiving when calculating alias interference for physreg coalescing.Jakob Stoklund Olesen2010-07-061-102/+58
| | | | | | | | | | | | It is OK for an alias live range to overlap if there is a copy to or from the physical register. CoalescerPair can work out if the copy is coalescable independently of the alias. This means that we can join with the actual destination interval instead of using the getOrigDstReg() hack. It is no longer necessary to merge clobber ranges into subregisters. llvm-svn: 107695
* Detect and handle COPY in many places.Jakob Stoklund Olesen2010-07-031-18/+23
| | | | | | | This code is transitional, it will soon be possible to eliminate isExtractSubreg, isInsertSubreg, and isMoveInstr in most places. llvm-svn: 107547
* Use skipInstruction() as a simpler way of iterating over instructions using ↵Jakob Stoklund Olesen2010-06-301-10/+2
| | | | | | SrcReg llvm-svn: 107234
* After physreg coalescing, physical registers might not have live ranges whereJakob Stoklund Olesen2010-06-281-1/+2
| | | | | | | | | | you would expect. Don't assert on that case, just give up. This fixes PR7513. llvm-svn: 107046
* Don't track kills in VNInfo. Use interval ends instead.Jakob Stoklund Olesen2010-06-251-40/+5
| | | | | | | | | | | | The VNInfo.kills vector was almost unused except for all the code keeping it updated. The few places using it were easily rewritten to check for interval ends instead. The two new methods LiveInterval::killedAt and killedInRange are replacements. This brings us down to 3 independent data structures tracking kills. llvm-svn: 106905
* We should remove the live range from the destination register only if *all* defsBill Wendling2010-06-251-2/+2
| | | | | | | | | are dead, not just the def of this register. I.e., a register could be dead, but it's subreg isn't. Testcase to follow with a subsequent patch. llvm-svn: 106878
* Teach AdjustCopiesBackFrom to also use CoalescerPair to identify compatible ↵Jakob Stoklund Olesen2010-06-241-14/+12
| | | | | | copies. llvm-svn: 106780
* Replace a big gob of old coalescer logic with the new CoalescerPair class.Jakob Stoklund Olesen2010-06-241-691/+206
| | | | | | | | | | CoalescerPair can determine if a copy can be coalesced, and which register gets merged away. The old logic in SimpleRegisterCoalescing had evolved into something a bit too convoluted. This second attempt fixes some crashes that only occurred Linux. llvm-svn: 106769
* Revert "Replace a big gob of old coalescer logic with the new CoalescerPair ↵Jakob Stoklund Olesen2010-06-241-180/+518
| | | | | | | | class." Whiny buildbots. llvm-svn: 106710
* Replace a big gob of old coalescer logic with the new CoalescerPair class.Jakob Stoklund Olesen2010-06-241-518/+180
| | | | | | | | CoalescerPair can determine if a copy can be coalesced, and which register gets merged away. The old logic in SimpleRegisterCoalescing had evolved into something a bit too convoluted. llvm-svn: 106701
* Remove the SimpleJoin optimization from SimpleRegisterCoalescing.Jakob Stoklund Olesen2010-06-221-476/+67
| | | | | | | | | Measurements show that it does not speed up coalescing, so there is no reason the keep the added complexity around. Also clean out some unused methods and static functions. llvm-svn: 106548
* Fix an exotic bug that only showed up in an internal test case.Jakob Stoklund Olesen2010-06-151-2/+4
| | | | | | | | SimpleRegisterCoalescing::JoinIntervals() uses CoalescerPair to determine if a copy is coalescable, and in very rare cases it can return true where LHS is not live - the coalescable copy can come from an alias of the physreg in LHS. llvm-svn: 106021
* Add CoalescerPair helper class.Jakob Stoklund Olesen2010-06-151-33/+20
| | | | | | | | | | | | | | | | | | | | Given a copy instruction, CoalescerPair can determine which registers to coalesce in order to eliminate the copy. It deals with all the subreg fun to determine a tuple (DstReg, SrcReg, SubIdx) such that: - SrcReg is a virtual register that will disappear after coalescing. - DstReg is a virtual or physical register whose live range will be extended. - SubIdx is 0 when DstReg is a physical register. - SrcReg can be joined with DstReg:SubIdx. CoalescerPair::isCoalescable() determines if another copy instruction is compatible with the same tuple. This fixes some NEON miscompilations where shuffles are getting coalesced as if they were copies. The CoalescerPair class will replace a lot of the spaghetti logic in JoinCopy later. llvm-svn: 105997
* Add full register <imp-def> operands when the coalescer is creating partialJakob Stoklund Olesen2010-06-021-50/+50
| | | | | | | | | register updates. These operands tell the spiller that the other parts of the partially defined register are don't-care, and a reload is not necessary. llvm-svn: 105361
* Slightly change the meaning of the reMaterialize target hook when the originalJakob Stoklund Olesen2010-06-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | instruction defines subregisters. Any existing subreg indices on the original instruction are preserved or composed with the new subreg index. Also substitute multiple operands mentioning the original register by using the new MachineInstr::substituteRegister() function. This is necessary because there will soon be <imp-def> operands added to non read-modify-write partial definitions. This instruction: %reg1234:foo = FLAP %reg1234<imp-def> will reMaterialize(%reg3333, bar) like this: %reg3333:bar-foo = FLAP %reg333:bar<imp-def> Finally, replace the TargetRegisterInfo pointer argument with a reference to indicate that it cannot be NULL. llvm-svn: 105358
* Properly compose subregister indices when coalescing.Jakob Stoklund Olesen2010-06-011-13/+1
| | | | | | | The comment about ordering of subreg indices is no longer true. This exposed a bug in the new substVirtReg method that is also fixed. llvm-svn: 105294
* Disable invalid coalescer assertion.Jakob Stoklund Olesen2010-05-251-1/+4
| | | | llvm-svn: 104574
* - Change MachineInstr::findRegisterDefOperandIdx so it can also look for defsEvan Cheng2010-05-211-2/+3
| | | | | | | | | | that are aliases of the specified register. - Rename modifiesRegister to definesRegister since it's looking a def of the specific register or one of its super-registers. It's not looking for def of a sub-register or alias that could change the specified register. - Added modifiesRegister to look for defs of aliases. llvm-svn: 104377
* Fix a crash when debugging the coalescer. DebugValue instructions are notBob Wilson2010-05-181-4/+13
| | | | | | in the coalescer's instruction map. llvm-svn: 104086
* It's not safe eliminate copies where src and dst have different sub-register ↵Evan Cheng2010-05-111-5/+7
| | | | | | indices. llvm-svn: 103450
* Fixes a coalescer bug that caused llc to crash on 2009-11-30-LiveVariablesBug.llEvan Cheng2010-05-061-4/+16
| | | | | | | | | | | with the fix in 103157. %reg1039:1<def> = VMOVS %S1<kill>, pred:14, pred:%reg0 is not coalescable since none of the super-registers of S1 are in reg1039's register class: DPR_VFP2. But it is still a legal copy instruction so it should not assert. llvm-svn: 103170
* Check that subregisters don't have independent values in ↵Jakob Stoklund Olesen2010-05-031-3/+14
| | | | | | | | RemoveCopyByCommutingDef(). This fixes PR6941. llvm-svn: 102970
* Don't use floating point in SimpleRegisterCoalescing.Jakob Stoklund Olesen2010-04-301-15/+10
| | | | | | Rounding differences causes tests to fail on Linux. llvm-svn: 102729
* Reject really weird coalescer case when trying to merge identical subregistersJakob Stoklund Olesen2010-04-291-0/+7
| | | | | | | | | | | | | of different register classes. e.g. %reg1048:3<def> = EXTRACT_SUBREG %RAX<kill>, 3 Where %reg1048 is a GR32 register. This is not impossible to handle, but it is pretty hard and very rare. This should unbreak the dragonegg builder. llvm-svn: 102672
* Fix typos in assertion strings.Dan Gohman2010-04-291-2/+2
| | | | llvm-svn: 102666
* Slightly verboser debug spew from coalescerJakob Stoklund Olesen2010-04-291-24/+25
| | | | llvm-svn: 102663
* Recompute kill flags from live intervals after coalescing instead of trying toJakob Stoklund Olesen2010-04-281-45/+21
| | | | | | | | | | | update them. Computing kill flags is notoriously difficult, and the coalescer would get it wrong sometimes, and it would completely skip physical registers. Now we simply remove kill flags based on the live intervals after coalescing. This is a few percent slower, but now we get correct kill flags for physical registers after coalescing. llvm-svn: 102510
* Do not try to optimize a copy that has already been marked for deletion.Evan Cheng2010-04-211-1/+2
| | | | llvm-svn: 102027
* - Clean up some crappy code which deals with coalescing of copies which look atEvan Cheng2010-04-211-52/+68
| | | | | | | extract_subreg / insert_subreg, etc. - Add support for more aggressive insert_subreg coalescing. llvm-svn: 101971
* Coalescer should not delete copy instructions whose defs are partially dead. ↵Evan Cheng2010-04-081-1/+1
| | | | | | | | e.g. %RDI<def,dead> = MOV64rr %RAX<kill>, %EDI<imp-def> llvm-svn: 100804
* Try trivial remat before the coalescer gives up on a vr / physreg coalescing ↵Evan Cheng2010-03-261-1/+7
| | | | | | for fear of tying up a physical register. llvm-svn: 99575
* Code clean up.Evan Cheng2010-03-251-11/+10
| | | | llvm-svn: 99544
* Remove an unused option.Evan Cheng2010-03-251-59/+29
| | | | llvm-svn: 99537
* Avoid being influenced by dbg_value instructions.Evan Cheng2010-03-251-1/+1
| | | | llvm-svn: 99465
* Free SavedLI even if SimpleRegisterCoalescing::JoinCopy() returns early.Jeffrey Yasskin2010-03-211-4/+5
| | | | llvm-svn: 99113
* Revert "Change coalescer complexity from N^2 to N logN by changing one letter."Jakob Stoklund Olesen2010-03-181-1/+12
| | | | | | This reverts commit 98776. It broke the llvm-gcc boot strap. llvm-svn: 98784
* Change coalescer complexity from N^2 to N logN by changing one letter.Jakob Stoklund Olesen2010-03-171-12/+1
| | | | | | | | | Remove ugly hack that aborted the coalescer before using N^2 time. This affects functions with very complicated live intervals for physical registers, i.e. functions with thousands of function calls. llvm-svn: 98776
* The check for coalescing a virtual register to a physical register, e.g.Evan Cheng2010-03-111-7/+18
| | | | | | | | | cl = EXTRACT_SUBREG reg1024, 1, is overly conservative. It should check for overlaps of vr's live interval with the super registers of the physical register (ECX in this case) and let JoinIntervals() handle checking the coalescing feasibility against the physical register (cl in this case). llvm-svn: 98251
* Disable physical register coalescing when the number of live ranges for theJakob Stoklund Olesen2010-03-091-0/+12
| | | | | | | | | | | | | physreg becomes ridiculously high. std::upper_bound may be log(N), but for sufficiently large live intervals, it becomes log(N)*cachemiss = a long long time. This patch improves coalescer time by 4500x for a function with 20000 function calls. The generated code is different, but not significantly worse - the allocator hints are almost as good as physreg coalescing anyway. llvm-svn: 98023
OpenPOWER on IntegriCloud