summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/Inliner.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Let the -inline-threshold command line argument take precedence over theJakob Stoklund Olesen2010-11-021-1/+2
| | | | | | | | threshold given to createFunctionInliningPass(). Both opt -O3 and clang would silently ignore the -inline-threshold option. llvm-svn: 118117
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-2/+2
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-2/+2
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-2/+2
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* simplify by using CallSite constructors; virtually eliminates CallSite::get ↵Gabor Greif2010-07-281-4/+4
| | | | | | from the tree llvm-svn: 109687
* Grammar.Eric Christopher2010-07-131-1/+1
| | | | llvm-svn: 108252
* Avoid swap when a copy suffices.Benjamin Kramer2010-05-311-1/+1
| | | | llvm-svn: 105220
* revert r102831. We already delete dead readonly calls inChris Lattner2010-05-011-8/+1
| | | | | | | other places, killing a valid transformation is not the right answer. llvm-svn: 102850
* Disable the call-deletion transformation introduced in r86975. WithoutOwen Anderson2010-05-011-1/+8
| | | | | | | | | | halting analysis, it is illegal to delete a call to a read-only function. The correct solution is almost certainly to add a "must halt" attribute and only allow deletions in its presence. XFAIL the relevant testcase for now. llvm-svn: 102831
* rename InlineInfo.DevirtualizedCalls -> InlinedCalls toChris Lattner2010-05-011-4/+4
| | | | | | | reflect that it includes all inlined calls now, not just devirtualized ones. llvm-svn: 102824
* The inliner has traditionally not considered call sitesChris Lattner2010-05-011-9/+48
| | | | | | | | | | | | | | | | | that appear due to inlining a callee as candidates for futher inlining, but a recent patch made it do this if those call sites were indirect and became direct. Unfortunately, in bizarre cases (see testcase) doing this can cause us to infinitely inline mutually recursive functions into callers not in the cycle. Fix this by keeping track of the inline history from which callsite inline candidates got inlined from. This shouldn't affect any "real world" code, but is required for a follow on patch that is coming up next. llvm-svn: 102822
* remove #if 1's.Chris Lattner2010-04-251-2/+0
| | | | llvm-svn: 102296
* enable my inliner change: add newly devirtualized call sites toChris Lattner2010-04-231-1/+1
| | | | | | the worklist, making them inline candidates. llvm-svn: 102213
* switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.Chris Lattner2010-04-231-2/+4
| | | | | | | | | This fixes a bug where calls inlined into an invoke would get changed into an invoke but the array would keep pointing to the (now dead) call. The improved inliner behavior is still disabled for now. llvm-svn: 102196
* disable my previous inliner patch, it appears to be busting self-host.Chris Lattner2010-04-231-0/+2
| | | | llvm-svn: 102153
* The inliner was choosing to not consider call sitesChris Lattner2010-04-221-1/+7
| | | | | | | | | | that appear in the SCC as a result of inlining as candidates for inlining. Change this so that it *does* consider call sites that change from being indirect to being direct as a result of inlining. This allows it to completely "devirtualize" the testcase. llvm-svn: 102146
* refactor the interface to InlineFunction so that most of the in/outChris Lattner2010-04-221-7/+6
| | | | | | | | arguments are handled with a new InlineFunctionInfo class. This makes it easier to extend InlineFunction to return more info in the future. llvm-svn: 102137
* make the inliner do less work for leaf functions.Chris Lattner2010-04-201-0/+4
| | | | llvm-svn: 101846
* introduce a new CallGraphSCC class, and pass it aroundChris Lattner2010-04-161-6/+6
| | | | | | | | to CallGraphSCCPass's instead of passing around a std::vector<CallGraphNode*>. No functionality change, but now we have a much tidier interface. llvm-svn: 101558
* Try to keep the cached inliner costs around for a bit longer for big functions.Jakob Stoklund Olesen2010-03-091-5/+5
| | | | | | | | | | | | | | | 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-5/+5
| | | | llvm-svn: 98094
* Try to keep the cached inliner costs around for a bit longer for big functions.Jakob Stoklund Olesen2010-03-091-5/+5
| | | | | | | | | | | 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
* Add inlining threshold to log output.Jakob Stoklund Olesen2010-03-091-1/+4
| | | | llvm-svn: 98024
* Enable the inlinehint attribute in the Inliner.Jakob Stoklund Olesen2010-02-131-13/+12
| | | | | | | | | | | | | | | | | | | | Functions explicitly marked inline will get an inlining threshold slightly more aggressive than the default for -O3. This means than -O3 builds are mostly unaffected while -Os builds will be a bit bigger and faster. The difference depends entirely on how many 'inline's are sprinkled on the source. In the CINT2006 suite, only these tests are significantly affected under -Os: Size Time 471.omnetpp +1.63% -1.85% 473.astar +4.01% -6.02% 483.xalancbmk +4.60% 0.00% Note that 483.xalancbmk runs too quickly to give useful timing results. llvm-svn: 96066
* Reintroduce the InlineHint function attribute.Jakob Stoklund Olesen2010-02-061-7/+24
| | | | | | | | | | | | This time it's for real! I am going to hook this up in the frontends as well. The inliner has some experimental heuristics for dealing with the inline hint. When given a -respect-inlinehint option, functions marked with the inline keyword are given a threshold just above the default for -O3. We need some experiments to determine if that is the right thing to do. llvm-svn: 95466
* Increase inliner thresholds by 25.Jakob Stoklund Olesen2010-02-041-3/+3
| | | | | | | | This makes the inliner about as agressive as it was before my changes to the inliner cost calculations. These levels give the same performance and slightly smaller code than before. llvm-svn: 95320
* Move per-function inline threshold calculation to a method.Jakob Stoklund Olesen2010-01-201-14/+12
| | | | | | | No functional change except the forgotten test for InlineLimit.getNumOccurrences() == 0 in the CurrentThreshold2 calculation. llvm-svn: 94007
* Change errs() to dbgs().David Greene2010-01-051-11/+11
| | | | llvm-svn: 92625
* use isInstructionTriviallyDead, as pointed out by DuncanChris Lattner2009-11-121-3/+3
| | | | llvm-svn: 87035
* implement a nice little efficiency hack in the inliner. Since we're nowChris Lattner2009-11-121-14/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | running IPSCCP early, and we run functionattrs interlaced with the inliner, we often (particularly for small or noop functions) completely propagate all of the information about a call to its call site in IPSSCP (making a call dead) and functionattrs is smart enough to realize that the function is readonly (because it is interlaced with inliner). To improve compile time and make the inliner threshold more accurate, realize that we don't have to inline dead readonly function calls. Instead, just delete the call. This happens all the time for C++ codes, here are some counters from opt/llvm-ld counting the number of times calls were deleted vs inlined on various apps: Tramp3d opt: 5033 inline - Number of call sites deleted, not inlined 24596 inline - Number of functions inlined llvm-ld: 667 inline - Number of functions deleted because all callers found 699 inline - Number of functions inlined 483.xalancbmk opt: 8096 inline - Number of call sites deleted, not inlined 62528 inline - Number of functions inlined llvm-ld: 217 inline - Number of allocas merged together 2158 inline - Number of functions inlined 471.omnetpp: 331 inline - Number of call sites deleted, not inlined 8981 inline - Number of functions inlined llvm-ld: 171 inline - Number of functions deleted because all callers found 629 inline - Number of functions inlined Deleting a call is much faster than inlining it, and is insensitive to the size of the callee. :) llvm-svn: 86975
* Move the InlineCost code from Transforms/Utils to Analysis.Dan Gohman2009-10-131-1/+1
| | | | llvm-svn: 83998
* Use names instead of numbers for some of the magicDale Johannesen2009-10-091-3/+4
| | | | | | | constants used in inlining heuristics (especially those used in more than one file). No functional change. llvm-svn: 83675
* When considering whether to inline Callee into Caller,Dale Johannesen2009-10-091-6/+70
| | | | | | | | | and that will make Caller too big to inline, see if it might be better to inline Caller into its callers instead. This situation is described in PR 2973, although I haven't tried the specific case in SPASS. llvm-svn: 83602
* Allow -inline-threshold override default threshold even if compiling to ↵Evan Cheng2009-10-041-0/+1
| | | | | | optimize for size. llvm-svn: 83274
* comment and simplify some code.Chris Lattner2009-08-311-19/+14
| | | | llvm-svn: 80540
* Fix PR4834, a tricky case where the inliner would resolve anChris Lattner2009-08-311-6/+9
| | | | | | | | | | | | | | | indirect function pointer, inline it, then go to delete the body. The problem is that the callgraph had other references to the function, though the inliner had no way to know it, so we got a dangling pointer and an invalid iterator out of the deal. The fix to this is pretty simple: stop the inliner from deleting the function by knowing that there are references to it. Do this by making CallGraphNodes contain a refcount. This requires moving deletion of available_externally functions to the module-level cleanup sweep where it belongs. llvm-svn: 80533
* Fix some nasty callgraph dangling pointer problems in Chris Lattner2009-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | argpromotion and structretpromote. Basically, when replacing a function, they used the 'changeFunction' api which changes the entry in the function map (and steals/reuses the callgraph node). This has some interesting effects: first, the problem is that it doesn't update the "callee" edges in any callees of the function in the call graph. Second, this covers for a major problem in all the CGSCC pass stuff, which is that it is completely broken when functions are deleted if they *don't* reuse a CGN. (there is a cute little fixme about this though :). This patch changes the protocol that CGSCC passes must obey: now the CGSCC pass manager copies the SCC and preincrements its iterator to avoid passes invalidating it. This allows CGSCC passes to mutate the current SCC. However multiple passes may be run on that SCC, so if passes do this, they are now required to *update* the SCC to be current when they return. Other less interesting parts of this patch are that it makes passes update the CG more directly, eliminates changeFunction, and requires clients of replaceCallSite to specify the new callee CGN if they are changing it. llvm-svn: 80527
* finish a half formed thought :)Chris Lattner2009-08-281-1/+4
| | | | llvm-svn: 80334
* Implement a new optimization in the inliner: if inlining multipleChris Lattner2009-08-271-25/+125
| | | | | | | | | | | | | | | | | | | calls into a function and if the calls bring in arrays, try to merge them together to reduce stack size. For example, in the testcase we'd previously end up with 4 allocas, now we end up with 2 allocas. As described in the comments, this is not really the ideal solution to this problem, but it is surprisingly effective. For example, on 176.gcc, we end up eliminating 67 arrays at "gccas" time and another 24 at "llvm-ld" time. One piece of concern that I didn't look into: at -O0 -g with forced inlining this will almost certainly result in worse debug info. I think this is acceptable though given that this is a case of "debugging optimized code", and we don't want debug info to prevent the optimizer from doing things anyway. llvm-svn: 80215
* reduce header #include'ageChris Lattner2009-08-271-1/+4
| | | | llvm-svn: 80204
* reduce inlining factor some stuff out to a static helper function,Chris Lattner2009-08-271-87/+104
| | | | | | and other code cleanups. No functionality change. llvm-svn: 80199
* Allow multiple occurrences of -inline-threshold onDale Johannesen2009-08-251-1/+1
| | | | | | | | the command line. This gives llvm-gcc developers a way to control inlining (documented as "not intended for end users"). llvm-svn: 79966
* - Convert the rest of the DOUTs to DEBUG+errs().Bill Wendling2009-07-311-14/+13
| | | | | | | | - One formatting change. No intended functionality change. llvm-svn: 77717
* More migration to raw_ostream, the water has dried up around the iostream hole.Daniel Dunbar2009-07-251-2/+4
| | | | | | | | | | - Some clients which used DOUT have moved to DEBUG. We are deprecating the "magic" DOUT behavior which avoided calling printing functions when the statement was disabled. In addition to being unnecessary magic, it had the downside of leaving code in -Asserts builds, and of hiding potentially unnecessary computations. llvm-svn: 77019
* Convert several more passes to use getAnalysisIfAvailable<TargetData>()Dan Gohman2009-07-241-4/+3
| | | | | | instead of getAnalysis<TargetData>(). llvm-svn: 76982
* Add line breaks to make the debug output a bit more readable.Eli Friedman2009-07-181-4/+4
| | | | llvm-svn: 76284
* available_externall linkage is not local, this was confusing the codegenerator,Torok Edwin2009-05-231-1/+2
| | | | | | | | | and it wasn't generating calls through @PLT for these functions. hasLocalLinkage() is now false for available_externally, I attempted to fix the inliner and dce to handle available_externally properly. It passed make check. llvm-svn: 72328
* Use a SmallPtrSet instead of std::set.Dale Johannesen2009-03-231-2/+2
| | | | llvm-svn: 67578
* Clear the cached cost when removing a function inDale Johannesen2009-03-191-7/+12
| | | | | | | | | the inliner; prevents nondeterministic behavior when the same address is reallocated. Don't build call graph nodes for debug intrinsic calls; they're useless, and there were typically a lot of them. llvm-svn: 67311
* Add the private linkage.Rafael Espindola2009-01-151-2/+2
| | | | llvm-svn: 62279
OpenPOWER on IntegriCloud