summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Style changes only. Remove dead code, fix a comment.Nick Lewycky2006-09-231-11/+4
| | | | llvm-svn: 30588
* Be far more careful when splitting a loop header, either to form a preheaderChris Lattner2006-09-231-1/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | or when splitting loops with a common header into multiple loops. In particular the old code would always insert the preheader before the old loop header. This is disasterous in cases where the loop hasn't been rotated. For example, it can produce code like: .. outside the loop... jmp LBB1_2 #bb13.outer LBB1_1: #bb1 movsd 8(%esp,%esi,8), %xmm1 mulsd (%edi), %xmm1 addsd %xmm0, %xmm1 addl $24, %edi incl %esi jmp LBB1_3 #bb13 LBB1_2: #bb13.outer leal (%edx,%eax,8), %edi pxor %xmm1, %xmm1 xorl %esi, %esi LBB1_3: #bb13 movapd %xmm1, %xmm0 cmpl $4, %esi jl LBB1_1 #bb1 Note that the loop body is actually LBB1_1 + LBB1_3, which means that the loop now contains an uncond branch WITHIN it to jump around the inserted loop header (LBB1_2). Doh. This patch changes the preheader insertion code to insert it in the right spot, producing this code: ... outside the loop, fall into the header ... LBB1_1: #bb13.outer leal (%edx,%eax,8), %esi pxor %xmm0, %xmm0 xorl %edi, %edi jmp LBB1_3 #bb13 LBB1_2: #bb1 movsd 8(%esp,%edi,8), %xmm0 mulsd (%esi), %xmm0 addsd %xmm1, %xmm0 addl $24, %esi incl %edi LBB1_3: #bb13 movapd %xmm0, %xmm1 cmpl $4, %edi jl LBB1_2 #bb1 Totally crazy, no branch in the loop! :) llvm-svn: 30587
* Teach UpdateDomInfoForRevectoredPreds to handle revectored preds that are notChris Lattner2006-09-231-91/+49
| | | | | | | | reachable, making it general purpose enough for use by InsertPreheaderForLoop. Eliminate custom dominfo updating code in InsertPreheaderForLoop, using UpdateDomInfoForRevectoredPreds instead. llvm-svn: 30586
* Fix Transforms/IndVarsSimplify/2006-09-20-LFTR-Crash.llChris Lattner2006-09-211-15/+22
| | | | llvm-svn: 30555
* Don't rewrite ConstantExpr::get.Nick Lewycky2006-09-211-44/+20
| | | | llvm-svn: 30552
* Once we're down to "setcc type constant1, constant2", at least come upNick Lewycky2006-09-201-18/+14
| | | | | | with the right answer. llvm-svn: 30550
* Use a total ordering to compare instructions.Nick Lewycky2006-09-201-87/+101
| | | | | | Fixes infinite loop in resolve(). llvm-svn: 30540
* simplifyAndrew Lenharth2006-09-201-12/+8
| | | | llvm-svn: 30535
* We went through all that trouble to compute whether it was safe to transformChris Lattner2006-09-201-6/+46
| | | | | | | this comparison, but never checked it. Whoops, no wonder we miscompiled 177.mesa! llvm-svn: 30511
* Back out Chris' last set of changes. This breaks 177.mesa and povray somehow.Evan Cheng2006-09-201-43/+6
| | | | llvm-svn: 30505
* 80 col.Evan Cheng2006-09-201-1/+2
| | | | llvm-svn: 30504
* If we have an add, do it in the pointer realm, not the int realm. This is ↵Andrew Lenharth2006-09-191-0/+22
| | | | | | critical in the linux kernel for pointer analysis correctness llvm-svn: 30496
* implement select.ll:test19-22Chris Lattner2006-09-191-6/+43
| | | | llvm-svn: 30482
* Walk down the dominator tree instead of the control flow graph. That meansNick Lewycky2006-09-181-150/+90
| | | | | | | that we can't modify the CFG any more, at least not until it's possible to update the dominator tree (PR217). llvm-svn: 30469
* Fix an infinite loop building the CFEChris Lattner2006-09-181-1/+2
| | | | llvm-svn: 30465
* Implement a trivial optzn: of vastart is never called in a function that takesChris Lattner2006-09-181-2/+113
| | | | | | | | ... args, remove the '...'. This is Transforms/DeadArgElim/dead_vaargs.ll llvm-svn: 30459
* Implement InstCombine/cast.ll:test31. This speeds up 462.libquantum by 26%.Chris Lattner2006-09-181-4/+39
| | | | llvm-svn: 30456
* Implement Transforms/InstCombine/shift-sra.ll:test0Chris Lattner2006-09-181-0/+20
| | | | llvm-svn: 30450
* Rewrite shift/and/compare sequences to promote better licm of the RHS.Chris Lattner2006-09-181-28/+48
| | | | | | Use isLogicalShift/isArithmeticShift to simplify code. llvm-svn: 30448
* Fix Transforms/InstCombine/2006-09-15-CastToBool.ll and PR913Chris Lattner2006-09-161-0/+5
| | | | llvm-svn: 30405
* revert previous two patches. They cause miscompilation of ↵Chris Lattner2006-09-151-35/+1
| | | | | | MultiSource/Applications/Burg llvm-svn: 30397
* Revert my previous work on ArgumentPromotion. Further investigation has ↵Owen Anderson2006-09-151-34/+46
| | | | | | | | revealed these changes to be incorrect. They just weren't showing up in any of our current testcases. llvm-svn: 30385
* Adding dllimport, dllexport and external weak linkage types.Anton Korobeynikov2006-09-142-4/+6
| | | | | | | | | DLL* linkages got full (I hope) codegeneration support in C & both x86 assembler backends. External weak linkage added for future use, we don't provide any codegeneration, etc. support for it. llvm-svn: 30374
* Second half of the fix for Transforms/Inline/inline_cleanup.llChris Lattner2006-09-131-2/+28
| | | | | | | This folds unconditional branches that are often produced by code specialization. llvm-svn: 30307
* Add some more consistency checks.Nick Lewycky2006-09-131-1/+20
| | | | llvm-svn: 30305
* Fix unionSets so that it can merge correctly.Nick Lewycky2006-09-131-22/+34
| | | | llvm-svn: 30304
* Implement the first half of Transforms/Inline/inline_cleanup.llChris Lattner2006-09-131-1/+9
| | | | llvm-svn: 30303
* Erase dead instructions.Nick Lewycky2006-09-131-2/+3
| | | | llvm-svn: 30298
* Initialize DontInternalize.Devang Patel2006-09-131-1/+2
| | | | llvm-svn: 30281
* An sinkable instruction may exist with uses, if those uses are in dead blocks.Chris Lattner2006-09-121-0/+4
| | | | | | Handle this. This fixes PR908 and Transforms/LICM/2006-09-12-DeadUserOfSunkInstr.ll llvm-svn: 30275
* Fix PR905 and InstCombine/2006-09-11-EmptyStructCrash.llChris Lattner2006-09-111-1/+2
| | | | llvm-svn: 30266
* Skip the linear search if the answer is already known.Nick Lewycky2006-09-111-20/+22
| | | | llvm-svn: 30251
* Allow tail duplication in more cases, relaxing the previous restriction aChris Lattner2006-09-101-1/+12
| | | | | | bit. This fixes Regression/Transforms/TailDup/MergeTest.ll llvm-svn: 30237
* Replace EquivalenceClasses with a custom-built data structure. Many commonNick Lewycky2006-09-101-133/+259
| | | | | | | | | operations (like findProperties) should be faster, at the expense of unionSets being slower in cases that are rare in practise. Don't erase a dead Instruction. This fixes a memory corruption issue. llvm-svn: 30235
* Implement Transforms/InstCombine/hoist_instr.llChris Lattner2006-09-091-14/+54
| | | | llvm-svn: 30234
* Make inlining costs more accurate.Chris Lattner2006-09-091-3/+26
| | | | llvm-svn: 30231
* Turn div X, (Cond ? Y : 0) -> div X, YChris Lattner2006-09-091-19/+68
| | | | | | This implements select.ll::test18. llvm-svn: 30230
* Throttle back tail duplication to avoid creating really ugly sequences of code.Chris Lattner2006-09-071-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For Transforms/TailDup/if-tail-dup.ll, f.e., it produces: _foo: movl 8(%esp), %eax movl 4(%esp), %ecx testl $1, %ecx je LBB1_2 #cond_next LBB1_1: #cond_true movl $1, (%eax) LBB1_2: #cond_next testl $2, %ecx je LBB1_4 #cond_next10 LBB1_3: #cond_true6 movl $1, 4(%eax) LBB1_4: #cond_next10 testl $4, %ecx je LBB1_6 #cond_next18 LBB1_5: #cond_true14 movl $1, 8(%eax) LBB1_6: #cond_next18 testl $8, %ecx je LBB1_8 #return LBB1_7: #cond_true22 movl $1, 12(%eax) ret LBB1_8: #return ret instead of: _foo: movl 4(%esp), %eax testl $2, %eax sete %cl movl 8(%esp), %edx testl $1, %eax je LBB1_2 #cond_next LBB1_1: #cond_true movl $1, (%edx) testb %cl, %cl jne LBB1_4 #cond_next10 jmp LBB1_3 #cond_true6 LBB1_2: #cond_next testb %cl, %cl jne LBB1_4 #cond_next10 LBB1_3: #cond_true6 movl $1, 4(%edx) testl $4, %eax je LBB1_6 #cond_next18 jmp LBB1_5 #cond_true14 LBB1_4: #cond_next10 testl $4, %eax je LBB1_6 #cond_next18 LBB1_5: #cond_true14 movl $1, 8(%edx) testl $8, %eax je LBB1_8 #return jmp LBB1_7 #cond_true22 LBB1_6: #cond_next18 testl $8, %eax je LBB1_8 #return LBB1_7: #cond_true22 movl $1, 12(%edx) ret LBB1_8: #return ret llvm-svn: 30158
* Fix Duraid's changes to work when TLI is null. This fixes the failingChris Lattner2006-09-051-3/+7
| | | | | | lowerinvoke regtests. llvm-svn: 30115
* add setJumpBufSize() and setJumpBufAlignment() to target-lowering.Duraid Madina2006-09-041-10/+10
| | | | | | | Call these from your backend to enjoy setjmp/longjmp goodness, see lib/Target/IA64/IA64ISelLowering.cpp for an example llvm-svn: 30095
* Make ArgumentPromotion handle recursive functions that pass pointers in ↵Owen Anderson2006-09-021-11/+33
| | | | | | their recursive calls. llvm-svn: 30057
* Improve handling of SelectInst.Nick Lewycky2006-09-021-31/+44
| | | | | | | | Reorder operations to remove duplicated work. Fix to leave floating-point types out of the optimization. Add tests to predsimplify.ll for SwitchInst and SelectInst handling. llvm-svn: 30055
* Don't confuse canonicalize and lookup. Fixes predsimplify.reg4.ll. AlsoNick Lewycky2006-09-011-21/+20
| | | | | | corrects missing optimization opportunity removing cases from a switch. llvm-svn: 30009
* Properties where both Values weren't in the union (as being equal toNick Lewycky2006-08-311-24/+18
| | | | | | | | another Value) weren't being found by findProperties. This fixes predsimplify.ll test6, a missed optimization opportunity. llvm-svn: 29991
* Move to using the EquivalenceClass ADT. Removes SynSets.Nick Lewycky2006-08-301-165/+92
| | | | | | | | | If a branch's condition has become a ConstantBool, simplify it immediately. Removing the edge saves work and exposes up more optimization opportunities in the pass. Add support for SelectInst. llvm-svn: 29970
* Do not rely on std::sort and std::erase to get list of uniqueDevang Patel2006-08-291-10/+4
| | | | | | | | exit blocks. The output is dependent on addresses of basic block. Add and use Loop::getUniqueExitBlocks. llvm-svn: 29966
* Clean up a bit.Owen Anderson2006-08-291-51/+32
| | | | llvm-svn: 29950
* Add PredicateSimplifier pass. Collapses equal variables into one formNick Lewycky2006-08-281-0/+744
| | | | | | | and simplifies expressions. This implements the optimization described in PR807. llvm-svn: 29947
* Make LoopUnroll fold excessive BasicBlocks. This results in a significant ↵Owen Anderson2006-08-281-9/+89
| | | | | | | | speedup of gccas on 252.eon llvm-svn: 29936
* simplify AnalysisGroup registration, eliminating one typeid call.Chris Lattner2006-08-282-3/+3
| | | | llvm-svn: 29932
OpenPOWER on IntegriCloud