summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Unbreak VC++ build.Jeff Cohen2006-11-051-0/+1
| | | | llvm-svn: 31464
* For PR786:Reid Spencer2006-11-021-2/+0
| | | | | | | | | | Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting fall out by removing unused variables. Remaining warnings have to do with unused functions (I didn't want to delete code without review) and unused variables in generated code. Maintainers should clean up the remaining issues when they see them. All changes pass DejaGnu tests and Olden. llvm-svn: 31380
* give branch folding a simple heuristic to decide which block to split so thatChris Lattner2006-11-011-6/+49
| | | | | | | it inserts an uncond branch where it is less likely to cause a problem. This fixes some perf issues on ppc. llvm-svn: 31354
* make tail merging more aggressive. If two blocks share a common tail, but theChris Lattner2006-11-011-16/+53
| | | | | | | tail is not an entire block for either of them, pick one, split it, then merge the common part. llvm-svn: 31336
* enable branch folding with an optionChris Lattner2006-11-011-1/+2
| | | | llvm-svn: 31335
* Make CanFallThrough more intelligent (so it can handle blocks with (e.g.) noChris Lattner2006-10-291-62/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | successors), and make island block movement more general. This compiles CodeGen/X86/2006-04-27-ISelFoldingBug.ll to: _loadAndRLEsource_no_exit_2E_1_label_2E_0: subl $8, %esp movl %esi, 4(%esp) movl %ebx, (%esp) movl 16(%esp), %eax movl 12(%esp), %ecx LBB1_3: #label.0 movl _last, %edx movl %edx, %esi incl %esi movl %esi, _last movl %ecx, %ebx # TRUNCATE movb %bl, %bl movl _block, %esi movb %bl, 1(%esi,%edx) cmpl %eax, _last jge LBB1_2 #codeRepl5.exitStub LBB1_4: #label.0 cmpl $257, %ecx je LBB1_2 #codeRepl5.exitStub LBB1_1: #label.0.no_exit.1_crit_edge.exitStub movl $1, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret LBB1_2: #codeRepl5.exitStub xorl %eax, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret instead of: _loadAndRLEsource_no_exit_2E_1_label_2E_0: subl $8, %esp movl %esi, 4(%esp) movl %ebx, (%esp) movl 16(%esp), %eax movl 12(%esp), %ecx jmp LBB1_3 #label.0 LBB1_1: #label.0.no_exit.1_crit_edge.exitStub movl $1, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret LBB1_2: #codeRepl5.exitStub xorl %eax, %eax movl (%esp), %ebx movl 4(%esp), %esi addl $8, %esp ret LBB1_3: #label.0 movl _last, %edx movl %edx, %esi incl %esi movl %esi, _last movl %ecx, %ebx # TRUNCATE movb %bl, %bl movl _block, %esi movb %bl, 1(%esi,%edx) cmpl %eax, _last jge LBB1_2 #codeRepl5.exitStub LBB1_4: #label.0 cmpl $257, %ecx jne LBB1_1 #label.0.no_exit.1_crit_edge.exitStub jmp LBB1_2 #codeRepl5.exitStub ... which is much better layout :) llvm-svn: 31282
* Teach branch folding to fold identical jump tables together and to deleteChris Lattner2006-10-281-5/+53
| | | | | | jump tables that are dead. llvm-svn: 31273
* improve deletion of blocks that just contain branches by knowing thatChris Lattner2006-10-281-33/+38
| | | | | | the pred block doesn't fall through into them if it's a jumptable. llvm-svn: 31263
* simplify codeChris Lattner2006-10-251-1/+1
| | | | llvm-svn: 31188
* turn off tail merging for nowChris Lattner2006-10-251-0/+2
| | | | llvm-svn: 31180
* move single basic blocks that are neither fallen into nor fall out of intoChris Lattner2006-10-241-13/+96
| | | | | | | | | | | a place more useful. In particular, if we can put them in a place where code will be able to fall into it, do so. Otherwise, put it in a place it can fall through into a successor. Otherwise, if preventing a fallthrough, move to the end of the function, out of the way. This deletes several hundred unconditional branches from spass. llvm-svn: 31149
* Enable tail merging by default.Chris Lattner2006-10-231-4/+0
| | | | llvm-svn: 31140
* More complete solution to deleting blocks and debug info.Jim Laskey2006-10-231-1/+1
| | | | llvm-svn: 31129
* don't break infinite loopsChris Lattner2006-10-211-6/+19
| | | | llvm-svn: 31102
* Use branch reversal to do stuff like this:Chris Lattner2006-10-211-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | call L_strcmp$stub testl %eax, %eax - jne LBB26_208 #cond_true6020 - jmp LBB26_227 #bb7119 + je LBB26_227 #bb7119 LBB26_208: #cond_true6020 movl $l31_str14, 4(%esp) testl %eax, %eax - jne LBB26_704 #cond_true13042 - jmp LBB26_713 #bb13151 + je LBB26_713 #bb13151 LBB26_704: #cond_true13042 movl $_str52, 4(%esp) cmpl 76(%ecx), %eax - jge LBB26_1628 #cond_false63.i.i - jmp LBB26_1769 #_Z8makeGridP13mrSurfaceListidiidd.exit.i + jl LBB26_1769 #_Z8makeGridP13mrSurfaceListidiidd.exit.i LBB26_1628: #cond_false63.i.i movl $0, 48964(%esp) llvm-svn: 31100
* Transform code like:Chris Lattner2006-10-211-2/+13
| | | | | | | | | | | | | | | jle FOO jmp BAR BAR: into: jle FOO BAR: ... whoa! llvm-svn: 31098
* Three changes:Chris Lattner2006-10-211-117/+117
| | | | | | | | | | | | 1. Remove a bunch of ifdef'd code. 2. When a block just contains an uncond branch, change all blocks branching to it to jump to the destination instead. 3. If branch analysis tells us some edges in the machinecfg are not actually possible, remove them. #2 triggers a suprisingly large number of times. llvm-svn: 31094
* Add an experimental cross-jumping implementation.Chris Lattner2006-10-211-13/+231
| | | | | | | This is currently disabled by default and limited in several ways, but does have a positive effect. llvm-svn: 31090
* Teach the branch folder to update debug info if it removes blocks with lineChris Lattner2006-10-171-2/+23
| | | | | | # notes in it. llvm-svn: 31026
* Enable deleting branches to successor blocks. With the previous patches,Chris Lattner2006-10-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | branch folding can now compile stuff like this: void foo(int W, int X, int Y, int Z) { if (W & 1) { for (; X;--X) bar(); } else if (W & 2) { for (; Y;--Y) bar(); } else if (W & 4) { for (; Z;--Z) bar(); } else if (W & 8) { for (; W;--W) bar(); } if (W) { bar(); } } contrived testcase where loops exits all end up merging together. To have the loop merges be: ... cmplw cr0, r30, r27 bne cr0, LBB1_14 ;bb38 LBB1_16: ;cond_next48.loopexit mr r27, r29 LBB1_20: ;cond_next48 cmplwi cr0, r27, 0 beq cr0, LBB1_22 ;UnifiedReturnBlock ... instead of: ... cmplw cr0, r30, r27 bne cr0, LBB1_14 ;bb38 LBB1_16: ;cond_next48.loopexit mr r27, r29 b LBB1_20 ;cond_next48 LBB1_17: ;cond_next48.loopexit1 b LBB1_20 ;cond_next48 LBB1_18: ;cond_next48.loopexit2 b LBB1_20 ;cond_next48 LBB1_19: ;cond_next48.loopexit3 LBB1_20: ;cond_next48 cmplwi cr0, r27, 0 beq cr0, LBB1_22 ;UnifiedReturnBlock ... This is CodeGen/PowerPC/branch-opt.ll llvm-svn: 31006
* Reenable this pass, fixing the bugs in it.Chris Lattner2006-10-171-23/+32
| | | | | | It now correctly deletes unreachable blocks and blocks that are empty. llvm-svn: 31000
* disable this pass for now, it's causing issuesChris Lattner2006-10-141-0/+4
| | | | llvm-svn: 30951
* falling off the end of a function is ok with an unreachable instruction.Chris Lattner2006-10-141-28/+57
| | | | llvm-svn: 30950
* disable some objectionable code, maybe we can bring this pass to lifeChris Lattner2006-10-131-7/+42
| | | | llvm-svn: 30939
* Remove trailing whitespaceMisha Brukman2005-04-211-3/+3
| | | | llvm-svn: 21420
* Changes For Bug 352Reid Spencer2004-09-011-1/+1
| | | | | | | | Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. llvm-svn: 16137
* Dereferencing end() is bad.Chris Lattner2004-08-011-1/+1
| | | | llvm-svn: 15402
* Make OptimizeBlock take a MachineFunction::iterator instead of aAlkis Evlogimenos2004-07-311-4/+4
| | | | | | | MachineBasicBlock* as a parameter so that nxext() and prior() helper functions can work naturally on it. llvm-svn: 15376
* Next on a pointer increments the pointer, not an iteratorChris Lattner2004-07-311-1/+1
| | | | llvm-svn: 15375
* Use next() helper to make code more readable. UseAlkis Evlogimenos2004-07-311-4/+6
| | | | | | | MachineFunction::iterator instead of MachineBasicBlock* to avoid dereferencing end iterators. llvm-svn: 15373
* Use MachineFunction::iterator instead of a MachineBasicBlock* becauseAlkis Evlogimenos2004-07-311-2/+3
| | | | | | FallThrough maybe == to MF.end(). llvm-svn: 15372
* Implement a simple target-independent CFG cleanup passChris Lattner2004-07-311-0/+201
llvm-svn: 15368
OpenPOWER on IntegriCloud