summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/Inliner.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Enable recursive inlining. Reduce inlining thresholdDale Johannesen2009-01-121-5/+5
| | | | | | | back to 200; 400 seems to be too high, loses more than it gains. llvm-svn: 62107
* Increase default inlining aggressiveness in partialDale Johannesen2009-01-111-2/+2
| | | | | | | | | compensation for turning off gcc's inliner. This gets us closer to the amount of inlining we were getting before. It is not a win on everything, of course, but seems to gain overall. llvm-svn: 62058
* Adjustments to last patch based on review.Dale Johannesen2009-01-091-0/+5
| | | | llvm-svn: 61969
* Fix error where it wasn't getting the correct caller function.Bill Wendling2008-11-211-1/+2
| | | | llvm-svn: 59758
* If the function being inlined has a higher stack protection level than theBill Wendling2008-11-211-0/+9
| | | | | | | inlining function, then increase the stack protection level on the inlining function. llvm-svn: 59757
* Do now allow InlineAlways pass to remove dead functions.Devang Patel2008-11-051-0/+10
| | | | llvm-svn: 58744
* Add InlineCost class for represent the estimated cost of inlining aDaniel Dunbar2008-10-301-1/+14
| | | | | | | | | function. - This explicitly models the costs for functions which should "always" or "never" be inlined. This fixes bugs where such costs were not previously respected. llvm-svn: 58450
* Factor shouldInline method out of Inliner.Daniel Dunbar2008-10-291-18/+26
| | | | | | - No functionality change. llvm-svn: 58355
* Implement function notes as function attributes. Devang Patel2008-09-261-1/+2
| | | | llvm-svn: 56716
* Large mechanical patch.Devang Patel2008-09-251-1/+1
| | | | | | | | | | | | | | | s/ParamAttr/Attribute/g s/PAList/AttrList/g s/FnAttributeWithIndex/AttributeWithIndex/g s/FnAttr/Attribute/g This sets the stage - to implement function notes as function attributes and - to distinguish between function attributes and return value attributes. This requires corresponding changes in llvm-gcc and clang. llvm-svn: 56622
* Put FN_NOTE_AlwaysInline and others in FnAttr namespace.Devang Patel2008-09-241-1/+1
| | | | llvm-svn: 56527
* Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.Devang Patel2008-09-231-1/+1
| | | | | | Do not check isDeclaration() in hasNote(). It is clients' responsibility. llvm-svn: 56524
* Use parameter attribute store (soon to be renamed) forDevang Patel2008-09-231-1/+1
| | | | | | Function Notes also. Function notes are stored at index ~0. llvm-svn: 56511
* Add hasNote() to check note associated with a function.Devang Patel2008-09-221-1/+1
| | | | llvm-svn: 56477
* Use removeAllCalledFunctions rather than removingDuncan Sands2008-09-051-5/+3
| | | | | | edges one by one by hand. llvm-svn: 55836
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-4/+4
| | | | llvm-svn: 55779
* Update inline threshold for current function if the notes say, optimize for ↵Devang Patel2008-09-031-2/+9
| | | | | | size. llvm-svn: 55745
* Handle "always inline" note during inline cost analysis.Devang Patel2008-09-031-6/+1
| | | | llvm-svn: 55712
* Handle "noinline" note inside the simple inliner.Devang Patel2008-09-031-4/+2
| | | | llvm-svn: 55708
* s/FP_AlwaysInline/FN_NOTE_AlwaysInline/gDevang Patel2008-09-021-2/+2
| | | | llvm-svn: 55676
* respect inline=never and inline=always notes.Devang Patel2008-09-021-1/+8
| | | | llvm-svn: 55673
OpenPOWER on IntegriCloud