Michael Ilseman
2011-Apr-25 22:12 UTC
[LLVMdev] Inefficiency in Intrinsic::getName in Function.cpp?
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", #define GET_INTRINSIC_NAME_TABLE #include "llvm/Intrinsics.gen" #undef GET_INTRINSIC_NAME_TABLE };
Chris Lattner
2011-Apr-25 22:19 UTC
[LLVMdev] Inefficiency in Intrinsic::getName in Function.cpp?
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", > #define GET_INTRINSIC_NAME_TABLE > #include "llvm/Intrinsics.gen" > #undef GET_INTRINSIC_NAME_TABLE > };Nice catch, it was just an oversight. Fixed in r130160, thanks! -Chris
Reasonably Related Threads
- [LLVMdev] [POTENTIAL API CHANGE] Improving llvm::Value getName()/setName()
- [LLVMdev] Function::getName in CallGraphSCCPass causes bus error
- [PATCH AUTOSEL 5.5 30/67] vhost: Check docket sk_family instead of call getname
- [PATCH AUTOSEL 5.4 26/58] vhost: Check docket sk_family instead of call getname
- [PATCH AUTOSEL 4.19 12/31] vhost: Check docket sk_family instead of call getname