[SROA] Prefix names using a custom IRBuilder inserter.
authorChandler Carruth <chandlerc@gmail.com>
Thu, 21 Mar 2013 09:52:18 +0000 (09:52 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 21 Mar 2013 09:52:18 +0000 (09:52 +0000)
commit34f0c7fcafad61d2292aa6d95e6efdb141447fdf
tree65b836698492b692056991bcdb318e78a049004c
parenta9a962cad836c564773c0c98ac53e7724e44b730
[SROA] Prefix names using a custom IRBuilder inserter.

The key part of this is ensuring that name prefixes remain in a Twine
form until we get to a point where we can nuke them under NDEBUG. This
is tricky using the old APIs as they played fast and loose with Twine,
which is prone to serious error. The inserter is much cleaner as it is
actually in the call stack leading to the setName call, and so has
a good opportunity to prepend the prefix.

This matters more than you might imagine because most runs over an
alloca find a single partition, and rewrite 3 or 4 instructions
referring to it. As a consequence doing this lazily and exclusively with
Twine allows the optimizer to delete more of it and shaves another 2% to
3% off of the release build's SROA run time for PR15412. I also think
the APIs are cleaner, and the use of Twine is more reliable, so
I consider it a win-win despite the churn required to reach this state.

llvm-svn: 177631
llvm/lib/Transforms/Scalar/SROA.cpp