[LLVMdev] Inefficiency in Intrinsic::getName in Function.cpp?

Chris Lattner clattner at apple.com
Mon Apr 25 15:19:33 PDT 2011

On Apr 25, 2011, at 3:12 PM, Michael Ilseman wrote:

> I was looking over Function.cpp and saw that for every call to
> Intrinsic::getName, the entire intrinsic table (about a thousand
> references to strings) gets copied over for the initialization of
> Table. Is there a reason for why this is done, or would it be better
> for Table to be static, so that this initialization only happens on
> the first call? Perhaps this is optimized away for the release build,
> but for the debug build I'm running it seems to redo the
> initialization on every call.
>  const char * const Table[] = {
>    "not_intrinsic",
> #include "llvm/Intrinsics.gen"
>  };

Nice catch, it was just an oversight.  Fixed in r130160, thanks!


More information about the llvm-dev mailing list