Speedup Function::getIntrinsicID() with caching of result

Duncan Sands baldrick at free.fr
Thu Feb 28 09:01:56 PST 2013


Hi Evan,

On 28/02/13 17:52, Evan Cheng wrote:
>
>
> On Feb 28, 2013, at 2:21 AM, Duncan Sands <baldrick at free.fr> wrote:
>
>> Hi Jean-Luc,
>>
>> On 28/02/13 02:16, Jean-Luc Duprat 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).
>>>
>>> This changes passes the regression tests and the nightly tests suite.
>>
>> if you delete an intrinsic function declaration from the module, don't you get a
>
> Is that even legal to remove intrinsic function?

yes, you can add a declaration for an intrinsic function and remove it too.

Ciao, Duncan.

>
> Evan
>
>> stale pointer to freed memory in the cache?  To avoid all such issues, maybe it
>> is simpler to have the cache map the name (a StringRef) to the intrinsic ID,
>> rather than mapping the function pointer to the intrinsic ID.  You probably lose
>> some of the speedup then though.
>>
>> Ciao, Duncan.
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list