summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/BranchFolding.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.Dale Johannesen2007-06-021-9/+6
| | | | llvm-svn: 37394
* Implement smarter algorithm for choosing which blocks to tail-merge.Dale Johannesen2007-06-011-28/+43
| | | | | | | | See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well; shaves another 10K off our favorite benchmark. I was hesitant about this because of compile speed, but seems to do OK on a bootstrap. llvm-svn: 37392
* Arrange for only 1 of multiple branches to landing pad to be kept.Dale Johannesen2007-05-311-4/+13
| | | | | | Do not remove empty landing pads (EH table needs to be updated) llvm-svn: 37375
* Changed per review comment.Dale Johannesen2007-05-301-3/+2
| | | | llvm-svn: 37355
* Make stable_sort in tail merging actually be stable (it never was, but didn'tDale Johannesen2007-05-291-1/+16
| | | | | | matter until my last change). Reenable tail merging by default. llvm-svn: 37354
* Blocks that cond-br and uncond-br/fallthrough to same block should haveDale Johannesen2007-05-241-1/+4
| | | | | | only one successor. llvm-svn: 37324
* Fix for PR1444: do not create two successors to the same block.Dale Johannesen2007-05-241-2/+10
| | | | | | | Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll by exposing an unrelated latent problem; working on that. llvm-svn: 37323
* Two tail merging improvements:Dale Johannesen2007-05-231-40/+44
| | | | | | | | | When considering blocks with more than 2 predecessors, merge the block with the largest number of matching insns, rather than the first block found. Considering that 1 matching insn is enough to show a win for candidates that already end with a branch. llvm-svn: 37315
* Make tail merging the default, except on powerPC. There was no prior artDale Johannesen2007-05-221-4/+13
| | | | | | | for a target-dependent default with a command-line override; this way should be generally usable. llvm-svn: 37285
* Remove some unneeded branches. (spotted by Evan, thanks)Dale Johannesen2007-05-181-0/+1
| | | | llvm-svn: 37198
* Remove extra CFG edges before doing these passes; it makes them happier.Dale Johannesen2007-05-151-1/+16
| | | | llvm-svn: 37089
* Do not generate branches to entry block. This fixes several test suiteDale Johannesen2007-05-101-4/+19
| | | | | | failures on PPC (can happen only when prologue code is null) llvm-svn: 36979
* Make tail merging handle many more cases (all it can, I think).Dale Johannesen2007-05-101-32/+91
| | | | llvm-svn: 36966
* Handle some non-exit blocks in tail merging.Dale Johannesen2007-05-071-11/+81
| | | | llvm-svn: 36907
* Drop 'const'Devang Patel2007-05-031-2/+2
| | | | llvm-svn: 36662
* Use 'static const char' instead of 'static const int'.Devang Patel2007-05-021-2/+2
| | | | | | | Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. llvm-svn: 36652
* Do not use typeinfo to identify pass in pass manager.Devang Patel2007-05-011-0/+4
| | | | llvm-svn: 36632
* Fix PR1228 and CodeGen/Generic/2007-04-30-LandingPadBranchFolding.llChris Lattner2007-04-301-2/+8
| | | | llvm-svn: 36602
* maintain LiveIn when splitting blocks (register scavenging needs it)Dale Johannesen2007-03-201-1/+22
| | | | llvm-svn: 35226
* Remove isAccessable.Jim Laskey2007-02-221-4/+4
| | | | llvm-svn: 34497
* Make branch folding behave in the presence of landing pads.Jim Laskey2007-02-211-25/+30
| | | | llvm-svn: 34476
* Fixes PR 1200Dale Johannesen2007-02-171-13/+29
| | | | llvm-svn: 34359
* Change the MachineDebugInfo to MachineModuleInfo to better reflect usageJim Laskey2007-01-261-6/+6
| | | | | | for debugging and exception handling. llvm-svn: 33550
* Make LABEL a builtin opcode.Jim Laskey2007-01-261-6/+2
| | | | llvm-svn: 33537
* Eliminate static ctors from StatisticsChris Lattner2006-12-191-3/+3
| | | | llvm-svn: 32698
* Detemplatize the Statistic class. The only type it is instantiated withChris Lattner2006-12-061-3/+3
| | | | | | is 'unsigned'. llvm-svn: 32279
* Don't transform in another bad case: if the block is empty, it should beChris Lattner2006-11-181-1/+2
| | | | | | simplified before we do this xform so that our cost model is accurate. llvm-svn: 31864
* Fix another case we *don't* want to do this xform.Chris Lattner2006-11-181-2/+26
| | | | llvm-svn: 31861
* make the previous change more aggressive, moving any block with no fallthrough.Chris Lattner2006-11-181-9/+11
| | | | | | This speeds up yacr2 by 7% on a core2. llvm-svn: 31856
* Minor code layout tweak: if we have something like this:Chris Lattner2006-11-181-0/+50
| | | | | | | | | | | | | | | if (cond) goto BB2 BB1: ... return; BB2: ... Move BB1 to the end of the function so that the code falls through in the non-return case. This has the effect of moving assert (and other no-return call) bodies and return blocks out of loops. llvm-svn: 31855
* optimize single MBB loops better. In particular, produce:Chris Lattner2006-11-081-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LBB1_57: #bb207.i movl 72(%esp), %ecx movb (%ecx,%eax), %cl movl 80(%esp), %edx movb %cl, 1(%edx,%eax) incl %eax cmpl $143, %eax jne LBB1_57 #bb207.i jmp LBB1_64 #cond_next255.i intead of: LBB1_57: #bb207.i movl 72(%esp), %ecx movb (%ecx,%eax), %cl movl 80(%esp), %edx movb %cl, 1(%edx,%eax) incl %eax cmpl $143, %eax je LBB1_64 #cond_next255.i jmp LBB1_57 #bb207.i This eliminates a branch per iteration of the loop. This hurted PPC particularly, because the extra branch meant another dispatch group for each iteration of the loop. llvm-svn: 31530
* 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
OpenPOWER on IntegriCloud