summaryrefslogtreecommitdiff
path: root/lib/CodeGen/PHIElimination.cpp
Commit message (Collapse)AuthorAge
...
* Move PHIElimination's SplitCriticalEdge for MachineBasicBlocks outDan Gohman2010-06-22
| | | | | | | | into a utility routine, teach it how to update MachineLoopInfo, and make use of it in MachineLICM to split critical edges on demand. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106555 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a DebugLoc parameter to TargetInstrInfo::InsertBranch(). ThisStuart Hastings2010-06-17
| | | | | | | | | | | | | addresses a longstanding deficiency noted in many FIXMEs scattered across all the targets. This effectively moves the problem up one level, replacing eleven FIXMEs in the targets with eight FIXMEs in CodeGen, plus one path through FastISel where we actually supply a DebugLoc, fixing Radar 7421831. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106243 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a DebugLoc argument to TargetInstrInfo::copyRegToReg, so that itDan Gohman2010-05-06
| | | | | | | doesn't have to guess. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103194 91177308-0d34-0410-b5e6-96231b3b80d8
* Move REG_SEQUENCE removal to 2addr pass.Evan Cheng2010-05-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103109 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach PHI elimination to remove REG_SEQUENCE instructions and update ↵Evan Cheng2010-05-04
| | | | | | | | | | | | | | references of the source operands with references of the destination with subreg indices. e.g. %reg1029<def>, %reg1030<def> = VLD1q16 %reg1024<kill>, ... %reg1031<def> = REG_SEQUENCE %reg1029<kill>, 5, %reg1030<kill>, 6 => %reg1031:5<def>, %reg1031:6<def> = VLD1q16 %reg1024<kill>, ... PHI elimination now does more than phi elimination. It is really a de-SSA pass. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103039 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename variables for consistency.Evan Cheng2010-05-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103013 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid being influenced by dbg_value instructions.Evan Cheng2010-03-25
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99465 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove PHINodeTraits and use MachineInstrExpressionTrait instead.Evan Cheng2010-03-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97687 91177308-0d34-0410-b5e6-96231b3b80d8
* Keep track of phi join registers explicitly in LiveVariables.Jakob Stoklund Olesen2010-02-23
| | | | | | | | Previously, LiveIntervalAnalysis would infer phi joins by looking for multiply defined registers. That doesn't work if the phi join is implicitly defined in all but one of the predecessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96994 91177308-0d34-0410-b5e6-96231b3b80d8
* Dead code eliminationJakob Stoklund Olesen2010-02-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96837 91177308-0d34-0410-b5e6-96231b3b80d8
* Dead code elimination.Jakob Stoklund Olesen2010-02-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96496 91177308-0d34-0410-b5e6-96231b3b80d8
* move target-independent opcodes out of TargetInstrInfoChris Lattner2010-02-09
| | | | | | | | | | into TargetOpcodes.h. #include the new TargetOpcodes.h into MachineInstr. Add new inline accessors (like isPHI()) to MachineInstr, and start using them throughout the codebase. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95687 91177308-0d34-0410-b5e6-96231b3b80d8
* Change errs() to dbgs().David Greene2010-01-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92566 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn off critical edge splitting for landing pads. The introduction of aBill Wendling2009-12-17
| | | | | | | | | | | non-landing pad basic block as the successor to a block that ends in an unconditional jump will cause block folding to remove the added block as a successor. Thus eventually removing it AND the landing pad entirely. Critical edge splitting is an optimization, so we can safely turn it off when dealing with landing pads. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91634 91177308-0d34-0410-b5e6-96231b3b80d8
* Reuse lowered phi nodes.Jakob Stoklund Olesen2009-12-16
| | | | | | | | | | | | | | Tail duplication produces lots of identical phi nodes in different basic blocks. Teach PHIElimination to reuse the join registers when lowering a phi node that is identical to an already lowered node. This saves virtual registers, and more importantly it avoids creating copies the the coalescer doesn't know how to eliminate. Teach LiveIntervalAnalysis about the phi joins with multiple uses. This patch significantly reduces code size produced by -pre-regalloc-taildup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91549 91177308-0d34-0410-b5e6-96231b3b80d8
* improve portability to avoid conflicting with std::next in c++'0x.Chris Lattner2009-12-03
| | | | | | | Patch by Howard Hinnant! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90365 91177308-0d34-0410-b5e6-96231b3b80d8
* Move PHIElimination::isLiveOut method to LiveVariables.Jakob Stoklund Olesen2009-12-01
| | | | | | | | We want LiveVariables clients to use methods rather than accessing the getVarInfo data structure directly. That way it will be possible to change the LiveVariables representation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90240 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more clever about calculating live variables through new basic blocks.Jakob Stoklund Olesen2009-11-21
| | | | | | | | | | | | When splitting a critical edge, the registers live through the edge are: - Used in a PHI instruction, or - Live out from the predecessor, and - Live in to the successor. This allows the coalescer to eliminate even more phi joins. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89530 91177308-0d34-0410-b5e6-96231b3b80d8
* Place new basic blocks immediately after their predecessor when splittingJakob Stoklund Olesen2009-11-19
| | | | | | | | | critical edges in PHIElimination. This has a huge impact on regalloc performance, and we recover almost all of the 10% compile time regression that edge splitting introduced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89381 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't require LiveVariables for PHIElimination. Enable critical edge splittingJakob Stoklund Olesen2009-11-18
| | | | | | | | | | | | when LiveVariables is available. The -split-phi-edges is now gone, and so is the hack to disable it when using the local register allocator. The PHIElimination pass no longer has LiveVariables as a prerequisite - that is what broke the local allocator. Instead we do critical edge splitting when possible - that is when LiveVariables is available. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89213 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix inverted test and add testcase from failing self-host.Jakob Stoklund Olesen2009-11-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89167 91177308-0d34-0410-b5e6-96231b3b80d8
* Disable -split-phi-edges to unbreak the buildbotsJakob Stoklund Olesen2009-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89142 91177308-0d34-0410-b5e6-96231b3b80d8
* Never call UpdateTerminator() when AnalyzeBranch would fail.Jakob Stoklund Olesen2009-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89139 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable -split-phi-edges by default, except when -regalloc=local.Jakob Stoklund Olesen2009-11-17
| | | | | | | The local register allocator doesn't like it when LiveVariables is run. We should also disable edge splitting under -O0, but that has to wait a bit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89125 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 89021. It's miscompiling llvm-gcc driver driver at -O0.Evan Cheng2009-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89082 91177308-0d34-0410-b5e6-96231b3b80d8
* Enable -split-phi-edges by defaultJakob Stoklund Olesen2009-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89021 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix for the original bug in PR5495 - Look at uses as well as defs when ↵Lang Hames2009-11-16
| | | | | | | | | determining the PHI-copy insert point. - Patch by Andrew Canis! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88880 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bug in -split-phi-edges.Jakob Stoklund Olesen2009-11-14
| | | | | | | | | | When splitting an edge after a machine basic block with fall-through, we forgot to insert a jump instruction. Fix this by calling updateTerminator() on the fall-through block when relevant. Also be more precise in PHIElimination::isLiveIn. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88728 91177308-0d34-0410-b5e6-96231b3b80d8
* Update MachineDominator informationJakob Stoklund Olesen2009-11-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88727 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PHIElimination optimization that uses MBB->getBasicBlock.Jakob Stoklund Olesen2009-11-13
| | | | | | | | | | | The BasicBlock associated with a MachineBasicBlock does not necessarily correspond to the code in the MBB. Don't insert a new IR BasicBlock when splitting critical edges. We are not supposed to modify the IR during codegen, and we should be able to do just fine with a NULL BB. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88707 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix -Asserts warning.Daniel Dunbar2009-11-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87024 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix liveness calculation when splitting critical edges during PHI elimination.Jakob Stoklund Olesen2009-11-11
| | | | | | | | | | | | | | - Edges are split before any phis are eliminated, so the code is SSA. - Create a proper IR BasicBlock for the split edges. - LiveVariables::addNewBlock now has same syntax as MachineDominatorTree::addNewBlock. Algorithm calculates predecessor live-out set rather than successor live-in set. This feature still causes some miscompilations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86867 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach PHIElimination to split critical edges when -split-phi-edges is enabled.Jakob Stoklund Olesen2009-11-10
| | | | | | | | Critical edges leading to a PHI node are split when the PHI source variable is live out from the predecessor block. This help the coalescer eliminate more PHI joins. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86725 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactoring: Extract method PHIElimination::isLiveOut().Jakob Stoklund Olesen2009-11-10
| | | | | | | Clean up some whitespace. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86724 91177308-0d34-0410-b5e6-96231b3b80d8
* Use setPreservesAll and setPreservesCFG in CodeGen passes.Dan Gohman2009-07-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77754 91177308-0d34-0410-b5e6-96231b3b80d8
* For real this time: PHI Def & Kill tracking added to PHIElimination.Lang Hames2009-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76865 91177308-0d34-0410-b5e6-96231b3b80d8
* Added PHI Def & Kill tracking to PHIElimination pass.Lang Hames2009-07-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76849 91177308-0d34-0410-b5e6-96231b3b80d8
* Exposed PHIElimination pass within CodeGen.Lang Hames2009-07-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76688 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 74898. It broke several tests.Evan Cheng2009-07-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74925 91177308-0d34-0410-b5e6-96231b3b80d8
* if the terminator is a branch depending upon the side effects of aSanjiv Gupta2009-07-07
| | | | | | | | | previous cmp; a copy can not be inserted here if the copy insn also has side effects. We don't have access to the attributes of copy insn here; so just play safe by finding a safe locations for branch terminators. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74898 91177308-0d34-0410-b5e6-96231b3b80d8
* LiveVariables::VarInfo contains an AliveBlocks BitVector, which has as manyJeffrey Yasskin2009-05-26
| | | | | | | | | | | entries as there are basic blocks in the function. LiveVariables::getVarInfo creates a VarInfo struct for every register in the function, leading to quadratic space use. This patch changes the BitVector to a SparseBitVector, which doesn't help the worst-case memory use but does reduce the actual use in very long functions with short-lived variables. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72426 91177308-0d34-0410-b5e6-96231b3b80d8
* Eliminate VarInfo::UsedBlocks.Evan Cheng2009-05-26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72411 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r67049, with the test adjusted for darwinDuncan Sands2009-03-17
| | | | | | | (which produces "call L_f$stub" rather than "call f"). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67079 91177308-0d34-0410-b5e6-96231b3b80d8
* --- Reverse-merging (from foreign repository) r67049 into '.':Bill Wendling2009-03-16
| | | | | | | | | | | | | | | | | U test/CodeGen/X86/2009-03-13-PHIElimBug.ll D test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll U lib/CodeGen/PHIElimination.cpp r67049 was causing this failure: Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/dg.exp ... FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/2009-03-13-PHIElimBug.ll for PR3784 Failed with exit(1) at line 1 while running: llvm-as < /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/2009-03-13-PHIElimBug.ll | llc -march=x86 | /usr/bin/grep -A 2 {call f} | /usr/bin/grep movl child process exited abnormally git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67051 91177308-0d34-0410-b5e6-96231b3b80d8
* Tweak the fix for PR3784: be less sensitive about justDuncan Sands2009-03-16
| | | | | | | | | | | | | | | | | | | how invokes are set up. The fix could be disturbed by register copies coming after the EH_LABEL, and also didn't behave quite right when it was the invoke result that was used in a phi node. Also (see new testcase) fix another phi elimination bug while there: register copies in the landing pad need to come after the EH_LABEL, because that's where execution branches to when unwinding. If they come before the EH_LABEL then they will never be executed... Also tweak the original testcase so it doesn't use a no-longer existing counter. The accumulated phi elimination changes fix two of seven Ada testsuite failures that turned up after landing pad critical edge splitting was turned off. So there's probably more to come. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67049 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR3784: If the source of a phi comes from a bb ended with an invoke, ↵Evan Cheng2009-03-13
| | | | | | | | | make sure the copy is inserted before the try range (unless it's used as an input to the invoke, then insert it after the last use), not at the end of the bb. Also re-apply r66140 which was disabled as a workaround. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66976 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitly pass in debug location information to BuildMI.Bill Wendling2009-02-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63599 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getAnalysisToUpdate to getAnalysisIfAvailable.Duncan Sands2009-01-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63198 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
* Pool-allocation for MachineInstrs, MachineBasicBlocks, andDan Gohman2008-07-07
| | | | | | | | | | | | MachineMemOperands. The pools are owned by MachineFunctions. This drastically reduces the number of calls to malloc/free made during the "Emit" phase of scheduling, as well as later phases in CodeGen. Combined with other changes, this speeds up the "instruction selection" phase of CodeGen by 10% in some cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53212 91177308-0d34-0410-b5e6-96231b3b80d8