summaryrefslogtreecommitdiff
path: root/lib/CodeGen/IfConversion.cpp
Commit message (Collapse)AuthorAge
* Run branch folding if if-converter make some transformations.Evan Cheng2009-09-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80994 91177308-0d34-0410-b5e6-96231b3b80d8
* remove various std::ostream version of printing methods fromChris Lattner2009-08-23
| | | | | | | | | MachineInstr and MachineOperand. This required eliminating a bunch of stuff that was using DOUT, I hope that bill doesn't mind me stealing his fun. ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79813 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert DOUT to DEBUG(errs()...).Bill Wendling2009-08-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79751 91177308-0d34-0410-b5e6-96231b3b80d8
* More migration to raw_ostream, the water has dried up around the iostream hole.Daniel Dunbar2009-07-25
| | | | | | | | | | | - Some clients which used DOUT have moved to DEBUG. We are deprecating the "magic" DOUT behavior which avoided calling printing functions when the statement was disabled. In addition to being unnecessary magic, it had the downside of leaving code in -Asserts builds, and of hiding potentially unnecessary computations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77019 91177308-0d34-0410-b5e6-96231b3b80d8
* llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.Torok Edwin2009-07-14
| | | | | | | | | | This adds location info for all llvm_unreachable calls (which is a macro now) in !NDEBUG builds. In NDEBUG builds location info and the message is off (it only prints "UREACHABLE executed"). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75640 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix assert(0) conversion, as suggested by Chris.Torok Edwin2009-07-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75423 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert more assert(0)+abort() -> LLVM_UNREACHABLE,Torok Edwin2009-07-11
| | | | | | | and abort()/exit() -> llvm_report_error(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75363 91177308-0d34-0410-b5e6-96231b3b80d8
* Fewer static variables, part 3 of many.Owen Anderson2009-06-24
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74140 91177308-0d34-0410-b5e6-96231b3b80d8
* ifcvt should ignore cfg where true and false successors are the same.Evan Cheng2009-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73423 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r71744. I must not have understood this correctly, because theBob Wilson2009-05-14
| | | | | | | assertion is failing for some tests. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71779 91177308-0d34-0410-b5e6-96231b3b80d8
* The IfConverter::MergeBlocks method appears to be used only to merge a basicBob Wilson2009-05-13
| | | | | | | | | block with its unique predecessor. Change the code to assert if that is not the case, instead of trying to handle situations where the block has multiple predecessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71744 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert a portion of Dan's change r71018 that I'm convinced is wrong.Bob Wilson2009-05-13
| | | | | | | | | | | | | | | | | | | | Dan was trying to catch the case where a basic block ends with a conditional branch to the fall-through block. In this case, all the instructions have been moved out of FromBBI, leaving it empty. It cannot end with a conditional branch. As the existing comment indicates, it will always fall through to the next block. If the block already had the next block (NBB) listed as a successor, the preceding loop has a check for that and does not remove it. Thus, we need to check and add the successor only when it is not already listed. With Dan's change, the empty block often ends up with the fall-through successor listed twice. This exposed the problem in pr4195, where CodePlacementOpt did not handle the same predecessor listed more than once. It is also at least partially responsible for pr4202 and probably a similar issue with Thumb branches being out of range. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71742 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge adjacent conditional.Bob Wilson2009-05-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71741 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused variable.Bob Wilson2009-05-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71740 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some typos and spelling and grammar, mostly in comments, but also oneBob Wilson2009-05-13
| | | | | | | field name. No functional changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71739 91177308-0d34-0410-b5e6-96231b3b80d8
* If a MachineBasicBlock has multiple ways of reaching another block,Dan Gohman2009-05-05
| | | | | | | | | allow it to have multiple CFG edges to that block. This is needed to allow MachineBasicBlock::isOnlyReachableByFallthrough to work correctly. This fixes PR4126. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71018 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo. Patch by nlewycky.Duncan Sands2008-11-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58709 91177308-0d34-0410-b5e6-96231b3b80d8
* fix leakage of IfcvtTokensNuno Lopes2008-11-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58690 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimized FCMP_OEQ and FCMP_UNE for x86.Dan Gohman2008-10-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Where previously LLVM might emit code like this: ucomisd %xmm1, %xmm0 setne %al setp %cl orb %al, %cl jne .LBB4_2 it now emits this: ucomisd %xmm1, %xmm0 jne .LBB4_2 jp .LBB4_2 It has fewer instructions and uses fewer registers, but it does have more branches. And in the case that this code is followed by a non-fallthrough edge, it may be followed by a jmp instruction, resulting in three branch instructions in sequence. Some effort is made to avoid this situation. To achieve this, X86ISelLowering.cpp now recognizes FCMP_OEQ and FCMP_UNE in lowered form, and replace them with code that emits two branches, except in the case where it would require converting a fall-through edge to an explicit branch. Also, X86InstrInfo.cpp's branch analysis and transform code now knows now to handle blocks with multiple conditional branches. It uses loops instead of having fixed checks for up to two instructions. It can now analyze and transform code generated from FCMP_OEQ and FCMP_UNE. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57873 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
* Fix SmallVector's size calculation so that a size of 0 isDan Gohman2008-08-22
| | | | | | | | handled correctly, and change a few SmallVector uses to use size 0 to more clearly reflect their intent. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55181 91177308-0d34-0410-b5e6-96231b3b80d8
* Convert uses of std::vector in TargetInstrInfo to SmallVector. This change ↵Owen Anderson2008-08-14
| | | | | | had to be propoagated down into all the targets and up into all clients of this API. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54802 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
* Register if-converter pass for -debug-pass.Evan Cheng2008-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51931 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a quick and dirty "loop aligner pass". x86 uses it to align its loops to ↵Evan Cheng2008-02-28
| | | | | | 16-byte boundaries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47703 91177308-0d34-0410-b5e6-96231b3b80d8
* Update gcc 4.3 warnings fix patch with recent head changesAnton Korobeynikov2008-02-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47368 91177308-0d34-0410-b5e6-96231b3b80d8
* Use empty() instead of comparing size() with zero.Dan Gohman2008-01-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46514 91177308-0d34-0410-b5e6-96231b3b80d8
* rename TargetInstrDescriptor -> TargetInstrDesc.Chris Lattner2008-01-07
| | | | | | | | Make MachineInstr::getDesc return a reference instead of a pointer, since it can never be null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45695 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify some code using new predicatesChris Lattner2008-01-07
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45689 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflectsChris Lattner2008-01-07
| | | | | | | | | | | | | | | | | | that it is cheap and efficient to get. Move a variety of predicates from TargetInstrInfo into TargetInstrDescriptor, which makes it much easier to query a predicate when you don't have TII around. Now you can use MI->getDesc()->isBranch() instead of going through TII, and this is much more efficient anyway. Not all of the predicates have been moved over yet. Update old code that used MI->getInstrDescriptor()->Flags to use the new predicates in many places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45674 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Somehow this wasn't committed last time. M_CLOBBERS_PRED is gone.Evan Cheng2007-07-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38495 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach if-conversion about instructions that were already predicated, e.g. ↵Evan Cheng2007-07-06
| | | | | | conditional move. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37964 91177308-0d34-0410-b5e6-96231b3b80d8
* Avoid if-converting simple block that ends with unconditional branch or ↵Evan Cheng2007-06-19
| | | | | | fallthrough unless it branches / falls to the 'false' block. Not profitable, may end up increasing code size. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37660 91177308-0d34-0410-b5e6-96231b3b80d8
* Replace TargetInstrInfo::CanBeDuplicated() with a M_NOT_DUPLICABLE bit.Evan Cheng2007-06-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37643 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some fragile code wrt CFG edge updating.Evan Cheng2007-06-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37634 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly remove duplicate instructions as result of diamond if-conversion. ↵Evan Cheng2007-06-18
| | | | | | Other bug fixes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37623 91177308-0d34-0410-b5e6-96231b3b80d8
* Really turn if-converter loose:Evan Cheng2007-06-16
| | | | | | | | | | | 1. Consider all possible ifcvt cases at once. No longer restricted to bottom up iterative approach. 2. Sort all possible cases based on a cost function. Perform the most profitable ones first invalidate others that target the same blocks. 3. Fixed a number of bugs related to block duplication. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37613 91177308-0d34-0410-b5e6-96231b3b80d8
* Not every predicable block can be safely duplicated.Evan Cheng2007-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37607 91177308-0d34-0410-b5e6-96231b3b80d8
* MachineInstr::isPredicable() is no longer needed.Evan Cheng2007-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37599 91177308-0d34-0410-b5e6-96231b3b80d8
* Extra edges are deleted later if needed.Evan Cheng2007-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37593 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow small blocks to be duplicated to enable if-conversion.Evan Cheng2007-06-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37590 91177308-0d34-0410-b5e6-96231b3b80d8
* No really, clear predcessors states.Evan Cheng2007-06-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37581 91177308-0d34-0410-b5e6-96231b3b80d8
* If BB is predicated, invalidate its predecessor(s) which would if-convert ↵Evan Cheng2007-06-14
| | | | | | it. It needs to be re-analyzed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37580 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo.Evan Cheng2007-06-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37577 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix some stupid bugs that have effectively disabled if-conversion.Evan Cheng2007-06-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37575 91177308-0d34-0410-b5e6-96231b3b80d8
* TypoEvan Cheng2007-06-13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37566 91177308-0d34-0410-b5e6-96231b3b80d8
* Now if-converting all 4 variants of triangles.Evan Cheng2007-06-12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37565 91177308-0d34-0410-b5e6-96231b3b80d8
* Restructure code to reduce ifcvt compile time cost.Evan Cheng2007-06-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37543 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the build.Reid Spencer2007-06-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37537 91177308-0d34-0410-b5e6-96231b3b80d8