[cfe-commits] [PATCH] make __builtin_annotation generic

Julien Lerouge jlerouge at apple.com
Tue Apr 24 11:34:34 PDT 2012


On Tue, Apr 24, 2012 at 02:05:16PM -0400, Xi Wang wrote:
> Hi,
> 
> Currently __builtin_annotation() only annotates an i32.
> 
> 	i32 __builtin_annotation(i32, string);
> 
> Applying it to i64 (e.g., long long) generates the following IR.
>     
> 	trunc i64 {{.*}} to i32
> 	call i32 @llvm.annotation.i32
> 	zext i32 {{.*}} to i64
>     
> The redundant truncation and extension make the result difficult to use.
>     
> This patch makes __builtin_annotation() generic.
> 
> 	type __builtin_annotation(type, string);
> 
> For the i64 example, it simplifies the generated IR to:
>     
> 	call i64 @llvm.annotation.i64
> 
> Please review.  Thanks.
> 
> - xi

Hello Xi,

Looks good to me. Thanks.

The only thing I'd be worried about is that this could break current
users of those annotations who expect the casts (although it would be an
easy fix). That's the reason why I kept the casts when I backported this
thing from llvm-gcc.

I'll apply your patch (unless you have commit access?).

Thanks,
Julien

-- 
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com



More information about the cfe-commits mailing list