summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
Commit message (Collapse)AuthorAgeFilesLines
* When simplifying a call to a bitcast function, tighten upDuncan Sands2008-06-011-18/+15
| | | | | | | | | | | | | | | | | | | | the conditions for performing the transform when only the function declaration is available: no longer allow turning i32 into i64 for example. Only allow changing between pointer types, and between pointer types and integers of the same size. For return values ptr -> intptr was already allowed; I added ptr -> ptr and intptr -> ptr while there. As shown by a recent objc testcase, changing the way parameters/return values are passed can be fatal when calling code written in assembler that directly manipulates call arguments and return values unless the transform has no impact on the way they are passed at the codegen level. While it is possible to imagine an ABI that treats integers of pointer size differently to pointers, I don't think LLVM supports any so the transform should now be safe while still being useful. llvm-svn: 51834
* Peer through sext/zext when looking for not(cmp).Nick Lewycky2008-05-311-0/+20
| | | | llvm-svn: 51819
* Add more i1 optimizations. add, sub, mul, s/udiv on i1 are now simplified away.Nick Lewycky2008-05-311-5/+15
| | | | llvm-svn: 51817
* Adding i1 is always Xor.Nick Lewycky2008-05-311-0/+3
| | | | llvm-svn: 51816
* const-ify getOpcode.Dan Gohman2008-05-291-3/+3
| | | | llvm-svn: 51698
* Add a newline at the end of this file.Duncan Sands2008-05-291-1/+1
| | | | llvm-svn: 51680
* Replace the old ADCE implementation with a new one that more simply solvesOwen Anderson2008-05-291-457/+62
| | | | | | | | | the one case that ADCE catches that normal DCE doesn't: non-induction variable loop computations. This implementation handles this problem without using postdominators. llvm-svn: 51668
* Remove debugging code.Owen Anderson2008-05-291-5/+1
| | | | llvm-svn: 51666
* Implement PR2370: memmove(x,x,size) -> noop.Chris Lattner2008-05-281-0/+4
| | | | llvm-svn: 51636
* Fix some constructs that gcc-4.4 warns about.Duncan Sands2008-05-271-2/+2
| | | | llvm-svn: 51591
* InequalityGraph::node() can create new nodes, invalidating iterators acrossNick Lewycky2008-05-271-0/+1
| | | | | | | the set of nodes. Fix makeEqual to handle this by creating the new node first then iterating across them second. llvm-svn: 51573
* Grammaro.Nick Lewycky2008-05-261-1/+1
| | | | llvm-svn: 51572
* "ret (constexpr)" can't be folded into a Constant. Add a method toNick Lewycky2008-05-251-0/+10
| | | | | | | | | | Analysis/ConstantFolding to fold ConstantExpr's, then make instcombine use it to try to use targetdata to fold constant expressions on void instructions. Also extend the icmp(inttoptr, inttoptr) folding to handle the case where int size != ptr size. llvm-svn: 51559
* Fix a serious brain-o. Obviously no-one reviewed my patch :(Chris Lattner2008-05-241-2/+4
| | | | | | This fixes PR2359 llvm-svn: 51536
* Fix PR2358 by resolving calls with undef arguments to overdefined.Chris Lattner2008-05-241-0/+6
| | | | llvm-svn: 51535
* Remove x86.sse2.loadh.pd and x86.sse2.loadl.pd. These will be lowered into ↵Evan Cheng2008-05-241-5/+0
| | | | | | load and shuffle instructions. llvm-svn: 51521
* Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places toDan Gohman2008-05-238-34/+16
| | | | | | use it instead of duplicating its functionality. llvm-svn: 51499
* Replace some weird usage of UserOp1 introduced in r49492 by a plain if.Matthijs Kooijman2008-05-231-1/+3
| | | | llvm-svn: 51482
* Constant integer vectors may also be negated.Nick Lewycky2008-05-231-0/+5
| | | | llvm-svn: 51476
* Typo.Nick Lewycky2008-05-231-1/+1
| | | | llvm-svn: 51475
* Revert X + X --> X * 2 optz'n which pessimizes heavily on x86.Nick Lewycky2008-05-231-13/+5
| | | | llvm-svn: 51474
* Implement X + X for vectors.Nick Lewycky2008-05-231-5/+13
| | | | llvm-svn: 51472
* Fix a recently added optimization to not crash on vectors.Nick Lewycky2008-05-231-2/+10
| | | | llvm-svn: 51471
* Generalize the new code in instcombine's ComputeNumSignBits for handlingDan Gohman2008-05-231-44/+9
| | | | | | | and/or to handle more cases (such as this add-sitofp.ll testcase), and port it to selectiondag's ComputeNumSignBits. llvm-svn: 51469
* Use isSingleValueType instead of isFirstClassType toDan Gohman2008-05-231-2/+2
| | | | | | exclude struct and array types. llvm-svn: 51467
* Allow for switch with no cases. Was causing faultDale Johannesen2008-05-231-0/+2
| | | | | | in gcc.dg/pr27531-1.c. llvm-svn: 51464
* Use isSingleValueType instead of isFirstClassType toDan Gohman2008-05-231-1/+1
| | | | | | exclude struct and array types. llvm-svn: 51456
* rewrite the validity checking for memory promotion to be simpler,Chris Lattner2008-05-221-49/+52
| | | | | | | more aggressive, and more correct. Verify that we only attempt to promote loads and stores. llvm-svn: 51406
* Use 'continue' to reduce nesting in this loop. No functionality change.Chris Lattner2008-05-221-54/+51
| | | | llvm-svn: 51399
* When LSR is replacing an instruction, callDan Gohman2008-05-211-7/+10
| | | | | | | | | | | | | | | | | | | | ScalarEvolution::deleteValueFromRecords on it before doing the replaceAllUsesWith, because ScalarEvolution looks at the instruction's users to find SCEV references to the instruction's SCEV object in its internal maps. Move all of LSR's loop-related state clearing after processing the loop and before cleaning up dead PHI nodes. This eliminates all of LSR's SCEV references just before the calls to ScalarEvolution::deleteValueFromRecords so that when ScalarEvolution drops its own SCEV references, the reference counts will reach zero and the SCEVs will be deleted immediately. These changes fix some compiler aborts involving ScalarEvolution holding onto and reusing SCEV objects for instructions that have been deleted. No regression test unfortunately; because the symptoms were due to dangling pointers, reduced testcases ended up being fairly arbitrary. llvm-svn: 51359
* Port SelectionDAG's ComputeNumSignBits-using code to instcombine,Dan Gohman2008-05-201-1/+28
| | | | | | now that instcombine also has ComputeNumSignBits. llvm-svn: 51350
* Fix typo.Matthijs Kooijman2008-05-201-1/+1
| | | | llvm-svn: 51303
* Teach instcombine 4 new xforms:Chris Lattner2008-05-201-3/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (add (sext x), cst) --> (sext (add x, cst')) (add (sext x), (sext y)) --> (sext (add int x, y)) (add double (sitofp x), fpcst) --> (sitofp (add int x, intcst)) (add double (sitofp x), (sitofp y)) --> (sitofp (add int x, y)) This generally reduces conversions. For example MiBench/telecomm-gsm gets these simplifications: HACK2: %tmp67.i142.i.i = sext i16 %tmp6.i141.i.i to i32 ; <i32> [#uses=1] %tmp23.i139.i.i = sext i16 %tmp2.i138.i.i to i32 ; <i32> [#uses=1] %tmp8.i143.i.i = add i32 %tmp67.i142.i.i, %tmp23.i139.i.i ; <i32> [#uses=3] HACK2: %tmp67.i121.i.i = sext i16 %tmp6.i120.i.i to i32 ; <i32> [#uses=1] %tmp23.i118.i.i = sext i16 %tmp2.i117.i.i to i32 ; <i32> [#uses=1] %tmp8.i122.i.i = add i32 %tmp67.i121.i.i, %tmp23.i118.i.i ; <i32> [#uses=3] HACK2: %tmp67.i.i190.i = sext i16 %tmp6.i.i189.i to i32 ; <i32> [#uses=1] %tmp23.i.i187.i = sext i16 %tmp2.i.i186.i to i32 ; <i32> [#uses=1] %tmp8.i.i191.i = add i32 %tmp67.i.i190.i, %tmp23.i.i187.i ; <i32> [#uses=3] HACK2: %tmp67.i173.i.i.i = sext i16 %tmp6.i172.i.i.i to i32 ; <i32> [#uses=1] %tmp23.i170.i.i.i = sext i16 %tmp2.i169.i.i.i to i32 ; <i32> [#uses=1] %tmp8.i174.i.i.i = add i32 %tmp67.i173.i.i.i, %tmp23.i170.i.i.i ; <i32> [#uses=3] HACK2: %tmp67.i152.i.i.i = sext i16 %tmp6.i151.i.i.i to i32 ; <i32> [#uses=1] %tmp23.i149.i.i.i = sext i16 %tmp2.i148.i.i.i to i32 ; <i32> [#uses=1] %tmp8.i153.i.i.i = add i32 %tmp67.i152.i.i.i, %tmp23.i149.i.i.i ; <i32> [#uses=3] HACK2: %tmp67.i.i.i.i = sext i16 %tmp6.i.i.i.i to i32 ; <i32> [#uses=1] %tmp23.i.i5.i.i = sext i16 %tmp2.i.i.i.i to i32 ; <i32> [#uses=1] %tmp8.i.i7.i.i = add i32 %tmp67.i.i.i.i, %tmp23.i.i5.i.i ; <i32> [#uses=3] This also fixes a bug in ComputeNumSignBits handling select and makes it more aggressive with and/or. llvm-svn: 51302
* fix two issues Neil noticed, thanks!Chris Lattner2008-05-201-5/+5
| | | | llvm-svn: 51296
* Refine the fix in r51169 to only apply when the operand val beingDan Gohman2008-05-201-3/+4
| | | | | | | | replaced is a PHI. This prevents it from inserting uses before defs in the case that it isn't a PHI and it depends on other instructions later in the block. This fixes the 447.dealII regression on x86-64. llvm-svn: 51292
* Make AssociativeOpt static.Dan Gohman2008-05-201-1/+1
| | | | llvm-svn: 51290
* Do not erase induction variable increment if it is used outside the loop.Devang Patel2008-05-191-4/+20
| | | | llvm-svn: 51280
* Add a ComputeNumSignBits function for use by instcombine, based on theDan Gohman2008-05-191-5/+149
| | | | | | code in SelectionDAG. llvm-svn: 51279
* switch to Type::getFPMantissaWidth instead of reinventing it.Chris Lattner2008-05-191-15/+3
| | | | llvm-svn: 51275
* minor cleanups, teach instcombine that sitofp/uitofp cannot Chris Lattner2008-05-191-3/+8
| | | | | | produce a negative zero. llvm-svn: 51272
* convert fptosi(sitofp x) -> x if the fp value has enough bits in its mantissaChris Lattner2008-05-191-9/+27
| | | | | | | to accurately represent the integer. This triggers 9 times in 471.omnetpp, though 8 of those seem to be inlined from the same place. llvm-svn: 51271
* Fold FP comparisons where one operand is converted from an integerChris Lattner2008-05-191-0/+160
| | | | | | | | | | | | | | | | | | | | type and the other operand is a constant into integer comparisons. This happens surprisingly frequently (e.g. 10 times in 471.omnetpp), which are things like this: %tmp8283 = sitofp i32 %tmp82 to double %tmp1013 = fcmp ult double %tmp8283, 0.0 Clearly comparing tmp82 against i32 0 is cheaper here. this also triggers 8 times in gobmk, including this one: %tmp375376 = sitofp i32 %tmp375 to double %tmp377 = fcmp ogt double %tmp375376, 8.150000e+01 which is comparing an integer against 81.5 :). llvm-svn: 51268
* remove debug outputChris Lattner2008-05-191-3/+1
| | | | llvm-svn: 51264
* be more aggressive about transforming add -> or when the operands have noChris Lattner2008-05-191-0/+19
| | | | | | | | | | | | | | | | | | | intersecting bits. This triggers all over the place, for example in lencode, with adds of stuff like: %tmp580 = mul i32 %tmp579, 2 %tmp582 = and i32 %b8, 1 and %tmp28 = shl i32 %abs.i, 1 %sign.0 = select i1 %tmp23, i32 1, i32 0 and %tmp344 = shl i32 %tmp343, 2 %tmp346 = and i32 %tmp96, 3 etc. llvm-svn: 51263
* Fix PR2341 - when the length is 4 use an i32 notDuncan Sands2008-05-191-8/+10
| | | | | | an i16! Cleaned up trailing whitespace while there. llvm-svn: 51240
* Teach GVN to not assert on vector comparisonsNate Begeman2008-05-181-2/+2
| | | | llvm-svn: 51230
* Fix PR2339Chris Lattner2008-05-181-1/+1
| | | | llvm-svn: 51226
* Move isTrueWhenEqual to ICmpInst.Nick Lewycky2008-05-171-20/+4
| | | | llvm-svn: 51215
* API change for {BinaryOperator|CmpInst|CastInst}::create*() --> Create. ↵Gabor Greif2008-05-169-296/+296
| | | | | | Legacy interfaces will be in place for some time. (Merge from use-diet branch.) llvm-svn: 51200
* Bill pointed out that system headers should beDuncan Sands2008-05-161-1/+1
| | | | | | included after local headers. llvm-svn: 51187
OpenPOWER on IntegriCloud