[LLVMdev] getIntrinsicID() optimization
clattner at apple.com
Sat Oct 17 15:53:56 CDT 2009
On Oct 16, 2009, at 5:50 AM, Nicolas Capens wrote:
> Hi all,
> While profiling I discovered that the Function::getIntrinsicID()
> method is called a lot, and every time it uses string comparison to
> recompute the ID number. As far as I know the name of an intrinsic
> function doesn’t change, so the ID could be determined just once at
> Function construction time.
> I’ve attached a patch that does this and it appears to work for the
> code I tested it with. Could anyone look at potential caveats and if
> there are none commit it?
Sorry for the delay. I don't think that this is the right way to go.
Making Function larger is an extremely expensive thing to do. There
are use cases in LLVM where apps load large modules lazily and stream
in functions on demand. The way this works currently is that the
function objects are created eagerly, but their bodies are lazy.
Increasing hte size of function can substantially penalize these cases.
Also, as Jeffrey points out, it is not safe with setName().
However, this would be a great thing to have. Instead of adding a new
field, is there space in the "SubClassData" field in Value?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the LLVMdev