<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm/lib/Transforms/IPO, branch release_31</title>
<subtitle>http://llvm.org</subtitle>
<id>https://git.amat.us/llvm/atom/lib/Transforms/IPO?h=release_31</id>
<link rel='self' href='https://git.amat.us/llvm/atom/lib/Transforms/IPO?h=release_31'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/'/>
<updated>2012-04-16T04:23:52Z</updated>
<entry>
<title>Add a Fixme.</title>
<updated>2012-04-16T04:23:52Z</updated>
<author>
<name>Bill Wendling</name>
<email>isanbard@gmail.com</email>
</author>
<published>2012-04-16T04:23:52Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=ab3a9193b12059bebb380ec90fe9a373542bc920'/>
<id>urn:sha1:ab3a9193b12059bebb380ec90fe9a373542bc920</id>
<content type='text'>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154793 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>By default, use Early-CSE instead of GVN for vectorization cleanup.</title>
<updated>2012-04-13T17:15:33Z</updated>
<author>
<name>Hal Finkel</name>
<email>hfinkel@anl.gov</email>
</author>
<published>2012-04-13T17:15:33Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=064551e94c9763c7e74121b88f9cbccc0969946a'/>
<id>urn:sha1:064551e94c9763c7e74121b88f9cbccc0969946a</id>
<content type='text'>
As has been suggested by Duncan and others, Early-CSE and GVN should
do similar redundancy elimination, but Early-CSE is much less expensive.
Most of my autovectorization benchmarks show a performance regresion, but
all of these are &lt; 0.1%, and so I think that it is still worth using
the less expensive pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154673 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Code-gen may inject code into the IR before it emits the ASM. The linker</title>
<updated>2012-04-13T01:06:27Z</updated>
<author>
<name>Bill Wendling</name>
<email>isanbard@gmail.com</email>
</author>
<published>2012-04-13T01:06:27Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=aab3c0cb077f741af3447cc030c28bedd23b491c'/>
<id>urn:sha1:aab3c0cb077f741af3447cc030c28bedd23b491c</id>
<content type='text'>
obviously cannot know that this code is present, let alone used. So prevent the
internalize pass from internalizing those global values which code-gen may
insert.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154645 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Add two statistics to help track how we are computing the inline cost.</title>
<updated>2012-04-11T10:15:10Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-04-11T10:15:10Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=d6fc26217e194372cabe4ef9e2514beac511a943'/>
<id>urn:sha1:d6fc26217e194372cabe4ef9e2514beac511a943</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>Add an option to turn off the expensive GVN load PRE part of GVN.</title>
<updated>2012-04-02T22:16:50Z</updated>
<author>
<name>Bill Wendling</name>
<email>isanbard@gmail.com</email>
</author>
<published>2012-04-02T22:16:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=3197b4453d214aa96de3a42da8f8fe189fff2077'/>
<id>urn:sha1:3197b4453d214aa96de3a42da8f8fe189fff2077</id>
<content type='text'>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153902 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Belatedly address some code review from Chris.</title>
<updated>2012-04-01T10:41:24Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-04-01T10:41:24Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=dafe48e230916ce0de4228d81dece732159994f1'/>
<id>urn:sha1:dafe48e230916ce0de4228d81dece732159994f1</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>Fix a pretty scary bug I introduced into the always inliner with</title>
<updated>2012-04-01T10:21:05Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-04-01T10:21:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=6052eef8bd701b30a0ab5749296671ca34389c39'/>
<id>urn:sha1:6052eef8bd701b30a0ab5749296671ca34389c39</id>
<content type='text'>
a single missing character. Somehow, this had gone untested. I've added
tests for returns-twice logic specifically with the always-inliner that
would have caught this, and fixed the bug.

Thanks to Matt for the careful review and spotting this!!! =D

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153832 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Give the always-inliner its own custom filter. It shouldn't have to pay</title>
<updated>2012-03-31T13:17:18Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-03-31T13:17:18Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=b594a84df501385e4d90bd9531084be62cef0857'/>
<id>urn:sha1:b594a84df501385e4d90bd9531084be62cef0857</id>
<content type='text'>
the very high overhead of the complex inline cost analysis when all it
wants to do is detect three patterns which must not be inlined. Comment
the code, clean it up, and leave some hints about possible performance
improvements if this ever shows up on a profile.

Moving this off of the (now more expensive) inline cost analysis is
particularly important because we have to run this inliner even at -O0.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153814 91177308-0d34-0410-b5e6-96231b3b80d8
</content>
</entry>
<entry>
<title>Remove a bunch of empty, dead, and no-op methods from all of these</title>
<updated>2012-03-31T12:48:08Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-03-31T12:48:08Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=45de584b4f82fbfb9cb9c50bc1fc08931b534308'/>
<id>urn:sha1:45de584b4f82fbfb9cb9c50bc1fc08931b534308</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>Initial commit for the rewrite of the inline cost analysis to operate</title>
<updated>2012-03-31T12:42:41Z</updated>
<author>
<name>Chandler Carruth</name>
<email>chandlerc@gmail.com</email>
</author>
<published>2012-03-31T12:42:41Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/llvm/commit/?id=f2286b0152f0b942e82d8e809186e5cc0d247131'/>
<id>urn:sha1:f2286b0152f0b942e82d8e809186e5cc0d247131</id>
<content type='text'>
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
</content>
</entry>
</feed>
