summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
Commit message (Collapse)AuthorAgeFilesLines
* Fix a regression in a patch from a couple of days ago. This fixesChris Lattner2006-02-281-1/+3
| | | | | | Transforms/InstCombine/2006-02-28-Crash.ll llvm-svn: 26427
* Implement rem.ll:test[7-9] and PR712Chris Lattner2006-02-281-6/+22
| | | | llvm-svn: 26415
* Simplify some code now that the RHS of a rem can't be 0Chris Lattner2006-02-281-8/+6
| | | | llvm-svn: 26413
* Rearrange some code, fold "rem X, 0", implementing rem.ll:test6Chris Lattner2006-02-281-38/+39
| | | | llvm-svn: 26411
* Merge two almost-identical pieces of code.Chris Lattner2006-02-271-46/+42
| | | | | | | | | | | | | | | Make this code more powerful by using ComputeMaskedBits instead of looking for an AND operand. This lets us fold this: int %test23(int %a) { %tmp.1 = and int %a, 1 %tmp.2 = seteq int %tmp.1, 0 %tmp.3 = cast bool %tmp.2 to int ;; xor tmp1, 1 ret int %tmp.3 } into: xor (and a, 1), 1 llvm-svn: 26396
* Fold (A^B) == A -> B == 0Chris Lattner2006-02-271-0/+26
| | | | | | and (A-B) == A -> B == 0 llvm-svn: 26394
* Fold (X|C1)^C2 -> X^(C1|C2) when possible. This implementsChris Lattner2006-02-261-0/+14
| | | | | | InstCombine/or.ll:test23. llvm-svn: 26385
* Fix a problem that Nate noticed that boils down to an over conservative checkChris Lattner2006-02-241-22/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the code that does "select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y)))". We now compile this loop: LBB1_1: ; no_exit add r6, r2, r3 subf r3, r2, r3 cmpwi cr0, r2, 0 addi r7, r5, 4 lwz r2, 0(r5) addi r4, r4, 1 blt cr0, LBB1_4 ; no_exit LBB1_3: ; no_exit mr r3, r6 LBB1_4: ; no_exit cmpwi cr0, r4, 16 mr r5, r7 bne cr0, LBB1_1 ; no_exit into this instead: LBB1_1: ; no_exit srawi r6, r2, 31 add r2, r2, r6 xor r6, r2, r6 addi r7, r5, 4 lwz r2, 0(r5) addi r4, r4, 1 add r3, r3, r6 cmpwi cr0, r4, 16 mr r5, r7 bne cr0, LBB1_1 ; no_exit llvm-svn: 26356
* Fix Regression/Transforms/LoopUnswitch/2006-02-22-UnswitchCrash.ll, whichChris Lattner2006-02-221-1/+3
| | | | | | | | | caused SPASS to fail building last night. We can't trivially unswitch a loop if the exit block has phi nodes in it, because we don't know which predecessor to use. llvm-svn: 26320
* Add some comments, simplify some code, and fix a bug that caused rewritingChris Lattner2006-02-221-34/+26
| | | | | | to rewrite with the wrong value. llvm-svn: 26311
* improved support for branch folding, still not enabled.Chris Lattner2006-02-181-143/+269
| | | | llvm-svn: 26289
* Fix bugs identified by VC++.Jeff Cohen2006-02-181-2/+2
| | | | llvm-svn: 26287
* Implement deletion of dead blocks, currently disabled.Chris Lattner2006-02-181-28/+75
| | | | llvm-svn: 26285
* a previous patch completely disabled trivial unswitching, this fixees it.Chris Lattner2006-02-181-1/+0
| | | | | | Thanks to nate for pointing this out :) llvm-svn: 26280
* initial trivial support for folding branches that have now-constant ↵Chris Lattner2006-02-181-3/+34
| | | | | | destinations. llvm-svn: 26279
* When unswitching a loop, make sure to update loop info with exit blocks inChris Lattner2006-02-181-2/+4
| | | | | | the right loop. llvm-svn: 26277
* Fix Transforms/SimplifyCFG/2006-02-17-InfiniteUnroll.llChris Lattner2006-02-181-2/+8
| | | | llvm-svn: 26275
* Fix loops where the header has an exit, fixing a loop-unswitch crash on craftyChris Lattner2006-02-171-13/+15
| | | | llvm-svn: 26258
* start of some new simplification code, not thoroughly tested, use at your ownChris Lattner2006-02-171-14/+161
| | | | | | risk :) llvm-svn: 26248
* Rework the SelectionDAG-based implementations of SimplifyDemandedBitsNate Begeman2006-02-161-3/+3
| | | | | | | and ComputeMaskedBits to match the new improved versions in instcombine. Tested against all of multisource/benchmarks on ppc. llvm-svn: 26238
* Change SplitBlock to increment a BasicBlock::iterator, not an Instruction*. ↵Chris Lattner2006-02-161-23/+27
| | | | | | | | | | | Apparently they do different things :) This fixes a testcase that nate reduced from spass. Also included are a couple minor code changes that don't affect the generated code at all. llvm-svn: 26235
* Fix VC++ warning.Jeff Cohen2006-02-161-1/+0
| | | | llvm-svn: 26228
* fix a bug where we unswitched the wrong wayChris Lattner2006-02-161-2/+2
| | | | llvm-svn: 26225
* Implement trivial unswitching for switch stmts. This allows us to trivialChris Lattner2006-02-151-27/+51
| | | | | | | | | | | | | | | | | | unswitch this loop on 2 before sweating to unswitch on 1/3. void test4(int N, int i, int C, int*P, int*Q) { int j; for (j = 0; j < N; ++j) { switch (C) { // general unswitching. default: P[i+j] = 0; break; case 1: Q[i+j] = 0; break; case 3: P[i+j] = Q[i+j]; break; case 2: break; // TRIVIAL UNSWITCH on C==2 } } } llvm-svn: 26223
* make "trivial" unswitching significantly more general. It can now handleChris Lattner2006-02-151-47/+79
| | | | | | | | | | | | | this for example: for (j = 0; j < N; ++j) { // trivial unswitch if (C) P[i+j] = 0; } turning it into the obvious code without bothering to duplicate an empty loop. llvm-svn: 26220
* fix a bunch of alpha regressions. see bug 709Andrew Lenharth2006-02-151-6/+6
| | | | llvm-svn: 26218
* Checking the wrong value. This caused us to emit silly code likeChris Lattner2006-02-151-1/+1
| | | | | | | Y = seteq bool X, true instead of just using X :) llvm-svn: 26215
* more refactoring, no functionality change.Chris Lattner2006-02-151-12/+11
| | | | llvm-svn: 26194
* pull some code out into a functionChris Lattner2006-02-151-18/+28
| | | | llvm-svn: 26191
* Canonicalize inner loops before outer loops. Inner loop canonicalizationChris Lattner2006-02-141-4/+5
| | | | | | | | can provide work for the outer loop to canonicalize. This fixes a case that breaks unswitching. llvm-svn: 26189
* When splitting exit edges to canonicalize loops, make sure to put the newChris Lattner2006-02-141-18/+20
| | | | | | | | block in the appropriate loop nest. Third time is the charm, right? llvm-svn: 26187
* Use statistics to keep track of what flavors of loops we are unswitchingChris Lattner2006-02-141-7/+19
| | | | llvm-svn: 26157
* Implement Instcombine/and.ll:test34Chris Lattner2006-02-131-0/+12
| | | | llvm-svn: 26155
* If any of the sign extended bits are demanded, the input sign bit is demandedChris Lattner2006-02-131-3/+9
| | | | | | | | for a sign extension. This fixes InstCombine/2006-02-13-DemandedMiscompile.ll and Ptrdist/bc. llvm-svn: 26152
* Be careful not to request or look at bits shifted in from outside the sizeChris Lattner2006-02-131-3/+9
| | | | | | of the input. This fixes the mediabench/gsm/toast failure last night. llvm-svn: 26138
* remove some more dead special case codeChris Lattner2006-02-121-35/+8
| | | | llvm-svn: 26135
* Eliminate special case hacks that are superceded by general purpose hacksChris Lattner2006-02-121-139/+51
| | | | llvm-svn: 26134
* Three changes:Chris Lattner2006-02-121-6/+135
| | | | | | | | | | | | 1. Teach GetConstantInType to handle boolean constants. 2. Teach instcombine to fold (compare X, CST) when X has known 0/1 bits. Testcase here: set.ll:test22 3. Improve the "(X >> c1) & C2 == 0" folding code to allow a noop cast between the shift and and. More aggressive bitfolding for other reasons was turning signed shr's into unsigned shr's, leaving the noop cast in the way. llvm-svn: 26131
* Revert my last patch. It too breaks stuffChris Lattner2006-02-121-12/+6
| | | | llvm-svn: 26128
* Fix for my previously reverted patchChris Lattner2006-02-111-6/+12
| | | | llvm-svn: 26126
* Port the recent innovations in ComputeMaskedBits to SimplifyDemandedBits.Chris Lattner2006-02-111-211/+425
| | | | | | | | | | | This allows us to simplify on conditions where bits are not known, but they are not demanded either! This also fixes a couple of bugs in ComputeMaskedBits that were exposed during this work. In the future, swaths of instcombine should be removed, as this code subsumes a bunch of ad-hockery. llvm-svn: 26122
* revert my previous change, it exposed other problems.Chris Lattner2006-02-111-1/+1
| | | | llvm-svn: 26121
* Make this check stricter. Disallow loop exit blocks from being shared byChris Lattner2006-02-111-4/+7
| | | | | | loops and their subloops. llvm-svn: 26118
* remove dead exprChris Lattner2006-02-111-1/+0
| | | | llvm-svn: 26116
* implement unswitching of loops with switch stmts and selects in themChris Lattner2006-02-111-94/+135
| | | | llvm-svn: 26114
* Update PHI nodes in successors of exit blocks.Chris Lattner2006-02-101-5/+34
| | | | llvm-svn: 26113
* Reform the unswitching code in terms of edge splitting, not block splitting.Chris Lattner2006-02-101-49/+67
| | | | llvm-svn: 26112
* Fix a case where UnswitchTrivialCondition broke critical edges withChris Lattner2006-02-101-1/+24
| | | | | | phi's in the successors llvm-svn: 26108
* add some notes, move some code around. Implement unswitching of loopsChris Lattner2006-02-101-19/+64
| | | | | | with branches on partially invariant computations. llvm-svn: 26104
* Move code around to be more logical, no functionality change.Chris Lattner2006-02-101-26/+32
| | | | llvm-svn: 26103
OpenPOWER on IntegriCloud