Move the instruction simplification of callsite arguments in the inliner
authorChandler Carruth <chandlerc@gmail.com>
Sun, 25 Mar 2012 04:03:40 +0000 (04:03 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sun, 25 Mar 2012 04:03:40 +0000 (04:03 +0000)
commitd54f9a4c3bcdb247ea4aa311251c19242b03be63
treeb8a2820b65d1697636eb7ea8ac4505ca943aa1cf
parentacdae3e25a03e4e08039cb18f50b7788f71c0b2e
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
lib/Transforms/IPO/Inliner.cpp
lib/Transforms/Utils/CloneFunction.cpp
test/Transforms/Inline/inline_cleanup.ll