History log of /external/llvm/lib/Transforms/IPO/Inliner.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
dce4a407a24b04eebc6a376f8e62b41aaa7b071f 29-May-2014 Stephen Hines <srhines@google.com> Update LLVM for 3.5 rebase (r209712).

Change-Id: I149556c940fb7dc92d075273c87ff584f400941f
/external/llvm/lib/Transforms/IPO/Inliner.cpp
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/lib/Transforms/IPO/Inliner.cpp
86f4f6526b18765cdb78bee593e1354bc9f55085 17-Jul-2013 Hal Finkel <hfinkel@anl.gov> Fix comparisons of alloca alignment in inliner merging

Duncan pointed out a mistake in my fix in r186425 when only one of the allocas
being compared had the target-default alignment. This is essentially his
suggested solution. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186510 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
5a5ebb7f9fa7fa82c0c466a36a90e5c18bb13073 16-Jul-2013 Hal Finkel <hfinkel@anl.gov> When the inliner merges allocas, it must keep the larger alignment

For safety, the inliner cannot decrease the allignment on an alloca when
merging it with another.

I've included two variants of the test case for this: one with DataLayout
available, and one without. When DataLayout is not available, if only one of
the allocas uses the default alignment (getAlignment() == 0), then they cannot
be safely merged.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186425 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
114baee1fa017daefad2339c77b45b9ca3d79a41 23-Jan-2013 Bill Wendling <isanbard@gmail.com> Add the IR attribute 'sspstrong'.

SSPStrong applies a heuristic to insert stack protectors in these situations:

* A Protector is required for functions which contain an array, regardless of
type or length.

* A Protector is required for functions which contain a structure/union which
contains an array, regardless of type or length. Note, there is no limit to
the depth of nesting.

* A protector is required when the address of a local variable (i.e., stack
based variable) is exposed. (E.g., such as through a local whose address is
taken as part of the RHS of an assignment or a local whose address is taken as
part of a function argument.)

This patch implements the SSPString attribute to be equivalent to
SSPRequired. This will change in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173230 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
0b8c9a80f20772c3793201ab5b251d3520b9cea3 02-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Move all of the header files which are involved in modelling the LLVM IR
into their new header subdirectory: include/llvm/IR. This matches the
directory structure of lib, and begins to correct a long standing point
of file layout clutter in LLVM.

There are still more header files to move here, but I wanted to handle
them in separate commits to make tracking what files make sense at each
layer easier.

The only really questionable files here are the target intrinsic
tablegen files. But that's a battle I'd rather not fight today.

I've updated both CMake and Makefile build systems (I think, and my
tests think, but I may have missed something).

I've also re-sorted the includes throughout the project. I'll be
committing updates to Clang, DragonEgg, and Polly momentarily.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
831737d329a727f53a1fb0572f7b7a8127208881 30-Dec-2012 Bill Wendling <isanbard@gmail.com> Remove the Function::getFnAttributes method in favor of using the AttributeSet
directly.

This is in preparation for removing the use of the 'Attribute' class as a
collection of attributes. That will shift to the AttributeSet class instead.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171253 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
7ccc2f7a7859a72ce73e6d8dc4242c6dd7984c45 27-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Make this parameter be named consistently with most other
getAnalysisUsage implementations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171157 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
034b94b17006f51722886b0f2283fb6fb19aca1f 19-Dec-2012 Bill Wendling <isanbard@gmail.com> Rename the 'Attributes' class to 'Attribute'. It's going to represent a single attribute in the future.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170502 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
fcc934322bc6e0b89df8fbcdde59145f5af1179a 13-Dec-2012 Quentin Colombet <qcolombet@apple.com> Take into account minimize size attribute in the inliner.

Better controls the inlining of functions when the caller function has MinSize attribute.
Basically, when the caller function has this attribute, we do not "force" the inlining
of callee functions carrying the InlineHint attribute (i.e., functions defined with
inline keyword)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170065 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d04a8d4b33ff316ca4cf961e06c9e312eff8e64f 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Use the new script to sort the includes of every file under lib.

Sooooo many of these had incorrect or strange main module includes.
I have manually inspected all of these, and fixed the main module
include to be the nearest plausible thing I could find. If you own or
care about any of these source files, I encourage you to take some time
and check that these edits were sensible. I can't have broken anything
(I strictly added headers, and reordered them, never removed), but they
may not be the headers you'd really like to identify as containing the
API being implemented.

Many forward declarations and missing includes were added to a header
files to allow them to parse cleanly when included first. The main
module rule does in fact have its merits. =]

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
f5e6d70f8c8f21e744a10fd463cdeddae31cbab5 10-Oct-2012 Bill Wendling <isanbard@gmail.com> Have 'addFnAttr' take the attribute enum value. Then have it build the attribute object and add it appropriately. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165595 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
6765834754cbb3cb0f15b4b15e98c5e73fa50066 09-Oct-2012 Bill Wendling <isanbard@gmail.com> Create enums for the different attributes.

We use the enums to query whether an Attributes object has that attribute. The
opaque layer is responsible for knowing where that specific attribute is stored.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165488 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
3574eca1b02600bac4e625297f4ecf745f4c4f32 08-Oct-2012 Micah Villmow <villmow@gmail.com> Move TargetData to DataLayout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
2c189061184925c6a8ecbb5a19e648b230a41c0e 26-Sep-2012 Bill Wendling <isanbard@gmail.com> Remove the `hasFnAttr' method from Function.

The hasFnAttr method has been replaced by querying the Attributes explicitly. No
intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
aa8405811ed9ad84e5afb70dac04ebfbae519316 13-Sep-2012 Nadav Rotem <nrotem@apple.com> Fix an 80 char line limit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163808 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
8e0d1c03ca7fd86e6879b4e37d0d7f0e982feef6 29-Aug-2012 Benjamin Kramer <benny.kra@googlemail.com> Make MemoryBuiltins aware of TargetLibraryInfo.

This disables malloc-specific optimization when -fno-builtin (or -ffreestanding)
is specified. This has been a problem for a long time but became more severe
with the recent memory builtin improvements.

Since the memory builtin functions are used everywhere, this required passing
TLI in many places. This means that functions that now have an optional TLI
argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead
mallocs anymore if the TLI argument is missing. I've updated most passes to do
the right thing.

Fixes PR13694 and probably others.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d9b0b025612992a0b724eeca8bdf10b1d7a5c355 02-Jun-2012 Benjamin Kramer <benny.kra@googlemail.com> Fix typos found by http://github.com/lyda/misspell-check

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157885 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
ab767213fdfc219384e26b8073783cb883974dcd 23-May-2012 Patrik Hägglund <patrik.h.hagglund@ericsson.com> Fix the inliner so that the optsize function attribute don't alter the
inline threshold if the global inline threshold is lower (as for -Oz).

Reviewed by Chandler Carruth and Bill Wendling.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157323 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d6fc26217e194372cabe4ef9e2514beac511a943 11-Apr-2012 Chandler Carruth <chandlerc@gmail.com> Add two statistics to help track how we are computing the inline cost.

Yea, 'NumCallerCallersAnalyzed' isn't a great name, suggestions welcome.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154492 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
dafe48e230916ce0de4228d81dece732159994f1 01-Apr-2012 Chandler Carruth <chandlerc@gmail.com> Belatedly address some code review from Chris.

As a side note, I really dislike array_pod_sort... Do we really still
care about any STL implementations that get this so wrong? Does libc++?

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153834 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
dacffb6679ff99fec4cc9c54f4257d2913870d01 27-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Make a seemingly tiny change to the inliner and fix the generated code
size bloat. Unfortunately, I expect this to disable the majority of the
benefit from r152737. I'm hopeful at least that it will fix PR12345. To
explain this requires... quite a bit of backstory I'm afraid.

TL;DR: The change in r152737 actually did The Wrong Thing for
linkonce-odr functions. This change makes it do the right thing. The
benefits we saw were simple luck, not any actual strategy. Benchmark
numbers after a mini-blog-post so that I've written down my thoughts on
why all of this works and doesn't work...

To understand what's going on here, you have to understand how the
"bottom-up" inliner actually works. There are two fundamental modes to
the inliner:

1) Standard fixed-cost bottom-up inlining. This is the mode we usually
think about. It walks from the bottom of the CFG up to the top,
looking at callsites, taking information about the callsite and the
called function and computing th expected cost of inlining into that
callsite. If the cost is under a fixed threshold, it inlines. It's
a touch more complicated than that due to all the bonuses, weights,
etc. Inlining the last callsite to an internal function gets higher
weighth, etc. But essentially, this is the mode of operation.

2) Deferred bottom-up inlining (a term I just made up). This is the
interesting mode for this patch an r152737. Initially, this works
just like mode #1, but once we have the cost of inlining into the
callsite, we don't just compare it with a fixed threshold. First, we
check something else. Let's give some names to the entities at this
point, or we'll end up hopelessly confused. We're considering
inlining a function 'A' into its callsite within a function 'B'. We
want to check whether 'B' has any callers, and whether it might be
inlined into those callers. If so, we also check whether inlining 'A'
into 'B' would block any of the opportunities for inlining 'B' into
its callers. We take the sum of the costs of inlining 'B' into its
callers where that inlining would be blocked by inlining 'A' into
'B', and if that cost is less than the cost of inlining 'A' into 'B',
then we skip inlining 'A' into 'B'.

Now, in order for #2 to make sense, we have to have some confidence that
we will actually have the opportunity to inline 'B' into its callers
when cheaper, *and* that we'll be able to revisit the decision and
inline 'A' into 'B' if that ever becomes the correct tradeoff. This
often isn't true for external functions -- we can see very few of their
callers, and we won't be able to re-consider inlining 'A' into 'B' if
'B' is external when we finally see more callers of 'B'. There are two
cases where we believe this to be true for C/C++ code: functions local
to a translation unit, and functions with an inline definition in every
translation unit which uses them. These are represented as internal
linkage and linkonce-odr (resp.) in LLVM. I enabled this logic for
linkonce-odr in r152737.

Unfortunately, when I did that, I also introduced a subtle bug. There
was an implicit assumption that the last caller of the function within
the TU was the last caller of the function in the program. We want to
bonus the last caller of the function in the program by a huge amount
for inlining because inlining that callsite has very little cost.
Unfortunately, the last caller in the TU of a linkonce-odr function is
*not* the last caller in the program, and so we don't want to apply this
bonus. If we do, we can apply it to one callsite *per-TU*. Because of
the way deferred inlining works, when it sees this bonus applied to one
callsite in the TU for 'B', it decides that inlining 'B' is of the
*utmost* importance just so we can get that final bonus. It then
proceeds to essentially force deferred inlining regardless of the actual
cost tradeoff.

The result? PR12345: code bloat, code bloat, code bloat. Another result
is getting *damn* lucky on a few benchmarks, and the over-inlining
exposing critically important optimizations. I would very much like
a list of benchmarks that regress after this change goes in, with
bitcode before and after. This will help me greatly understand what
opportunities the current cost analysis is missing.

Initial benchmark numbers look very good. WebKit files that exhibited
the worst of PR12345 went from growing to shrinking compared to Clang
with r152737 reverted.

- Bootstrapped Clang is 3% smaller with this change.
- Bootstrapped Clang -O0 over a single-source-file of lib/Lex is 4%
faster with this change.

Please let me know about any other performance impact you see. Thanks to
Nico for reporting and urging me to actually fix, Richard Smith, Duncan
Sands, Manuel Klimek, and Benjamin Kramer for talking through the issues
today.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153506 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d54f9a4c3bcdb247ea4aa311251c19242b03be63 25-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Move the instruction simplification of callsite arguments in the inliner
to instead rely on much more generic and powerful instruction
simplification in the function cloner (and thus inliner).

This teaches the pruning function cloner to use instsimplify rather than
just the constant folder to fold values during cloning. This can
simplify a large number of things that constant folding alone cannot
begin to touch. For example, it will realize that 'or' and 'and'
instructions with certain constant operands actually become constants
regardless of what their other operand is. It also can thread back
through the caller to perform simplifications that are only possible by
looking up a few levels. In particular, GEPs and pointer testing tend to
fold much more heavily with this change.

This should (in some cases) have a positive impact on compile times with
optimizations on because the inliner itself will simply avoid cloning
a great deal of code. It already attempted to prune proven-dead code,
but now it will be use the stronger simplifications to prove more code
dead.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
b16117c368ad4e6d004ac912549b2c6ed06731a5 14-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Change where we enable the heuristic that delays inlining into functions
which are small enough to themselves be inlined. Delaying in this manner
can be harmful if the function is inelligible for inlining in some (or
many) contexts as it pessimizes the code of the function itself in the
event that inlining does not eventually happen.

Previously the check was written to only do this delaying of inlining
for static functions in the hope that they could be entirely deleted and
in the knowledge that all callers of static functions will have the
opportunity to inline if it is in fact profitable. However, with C++ we
get two other important sources of functions where the definition is
always available for inlining: inline functions and templated functions.
This patch generalizes the inliner to allow linkonce-ODR (the linkage
such C++ routines receive) to also qualify for this delay-based
inlining.

Benchmarking across a range of large real-world applications shows
roughly 2% size increase across the board, but an average speedup of
about 0.5%. Some benhcmarks improved over 2%, and the 'clang' binary
itself (when bootstrapped with this feature) shows a 1% -O0 performance
improvement when run over all Sema, Lex, and Parse source code smashed
into a single file. A clean re-build of Clang+LLVM with a bootstrapped
Clang shows approximately 2% improvement, but that measurement is often
noisy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152737 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
6c0b3ac8ea51d35bbd2565f17f1a73c3bfcb5cdf 12-Mar-2012 Chandler Carruth <chandlerc@gmail.com> When inlining a function and adding its inner call sites to the
candidate set for subsequent inlining, try to simplify the arguments to
the inner call site now that inlining has been performed.

The goal here is to propagate and fold constants through deeply nested
call chains. Without doing this, we loose the inliner bonus that should
be applied because the arguments don't match the exact pattern the cost
estimator uses.

Reviewed on IRC by Benjamin Kramer.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152556 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
c66330504c3f433430a28cd7f7f981e555c51bce 20-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Refactor code from inlining and globalopt that checks whether a function definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142572 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
db125cfaf57cc83e7dd7453de2d509bc8efd0e5e 18-Jul-2011 Chris Lattner <sabre@nondot.org> land David Blaikie's patch to de-constify Type, with a few tweaks.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
ddcdcc88631c6bd4ad43d9198b98bc9a829be036 23-Apr-2011 Jay Foad <jay.foad@gmail.com> Remove unused STL header includes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130068 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
c84e3c0c03a0dab7aea7047e7b8e38051542f7e4 04-Jan-2011 Dale Johannesen <dalej@apple.com> Improve the accuracy of the inlining heuristic looking for the
case where a static caller is itself inlined everywhere else, and
thus may go away if it doesn't get too big due to inlining other
things into it. If there are references to the caller other than
calls, it will not be removed; account for this.
This results in same-day completion of the case in PR8853.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122821 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
6c3ee0f3c9684e588c8852d90c891d6354175c9e 06-Dec-2010 Chris Lattner <sabre@nondot.org> Fix PR8735, a really terrible problem in the inliner's "alloca merging"
optimization.

Consider:
static void foo() {
A = alloca
...
}

static void bar() {
B = alloca
...
call foo();
}

void main() {
bar()
}

The inliner proceeds bottom up, but lets pretend it decides not to inline foo
into bar. When it gets to main, it inlines bar into main(), and says "hey, I
just inlined an alloca "B" into main, lets remember that. Then it keeps going
and finds that it now contains a call to foo. It decides to inline foo into
main, and says "hey, foo has an alloca A, and I have an alloca B from another
inlined call site, lets reuse it". The problem with this of course, is that
the lifetime of A and B are nested, not disjoint.

Unfortunately I can't create a reasonable testcase for this: the one in the
PR is both huge and extremely sensitive, because you minor tweaks end up
causing foo to get inlined into bar too early. We already have tests for the
basic alloca merging optimization and this does not break them.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120995 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
7d32b8032d7ec2472b994aab2ac3459e8d47c496 06-Dec-2010 Chris Lattner <sabre@nondot.org> improve -debug output and comments a little.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120993 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
930f5efac0f76aa9e3772d9a36757f18b3573112 03-Nov-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Let the -inline-threshold command line argument take precedence over the
threshold given to createFunctionInliningPass().

Both opt -O3 and clang would silently ignore the -inline-threshold option.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118117 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
7d3056b16038a6a09c452c0dfcc3c8f4e421506a 29-Jul-2010 Gabor Greif <ggreif@gmail.com> simplify by using CallSite constructors; virtually eliminates CallSite::get from the tree

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109687 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
f0193ed8decb2e78d8d5ec4a4eaeed8f3036bf6e 13-Jul-2010 Eric Christopher <echristo@apple.com> Grammar.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108252 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
c29df3cac735bc85d16e4ef3186cb50e41bec7bb 31-May-2010 Benjamin Kramer <benny.kra@googlemail.com> Avoid swap when a copy suffices.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105220 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
83f66fe6144c2041f1f7897f7015b0e2e68faad3 01-May-2010 Chris Lattner <sabre@nondot.org> revert r102831. We already delete dead readonly calls in
other places, killing a valid transformation is not the right
answer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102850 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
1b4a38646f6bbeb32a125a1f2316a7b2d27916d7 01-May-2010 Owen Anderson <resistor@mac.com> Disable the call-deletion transformation introduced in r86975. Without
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102831 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
0ca2f28458ae9122f413a4092ddcee33a9dd21c6 01-May-2010 Chris Lattner <sabre@nondot.org> rename InlineInfo.DevirtualizedCalls -> InlinedCalls to
reflect that it includes all inlined calls now, not just
devirtualized ones.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102824 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
159528702aed7222cb30c3e8b55287e4ca8068cf 01-May-2010 Chris Lattner <sabre@nondot.org> The inliner has traditionally not considered call sites
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102822 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d89673c028a5091ffe68bd2e7e818e6e906b8f89 25-Apr-2010 Chris Lattner <sabre@nondot.org> remove #if 1's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102296 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
5d7da4321521850e5e35a77b7af0b168d8121633 23-Apr-2010 Chris Lattner <sabre@nondot.org> enable my inliner change: add newly devirtualized call sites to
the worklist, making them inline candidates.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102213 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
076863225ce070345ff7048f48b3550e00598a10 23-Apr-2010 Chris Lattner <sabre@nondot.org> switch InlineInfo.DevirtualizedCalls's list to be of WeakVH.
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102196 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
62cc838b90d32b41f3025b400845b3e194b53e32 23-Apr-2010 Chris Lattner <sabre@nondot.org> disable my previous inliner patch, it appears to be busting self-host.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
fe9af3b1f7e5d68ecc330bdf4f047d76838f8cc3 23-Apr-2010 Chris Lattner <sabre@nondot.org> The inliner was choosing to not consider call sites
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102146 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
60915146f4d35e12f10dcdaa155596fac79184da 23-Apr-2010 Chris Lattner <sabre@nondot.org> refactor the interface to InlineFunction so that most of the in/out
arguments are handled with a new InlineFunctionInfo class. This
makes it easier to extend InlineFunction to return more info in the
future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
4471136e4db67f5b6cf064cb3b0a7668f15bfe6c 20-Apr-2010 Chris Lattner <sabre@nondot.org> make the inliner do less work for leaf functions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101846 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
2ddbf8208e0ee50cb1aeb24d509b52549a85c211 09-Mar-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Add inlining threshold to log output.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98024 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
f0907fe59093753fe5a9e8fe5adc399dbdc94627 13-Feb-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Enable the inlinehint attribute in the Inliner.

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96066 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
f9c3b228e5579e0d2a9cd05a2191fe17b4c58b23 04-Feb-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Increase inliner thresholds by 25.

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95320 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
c0aa67950ae0f6e9611240d8f0e3ac49dc8195c0 05-Jan-2010 David Greene <greened@obbligato.org> Change errs() to dbgs().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92625 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
4ff4141a9ee9ce705f2a709f3372acaf58d86ea3 12-Nov-2009 Chris Lattner <sabre@nondot.org> use isInstructionTriviallyDead, as pointed out by Duncan


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87035 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
dbab4dc942e0c3286415908762de71a9447f9dfa 12-Nov-2009 Chris Lattner <sabre@nondot.org> implement a nice little efficiency hack in the inliner. Since we're now
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. :)



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86975 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
e4aeec003f82a5263ffb168e175e6fca8b6f681d 13-Oct-2009 Dan Gohman <gohman@apple.com> Move the InlineCost code from Transforms/Utils to Analysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83998 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
bdb984bc2757114bc706026603ed40d7f508c4c1 09-Oct-2009 Dale Johannesen <dalej@apple.com> Use names instead of numbers for some of the magic
constants used in inlining heuristics (especially
those used in more than one file). No functional change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83675 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
e91b9a3b59688023e20cee8441179300b87c844e 09-Oct-2009 Dale Johannesen <dalej@apple.com> When considering whether to inline Callee into Caller,
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83602 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
a0479e53323ade402272ddf8302c8aa2c496c775 04-Oct-2009 Evan Cheng <evan.cheng@apple.com> Allow -inline-threshold override default threshold even if compiling to optimize for size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83274 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d43d5e832f756c9d2c0c8ff4d2f51807a27cab8d 31-Aug-2009 Chris Lattner <sabre@nondot.org> comment and simplify some code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80540 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
b374b90e81d0ce6b5d02041ba4f7b15a945b38d8 31-Aug-2009 Chris Lattner <sabre@nondot.org> Fix PR4834, a tricky case where the inliner would resolve an
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80533 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
cc0a0299d96676e0a51e9b8f5bf617d8025f09a7 28-Aug-2009 Chris Lattner <sabre@nondot.org> finish a half formed thought :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
135755dae4c3fa8003b76150689d5064aa4612ee 27-Aug-2009 Chris Lattner <sabre@nondot.org> reduce inlining factor some stuff out to a static helper function,
and other code cleanups. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80199 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
5fee49eff92c2ae2f70eb84d136c31a706560750 25-Aug-2009 Dale Johannesen <dalej@apple.com> Allow multiple occurrences of -inline-threshold on
the command line. This gives llvm-gcc developers
a way to control inlining (documented as "not intended
for end users").



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79966 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
84a832f9272ed7f1a47c3e019c770b62e373cc6c 31-Jul-2009 Bill Wendling <isanbard@gmail.com> - Convert the rest of the DOUTs to DEBUG+errs().
- One formatting change.

No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
ce63ffb52f249b62cdf2d250c128007b13f27e71 25-Jul-2009 Daniel Dunbar <daniel@zuster.org> More migration to raw_ostream, the water has dried up around the iostream hole.
- 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
ef6ab66bcfdbd87f2e25c720e7e1dca7e36cf269 18-Jul-2009 Eli Friedman <eli.friedman@gmail.com> Add line breaks to make the debug output a bit more readable.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76284 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
f5ff1d335b76170c2c715d5f13e6ed598b2b5677 23-May-2009 Torok Edwin <edwintorok@gmail.com> available_externall linkage is not local, this was confusing the codegenerator,
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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72328 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
bb46f52027416598a662dc1c58f48d9d56b1a65b 15-Jan-2009 Rafael Espindola <rafael.espindola@gmail.com> Add the private linkage.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
cbfdf9644ce38fd3404469c26ac3c8466c940b6e 12-Jan-2009 Dale Johannesen <dalej@apple.com> Enable recursive inlining. Reduce inlining threshold
back to 200; 400 seems to be too high, loses more than
it gains.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62107 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
c3443718540c6662f7502feb76849cf816baaa9f 12-Jan-2009 Dale Johannesen <dalej@apple.com> Increase default inlining aggressiveness in partial
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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62058 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
66c75aaa028683c389c55b377ee2411b61081677 21-Nov-2008 Bill Wendling <isanbard@gmail.com> Fix error where it wasn't getting the correct caller function.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59758 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
8c1604e7d617622cb391f1c679ddf70ea03baedc 21-Nov-2008 Bill Wendling <isanbard@gmail.com> If the function being inlined has a higher stack protection level than the
inlining function, then increase the stack protection level on the inlining
function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59757 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
2c9c3e73682749016d5885b67ff719f634b37d58 27-Sep-2008 Devang Patel <dpatel@apple.com> Implement function notes as function attributes.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56716 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
0598866c052147c31b808391f58434ce3dbfb838 25-Sep-2008 Devang Patel <dpatel@apple.com> Large mechanical patch.

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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
20bcaff6a7f93a9894f7233c449b016bafe93b26 24-Sep-2008 Devang Patel <dpatel@apple.com> Put FN_NOTE_AlwaysInline and others in FnAttr namespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56527 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
dd4924c564c7a661b78b604ebf16dfef7aa62b35 24-Sep-2008 Devang Patel <dpatel@apple.com> Move FN_NOTE_AlwaysInline and other out of ParamAttrs namespace.
Do not check isDeclaration() in hasNote(). It is clients' responsibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d9b4a5f859188cbb168c223071b413e58c53c925 24-Sep-2008 Devang Patel <dpatel@apple.com> Use parameter attribute store (soon to be renamed) for
Function Notes also. Function notes are stored at index ~0.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56511 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
f3ba70861ccf00b1072ae1b6ade3ebe2da6cff40 23-Sep-2008 Devang Patel <dpatel@apple.com> Add hasNote() to check note associated with a function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56477 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
6f0a7687ab9a0509e847279fae27554ce7da0ba1 05-Sep-2008 Duncan Sands <baldrick@free.fr> Use removeAllCalledFunctions rather than removing
edges one by one by hand.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55836 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
7bbb4339f905345f92fcd60bf8f64bdc29c8cc36 04-Sep-2008 Devang Patel <dpatel@apple.com> Update inline threshold for current function if the notes say, optimize for size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55745 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
67243399dd7427c4f530a8c8cc73dfcfd4788f73 03-Sep-2008 Devang Patel <dpatel@apple.com> Handle "always inline" note during inline cost analysis.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55712 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
910c120a7c439ee3c6e9cd249ff0a05f0fdb6c98 03-Sep-2008 Devang Patel <dpatel@apple.com> Handle "noinline" note inside the simple inliner.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55708 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
cb7f483d8c1e0ee48969e13aa3929dd172c97eff 03-Sep-2008 Devang Patel <dpatel@apple.com> s/FP_AlwaysInline/FN_NOTE_AlwaysInline/g


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55676 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
691e52445e2a32d237fc23073fbaf93fb96ce584 03-Sep-2008 Devang Patel <dpatel@apple.com> respect inline=never and inline=always notes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55673 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
844731a7f1909f55935e3514c9e713a62d67662e 13-May-2008 Dan Gohman <gohman@apple.com> Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
4a3f6c88820a204f80ca0fa3f1f2fe09ca10b02f 06-May-2008 Dan Gohman <gohman@apple.com> Make several variable declarations static.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50696 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
7c3becd9d729b976d79b18e6165e74390e613bb5 02-Apr-2008 Evan Cheng <evan.cheng@apple.com> 1. Drop default inline threshold back down to 200.
2. Do not use # of basic blocks as part of the cost computation since it doesn't really figure into function size.
3. More aggressively inline function with vector code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49061 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
b822e70f368b232c32c34d5ae93377aaa824becc 01-Mar-2008 Chris Lattner <sabre@nondot.org> allow specified inline threshold to be negative, as the value is
itself sometimes negative.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47786 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
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/lib/Transforms/IPO/Inliner.cpp
4ee451de366474b9c228b4e5fa573795a715216d 29-Dec-2007 Chris Lattner <sabre@nondot.org> Remove attribution from file headers, per discussion on llvmdev.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
cb406c25973b4e88a6c10ad839ef1beeb3664715 03-Oct-2007 Dan Gohman <gohman@apple.com> Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42585 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
6f7426ec2e46bb19cc9f9e75f1c355b35cf12d7d 20-Jun-2007 Tanya Lattner <tonic@nondot.org> Inliner pass header file was moved.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37665 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
1ce6f8da7283a1f281f1767905873537d66560d5 07-May-2007 Chris Lattner <sabre@nondot.org> Fix PR1395, by passing the ID correctly


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36894 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
1997473cf72957d0e70322e2fe6fe2ab141c58a6 03-May-2007 Devang Patel <dpatel@apple.com> Drop 'const'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
3e15bf33e024b9df9e89351a165acfdb1dde51ed 02-May-2007 Devang Patel <dpatel@apple.com> Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
794fd75c67a2cdc128d67342c6d88a504d186896 01-May-2007 Devang Patel <dpatel@apple.com> Do not use typeinfo to identify pass in pass manager.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
ff2dad312883e5da91fb9f4e3619b7d095867f3b 31-Jan-2007 Chris Lattner <sabre@nondot.org> the inliner pass now passes targetdata down through the inliner api's


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33677 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
5cbf985dcbc89fba3208e7baf8b6f488b06d3ec9 30-Jan-2007 Reid Spencer <rspencer@reidspencer.com> For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
86453c52ba02e743d29c08456e51006500041456 19-Dec-2006 Chris Lattner <sabre@nondot.org> Eliminate static ctors due to Statistic objects


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
ac0b6ae358944ae8b2b5a11dc08f52c3ed89f2da 06-Dec-2006 Chris Lattner <sabre@nondot.org> Detemplatize the Statistic class. The only type it is instantiated with
is 'unsigned'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
0a81aac4b46eed130d20714af5a1c01b05d0275e 26-Nov-2006 Bill Wendling <isanbard@gmail.com> Replace #include <iostream> with llvm_* streams.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31924 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
08ff1480ffcb22e946c7bb6c7d66c5d977ae3d6e 10-Nov-2006 Chris Lattner <sabre@nondot.org> second patch to fix PR992/993.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31610 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
a9d709d51a952a61d8baf413036363adcc90a3e2 10-Nov-2006 Chris Lattner <sabre@nondot.org> Minimal patch to fix PR992/PR993


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31608 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
3ed469ccd7b028a030b550d84b7336d146f5d8fa 02-Nov-2006 Reid Spencer <rspencer@reidspencer.com> For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31380 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d85340f4ec587e22b0239617f3b747a6df113894 12-Jul-2006 Chris Lattner <sabre@nondot.org> Change the callgraph representation to store the callsite along with the
target CG node. This allows the inliner to properly update the callgraph
when using the pruning inliner. The pruning inliner may not copy over all
call sites from a callee to a caller, so the edges corresponding to those
call sites should not be copied over either.

This fixes PR827 and Transforms/Inline/2006-07-12-InlinePruneCGUpdate.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29120 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
2144c2536428f3e4eff4ec8323f00b3b47a80a2e 13-May-2006 Chris Lattner <sabre@nondot.org> Remove some dead variables.

Fix a nasty bug in the memcmp optimizer where we used the wrong variable!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28269 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
dac58ad983c62b49629e1f2969f4e0a621167d63 23-Jan-2006 Chris Lattner <sabre@nondot.org> Make iostream #inclusion explicit


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
432a205769d22e7744dd8b0b45efd687aa6998e3 14-Jan-2006 Chris Lattner <sabre@nondot.org> Let the inliner update the callgraph to reflect the changes it makes, instead
of doing it ourselves. This fixes Transforms/Inline/2006-01-14-CallGraphUpdate.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25321 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
8acb249725e3304aafe91d5357f69722957c51b1 13-Jan-2006 Chris Lattner <sabre@nondot.org> Fix 80 column violations


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@25279 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
fd93908ae8b9684fe71c239e3c6cfe13ff6a2663 22-Apr-2005 Misha Brukman <brukman+llvm@gmail.com> Remove trailing whitespace


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21427 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
0c0aa711b8a0550c21f032125c4663ff45864f81 18-Sep-2004 Chris Lattner <sabre@nondot.org> Fix the inliner to always delete any edges from the external call node to
a function being deleted. Due to optimizations done while inlining, there
can be edges from the external call node to a function node that were not
apparent any longer.

This fixes the compiler crash while compiling 175.vpr


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16399 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
551ccae044b0ff658fe629dd67edd5ffe75d10e8 02-Sep-2004 Reid Spencer <rspencer@reidspencer.com> Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
54970c032815edadb1b2988ea33f5a1173e5b29c 08-Aug-2004 Chris Lattner <sabre@nondot.org> Fix another really nasty regression that Anshu pointed out. In cases where
dangling constant users were removed from a function, causing it to be dead,
we never removed the call graph edge from the external node to the function.

In most cases, this didn't cause a problem (by luck). This should definitely
go into 1.3


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15570 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
47b14a4a6a455c7be169cfd312fcbe796f0ad426 29-Jul-2004 Misha Brukman <brukman+llvm@gmail.com> Fix #includes of i*.h => Instructions.h as per PR403.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
8919cccc3db3290149e9b0f750f883ece3ba2bc7 18-Jul-2004 Chris Lattner <sabre@nondot.org> Fix a performance regression from the CPR patch, simplify code


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14974 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
5827aebe64e442241fd16ef7006433251d060738 18-Jul-2004 Chris Lattner <sabre@nondot.org> Fix a rather serious bug in previous checkin


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14957 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
518310cb0d136906ff0a99d7a24cb460794de5bf 18-Jul-2004 Reid Spencer <rspencer@reidspencer.com> bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14953 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
cf5933a716e7eb6bd5ff49aa62f3e76379ebaf51 20-Jun-2004 Chris Lattner <sabre@nondot.org> Fix the inliner to be deterministic, not letting its output depend on the
relative location of Function objects in memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14260 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
b11a99bd39ec12733527bde330302b435b8d9f1a 24-May-2004 Chris Lattner <sabre@nondot.org> Fix a bug in my previous checkin


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13717 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
befa499d45ffcc32bd9902518aec18589464e47c 23-May-2004 Chris Lattner <sabre@nondot.org> Fix cases where we missed inlining some more obvious candidates because the
caller was in an SCC.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13693 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
3e1358a9fa1ebd3f51c94eb69da55d693895fe7c 21-Apr-2004 Chris Lattner <sabre@nondot.org> Fix an incredibly nasty iterator invalidation problem. I am too spoiled by ilists :)
Eventually it would be nice if CallGraph maintained an ilist of CallGraphNode's instead
of a vector of pointers to them, but today is not that day.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13100 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
107fb18d8968064667b187c3f65ff0558ee130e1 21-Apr-2004 Chris Lattner <sabre@nondot.org> Fix typeo


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13089 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
68d57e7ae80044401efd889270a12c71b3efb9ab 21-Apr-2004 Chris Lattner <sabre@nondot.org> REALLY fix PR324: don't delete linkonce functions until after the SCC traversal
is done, which avoids invalidating iterators in the SCC traversal routines


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13088 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
5ad2b1d54424f39390250d2ff11cc29312926efc 20-Apr-2004 Chris Lattner <sabre@nondot.org> Fix PR324 and testcase: Inline/2004-04-20-InlineLinkOnce.llx


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13080 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
ce1a3a292d7696c973efe27809384d33a530dd65 12-Apr-2004 Chris Lattner <sabre@nondot.org> Actually update the call graph as the inliner changes it. This allows us to
execute other CallGraphSCCPasses after the inliner without crashing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12861 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
85eb157d966c6015262ec0d7f0353c7f416dee7b 12-Apr-2004 Chris Lattner <sabre@nondot.org> Stop printing Function*


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12857 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
775cbdd51a3b33dd5eb343689f65ab5cc8ac7118 08-Apr-2004 Chris Lattner <sabre@nondot.org> Remove the "really gross hacks" that are there to deal with recursive functions.
Now we collect all of the call sites we are interested in inlining, then inline
them. This entirely avoids issues with trying to inline a call site we got by
inlining another call site. This also eliminates iterator invalidation issues.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12770 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
a51bcb50b0c74adc741361824ef81dbefb715c53 21-Nov-2003 Chris Lattner <sabre@nondot.org> Finegrainify namespacification
Print out the costs for functions that AREN'T inlined as well


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10135 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d0fde30ce850b78371fd1386338350591f9ff494 11-Nov-2003 Brian Gaeke <gaeke@uiuc.edu> Put all LLVM code into the llvm namespace, as per bug 109.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
d77922f1a2ed9290544ded8a50d52fd24065556f 09-Nov-2003 Chris Lattner <sabre@nondot.org> Do NOT inline self recursive calls into other functions. This is causing the
pool allocator no end of trouble, and doesn't make a lot of sense anyway. This
does not solve the problem with mutually recursive functions, but they are much less common.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9828 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
bb9ae1512e1179681c1774f2f1a9d8c042941a56 31-Oct-2003 Chris Lattner <sabre@nondot.org> Strip off CPR's manually, because if we don't, the inliner doesn't delete dead
functions. GRR


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
b576c94c15af9a440f69d9d03c2afead7971118c 20-Oct-2003 John Criswell <criswell@uiuc.edu> Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9298 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp
237ef567f6764f24a47c63121cc0a599ddc8f56d 31-Aug-2003 Chris Lattner <sabre@nondot.org> Heavily refactor code:
* Separate the policy decisions into a derived class [InlineSimple]
* Move the inlining mechanics into a base class [Inliner]
* Change the inliner to be an SCCPass, making it more structured and
eventually pipelinable with other SCC passes


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8257 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/Transforms/IPO/Inliner.cpp