45de584b4f82fbfb9cb9c50bc1fc08931b534308 |
|
31-Mar-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Remove a bunch of empty, dead, and no-op methods from all of these interfaces. These methods were used in the old inline cost system where there was a persistent cache that had to be updated, invalidated, and cleared. We're now doing more direct computations that don't require this intricate dance. Even if we resume some level of caching, it would almost certainly have a simpler and more narrow interface than this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153813 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
f2286b0152f0b942e82d8e809186e5cc0d247131 |
|
31-Mar-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Initial commit for the rewrite of the inline cost analysis to operate on a per-callsite walk of the called function's instructions, in breadth-first order over the potentially reachable set of basic blocks. This is a major shift in how inline cost analysis works to improve the accuracy and rationality of inlining decisions. A brief outline of the algorithm this moves to: - Build a simplification mapping based on the callsite arguments to the function arguments. - Push the entry block onto a worklist of potentially-live basic blocks. - Pop the first block off of the *front* of the worklist (for breadth-first ordering) and walk its instructions using a custom InstVisitor. - For each instruction's operands, re-map them based on the simplification mappings available for the given callsite. - Compute any simplification possible of the instruction after re-mapping, and store that back int othe simplification mapping. - Compute any bonuses, costs, or other impacts of the instruction on the cost metric. - When the terminator is reached, replace any conditional value in the terminator with any simplifications from the mapping we have, and add any successors which are not proven to be dead from these simplifications to the worklist. - Pop the next block off of the front of the worklist, and repeat. - As soon as the cost of inlining exceeds the threshold for the callsite, stop analyzing the function in order to bound cost. The primary goal of this algorithm is to perfectly handle dead code paths. We do not want any code in trivially dead code paths to impact inlining decisions. The previous metric was *extremely* flawed here, and would always subtract the average cost of two successors of a conditional branch when it was proven to become an unconditional branch at the callsite. There was no handling of wildly different costs between the two successors, which would cause inlining when the path actually taken was too large, and no inlining when the path actually taken was trivially simple. There was also no handling of the code *path*, only the immediate successors. These problems vanish completely now. See the added regression tests for the shiny new features -- we skip recursive function calls, SROA-killing instructions, and high cost complex CFG structures when dead at the callsite being analyzed. Switching to this algorithm required refactoring the inline cost interface to accept the actual threshold rather than simply returning a single cost. The resulting interface is pretty bad, and I'm planning to do lots of interface cleanup after this patch. Several other refactorings fell out of this, but I've tried to minimize them for this patch. =/ There is still more cleanup that can be done here. Please point out anything that you see in review. I've worked really hard to try to mirror at least the spirit of all of the previous heuristics in the new model. It's not clear that they are all correct any more, but I wanted to minimize the change in this single patch, it's already a bit ridiculous. One heuristic that is *not* yet mirrored is to allow inlining of functions with a dynamic alloca *if* the caller has a dynamic alloca. I will add this back, but I think the most reasonable way requires changes to the inliner itself rather than just the cost metric, and so I've deferred this for a subsequent patch. The test case is XFAIL-ed until then. As mentioned in the review mail, this seems to make Clang run about 1% to 2% faster in -O0, but makes its binary size grow by just under 4%. I've looked into the 4% growth, and it can be fixed, but requires changes to other parts of the inliner. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153812 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
f91f5af802bd4487c49ee17cd0d3e46c6456263e |
|
16-Mar-2012 |
Chandler Carruth <chandlerc@gmail.com> |
Start removing the use of an ad-hoc 'never inline' set and instead directly query the function information which this set was representing. This simplifies the interface of the inline cost analysis, and makes the always-inline pass significantly more efficient. Previously, always-inline would first make a single set of every function in the module *except* those marked with the always-inline attribute. It would then query this set at every call site to see if the function was a member of the set, and if so, refuse to inline it. This is quite wasteful. Instead, simply check the function attribute directly when looking at the callsite. The normal inliner also had similar redundancy. It added every function in the module with the noinline attribute to its set to ignore, even though inside the cost analysis function we *already tested* the noinline attribute and produced the same result. The only tricky part of removing this is that we have to be able to correctly remove only the functions inlined by the always-inline pass when finalizing, which requires a bit of a hack. Still, much less of a hack than the set of all non-always-inline functions was. While I was touching this function, I switched a heavy-weight set to a vector with sort+unique. The algorithm already had a two-phase insert and removal pattern, we were just needlessly paying the uniquing cost on every insert. This probably speeds up some compiles by a small amount (-O0 compiles with lots of always-inline, so potentially heavy libc++ users), but I've not tried to measure it. I believe there is no functional change here, but yell if you spot one. None are intended. Finally, the direction this is going in is to greatly simplify the inline cost query interface so that we can replace its implementation with a much more clever one. Along the way, all the APIs get simplified, so it seems incrementally good. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
fa086f1f00a8b75ab2e2208bd7a028e62f9854db |
|
25-Feb-2012 |
Chad Rosier <mcrosier@apple.com> |
Add support for disabling llvm.lifetime intrinsics in the AlwaysInliner. These are optimization hints, but at -O0 we're not optimizing. This becomes a problem when the alwaysinline attribute is abused. rdar://10921594 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151429 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
90c579de5a383cee278acc3f7e7b9d0a656e6a35 |
|
06-Aug-2010 |
Owen Anderson <resistor@mac.com> |
Reapply r110396, with fixes to appease the Linux buildbot gods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
1f74590e9d1b9cf0f1f81a156efea73f76546e05 |
|
06-Aug-2010 |
Owen Anderson <resistor@mac.com> |
Revert r110396 to fix buildbots. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
9ccaf53ada99c63737547c0235baeb8454b04e80 |
|
06-Aug-2010 |
Owen Anderson <resistor@mac.com> |
Don't use PassInfo* as a type identifier for passes. Instead, use the address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
2decb22222cac46bb1d9163e7b89d7e5be8ef65f |
|
17-Apr-2010 |
Chris Lattner <sabre@nondot.org> |
introduce a new CallGraphSCC class, and pass it around to CallGraphSCCPass's instead of passing around a std::vector<CallGraphNode*>. No functionality change, but now we have a much tidier interface. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
f7477470d37ee2ab9075eaee4745fa084d424ab8 |
|
10-Mar-2010 |
Jakob Stoklund Olesen <stoklund@2pi.dk> |
Try to keep the cached inliner costs around for a bit longer for big functions. 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98099 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
b5a158bab81b0b3f15d409fc433e706f8e885375 |
|
09-Mar-2010 |
Jakob Stoklund Olesen <stoklund@2pi.dk> |
Revert r98089, it was breaking a clang test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98094 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
9e5d87d568498db251de19cd3c26d02cc74bb2e1 |
|
09-Mar-2010 |
Jakob Stoklund Olesen <stoklund@2pi.dk> |
Try to keep the cached inliner costs around for a bit longer for big functions. 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
570a4a5d9ca31f276a67502d1e0533d59d331fea |
|
06-Feb-2010 |
Jakob Stoklund Olesen <stoklund@2pi.dk> |
Reintroduce the InlineHint function attribute. 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95466 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
f8526cb711ec96cd2d5aff30da57f65ae8e5b7b8 |
|
20-Jan-2010 |
Jakob Stoklund Olesen <stoklund@2pi.dk> |
Move per-function inline threshold calculation to a method. No functional change except the forgotten test for InlineLimit.getNumOccurrences() == 0 in the CurrentThreshold2 calculation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94007 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
5095e3d1d1caef8d573534d369e37277c623064c |
|
31-Aug-2009 |
Chris Lattner <sabre@nondot.org> |
Fix some nasty callgraph dangling pointer problems in 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
199ba42cbf56b2fc9c708edb4f08f97dd99ddd49 |
|
27-Aug-2009 |
Chris Lattner <sabre@nondot.org> |
Implement a new optimization in the inliner: if inlining multiple 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80215 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
12f0babca4459c253675700e1d707652d5b6ba17 |
|
27-Aug-2009 |
Chris Lattner <sabre@nondot.org> |
reduce header #include'age git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
02a436c48ecff9e34d50ce0a2f861e5acdd9bf3f |
|
24-Jul-2009 |
Dan Gohman <gohman@apple.com> |
Convert several more passes to use getAnalysisIfAvailable<TargetData>() instead of getAnalysis<TargetData>(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76982 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
16581bf931c0ccf2f8993397acfa4e1d509a68dc |
|
24-Mar-2009 |
Dale Johannesen <dalej@apple.com> |
Use a SmallPtrSet instead of std::set. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
1f67ce4aa3f65619f54c8a3072539da5b0022841 |
|
19-Mar-2009 |
Dale Johannesen <dalej@apple.com> |
Clear the cached cost when removing a function in 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67311 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
e345566f8eaeeda45e29e3709114a42209a360cc |
|
09-Jan-2009 |
Dale Johannesen <dalej@apple.com> |
Adjustments to last patch based on review. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61969 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
b7c6bf1e073088635951435acedff793add1cefd |
|
05-Nov-2008 |
Devang Patel <dpatel@apple.com> |
Do now allow InlineAlways pass to remove dead functions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58744 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
c5e1ec47c719806fcc882470595960512edc7441 |
|
30-Oct-2008 |
Daniel Dunbar <daniel@zuster.org> |
Add InlineCost class for represent the estimated cost of inlining a 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58450 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
1a99dbfe3b70c83d3f3e4648b5868c04697cd77c |
|
29-Oct-2008 |
Daniel Dunbar <daniel@zuster.org> |
Factor shouldInline method out of Inliner. - No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58355 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
ae73dc1448d25b02cabc7c64c86c64371453dda8 |
|
04-Sep-2008 |
Dan Gohman <gohman@apple.com> |
Tidy up several unbeseeming casts from pointer to intptr_t. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
652f7ea955bb433d6b7a4d33685dca9485fd7b8b |
|
31-May-2008 |
Evan Cheng <evan.cheng@apple.com> |
Revert 51775. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51795 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
babf11f249c7c6399c66f2567d4e7efa9c37a9c3 |
|
30-May-2008 |
Evan Cheng <evan.cheng@apple.com> |
Patches for building llvm on Solaris x86. Contributed by Nathan Keynes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51775 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
8d84d5b62cdf2a772d51338136c7022a6e1ff931 |
|
24-Mar-2008 |
Evan Cheng <evan.cheng@apple.com> |
Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it). Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
120d053e3ba810b44047fbcb719824bed5673ca9 |
|
12-Jan-2008 |
Chris Lattner <sabre@nondot.org> |
Allow clients to specify the inline threshold when creating the inliner pass. Patch by Robert Zeh. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
7ed47a13356daed2a34cd2209a31f92552e3bdd8 |
|
29-Dec-2007 |
Chris Lattner <sabre@nondot.org> |
Don't attribute in file headers anymore. See llvmdev for the discussion of this change. Boy are my fingers tired. ;-) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45411 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
c2bbfc18e9adbbdcf5b3375d8d25e2452f7df7f1 |
|
01-Aug-2007 |
Dan Gohman <gohman@apple.com> |
More explicit keywords. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|
9933e4bd7dc07943f62a9ae17dddb815c4901972 |
|
20-Jun-2007 |
Tanya Lattner <tonic@nondot.org> |
Move inliner pass header file. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Transforms/IPO/InlinerPass.h
|