summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add 'umax' similar to 'smax' SCEV. Closes PR2003.Nick Lewycky2008-02-201-44/+146
| | | | | | | | | | | | | | | Parse reversed smax and umax as smin and umin and express them with negative or binary-not SCEVs (which are really just subtract under the hood). Parse 'xor %x, -1' as (-1 - %x). Remove dead code (ConstantInt::get always returns a ConstantInt). Don't use getIntegerSCEV(-1, Ty). The first value is an int, then it gets passed into a uint64_t. Instead, create the -1 directly from ConstantInt::getAllOnesValue(). llvm-svn: 47360
* Fix typo. Thanks to Duncan for noticing.Wojciech Matyjewicz2008-02-131-1/+1
| | | | llvm-svn: 47062
* Add comments as per review feedback.Wojciech Matyjewicz2008-02-131-5/+13
| | | | llvm-svn: 47061
* Fix PR2002. Suppose n is the initial value for the induction Wojciech Matyjewicz2008-02-121-6/+4
| | | | | | | | | | variable (with step 1) and m is its final value. Then, the correct trip count is SMAX(m,n)-n. Previously, we used SMAX(0,m-n), but m-n may overflow and can't in general be interpreted as signed. Patch by Nick Lewycky. llvm-svn: 47007
* If the LHS of the comparison is a loop-invariant we also want to move it Wojciech Matyjewicz2008-02-111-2/+2
| | | | | | | | to the RHS. This simple change allows to compute loop iteration count for loops with condition similar to the one in the testcase (which seems to be quite common). llvm-svn: 46959
* Fix PR1798 - an error in the evaluation of SCEVAddRecExpr at an Wojciech Matyjewicz2008-02-111-49/+100
| | | | | | | | | | | | | | | | | | | | | | | | | arbitrary iteration. The patch: 1) changes SCEVSDivExpr into SCEVUDivExpr, 2) replaces PartialFact() function with BinomialCoefficient(); the computations (essentially, the division) in BinomialCoefficient() are performed with the apprioprate bitwidth necessary to avoid overflow; unsigned division is used instead of the signed one. Computations in BinomialCoefficient() require support from the code generator for APInts. Currently, we use a hack rounding up the neccessary bitwidth to the nearest power of 2. The hack is easy to turn off in future. One remaining issue: we assume the divisor of the binomial coefficient formula can be computed accurately using 16 bits. It means we can handle AddRecs of length up to 9. In future, we should use APInts to evaluate the divisor. Thanks to Nicholas for cooperation! llvm-svn: 46955
* Avoid unnecessarily casting away const, fixing a FIXME.Dan Gohman2008-01-311-1/+1
| | | | llvm-svn: 46591
* Don't be rude, emit debugging info where asked to.Nick Lewycky2008-01-021-5/+5
| | | | llvm-svn: 45485
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.Chris Lattner2007-12-101-2/+14
| | | | | | | | Reimplement the xform in Analysis/ConstantFolding.cpp where we can use targetdata to validate that it is safe. While I'm in there, fix some const correctness issues and generalize the interface to the "operand folder". llvm-svn: 44817
* Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.Nick Lewycky2007-11-251-80/+130
| | | | llvm-svn: 44319
* simplify some code.Chris Lattner2007-11-231-5/+1
| | | | llvm-svn: 44295
* Fix a bug where we'd try to find a scev value for a bitcast operand,Chris Lattner2007-11-231-0/+8
| | | | | | | even though the bitcast operand did not have integer type. This fixes PR1814. llvm-svn: 44286
* Instead of calculating constant factors, calculate the number of trailingNick Lewycky2007-11-221-54/+47
| | | | | | bits. Patch from Wojciech Matyjewicz. llvm-svn: 44268
* Small cleanup. Use APInt::getHighBitsSet method instead of shift left.Nick Lewycky2007-11-201-5/+4
| | | | | | "setcc" -> "icmp op" in comments. No functionality change. llvm-svn: 44249
* Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.Nick Lewycky2007-11-201-6/+8
| | | | llvm-svn: 44248
* Reverted r44163 per requestAnton Korobeynikov2007-11-151-52/+4
| | | | llvm-svn: 44177
* Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEVNick Lewycky2007-11-151-4/+51
| | | | | | | is disabled in the sense that it will refuse to create one from a UDiv instruction, until the code is better tested. llvm-svn: 44163
* Move the SCEV object factors from being static members of the individualDan Gohman2007-10-221-172/+188
| | | | | | | SCEV subclasses to being non-static member functions of the ScalarEvolution class. llvm-svn: 43224
* Build the correct range for loops with unusual bounds. Fix from Jay Foad.Nick Lewycky2007-09-271-1/+1
| | | | llvm-svn: 42394
* Next round of APFloat changes.Dale Johannesen2007-09-061-1/+2
| | | | | | | | | | | | | | Use APFloat in UpgradeParser and AsmParser. Change all references to ConstantFP to use the APFloat interface rather than double. Remove the ConstantFP double interfaces. Use APFloat functions for constant folding arithmetic and comparisons. (There are still way too many places APFloat is just a wrapper around host float/double, but we're getting there.) llvm-svn: 41747
* Use SmallVector instead of std::vector.Devang Patel2007-08-211-2/+2
| | | | llvm-svn: 41207
* Let scalar-evolution analyze loops with an unsigned comparison for the exitNick Lewycky2007-08-061-17/+35
| | | | | | condition. Fixes 1597. llvm-svn: 40867
* Don't assume it's safe to transform a loop just because it's dominated by anyNick Lewycky2007-08-061-1/+1
| | | | | | comparison. Fixes bug 1598. llvm-svn: 40866
* Handle decrementing loops properly. Fixes PR1533.Nick Lewycky2007-07-161-15/+13
| | | | | | | | Always pass the constant as the second parameter to HowManyLessThans. Remove obsolete "isSigned" parameter. llvm-svn: 39893
* Move the APInt form of SCEVUnknown::getIntegerSCEV to SCEVConstant::get, andDan Gohman2007-07-091-15/+14
| | | | | | | use SCEVConstant::get instead of SCEVUnknown::get when constructing a SCEV for a ConstantInt. llvm-svn: 38457
* Rename ScalarEvolution::deleteInstructionFromRecords toDan Gohman2007-06-191-14/+14
| | | | | | | | | deleteValueFromRecords and loosen the types to all it to accept Value* instead of just Instruction*, since this is what ScalarEvolution uses internally anyway. This allows more flexibility for future uses. llvm-svn: 37657
* In SCEVAddExpr::get, skip over any cast operands before looking for nestedDan Gohman2007-06-181-2/+5
| | | | | | | add operands after constant operands. The recent change to recognize sign-extend expressions caused this to be exposed more often. llvm-svn: 37628
* Add a SCEV class and supporting code for sign-extend expressions.Dan Gohman2007-06-151-0/+47
| | | | | | | | | | This created an ambiguity for expandInTy to decide when to use sign-extension or zero-extension, but it turns out that most of its callers don't actually need a type conversion, now that LLVM types don't have explicit signedness. Drop expandInTy in favor of plain expand, and change the few places that actually need a type conversion to do it themselves. llvm-svn: 37591
* Optimize this test. Firstly, only Instructions may use other Instructions.Nick Lewycky2007-06-061-2/+2
| | | | | | | Secondly, checking whether removal succeeded tells you whether it was in the map to begin with. llvm-svn: 37469
* Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.llNick Lewycky2007-06-061-3/+22
| | | | llvm-svn: 37459
* Drop 'const'Devang Patel2007-05-031-1/+1
| | | | llvm-svn: 36662
* Use 'static const char' instead of 'static const int'.Devang Patel2007-05-021-1/+1
| | | | | | | Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. llvm-svn: 36652
* Fix build error.Lauro Ramos Venancio2007-05-021-1/+1
| | | | llvm-svn: 36648
* Do not use typeinfo to identify pass in pass manager.Devang Patel2007-05-011-0/+1
| | | | llvm-svn: 36632
* Revert last patch. It was already fixed.Reid Spencer2007-04-161-6/+1
| | | | llvm-svn: 36102
* For PR1336:Reid Spencer2007-04-161-1/+6
| | | | | | | Fix a div-by-zero bug noticed by APInt. This fixes: test/Transforms/IndVarsSimplify/exit_value_tests.llx llvm-svn: 36099
* Fix a nasty bug introduced when apint'ified. This fixesChris Lattner2007-04-151-4/+4
| | | | | | Transforms/IndVarsSimplify/exit_value_tests.llx llvm-svn: 36081
* Eliminate unnecessary APInt construction.Zhou Sheng2007-04-071-8/+7
| | | | llvm-svn: 35740
* Make APInt variables do the computation stuffs instead ofZhou Sheng2007-04-071-14/+11
| | | | | | ConstantExpr::getXX if possible. llvm-svn: 35738
* Eliminate unnecessary zext/trunc stuffs.Zhou Sheng2007-04-071-14/+10
| | | | llvm-svn: 35737
* Treat xor of signbit like an add.Chris Lattner2007-04-021-1/+10
| | | | llvm-svn: 35586
* Guard further against APInt operations with operands of unequal bit width.Reid Spencer2007-03-041-4/+11
| | | | llvm-svn: 34897
* Fix an unequal bitwidth issue.Reid Spencer2007-03-021-3/+6
| | | | llvm-svn: 34831
* Prefer non-virtual calls to ConstantInt::isZero over virtual calls toReid Spencer2007-03-021-6/+6
| | | | | | Constant::isNullValue() in situations where it is possible. llvm-svn: 34821
* Make it possible to create an SCEVUnknown from an APInt as well as an int.Reid Spencer2007-03-011-0/+4
| | | | llvm-svn: 34816
* Construct ConstantInt with simpler constructor.Reid Spencer2007-03-011-4/+4
| | | | llvm-svn: 34795
* Fix last night's 445.gobmk breakage which was caused by comparison ofReid Spencer2007-03-011-0/+1
| | | | | | APInt's of unequal bitwidth. llvm-svn: 34790
* Remove the "isSigned" parameters from ConstantRange. It turns out theyReid Spencer2007-03-011-8/+7
| | | | | | | | are not needed as the results are the same with or without it. Patch by Nicholas Lewycky. llvm-svn: 34782
* APIntify various computations in ScalarEvolutionReid Spencer2007-03-011-55/+52
| | | | llvm-svn: 34780
OpenPOWER on IntegriCloud