Speedup Function::getIntrinsicID() with caching of result

Renato Golin renato.golin at linaro.org
Thu Feb 28 02:16:22 PST 2013


On 28 February 2013 01:16, Jean-Luc Duprat <jduprat at apple.com> wrote:

> The attached patch caches the result of Function::getIntrinsicID() in a
> DenseMap attached to the LLVMContext.  This reduces the time actually spent
> doing string to ID conversion and shows a 10% improvement in compile time
> for a particularly bad case that involves ARM Neon intrinsics (these have
> many overloads).
>

Hi Jean-Luc,

Looks good to me. The constant improvement was expected (O2/O3) and 10% is
a good improvement. I'm not expecting any substantial increase in memory
footprint.

One minor comment:

+  typedef llvm::LLVMContextImpl::IntrinsicIDCacheTy IntrinsicIDCacheTy;
+  IntrinsicIDCacheTy &IntrinsicIDCache =
getContext().pImpl->IntrinsicIDCache;

to

+  LLVMContextImpl::IntrinsicIDCacheTy &IntrinsicIDCache =
getContext().pImpl->IntrinsicIDCache;

Since the typedef is not used anywhere else and it was a bit confusing.

About erasing the old function on rename, I'm assuming this could occur on
vectorization. Did that show up as errors when you tested it?

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130228/db40424c/attachment.html>


More information about the llvm-commits mailing list