Hoist the definition of getTypeSizeInBits to be inlinable and in the
authorChandler Carruth <chandlerc@gmail.com>
Thu, 21 Mar 2013 09:52:22 +0000 (09:52 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 21 Mar 2013 09:52:22 +0000 (09:52 +0000)
commitdf973ed626b9ce119c133026bb29809ec0f75059
tree0e556763a8df07a8a40cf82eb08418e699566582
parent34f0c7fcafad61d2292aa6d95e6efdb141447fdf
Hoist the definition of getTypeSizeInBits to be inlinable and in the
header.

This method is called in the hot path for *many* passes, SROA is what
caught my interest. A common pattern is that which branch of the switch
should be taken is known in the callsite and so it is a very good
candidate for inlining and simplification. Moving it into the header
allows the optimizer to fold a lot of boring, repeatitive code in
callers of this routine.

I'm seeing pretty significant speedups in parts of SROA and I suspect
other passes will see similar speedups if they end up working with type
sizes frequently. I've not seen any significant growth of the binaries
as a consequence, but let me know if you see anything suspicious here.

llvm-svn: 177632
llvm/include/llvm/IR/DataLayout.h
llvm/lib/IR/DataLayout.cpp