summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* - Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an ↵Evan Cheng2008-06-301-2/+2
| | | | | | | | empty string for ConstantAggregateZero case which surprises selectiondag. - Correctly handle memcpy from constant string which is zero-initialized. llvm-svn: 52891
* Revert (52748 and friends):Anton Korobeynikov2008-06-291-2/+2
| | | | | | | | | | | | Move GetConstantStringInfo to lib/Analysis. Remove string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. This unbreaks llvm-gcc bootstrap. llvm-svn: 52884
* Move GetConstantStringInfo to lib/Analysis. RemoveEric Christopher2008-06-261-2/+2
| | | | | | | | | string output routine from Constant. Update all callers. Change debug intrinsic api slightly to accomodate move of routine, these now return values instead of strings. llvm-svn: 52748
* Fix PR2488, a case where we deleted stack restores too aggressively.Chris Lattner2008-06-251-4/+9
| | | | llvm-svn: 52702
* Fix for PR2479: correctly optimize expressions like (a > 13) & (a == Eli Friedman2008-06-211-2/+1
| | | | | | | | 15). See also PR1800, which is about the signed case. llvm-svn: 52608
* Fix PR2471, which is a bug involving an invalid promotion from a conditional ↵Chris Lattner2008-06-201-1/+7
| | | | | | load. llvm-svn: 52525
* Remove dead code causing a warning.Bill Wendling2008-06-191-2/+0
| | | | llvm-svn: 52502
* Use Instruction::moveBefore instead of manipulating the instruction listDan Gohman2008-06-191-4/+2
| | | | | | directly. llvm-svn: 52498
* Fix the regressions on sext-misc.ll my patch yesterday caused.Chris Lattner2008-06-181-0/+1
| | | | llvm-svn: 52466
* implement some simple bswap optimizations, rdar://5992453Chris Lattner2008-06-181-122/+168
| | | | llvm-svn: 52442
* make truncate/sext elimination capable of changing phi's. This Chris Lattner2008-06-181-5/+35
| | | | | | implements rdar://6013816 and the testcase in Transforms/InstCombine/sext-misc.ll. llvm-svn: 52440
* Fix typo that changed the logic to something wrong.Duncan Sands2008-06-171-1/+1
| | | | | | Spotted by Nick Lewycky. llvm-svn: 52411
* Pass around Instruction* instead of Instruction& in FindInsertedValue and ↵Matthijs Kooijman2008-06-161-1/+1
| | | | | | friends. llvm-svn: 52318
* 80 column fixes.Matthijs Kooijman2008-06-161-1/+2
| | | | llvm-svn: 52316
* Move FindScalarValue from InstructionCombining.cpp to ValueTracking.cpp. WhileMatthijs Kooijman2008-06-161-147/+1
| | | | | | | | | | I'm at it, rename it to FindInsertedValue. The only functional change is that newly created instructions are no longer added to instcombine's worklist, but that is not really necessary anyway (and I'll commit some improvements next that will completely remove the need). llvm-svn: 52315
* Don't skip over instructions other than loads that might read memory Eli Friedman2008-06-131-5/+6
| | | | | | when trying to sink stores. llvm-svn: 52259
* Make sure SimplifyStoreAtEndOfBlock doesn't mess with loops; the Eli Friedman2008-06-131-2/+6
| | | | | | | structure checks are incorrect if the blocks aren't distinct. Fixes PR2435. llvm-svn: 52257
* fix a minor deviation from the original in my previous commitGabor Greif2008-06-121-1/+1
| | | | llvm-svn: 52247
* op_iterator-ify some loops, low hanging fruit only, there is moreGabor Greif2008-06-121-19/+21
| | | | llvm-svn: 52246
* Teach instruction combining about the extractvalue. It can succesfully foldMatthijs Kooijman2008-06-111-0/+157
| | | | | | | | useless insert-extract chains, similar to how it folds them for vectors. Add a testcase for this. llvm-svn: 52217
* Clarify a comment.Matthijs Kooijman2008-06-111-3/+3
| | | | llvm-svn: 52212
* Limit the icmp+phi merging optimization to the cases where it is profitable:Chris Lattner2008-06-081-4/+12
| | | | | | don't make i1 phis when it won't be possible to eliminate them. llvm-svn: 52097
* As Chris suggested, handle the situation if ShAmt larger than BitWidth, Zhou Sheng2008-06-061-1/+1
| | | | | | otherwise, opt might crash. llvm-svn: 52041
* If BitWidth equals to ShtAmt, the RHSKnownZero[BitWidth-ShiftAmt-1] willZhou Sheng2008-06-051-1/+1
| | | | | | | | crash the opt. Just fix this. Test case in llvm/test/Transforms/InstCombine/2008-06-05-ashr-crash.ll llvm-svn: 52003
* move CannotBeNegativeZero to ValueTracking. Simplify some signbit comparisons.Chris Lattner2008-06-021-54/+2
| | | | llvm-svn: 51864
* move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBitsChris Lattner2008-06-021-651/+14
| | | | | | | out of instcombine into a new file in libanalysis. This also teaches ComputeNumSignBits about the number of sign bits in a constantint. llvm-svn: 51863
* 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
* Implement PR2370: memmove(x,x,size) -> noop.Chris Lattner2008-05-281-0/+4
| | | | llvm-svn: 51636
* "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
* Tidy up BasicBlock::getFirstNonPHI, and change a bunch of places toDan Gohman2008-05-231-6/+3
| | | | | | 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
* Port SelectionDAG's ComputeNumSignBits-using code to instcombine,Dan Gohman2008-05-201-1/+28
| | | | | | now that instcombine also has ComputeNumSignBits. llvm-svn: 51350
* 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
* Make AssociativeOpt static.Dan Gohman2008-05-201-1/+1
| | | | llvm-svn: 51290
* 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
OpenPOWER on IntegriCloud