History log of /external/llvm/include/llvm/Analysis/InlineCost.h
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
36b56886974eae4f9c5ebc96befd3e7bfe5de338 24-Apr-2014 Stephen Hines <srhines@google.com> Update to LLVM 3.5a.

Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
/external/llvm/include/llvm/Analysis/InlineCost.h
326ae27c4f744cc7fb43f5a413d042d54fc1ddc0 07-Jun-2013 Jakub Staszak <kubastaszak@gmail.com> Remove unneeded #include.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183460 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
453f4f01302f00651aae2fc7658f6e23a2beadb0 15-May-2013 David Blaikie <dblaikie@gmail.com> Use only explicit bool conversion operators

BitVector/SmallBitVector::reference::operator bool remain implicit since
they model more exactly a bool, rather than something else that can be
boolean tested.

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

One behavior change (YAMLParser) was made, though no test case is
included as I'm not sure how to reach that code path. Essentially any
comparison of llvm::yaml::document_iterators would be invalid if neither
iterator was at the end.

This helped uncover a couple of bugs in Clang - test cases provided for
those in a separate commit along with similar changes to `operator bool`
instances in Clang.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
8d6c0f4deeb0f2ff671df7ae92b75ee1e39acd37 21-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Now that the inline cost analysis is a pass, we can easily have it
depend on and use other analyses (as long as they're either immutable
passes or CGSCC passes of course -- nothing in the pass manager has been
fixed here). Leverage this to thread TargetTransformInfo down through
the inline cost analysis.

No functionality changed here, this just threads things through.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173031 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
86953b5795007eaa98838297360a6987e33e92e7 21-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Make the inline cost a proper analysis pass. This remains essentially
a dynamic analysis done on each call to the routine. However, now it can
use the standard pass infrastructure to reference other analyses,
instead of a silly setter method. This will become more interesting as
I teach it about more analysis passes.

This updates the two inliner passes to use the inline cost analysis.
Doing so highlights how utterly redundant these two passes are. Either
we should find a cheaper way to do always inlining, or we should merge
the two and just fiddle with the thresholds to get the desired behavior.
I'm leaning increasingly toward the latter as it would also remove the
Inliner sub-class split.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173030 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
78e1cdaba3cad6e85ff631542052bbb718c7e588 21-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Fix an old-style doxygen comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173027 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
4ef13242ab7473de62c2c4d77de3c69d362bd9ef 21-Jan-2013 Chandler Carruth <chandlerc@gmail.com> Cleanup the formatting of this header. This removes the namespace indent
and reformats a few constructors using clang-format. Only whitespace
changes here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173018 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
48fdf9b37926a9c3debd3f0b5814a2a4b6bb5097 10-Jan-2013 Jakub Staszak <kubastaszak@gmail.com> Remove unneeded #includes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172118 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
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/include/llvm/Analysis/InlineCost.h
255f89faee13dc491cb64fbeae3c763e7e2ea4e6 03-Dec-2012 Chandler Carruth <chandlerc@gmail.com> Sort the #include lines for the include/... tree with the script.

AKA: Recompile *ALL* the source code!

This one went much better. No manual edits here. I spot-checked for
silliness and grep-checked for really broken edits and everything seemed
good. It all still compiles. Yell if you see something that looks goofy.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169133 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
28f872f8a1945635f30763805c1418a90c6b345e 19-Nov-2012 Bob Wilson <bob.wilson@apple.com> Clean up handling of always-inline functions in the inliner.

This patch moves the isInlineViable function from the InlineAlways pass into
the InlineCostAnalyzer and then changes the InlineCost computation to use that
simple check for always-inline functions. All the special-case checks for
AlwaysInline in the CallAnalyzer can then go away.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168300 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
593423f7461fbbbf752ff013bf20c19ef95d3435 19-Nov-2012 Bob Wilson <bob.wilson@apple.com> Some comment fixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168299 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
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/include/llvm/Analysis/InlineCost.h
9455a61009d6745558b217a44838f5c6318b0d5c 19-Sep-2012 Benjamin Kramer <benny.kra@googlemail.com> InlineCost: Make TotalAllocaSizeRecursiveCaller unsigned to avoid sign-compare warnings.

It's a size, not a cost.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164219 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
92df026f0da91dc65ef6186e97ff87b1f53e8cd0 19-Sep-2012 Nadav Rotem <nrotem@apple.com> Prevent inlining of callees which allocate lots of memory into a recursive caller.

Example:

void foo() {
... foo(); // I'm recursive!

bar();
}

bar() { int a[1000]; // large stack size }

rdar://10853263



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164207 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
d5003cafd6fc86acaf8e09ef0ca1dc899da8850e 04-May-2012 Chandler Carruth <chandlerc@gmail.com> A pile of long over-due refactorings here. There are some very, *very*
minor behavior changes with this, but nothing I have seen evidence of in
the wild or expect to be meaningful. The real goal is unifying our logic
and simplifying the interfaces. A summary of the changes follows:

- Make 'callIsSmall' actually accept a callsite so it can handle
intrinsics, and simplify callers appropriately.
- Nuke a completely bogus declaration of 'callIsSmall' that was still
lurking in InlineCost.h... No idea how this got missed.
- Teach the 'isInstructionFree' about the various more intelligent
'free' heuristics that got added to the inline cost analysis during
review and testing. This mostly surrounds int->ptr and ptr->int casts.
- Switch most of the interesting parts of the inline cost analysis that
were essentially computing 'is this instruction free?' to use the code
metrics routine instead. This way we won't keep duplicating logic.

All of this is motivated by the desire to allow other passes to compute
a roughly equivalent 'cost' metric for a particular basic block as the
inline cost analysis. Sadly, re-using the same analysis for both is
really messy because only the actual inline cost analysis is ever going
to go to the contortions required for simplification, SROA analysis,
etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156140 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
b381578fcb5fea988f661dbbee9747b8fd55c5fb 06-Apr-2012 David Chisnall <csdavec@swan.ac.uk> Reintroduce InlineCostAnalyzer::getInlineCost() variant with explicit callee
parameter until we have a more sensible API for doing the same thing.

Reviewed by Chandler.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154180 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
caa2c40a57040dc3e1a5e40401cd1e4ede845451 02-Apr-2012 Chandler Carruth <chandlerc@gmail.com> Start cleaning up the InlineCost class. This switches to sentinel values
rather than a bitfield, a great suggestion by Chris during code review.

There is still quite a bit of cruft in the interface, but that requires
sorting out some awkward uses of the cost inside the actual inliner.

No functionality changed intended here.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153853 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
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/Analysis/InlineCost.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/Analysis/InlineCost.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/Analysis/InlineCost.h
220d2d7b50ddbbab1fe5e57fe9f39e72ef430a89 15-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Remove all remnants of partial specialization in the cost computation
side of things. This is all dead code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152759 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
274d377ea68195989c3238fe96ce2ca812a12faf 15-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Extend the inline cost calculation to account for bonuses due to
correlated pairs of pointer arguments at the callsite. This is designed
to recognize the common C++ idiom of begin/end pointer pairs when the
end pointer is a constant offset from the begin pointer. With the
C-based idiom of a pointer and size, the inline cost saw the constant
size calculation, and this provides the same level of information for
begin/end pairs.

In order to propagate this information we have to search for candidate
operations on a pair of pointer function arguments (or derived from
them) which would be simplified if the pointers had a known constant
offset. Then the callsite analysis looks for such pointer pairs in the
argument list, and applies the appropriate bonus.

This helps LLVM detect that half of bounds-checked STL algorithms
(such as hash_combine_range, and some hybrid sort implementations)
disappear when inlined with a constant size input. However, it's not
a complete fix due the inaccuracy of our cost metric for constants in
general. I'm looking into that next.

Benchmarks showed no significant code size change, and very minor
performance changes. However, specific code such as hashing is showing
significantly cleaner inlining decisions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152752 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
6f130bf368ab082ab87bafaee9bf4e1a78acc669 08-Mar-2012 Chandler Carruth <chandlerc@gmail.com> Rotate two of the functions used to count bonuses for the inline cost
analysis to be methods on the cost analysis's function info object
instead of the code metrics object. These really are just users of the
code metrics, they're building the information for the function's
analysis.

This is the first step of growing the amount of information we collect
about a function in order to cope with pair-wise simplifications due to
allocas.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152283 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
066b5d8403483bf3a8bb033b690da318fbc68e79 14-Nov-2011 Benjamin Kramer <benny.kra@googlemail.com> Make headers standalone.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144537 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
b2ab2fa524f3f90376639037bd81924483cca0af 01-Oct-2011 Andrew Trick <atrick@apple.com> Inlining and unrolling heuristics should be aware of free truncs.

We want heuristics to be based on accurate data, but more importantly
we don't want llvm to behave randomly. A benign trunc inserted by an
upstream pass should not cause a wild swings in optimization
level. See PR11034. It's a general problem with threshold-based
heuristics, but we can make it less bad.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140919 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
7a2bdde0a0eebcd2125055e0eacaca040f0b766c 15-Apr-2011 Chris Lattner <sabre@nondot.org> Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
4e8af6db184118638c21f713ad98e3292c6891c9 05-Feb-2011 Eric Christopher <echristo@apple.com> Rewrite how the indirect call bonus is handled. This now works by:

a) Making it a per call site bonus for functions that we can move from
indirect to direct calls.
b) Reduces the bonus from 500 to 100 per call site.
c) Subtracts the size of the possible newly inlineable call from the
bonus to only add a bonus if we can inline a small function to devirtualize
it.

Also changes the bonus from a positive that's subtracted to a negative
that's added.

Fixes the remainder of rdar://8546196 by reducing the object file size
after inlining by 84%.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124916 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
8e2da0ce9d70606e10889d17f481842586132d88 01-Feb-2011 Eric Christopher <echristo@apple.com> Reapply 124275 since the Dragonegg failure was unreproducible.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124641 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
eabde0cf0798e36934ffd03b071f2bd490ac1f11 26-Jan-2011 Eric Christopher <echristo@apple.com> Temporarily revert 124275 to see if it brings the dragonegg buildbot back.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124312 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
5d83955b8c2bdca28d0a0c62a9d0f9bbd5a6d668 26-Jan-2011 Eric Christopher <echristo@apple.com> Separate out the constant bonus from the size reduction metrics. Rework
a few loops accordingly. Should be no functional change.

This is a step for more accurate cost/benefit analysis of devirt/inlining
bonuses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124275 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
0f13bc8c23f93b5c84a71d60a8dff0142a769224 24-Jan-2011 Eric Christopher <echristo@apple.com> Perhaps a bit too much vertical whitespace.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124148 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
74fa7327d690e6ceda6ce77e4e5b8ef75cb12538 10-Oct-2010 Kenneth Uildriks <kennethuil@gmail.com> Now using a variant of the existing inlining heuristics to decide whether to create a given specialization of a function in PartialSpecialization. If the total performance bonus across all callsites passing the same constant exceeds the specialization cost, we create the specialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116158 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
ca52c8ba12285c0e86f1b6d3b354342c59e2a416 08-Oct-2010 Kenneth Uildriks <kennethuil@gmail.com> Start separating out code metrics into code size metrics and code performance metrics. Partial Specialization will apply the former to function specializations, and the latter to all callsites that can use a specialization, in order to decide whether to create a specialization

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116057 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
082bf2a977b6bb91d61ac5155e1906ecc6ba47bf 09-Sep-2010 Owen Anderson <resistor@mac.com> Refactor code-size reduction estimation methods out of InlineCostAnalyzer and into CodeMetrics. They
don't use any InlineCostAnalyzer state, and are useful for other clients who don't necessarily want to use
all of InlineCostAnalyzer's logic, some of which is fairly inlining-specific.

No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
42c7d23c6d56e0743169d94025264eaf17eb799d 09-Jun-2010 Kenneth Uildriks <kennethuil@gmail.com> Pulled CodeMetrics out of InlineCost.h and made it a bit more general, so it can be reused from PartialSpecializationCost

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105725 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
9a1581b9102511282ee823ab9a29819bc060e6a5 12-May-2010 Nick Lewycky <nicholas@mxc.ca> Clear CachedFunctionInfo upon Pass::releaseMemory. Because ValueMap will abort
on RAUW of functions, this is a correctness issue instead of a mere memory
usage problem.


No testcase until the new MergeFunctions can land.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103653 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
752e2590585227f6f10e80978f587915d9adb2ad 01-May-2010 David Chisnall <csdavec@swan.ac.uk> Added a variant of InlineCostAnalyzer::getInlineCost() that takes the called function as an explicit argument, for use when inlining function pointers.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102841 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
70745c661de12e3e5b7892776b190f2db703509b 22-Apr-2010 Chris Lattner <sabre@nondot.org> fix file header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@102049 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
b5f6af644ebe504479a74341ae8b0c706e7a5fcc 17-Apr-2010 Dale Johannesen <dalej@apple.com> Add comment (lost when reverting and reapplying 101503).



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101664 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
ab89ff78419cf0dfa6360c7b142b9fb1490866b7 17-Apr-2010 Dale Johannesen <dalej@apple.com> Reapply 101503+101520. These are "obviously correct" [Chris]
and don't cause any problems on Darwin.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101584 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
5b13a1a4c3a90c1dfd4b5c2521b5900ff367b12c 16-Apr-2010 Dan Gohman <gohman@apple.com> Revert 101520, which depended on 101503, which was reverted.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101528 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
f72a53db4453a45aca282bd13c1f2dbe40a08466 16-Apr-2010 Duncan Sands <baldrick@free.fr> Revert commit 101503 (johannes), in the hope of fixing the dragonegg build,
see http://google1.osuosl.org:8011/builders/dragonegg-x86_64-linux/builds/693
Original commit text:
Use a ValueMap not a std::map for the reason indicated
in the comment. This was causing nondeterministic changes
in inlining decisions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
899dd9be7fb91c089ef1ae20ef44b2a286433313 16-Apr-2010 Dan Gohman <gohman@apple.com> Trim a #include.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
d4ed2a8636a1662cbf1e0f077083cf780344263e 16-Apr-2010 Dale Johannesen <dalej@apple.com> Use a ValueMap not a std::map for the reason indicated
in the comment. This was causing nondeterministic changes
in inlining decisions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101503 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
52d55bd224ac08dfef959527ca8257f82a80dbb0 16-Apr-2010 Dan Gohman <gohman@apple.com> Make callIsSmall accessible as a utility function.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101463 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
f96769bed208b8a3f82b53771350dc0a743db85a 13-Mar-2010 Devang Patel <dpatel@apple.com> Remove extra parameter.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98403 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
cbd056074cfcd79265ee1e04e83f347355e9ad61 13-Mar-2010 Devang Patel <dpatel@apple.com> Do not overestimate code size reduction in presense of debug info.
Use CodeMetrics.analyzeBasicBlock() to estimate BB size.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98401 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.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/Analysis/InlineCost.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/Analysis/InlineCost.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/Analysis/InlineCost.h
aa034fa2299e41b73f60d3993f5460260e239fab 06-Feb-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Update CodeMetrics to count 'big' function calls explicitly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95453 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
43cda021d9425f53443b3d56bcf81afe99353ee9 27-Jan-2010 Jakob Stoklund Olesen <stoklund@2pi.dk> Fix inline cost predictions with SCIENCE.

After running a batch of measurements, it is clear that the inliner metrics
need some adjustments:

Own argument bonus: 20 -> 5
Outgoing argument penalty: 0 -> 5
Alloca bonus: 10 -> 5
Constant instr bonus: 7 -> 5
Dead successor bonus: 40 -> 5*(avg instrs/block)

The new cost metrics are generaly 25 points higher than before, so we may need
to move thresholds.

With this change, InlineConstants::CallPenalty becomes a political correction:

if (!isa<IntrinsicInst>(II) && !callIsSmall(CS.getCalledFunction()))
NumInsts += InlineConstants::CallPenalty + CS.arg_size();

The code size is accurately modelled by CS.arg_size(). CallPenalty is added
because calls tend to take a long time, so it may not be worth it to inline a
function with lots of calls.

All of the political corrections are in the InlineConstants namespace:
IndirectCallBonus, CallPenalty, LastCallToStaticBonus, ColdccPenalty,
NoreturnPenalty.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94615 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
68cf03a314f19935d9096ad22dfe7d4fdcbb5c19 14-Oct-2009 Dan Gohman <gohman@apple.com> Fix resetCachedCostInfo to reset all of the cost information, instead of
just the NumBlocks field.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
e7f0ed5aceed27d6f46521ec6e4c139986c5b489 13-Oct-2009 Dan Gohman <gohman@apple.com> Split code not specific to Function inlining out into a separate class,
named CodeMetrics. Move it to be a non-nested class. Rename RegionInfo
back to FunctionInfo.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84013 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/Analysis/InlineCost.h
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/include/llvm/Analysis/InlineCost.h