Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/transcoding/multiple_user_semantic_nonopaque.ll

raw
1 ; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc
2 ; RUN: llvm-spirv %t.bc -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
3
4 ; RUN: llvm-spirv %t.bc -o %t.spv
5 ; RUN: llvm-spirv -r %t.spv -o %t.rev.bc
6 ; RUN: llvm-dis -opaque-pointers=0 < %t.rev.bc | FileCheck %s --check-prefix=CHECK-LLVM
7
8 ; Check that even when FPGA memory extensions are enabled - yet we have
9 ; UserSemantic decoration be generated
10 ; RUN: llvm-as -opaque-pointers=0 %s -o %t.bc
11 ; RUN: llvm-spirv %t.bc --spirv-ext=+SPV_INTEL_fpga_memory_accesses,+SPV_INTEL_fpga_memory_attributes -spirv-text -o - | FileCheck %s --check-prefix=CHECK-SPIRV
12
13 ; CHECK-SPIRV: Name [[#ClassMember:]] "class.Sample"
14 ; CHECK-SPIRV: Decorate [[#Var:]] UserSemantic "var_annotation_a"
15 ; CHECK-SPIRV: Decorate [[#Var]] UserSemantic "var_annotation_b"
16 ; CHECK-SPIRV: MemberDecorate [[#ClassMember]] 0 UserSemantic "class_annotation_a"
17 ; CHECK-SPIRV: MemberDecorate [[#ClassMember]] 0 UserSemantic "class_annotation_b"
18 ; CHECK-SPIRV: Variable [[#]] [[#Var]] [[#]]
19
20 ; CHECK-LLVM-DAG: @[[StrA:[0-9_.]+]] = {{.*}}"var_annotation_a\00"
21 ; CHECK-LLVM-DAG: @[[StrB:[0-9_.]+]] = {{.*}}"var_annotation_b\00"
22 ; CHECK-LLVM-DAG: @[[StrStructA:[0-9_.]+]] = {{.*}}"class_annotation_a\00"
23 ; CHECK-LLVM-DAG: @[[StrStructB:[0-9_.]+]] = {{.*}}"class_annotation_b\00"
24 ; CHECK-LLVM: [[#Var:]] = alloca i32, align 4
25 ; CHECK-LLVM: [[#Bitcast1:]] = bitcast i32* %[[#Var]] to i8*
26 ; CHECK-LLVM: call void @llvm.var.annotation.p0i8.p0i8(i8* %[[#Bitcast1]], i8* getelementptr inbounds ([17 x i8], [17 x i8]* @[[StrA]], i32 0, i32 0), i8* undef, i32 undef, i8* undef)
27 ; CHECK-LLVM: [[#Bitcast2:]] = bitcast i32* %[[#Var]] to i8*
28 ; CHECK-LLVM: call void @llvm.var.annotation.p0i8.p0i8(i8* %[[#Bitcast2]], i8* getelementptr inbounds ([17 x i8], [17 x i8]* @[[StrB]], i32 0, i32 0), i8* undef, i32 undef, i8* undef)
29 ; CHECK-LLVM: %[[#StructMember:]] = alloca %class.Sample, align 4
30 ; CHECK-LLVM: %[[#GEP1:]] = getelementptr inbounds %class.Sample, %class.Sample* %[[#StructMember]], i32 0, i32 0
31 ; CHECK-LLVM: %[[#PtrAnn:]] = call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %[[#GEP1:]], i8* getelementptr inbounds ([19 x i8], [19 x i8]* @[[StrStructA]], i32 0, i32 0), i8* undef, i32 undef, i8* undef)
32 ; CHECK-LLVM: call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %[[#PtrAnn]], i8* getelementptr inbounds ([19 x i8], [19 x i8]* @[[StrStructB]], i32 0, i32 0), i8* undef, i32 undef, i8* undef)
33
34
35 source_filename = "llvm-link"
36 target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n8:16:32:64"
37 target triple = "spir64"
38
39 %class.Sample = type { i32 }
40
41 @.str = private unnamed_addr constant [17 x i8] c"var_annotation_a\00", section "llvm.metadata"
42 @.str.1 = private unnamed_addr constant [17 x i8] c"/app/example.cpp\00", section "llvm.metadata"
43 @.str.2 = private unnamed_addr constant [17 x i8] c"var_annotation_b\00", section "llvm.metadata"
44 @.str.3 = private unnamed_addr constant [19 x i8] c"class_annotation_a\00", section "llvm.metadata"
45 @.str.4 = private unnamed_addr constant [19 x i8] c"class_annotation_b\00", section "llvm.metadata"
46
47 define spir_func void @test() {
48 %1 = alloca i32, align 4
49 %2 = alloca %class.Sample, align 4
50 %3 = bitcast i32* %1 to i8*
51 call void @llvm.var.annotation(i8* %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i32 9, i8* null)
52 %4 = bitcast i32* %1 to i8*
53 call void @llvm.var.annotation(i8* %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i32 9, i8* null)
54 %5 = load i32, i32* %1, align 4
55 call void @_Z3fooi(i32 noundef %5)
56 %6 = getelementptr inbounds %class.Sample, %class.Sample* %2, i32 0, i32 0
57 %7 = bitcast i32* %6 to i8*
58 %8 = call i8* @llvm.ptr.annotation.p0i8(i8* %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* null)
59 %9 = bitcast i8* %8 to i32*
60 %10 = bitcast i32* %9 to i8*
61 %11 = call i8* @llvm.ptr.annotation.p0i8(i8* %10, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* null)
62 %12 = bitcast i8* %11 to i32*
63 %13 = load i32, i32* %12, align 4
64 call void @_Z3fooi(i32 noundef %13)
65 ret void
66 }
67
68 declare dso_local void @_Z3fooi(i32 noundef)
69
70 declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*)
71
72 declare i8* @llvm.ptr.annotation.p0i8(i8*, i8*, i8*, i32, i8*)