summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/InlineCost.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it ↵Kenneth Uildriks2010-06-091-7/+20
| | | | | | can be reused from PartialSpecializationCost llvm-svn: 105725
* Avoid counting InlineAsm as a call - it prevents loop unrolling.Jakob Stoklund Olesen2010-05-261-1/+5
| | | | | | | PR7026 Patch by Pekka Jääskeläinen! llvm-svn: 104780
* Clear CachedFunctionInfo upon Pass::releaseMemory. Because ValueMap will abortNick Lewycky2010-05-121-1/+6
| | | | | | | | | | on RAUW of functions, this is a correctness issue instead of a mere memory usage problem. No testcase until the new MergeFunctions can land. llvm-svn: 103653
* Added a variant of InlineCostAnalyzer::getInlineCost() that takes the called ↵David Chisnall2010-05-011-3/+9
| | | | | | function as an explicit argument, for use when inlining function pointers. llvm-svn: 102841
* Dan recently disabled recursive inlining within a function, but weChris Lattner2010-04-301-1/+9
| | | | | | | | | | | | | | | | | | were still inlining self-recursive functions into other functions. Inlining a recursive function into itself has the potential to reduce recursion depth by a factor of 2, inlining a recursive function into something else reduces recursion depth by exactly 1. Since inlining a recursive function into something else is a weird form of loop peeling, turn this off. The deleted testcase was added by Dale in r62107, since then we're leaning towards not inlining recursive stuff ever. In any case, if we like inlining recursive stuff, it should be done within the recursive function itself to get the algorithm recursion depth win. llvm-svn: 102798
* Revert r101471. For tight recursive functions which have multipleDan Gohman2010-04-211-7/+0
| | | | | | | | | recursive callsites, inlining can reduce the number of calls by exponential factors, as it does in MultiSource/Benchmarks/Olden/treeadd. More involved heuristics will be needed. llvm-svn: 101969
* fix PR6858: a dangling pointer use bug which was causedChris Lattner2010-04-171-1/+8
| | | | | | | | | | | | by switching CachedFunctionInfo from a std::map to a ValueMap (which is implemented in terms of a DenseMap). DenseMap has different iterator invalidation semantics than std::map. This should hopefully fix the dragonegg builder. llvm-svn: 101658
* a bunch of cleanups and tweaks, no functionality changes.Chris Lattner2010-04-171-42/+48
| | | | llvm-svn: 101657
* Disable inlining of recursive calls. It can complicate tailcallelim andDan Gohman2010-04-161-0/+7
| | | | | | | dependent analyses, and increase code size, so doing it profitably would require more complex heuristics. llvm-svn: 101471
* Make callIsSmall accessible as a utility function.Dan Gohman2010-04-161-4/+4
| | | | llvm-svn: 101463
* performance: cache the dereferenced use_iteratorGabor Greif2010-04-141-7/+8
| | | | llvm-svn: 101265
* Reapply r99451 with a fix to move the NoInline check to the cost functionsEric Christopher2010-03-251-2/+4
| | | | | | instead of InlineFunction. llvm-svn: 99483
* Treat copysignl like the other copysign functions.Duncan Sands2010-03-151-1/+1
| | | | llvm-svn: 98542
* Do not ignore arg_size() impact while counting bb instructions.Devang Patel2010-03-131-3/+2
| | | | llvm-svn: 98408
* Remove extra parameter.Devang Patel2010-03-131-5/+4
| | | | llvm-svn: 98403
* Do not overestimate code size reduction in presense of debug info.Devang Patel2010-03-131-6/+11
| | | | | | Use CodeMetrics.analyzeBasicBlock() to estimate BB size. llvm-svn: 98401
* Try to keep the cached inliner costs around for a bit longer for big functions.Jakob Stoklund Olesen2010-03-091-0/+42
| | | | | | | | | | | | | | | The Caller cost info would be reset everytime a callee was inlined. If the caller has lots of calls and there is some mutual recursion going on, the caller cost info could be calculated many times. This patch reduces inliner runtime from 240s to 0.5s for a function with 20000 small function calls. This is a more conservative version of r98089 that doesn't break the clang test CodeGenCXX/temp-order.cpp. That test relies on rather extreme inlining for constant folding. llvm-svn: 98099
* Revert r98089, it was breaking a clang test.Jakob Stoklund Olesen2010-03-091-36/+0
| | | | llvm-svn: 98094
* Try to keep the cached inliner costs around for a bit longer for big functions.Jakob Stoklund Olesen2010-03-091-0/+36
| | | | | | | | | | | The Caller cost info would be reset everytime a callee was inlined. If the caller has lots of calls and there is some mutual recursion going on, the caller cost info could be calculated many times. This patch reduces inliner runtime from 240s to 0.5s for a function with 20000 small function calls. llvm-svn: 98089
* Permit inlining into huge functions. This heuristic is ancient, and inliningJakob Stoklund Olesen2010-03-091-5/+0
| | | | | | can sometimes help reduce function size. llvm-svn: 98088
* There are two ways of checking for a given type, for example isa<PointerType>(T)Duncan Sands2010-02-161-2/+2
| | | | | | | and T->isPointerTy(). Convert most instances of the first form to the second form. Requested by Chris. llvm-svn: 96344
* Update CodeMetrics to count 'big' function calls explicitly.Jakob Stoklund Olesen2010-02-051-5/+9
| | | | llvm-svn: 95453
* Fix inline cost predictions with SCIENCE.Jakob Stoklund Olesen2010-01-261-28/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | After running a batch of measurements, it is clear that the inliner metrics need some adjustments: Own argument bonus: 20 -> 5 Outgoing argument penalty: 0 -> 5 Alloca bonus: 10 -> 5 Constant instr bonus: 7 -> 5 Dead successor bonus: 40 -> 5*(avg instrs/block) The new cost metrics are generaly 25 points higher than before, so we may need to move thresholds. With this change, InlineConstants::CallPenalty becomes a political correction: if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction())) NumInsts += InlineConstants::CallPenalty + CS.arg_size(); The code size is accurately modelled by CS.arg_size(). CallPenalty is added because calls tend to take a long time, so it may not be worth it to inline a function with lots of calls. All of the political corrections are in the InlineConstants namespace: IndirectCallBonus, CallPenalty, LastCallToStaticBonus, ColdccPenalty, NoreturnPenalty. llvm-svn: 94615
* Revert test polarity to match comment and desired outcome. Remove undeserved ↵Jakob Stoklund Olesen2010-01-261-2/+2
| | | | | | | | | | | | | | bonus. A GEP with all constant indices is already considered free by analyzeBasicBlock(), so don't give it an extra bonus in CountCodeReductionForAlloca(). This patch should remove a small positive bias toward inlining functions with variable-index GEPs, and remove a smaller negative bias from functions with all-constant index GEPs. llvm-svn: 94591
* Remove dead code.Jakob Stoklund Olesen2010-01-261-3/+0
| | | | | | | | | | Functions containing indirectbr are marked NeverInline by analyzeBasicBlock(), so there is no point in giving indirectbr special treatment in CountCodeReductionForConstant. It is never called. No functional change intended. llvm-svn: 94590
* Skip calculation of ArgumentWeights if it will never be used.Jakob Stoklund Olesen2010-01-261-0/+6
| | | | | | | | Save a few bytes by allocating the correct size vector. No functional change intended. llvm-svn: 94589
* Pad my commit stats by reducing indentation in this now separateEric Christopher2010-01-141-19/+20
| | | | | | commit. llvm-svn: 93473
* Few minor changes that were requested. No functional change.Eric Christopher2010-01-141-2/+6
| | | | llvm-svn: 93462
* Small tweak to inline cost computation. Ext of i/fcmp results are mostly ↵Evan Cheng2010-01-141-1/+6
| | | | | | optimized away in codegen. llvm-svn: 93453
* Reduce the inlining cost of functions that contain calls to easily,Eric Christopher2010-01-141-1/+27
| | | | | | and frequently optimized functions. llvm-svn: 93448
* Add a missing closing parenthesis, and tweak to fit in 80Duncan Sands2009-11-011-2/+2
| | | | | | columns. llvm-svn: 85732
* add a comment about why we don't allow inlining indbr.Chris Lattner2009-11-011-0/+5
| | | | llvm-svn: 85724
* pull check for return inst out of loop, never inline a callee that containsChris Lattner2009-11-011-5/+7
| | | | | | an indirectbr. llvm-svn: 85702
* rename indbr -> indirectbr to appease the residents of #llvm.Chris Lattner2009-10-281-1/+1
| | | | llvm-svn: 85351
* Random updates to passes for indbr, I need blockaddress before I can do much ↵Chris Lattner2009-10-271-0/+3
| | | | | | more. llvm-svn: 85316
* Remove FreeInst.Victor Hernandez2009-10-261-4/+0
| | | | | | | Remove LowerAllocations pass. Update some more passes to treate free calls just like they were treating FreeInst. llvm-svn: 85176
* Remove AllocationInst. Since MallocInst went away, AllocaInst is the only ↵Victor Hernandez2009-10-231-1/+1
| | | | | | subclass of AllocationInst, so it no longer is necessary. llvm-svn: 84969
* Remove MallocInst from LLVM Instructions.Victor Hernandez2009-10-171-1/+1
| | | | llvm-svn: 84299
* Compute a full cost value even when a setjmp call is found.Dan Gohman2009-10-131-3/+1
| | | | llvm-svn: 84015
* Split code not specific to Function inlining out into a separate class,Dan Gohman2009-10-131-25/+28
| | | | | | | named CodeMetrics. Move it to be a non-nested class. Rename RegionInfo back to FunctionInfo. llvm-svn: 84013
* Move the InlineCost code from Transforms/Utils to Analysis.Dan Gohman2009-10-131-0/+337
llvm-svn: 83998
OpenPOWER on IntegriCloud