summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* teach SCEV that the scale and addition of an inbounds gep don't NSW.Chris Lattner2011-02-131-2/+5
| | | | | | | This fixes a FIXME in scev-aa.ll (allowing a new no-alias result) and generally makes things more precise. llvm-svn: 125449
* Per discussion with Dan G, inbounds geps *certainly* can haveChris Lattner2011-02-111-3/+14
| | | | | | | | | | | unsigned overflow (e.g. "gep P, -1"), and while they can have signed wrap in theoretical situations, modelling an AddRec as not having signed wrap is going enough for any case we can think of today. In the future if this isn't enough, we can revisit this. Modeling them as having NUW isn't causing any known problems either FWIW. llvm-svn: 125410
* Tolerate degenerate phi nodes that can occur in the middle of optimizationNick Lewycky2011-02-101-0/+4
| | | | | | passes. Fixes PR9112. Patch by Jakub Staszak! llvm-svn: 125319
* Formatting and comment tweaks.Duncan Sands2011-02-091-5/+5
| | | | llvm-svn: 125200
* Teach instsimplify some tricks about exact/nuw/nsw shifts.Chris Lattner2011-02-091-39/+69
| | | | | | improve interfaces to instsimplify to take this info. llvm-svn: 125196
* Rework InstrTypes.h so to reduce the repetition around the NSW/NUW/ExactChris Lattner2011-02-091-2/+2
| | | | | | | | | | | | | | | | | versions of creation functions. Eventually, the "insertion point" versions of these should just be removed, we do have IRBuilder afterall. Do a massive rewrite of much of pattern match. It is now shorter and less redundant and has several other widgets I will be using in other patches. Among other changes, m_Div is renamed to m_IDiv (since it only matches integer divides) and m_Shift is gone (it used to match all binops!!) and we now have m_LogicalShift for the one client to use. Enhance IRBuilder to have "isExact" arguments to things like CreateUDiv and reduce redundancy within IRbuilder by having these methods chain to each other more instead of duplicating code. llvm-svn: 125194
* Add an m_Div pattern for matching either a udiv or an sdiv and use itDuncan Sands2011-02-071-4/+2
| | | | | | to simplify the "(X/Y)*Y->X when the division is exact" transform. llvm-svn: 125004
* teach instsimplify to transform (X / Y) * Y to XChris Lattner2011-02-061-3/+5
| | | | | | when the div is an exact udiv. llvm-svn: 124994
* Remove premature optimization that avoided calculating argument weightsEric Christopher2011-02-061-5/+0
| | | | | | | | | if we weren't going to inline the function. The rest of the code using this was removed. Fixes PR9154. llvm-svn: 124991
* Simplify test, as suggested by Chris.Anders Carlsson2011-02-061-6/+2
| | | | llvm-svn: 124990
* When loading from a constant, fold inttoptr if the integer type and the ↵Anders Carlsson2011-02-061-0/+11
| | | | | | resulting pointer type both have the same size. llvm-svn: 124987
* Fix another warning.Anders Carlsson2011-02-051-1/+1
| | | | llvm-svn: 124961
* Fix cut and paste error spotted by Jakob.Eric Christopher2011-02-051-1/+1
| | | | llvm-svn: 124930
* Rewrite how the indirect call bonus is handled. This now works by:Eric Christopher2011-02-051-78/+125
| | | | | | | | | | | | | | | | | a) Making it a per call site bonus for functions that we can move from indirect to direct calls. b) Reduces the bonus from 500 to 100 per call site. c) Subtracts the size of the possible newly inlineable call from the bonus to only add a bonus if we can inline a small function to devirtualize it. Also changes the bonus from a positive that's subtracted to a negative that's added. Fixes the remainder of rdar://8546196 by reducing the object file size after inlining by 84%. llvm-svn: 124916
* Improve threading of comparisons over select instructions (spotted by myDuncan Sands2011-02-031-3/+25
| | | | | | | | | | auto-simplifier). This has a big impact on Ada code, but not much else. Unfortunately the impact is mostly negative! This is due to PR9004 (aka SCCP failing to resolve conditional branch conditions in the destination blocks of the branch), in which simple correlated expressions are not resolved but complicated ones are, so simplifying has a bad effect! llvm-svn: 124788
* Fix typo in comment.Devang Patel2011-02-031-1/+1
| | | | llvm-svn: 124759
* Add support to describe template value parameter in debug info.Devang Patel2011-02-022-0/+27
| | | | llvm-svn: 124755
* Add support to describe template parameter type in debug info.Devang Patel2011-02-022-2/+28
| | | | llvm-svn: 124752
* Reenable the transform "(X*Y)/Y->X" when the multiplication is known not toDuncan Sands2011-02-021-5/+5
| | | | | | | | overflow (nsw flag), which was disabled because it breaks 254.gap. I have informed the GAP authors of the mistake in their code, and arranged for the testsuite to use -fwrapv when compiling this benchmark. llvm-svn: 124746
* Add a m_Undef pattern for convenience. This is so that code that usesDuncan Sands2011-02-011-16/+16
| | | | | | | pattern matching can also pattern match undef, creating a more uniform style. llvm-svn: 124657
* Add a m_SignBit pattern for convenience.Duncan Sands2011-02-011-3/+1
| | | | llvm-svn: 124656
* Have m_One also match constant vectors for which every element is 1.Duncan Sands2011-02-011-6/+0
| | | | llvm-svn: 124655
* Reapply 124275 since the Dragonegg failure was unreproducible.Eric Christopher2011-02-011-82/+85
| | | | llvm-svn: 124641
* Commit 124487 broke 254.gap. See if disabling the part that might be triggeredDuncan Sands2011-01-301-5/+5
| | | | | | by PR9088 fixes things. llvm-svn: 124561
* Transform (X/Y)*Y into X if the division is exact. Instcombine already ↵Duncan Sands2011-01-301-0/+9
| | | | | | | | | | | | knows how to do this and more, but would only do it if X/Y had only one use. Spotted as the most common missed simplification in SPEC by my auto-simplifier, now that it knows about nuw/nsw/exact flags. This removes a bunch of multiplications from 447.dealII and 483.xalancbmk. It also removes a lot from tramp3d-v4, which results in much more inlining. llvm-svn: 124560
* Fix comment.Nick Lewycky2011-01-291-1/+1
| | | | llvm-svn: 124544
* Move InstCombine's knowledge of fdiv to SimplifyInstruction().Frits van Bommel2011-01-291-2/+24
| | | | llvm-svn: 124534
* Fix typo: should have been testing that X was odd, not V.Duncan Sands2011-01-291-3/+3
| | | | llvm-svn: 124533
* Implementation of path profiling.Andrew Trick2011-01-295-3/+1176
| | | | | | | | | | Modified patch by Adam Preuss. This builds on the existing framework for block tracing, edge profiling and optimal edge profiling. See -help-hidden for new flags. For documentation, see the technical report "Implementation of Path Profiling..." in llvm.org/pubs. llvm-svn: 124515
* This dyn_cast should be a cast. Pointed out by Frits van Bommel.Duncan Sands2011-01-281-1/+1
| | | | llvm-svn: 124497
* Thread divisions over selects and phis. This doesn't fire much and has ↵Duncan Sands2011-01-281-9/+19
| | | | | | | | basically zero effect on the testsuite (it improves two Ada testcases). llvm-svn: 124496
* My auto-simplifier noticed that ((X/Y)*Y)/Y occurs several times in SPECDuncan Sands2011-01-281-0/+107
| | | | | | | | | | | | | | | | | benchmarks, and that it can be simplified to X/Y. (In general you can only simplify (Z*Y)/Y to Z if the multiplication did not overflow; if Z has the form "X/Y" then this is the case). This patch implements that transform and moves some Div logic out of instcombine and into InstructionSimplify. Unfortunately instcombine gets in the way somewhat, since it likes to change (X/Y)*Y into X-(X rem Y), so I had to teach instcombine about this too. Finally, thanks to the NSW/NUW flags, sometimes we know directly that "Z*Y" does not overflow, because the flag says so, so I added that logic too. This eliminates a bunch of divisions and subtractions in 447.dealII, and has good effects on some other benchmarks too. It seems to have quite an effect on tramp3d-v4 but it's hard to say if it's good or bad because inlining decisions changed, resulting in massive changes all over. llvm-svn: 124487
* Temporarily revert 124275 to see if it brings the dragonegg buildbot back.Eric Christopher2011-01-261-85/+82
| | | | llvm-svn: 124312
* APInt has a method for determining whether a number is a power of 2Duncan Sands2011-01-261-1/+1
| | | | | | which is more efficient than countPopulation - use it. llvm-svn: 124283
* Fix memory corruption. If one of the SCEV creation functions calls another butNick Lewycky2011-01-261-0/+2
| | | | | | | doesn't return immediately after then the insert position in UniqueSCEVs will be out of date. No test because this is a memory corruption issue. Fixes PR9051! llvm-svn: 124282
* Separate out the constant bonus from the size reduction metrics. ReworkEric Christopher2011-01-261-82/+85
| | | | | | | | | a few loops accordingly. Should be no functional change. This is a step for more accurate cost/benefit analysis of devirt/inlining bonuses. llvm-svn: 124275
* Coding style formatting changes.Eric Christopher2011-01-261-7/+2
| | | | llvm-svn: 124260
* In which I discover that zero+zero is zero, d'oh!Duncan Sands2011-01-251-3/+3
| | | | llvm-svn: 124188
* See if this fixes llvm-gcc bootstrap.Duncan Sands2011-01-251-1/+2
| | | | llvm-svn: 124184
* According to my auto-simplifier the most common missed simplifications inDuncan Sands2011-01-252-13/+228
| | | | | | | | | | | optimized code are: (non-negative number)+(power-of-two) != 0 -> true and (x | 1) != 0 -> true Instcombine knows about the second one of course, but only does it if X|1 has only one use. These fire thousands of times in the testsuite. llvm-svn: 124183
* Reorganize this so that the early exit and special cases come earlyEric Christopher2011-01-251-26/+26
| | | | | | rather than interspersed. No functional change. llvm-svn: 124168
* Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman2011-01-245-11/+13
| | | | | | | | | | | with BasicAA's DecomposeGEPExpression, which recently began using a TargetData. This fixes PR8968, though the testcase is awkward to reduce. Also, update several off GetUnderlyingObject's users which happen to have a TargetData handy to pass it in. llvm-svn: 124134
* fix PR8928 by clearing a stale map, patch by Jakub Staszak!Chris Lattner2011-01-241-0/+1
| | | | llvm-svn: 124132
* Add a comment.Dan Gohman2011-01-241-0/+1
| | | | llvm-svn: 124126
* Simplify some code with no functionality change. Make the test a lot moreNick Lewycky2011-01-231-12/+4
| | | | | | robust against smarter optimizations, using the power of FileCheck. llvm-svn: 124081
* Null initialize a few variables flagged byTed Kremenek2011-01-231-1/+1
| | | | | | | | | | clang's -Wuninitialized-experimental warning. While these don't look like real bugs, clang's -Wuninitialized-experimental analysis is stricter than GCC's, and these fixes have the benefit of being general nice cleanups. llvm-svn: 124073
* Use value ranges to fold ext(trunc) in SCEV when possible.Nick Lewycky2011-01-231-0/+34
| | | | llvm-svn: 124062
* Have SCEV turn sext(x) into zext(x) when x is s>= 0. This applies many times inNick Lewycky2011-01-221-0/+4
| | | | | | "make check" alone. llvm-svn: 124046
* Add a FIXME explaining the move to a single indirect call bonus per functionEric Christopher2011-01-221-0/+5
| | | | | | that we can change from indirect to direct. llvm-svn: 124045
* Only apply the devirtualization bonus once instead of per-call site in theEric Christopher2011-01-221-2/+6
| | | | | | | | target function. Fixes part of rdar://8546196 llvm-svn: 124044
OpenPOWER on IntegriCloud