-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][Clang] Fix annotations applied to integer fields #8198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// RUN: %clang_cc1 -fsycl-is-device -triple spir64-unknown-unknown -emit-llvm -no-opaque-pointers -o - %s | FileCheck %s | ||
Fznamznon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// This test checks that clang emits @llvm.ptr.annotation intrinsic correctly | ||
// when attribute annotate is applied to a struct field of integer type. | ||
|
||
// CHECK: private unnamed_addr addrspace(1) constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata" | ||
// CHECK: private unnamed_addr addrspace(1) constant [8 x i8] c"v_ann_{{.}}\00", section "llvm.metadata" | ||
// CHECK: private unnamed_addr addrspace(1) constant [8 x i8] c"w_ann_{{.}}\00", section "llvm.metadata" | ||
// CHECK: private unnamed_addr addrspace(1) constant [8 x i8] c"w_ann_{{.}}\00", section "llvm.metadata" | ||
// CHECK: private unnamed_addr addrspace(1) constant [8 x i8] c"f_ann_{{.}}\00", section "llvm.metadata" | ||
// CHECK: private unnamed_addr addrspace(1) constant [8 x i8] c"f_ann_{{.}}\00", section "llvm.metadata" | ||
|
||
struct foo { | ||
int v __attribute__((annotate("v_ann_0"))) __attribute__((annotate("v_ann_1"))); | ||
char w __attribute__((annotate("w_ann_0"))) __attribute__((annotate("w_ann_1"))); | ||
float f __attribute__((annotate("f_ann_0"))) __attribute__((annotate("f_ann_1"))); | ||
}; | ||
|
||
int __attribute__((sycl_device)) foo() { | ||
struct foo f; | ||
f.v = 1; | ||
// CHECK: getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %{{.*}}, i32 0, i32 0 | ||
// CHECK-NEXT: call i32 addrspace(4)* @llvm.ptr.annotation.p4i32.p1i8({{.*}}str{{.*}}str{{.*}}i32 14, i8 addrspace(1)* null) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this str a variable holding annotation?. Also what does 14 here refer to? Just curious and for my own learning There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, str is a variable with annotation string. 14 seems to be a line of code on which annotation happened. |
||
// CHECK-NEXT: call i32 addrspace(4)* @llvm.ptr.annotation.p4i32.p1i8({{.*}}str{{.*}}str{{.*}}i32 14, i8 addrspace(1)* null) | ||
f.w = 42; | ||
// CHECK: getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %{{.*}}, i32 0, i32 1 | ||
// CHECK-NEXT: call i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p1i8({{.*}}str{{.*}}str{{.*}}i32 15, i8 addrspace(1)* null) | ||
// CHECK-NEXT: call i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p1i8({{.*}}str{{.*}}str{{.*}}i32 15, i8 addrspace(1)* null) | ||
f.f = 0; | ||
// CHECK: getelementptr inbounds %struct.foo, %struct.foo addrspace(4)* %{{.*}}, i32 0, i32 2 | ||
// CHECK-NEXT: bitcast float addrspace(4)* %{{.*}} to i8 addrspace(4)* | ||
// CHECK-NEXT: call i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p1i8({{.*}}str{{.*}}str{{.*}}i32 16, i8 addrspace(1)* null) | ||
// CHECK-NEXT: bitcast i8 addrspace(4)* %{{.*}} to float addrspace(4)* | ||
// CHECK-NEXT: bitcast float addrspace(4)* %{{.*}} to i8 addrspace(4)* | ||
// CHECK-NEXT: call i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p1i8({{.*}}str{{.*}}str{{.*}}i32 16, i8 addrspace(1)* null) | ||
return 0; | ||
} |
Uh oh!
There was an error while loading. Please reload this page.