[LLVMdev] getIntrinsicID() optimization
Chris Lattner
clattner at apple.com
Sat Oct 17 13:53:56 PDT 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?
Hi Nicolas,
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?
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091017/8f406521/attachment.html>
More information about the llvm-dev
mailing list