summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/annotations-builtin.c
diff options
context:
space:
mode:
authorJulien Lerouge <jlerouge@apple.com>2012-04-28 17:39:16 +0000
committerJulien Lerouge <jlerouge@apple.com>2012-04-28 17:39:16 +0000
commit4a5b4443711edbd4ea06447a76ee3b464df9f22e (patch)
treedff88c7e1c39c1b3b9407469fcb593fce399d082 /clang/test/CodeGen/annotations-builtin.c
parent9de0b35648f2ede749ef54adee302fd7afda0982 (diff)
downloadbcm5719-llvm-4a5b4443711edbd4ea06447a76ee3b464df9f22e.tar.gz
bcm5719-llvm-4a5b4443711edbd4ea06447a76ee3b464df9f22e.zip
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 Patch by Xi Wang! llvm-svn: 155764
Diffstat (limited to 'clang/test/CodeGen/annotations-builtin.c')
-rw-r--r--clang/test/CodeGen/annotations-builtin.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/clang/test/CodeGen/annotations-builtin.c b/clang/test/CodeGen/annotations-builtin.c
index 42421a0a520..7938e49aa64 100644
--- a/clang/test/CodeGen/annotations-builtin.c
+++ b/clang/test/CodeGen/annotations-builtin.c
@@ -25,9 +25,7 @@ int main(int argc, char **argv) {
// CHECK: call i32 @llvm.annotation.i32
long long lla = __builtin_annotation(llfoo, "annotation_a");
-// CHECK: trunc i64 {{.*}} to i32
-// CHECK-NEXT: call i32 @llvm.annotation.i32
-// CHECK-NEXT: zext i32 {{.*}} to i64
+// CHECK: call i64 @llvm.annotation.i64
int inta = __builtin_annotation(intfoo, "annotation_a");
// CHECK: load i32* @intfoo
@@ -35,15 +33,11 @@ int main(int argc, char **argv) {
// CHECK-NEXT: store
short shorta = __builtin_annotation(shortfoo, "annotation_a");
-// CHECK: sext i16 {{.*}} to i32
-// CHECK-NEXT: call i32 @llvm.annotation.i32
-// CHECK-NEXT: trunc i32 {{.*}} to i16
+// CHECK: call i16 @llvm.annotation.i16
char chara = __builtin_annotation(charfoo, "annotation_a");
-// CHECK: sext i8 {{.*}} to i32
-// CHECK-NEXT: call i32 @llvm.annotation.i32
-// CHECK-NEXT: trunc i32 {{.*}} to i8
-//
+// CHECK: call i8 @llvm.annotation.i8
+
char **arg = (char**) __builtin_annotation((int) argv, "annotation_a");
// CHECK: ptrtoint i8** {{.*}} to
// CHECK: call i32 @llvm.annotation.i32
OpenPOWER on IntegriCloud