[llvm-commits] Patch: Have isa<IntrinsicInst> do a string prefix compare

Jim Grosbach grosbach at apple.com
Wed Dec 19 15:06:02 PST 2012


Excellent! Thanks for digging in and confirming. LGTM!

-j

On Dec 18, 2012, at 10:37 AM, Michael Ilseman <milseman at apple.com> wrote:

> 
> On Dec 17, 2012, at 3:44 PM, Michael Ilseman <milseman at apple.com> wrote:
> 
>> On Dec 17, 2012, at 3:35 PM, Jim Grosbach <grosbach at apple.com> wrote:
>> 
>>> Hi Michael,
>>> 
>>> This assumes that a) all intrinsics have names starting with "llvm."
>> 
>> The existing code in getIntrinsicID() has this assumption already, I'm just migrating it out into isIntrinsic().
>> 
>>> and b) every function name starting with "llvm." is an intrinsic.
>> 
>> I agree, this is a new assumption with my patch. I'll look into the docs, but it feels like "llvm.*" should be reserved for intrinsics. For example, if a user defines a function with that prefix, it might be auto-magically made into an intrinsic should LLVM ever introduce an intrinsic with that name. This would even happen should LLVM ever introduce an intrinsic with a similar enough prefix to that name.
> 
> From LangRef[1]:
> "Intrinsic function names must all start with an “llvm.” prefix. This prefix is reserved in LLVM for intrinsic names; thus, function names may not begin with this prefix."
> [1] http://llvm.org/docs/LangRef.html#intrinsic-functions
> 
> 
> 
>> 
>>> Both of those seem pretty strong to me. I don't suppose there's any chance there's docs to that effect in LangRef or anything like that?
>>> 
>>> -Jim
>>> 
>>> On Dec 17, 2012, at 1:13 PM, Michael Ilseman <milseman at apple.com> wrote:
>>> 
>>>> Refactor isIntrinsic() to be quicker, and change classof() (and thus, isa<IntrinsicInst>()) to use it. This decreases the number of occurrences of the slow-path string matching performed by getIntrinsicID().
>>>> 
>>>> <0001-Refactor-isIntrinsic-to-be-quicker-and-change-classo.patch>_______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>> 
>> 
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121219/49ea63b7/attachment.html>


More information about the llvm-commits mailing list