From d6795c7b2d8246579766e9555e39276ce547aacb Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Thu, 14 Sep 2023 14:48:08 +0100 Subject: [PATCH 1/2] Convert remaining transcoding tests to opaque pointers --- test/transcoding/CreatePipeFromPipeStorage.ll | 44 ++--- .../OpPhi_ArgumentsPlaceholders.ll | 12 +- test/transcoding/annotate_attribute.ll | 161 +++++++++--------- test/transcoding/extract_insert_value.ll | 16 +- test/transcoding/intrinsic_result_store.ll | 10 +- test/transcoding/memory_access.ll | 28 +-- .../spirv-private-array-initialization.ll | 4 +- 7 files changed, 137 insertions(+), 138 deletions(-) diff --git a/test/transcoding/CreatePipeFromPipeStorage.ll b/test/transcoding/CreatePipeFromPipeStorage.ll index 598b264a1c..bfaf5b0b5b 100644 --- a/test/transcoding/CreatePipeFromPipeStorage.ll +++ b/test/transcoding/CreatePipeFromPipeStorage.ll @@ -36,13 +36,13 @@ target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:2 target triple = "spir-unknown-unknown" %spirv.ConstantPipeStorage = type { i32, i32, i32 } -%"class.cl::pipe_storage" = type { %spirv.PipeStorage addrspace(1)* } +%"class.cl::pipe_storage" = type { ptr addrspace(1) } %spirv.PipeStorage = type opaque %"class.cl::pipe" = type { target("spirv.Pipe", 0) } %"class.cl::pipe" = type { target("spirv.Pipe", 1) } @_ZN2cl9__details29OpConstantPipeStorage_CreatorILi16ELi16ELi1EE5valueE = linkonce_odr addrspace(1) global %spirv.ConstantPipeStorage { i32 16, i32 16, i32 1 }, align 4 -@mygpipe = addrspace(1) global %"class.cl::pipe_storage" { %spirv.PipeStorage addrspace(1)* bitcast (%spirv.ConstantPipeStorage addrspace(1)* @_ZN2cl9__details29OpConstantPipeStorage_CreatorILi16ELi16ELi1EE5valueE to %spirv.PipeStorage addrspace(1)*) }, align 4 +@mygpipe = addrspace(1) global %"class.cl::pipe_storage" { ptr addrspace(1) @_ZN2cl9__details29OpConstantPipeStorage_CreatorILi16ELi16ELi1EE5valueE }, align 4 ; Function Attrs: nounwind @@ -64,8 +64,8 @@ entry: ; CHECK-SPIRV: PtrCastToGeneric {{[0-9]+}} [[SPIRV0:[0-9]+]] [[PIPE_STORAGE_ID]] ; CHECK-SPIRV: PtrAccessChain {{[0-9]+}} [[SPIRV1:[0-9]+]] [[SPIRV0]] [[CONSTANT_ZERO_ID]] [[CONSTANT_ZERO_ID]] - %0 = addrspacecast %"class.cl::pipe_storage" addrspace(1)* @mygpipe to %"class.cl::pipe_storage" addrspace(4)* - %1 = getelementptr %"class.cl::pipe_storage", %"class.cl::pipe_storage" addrspace(4)* %0, i32 0, i32 0 + %0 = addrspacecast ptr addrspace(1) @mygpipe to ptr addrspace(4) + %1 = getelementptr %"class.cl::pipe_storage", ptr addrspace(4) %0, i32 0, i32 0 ; CHECK-SPV-IR: %[[PIPE_STORAGE_1:[0-9]+]] = load ptr addrspace(1), ptr addrspace(4) %[[ID1]], align 4 @@ -80,10 +80,10 @@ entry: ; CHECK-SPIRV: PtrCastToGeneric {{[0-9]+}} [[GENERIC_WRITE_PIPE_WRAPPER_ID:[0-9]+]] [[WRITE_PIPE_WRAPPER_ID]] ; CHECK-SPIRV: FunctionCall {{[0-9]+}} {{[0-9]+}} [[WRITE_PIPE_WRAPPER_CTOR]] [[GENERIC_WRITE_PIPE_WRAPPER_ID]] [[WRITE_PIPE_ID]] - %2 = load %spirv.PipeStorage addrspace(1)*, %spirv.PipeStorage addrspace(1)* addrspace(4)* %1, align 4 - %3 = tail call spir_func target("spirv.Pipe", 1) @_Z39__spirv_CreatePipeFromPipeStorage_writePU3AS1K19__spirv_PipeStorage(%spirv.PipeStorage addrspace(1)* %2) - %4 = addrspacecast %"class.cl::pipe"* %mywpipe to %"class.cl::pipe" addrspace(4)* - call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(%"class.cl::pipe" addrspace(4)* %4, target("spirv.Pipe", 1) %3) + %2 = load ptr addrspace(1), ptr addrspace(4) %1, align 4 + %3 = tail call spir_func target("spirv.Pipe", 1) @_Z39__spirv_CreatePipeFromPipeStorage_writePU3AS1K19__spirv_PipeStorage(ptr addrspace(1) %2) + %4 = addrspacecast ptr %mywpipe to ptr addrspace(4) + call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(ptr addrspace(4) %4, target("spirv.Pipe", 1) %3) ; CHECK-SPV-IR: %[[PIPE_STORAGE_2:[0-9]+]] = load ptr addrspace(1), ptr addrspace(4) %[[ID1]], align 4 @@ -98,50 +98,50 @@ entry: ; CHECK-SPIRV: PtrCastToGeneric {{[0-9]+}} [[GENERIC_READ_PIPE_WRAPPER_ID:[0-9]+]] [[READ_PIPE_WRAPPER_ID]] ; CHECK-SPIRV: FunctionCall {{[0-9]+}} {{[0-9]+}} [[READ_PIPE_WRAPPER_CTOR]] [[GENERIC_READ_PIPE_WRAPPER_ID]] [[READ_PIPE_ID]] - %5 = load %spirv.PipeStorage addrspace(1)*, %spirv.PipeStorage addrspace(1)* addrspace(4)* %1, align 4 - %6 = tail call spir_func target("spirv.Pipe", 0) @_Z38__spirv_CreatePipeFromPipeStorage_readPU3AS1K19__spirv_PipeStorage(%spirv.PipeStorage addrspace(1)* %5) - %7 = addrspacecast %"class.cl::pipe"* %myrpipe to %"class.cl::pipe" addrspace(4)* - call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(%"class.cl::pipe" addrspace(4)* %7, target("spirv.Pipe", 0) %6) + %5 = load ptr addrspace(1), ptr addrspace(4) %1, align 4 + %6 = tail call spir_func target("spirv.Pipe", 0) @_Z38__spirv_CreatePipeFromPipeStorage_readPU3AS1K19__spirv_PipeStorage(ptr addrspace(1) %5) + %7 = addrspacecast ptr %myrpipe to ptr addrspace(4) + call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(ptr addrspace(4) %7, target("spirv.Pipe", 0) %6) ret void } ; Function Attrs: nounwind -define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(%"class.cl::pipe" addrspace(4)* nocapture %this, target("spirv.Pipe", 0) %handle) unnamed_addr align 2 { +define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(ptr addrspace(4) nocapture %this, target("spirv.Pipe", 0) %handle) unnamed_addr align 2 { entry: - tail call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(%"class.cl::pipe" addrspace(4)* %this, target("spirv.Pipe", 0) %handle) + tail call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(ptr addrspace(4) %this, target("spirv.Pipe", 0) %handle) ret void } ; Function Attrs: nounwind -define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(%"class.cl::pipe" addrspace(4)* nocapture %this, target("spirv.Pipe", 0) %handle) unnamed_addr align 2 { +define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE0EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE0EEE(ptr addrspace(4) nocapture %this, target("spirv.Pipe", 0) %handle) unnamed_addr align 2 { entry: - %_handle = getelementptr inbounds %"class.cl::pipe", %"class.cl::pipe" addrspace(4)* %this, i32 0, i32 0 + %_handle = getelementptr inbounds %"class.cl::pipe", ptr addrspace(4) %this, i32 0, i32 0 store target("spirv.Pipe", 0) %handle, target("spirv.Pipe", 0) addrspace(4)* %_handle, align 4, !tbaa !11 ret void } ; Function Attrs: nounwind -declare spir_func target("spirv.Pipe", 0) @_Z38__spirv_CreatePipeFromPipeStorage_readPU3AS1K19__spirv_PipeStorage(%spirv.PipeStorage addrspace(1)*) +declare spir_func target("spirv.Pipe", 0) @_Z38__spirv_CreatePipeFromPipeStorage_readPU3AS1K19__spirv_PipeStorage(ptr addrspace(1)) ; Function Attrs: nounwind -define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(%"class.cl::pipe" addrspace(4)* nocapture %this, target("spirv.Pipe", 1) %handle) unnamed_addr align 2 { +define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC1EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(ptr addrspace(4) nocapture %this, target("spirv.Pipe", 1) %handle) unnamed_addr align 2 { entry: - tail call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(%"class.cl::pipe" addrspace(4)* %this, target("spirv.Pipe", 1) %handle) + tail call spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(ptr addrspace(4) %this, target("spirv.Pipe", 1) %handle) ret void } ; Function Attrs: nounwind -define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(%"class.cl::pipe" addrspace(4)* nocapture %this, target("spirv.Pipe", 1) %handle) unnamed_addr align 2 { +define linkonce_odr spir_func void @_ZNU3AS42cl4pipeIDv4_iLNS_11pipe_accessE1EEC2EPU3AS1NS_7__spirv10OpTypePipeILNS3_15AccessQualifierE1EEE(ptr addrspace(4) nocapture %this, target("spirv.Pipe", 1) %handle) unnamed_addr align 2 { entry: - %_handle = getelementptr inbounds %"class.cl::pipe", %"class.cl::pipe" addrspace(4)* %this, i32 0, i32 0 + %_handle = getelementptr inbounds %"class.cl::pipe", ptr addrspace(4) %this, i32 0, i32 0 store target("spirv.Pipe", 1) %handle, target("spirv.Pipe", 1) addrspace(4)* %_handle, align 4, !tbaa !13 ret void } ; Function Attrs: nounwind -declare spir_func target("spirv.Pipe", 1) @_Z39__spirv_CreatePipeFromPipeStorage_writePU3AS1K19__spirv_PipeStorage(%spirv.PipeStorage addrspace(1)*) +declare spir_func target("spirv.Pipe", 1) @_Z39__spirv_CreatePipeFromPipeStorage_writePU3AS1K19__spirv_PipeStorage(ptr addrspace(1)) !opencl.enable.FP_CONTRACT = !{} !opencl.spir.version = !{!0} diff --git a/test/transcoding/OpPhi_ArgumentsPlaceholders.ll b/test/transcoding/OpPhi_ArgumentsPlaceholders.ll index d150464263..d60d7d4779 100644 --- a/test/transcoding/OpPhi_ArgumentsPlaceholders.ll +++ b/test/transcoding/OpPhi_ArgumentsPlaceholders.ll @@ -23,16 +23,16 @@ target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024" target triple = "spir" -%struct.Node = type { %struct.Node.0 addrspace(1)* } +%struct.Node = type { ptr addrspace(1) } %struct.Node.0 = type opaque ; Function Attrs: nounwind -define spir_kernel void @verify_linked_lists(%struct.Node addrspace(1)* %pNodes) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { +define spir_kernel void @verify_linked_lists(ptr addrspace(1) %pNodes) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { entry: br label %for.cond for.cond: ; preds = %for.inc, %entry - %pNode.0 = phi %struct.Node addrspace(1)* [ %pNodes, %entry ], [ %1, %for.inc ] + %pNode.0 = phi ptr addrspace(1) [ %pNodes, %entry ], [ %1, %for.inc ] %j.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] ;CHECK-SPIRV: Phi {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} {{[0-9]+}} [[BitcastResultId:[0-9]+]] {{[0-9]+}} ;CHECK-SPIRV-NEXT: Phi @@ -43,10 +43,10 @@ for.cond: ; preds = %for.inc, %entry br i1 %cmp, label %for.body, label %for.end for.body: ; preds = %for.cond - %pNext = getelementptr inbounds %struct.Node, %struct.Node addrspace(1)* %pNode.0, i32 0, i32 0 + %pNext = getelementptr inbounds %struct.Node, ptr addrspace(1) %pNode.0, i32 0, i32 0 - %0 = load %struct.Node.0 addrspace(1)*, %struct.Node.0 addrspace(1)* addrspace(1)* %pNext, align 4 - %1 = bitcast %struct.Node.0 addrspace(1)* %0 to %struct.Node addrspace(1)* + %0 = load ptr addrspace(1), ptr addrspace(1) %pNext, align 4 + %1 = bitcast ptr addrspace(1) %0 to ptr addrspace(1) ;CHECK-SPIRV: Load {{[0-9]+}} [[LoadResultId:[0-9]+]] ;CHECK-SPIRV: Bitcast {{[0-9]+}} [[BitcastResultId]] [[LoadResultId]] ;CHECK-LLVM: [[LoadResult:%[0-9]+]] = load ptr addrspace(1), ptr addrspace(1) {{.*}} diff --git a/test/transcoding/annotate_attribute.ll b/test/transcoding/annotate_attribute.ll index 4a19ca40a4..6461fe018d 100644 --- a/test/transcoding/annotate_attribute.ll +++ b/test/transcoding/annotate_attribute.ll @@ -36,7 +36,7 @@ target triple = "spir64-unknown-linux" %struct.S.1 = type { i32 } %struct.S.2 = type { i32 } %struct.S.3 = type { i32 } -%struct.MyIP = type { i32 addrspace(4)* } +%struct.MyIP = type { ptr addrspace(4) } ; CHECK-LLVM-DAG: [[STR:@[0-9_.]+]] = {{.*}}42 ; CHECK-LLVM-DAG: [[STR2:@[0-9_.]+]] = {{.*}}{FOO} @@ -78,30 +78,30 @@ target triple = "spir64-unknown-linux" define spir_kernel void @_ZTSZ4mainE15kernel_function() #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 { entry: %0 = alloca %class.anon, align 1 - %1 = bitcast %class.anon* %0 to i8* - call void @llvm.lifetime.start.p0i8(i64 1, i8* %1) #4 - call spir_func void @"_ZZ4mainENK3$_0clEv"(%class.anon* %0) - %2 = bitcast %class.anon* %0 to i8* - call void @llvm.lifetime.end.p0i8(i64 1, i8* %2) #4 + %1 = bitcast ptr %0 to ptr + call void @llvm.lifetime.start.p0(i64 1, ptr %1) #4 + call spir_func void @"_ZZ4mainENK3$_0clEv"(ptr %0) + %2 = bitcast ptr %0 to ptr + call void @llvm.lifetime.end.p0(i64 1, ptr %2) #4 ret void } ; Function Attrs: argmemonly nounwind -declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1 +declare void @llvm.lifetime.start.p0(i64, ptr nocapture) #1 ; Function Attrs: inlinehint nounwind -define internal spir_func void @"_ZZ4mainENK3$_0clEv"(%class.anon* %this) #2 align 2 { +define internal spir_func void @"_ZZ4mainENK3$_0clEv"(ptr %this) #2 align 2 { entry: - %this.addr = alloca %class.anon*, align 8 - store %class.anon* %this, %class.anon** %this.addr, align 8, !tbaa !5 - %this1 = load %class.anon*, %class.anon** %this.addr, align 8 + %this.addr = alloca ptr, align 8 + store ptr %this, ptr %this.addr, align 8, !tbaa !5 + %this1 = load ptr, ptr %this.addr, align 8 call spir_func void @_Z3foov() call spir_func void @_Z3bazv() ret void } ; Function Attrs: argmemonly nounwind -declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1 +declare void @llvm.lifetime.end.p0(i64, ptr nocapture) #1 ; Function Attrs: nounwind define spir_func void @_Z3foov() #3 { @@ -110,64 +110,64 @@ entry: %var_two = alloca i32, align 4 %var_three = alloca i8, align 1 %var_four = alloca i8, align 1 - %0 = bitcast i32* %var_one to i8* - call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4 - %var_one1 = bitcast i32* %var_one to i8* + %0 = bitcast ptr %var_one to ptr + call void @llvm.lifetime.start.p0(i64 4, ptr %0) #4 + %var_one1 = bitcast ptr %var_one to ptr ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR]], ptr undef, i32 undef, ptr undef) - call void @llvm.var.annotation(i8* %var_one1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 2, i8* undef) - %1 = bitcast i32* %var_two to i8* - call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #4 - %var_two2 = bitcast i32* %var_two to i8* + call void @llvm.var.annotation(ptr %var_one1, ptr @.str, ptr @.str.1, i32 2, ptr undef) + %1 = bitcast ptr %var_two to ptr + call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4 + %var_two2 = bitcast ptr %var_two to ptr ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR2]], ptr undef, i32 undef, ptr undef) - call void @llvm.var.annotation(i8* %var_two2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* undef) - call void @llvm.lifetime.start.p0i8(i64 1, i8* %var_three) #4 + call void @llvm.var.annotation(ptr %var_two2, ptr @.str.2, ptr @.str.1, i32 3, ptr undef) + call void @llvm.lifetime.start.p0(i64 1, ptr %var_three) #4 ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR3]], ptr undef, i32 undef, ptr undef) - call void @llvm.var.annotation(i8* %var_three, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 4, i8* undef) - call void @llvm.lifetime.end.p0i8(i64 1, i8* %var_three) #4 - call void @llvm.lifetime.start.p0i8(i64 1, i8* %var_four) #4 + call void @llvm.var.annotation(ptr %var_three, ptr @.str.3, ptr @.str.1, i32 4, ptr undef) + call void @llvm.lifetime.end.p0(i64 1, ptr %var_three) #4 + call void @llvm.lifetime.start.p0(i64 1, ptr %var_four) #4 ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR7]], ptr undef, i32 undef, ptr undef) - call void @llvm.var.annotation(i8* %var_four, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 4, i8* bitcast ({ i32, i32 }* @.args.0 to i8*)) - call void @llvm.lifetime.end.p0i8(i64 1, i8* %var_four) #4 - %2 = bitcast i32* %var_two to i8* - call void @llvm.lifetime.end.p0i8(i64 4, i8* %2) #4 - %3 = bitcast i32* %var_one to i8* - call void @llvm.lifetime.end.p0i8(i64 4, i8* %3) #4 + call void @llvm.var.annotation(ptr %var_four, ptr @.str.7, ptr @.str.1, i32 4, ptr @.args.0) + call void @llvm.lifetime.end.p0(i64 1, ptr %var_four) #4 + %2 = bitcast ptr %var_two to ptr + call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4 + %3 = bitcast ptr %var_one to ptr + call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4 ret void } ; Function Attrs: nounwind -declare void @llvm.var.annotation(i8*, i8*, i8*, i32, i8*) #4 +declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr) #4 ; Function Attrs: nounwind define spir_func void @_Z3bazv() #3 { entry: %s1 = alloca %struct.bar, align 4 - %0 = bitcast %struct.bar* %s1 to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #4 + %0 = bitcast ptr %s1 to ptr + call void @llvm.lifetime.start.p0(i64 8, ptr %0) #4 ; CHECK-LLVM: %[[FIELD1:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD1]]{{.*}}[[STR4]] - %f1 = getelementptr inbounds %struct.bar, %struct.bar* %s1, i32 0, i32 0 - %1 = call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %f1, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 8, i8* undef) - store i32 0, i32* %1, align 4, !tbaa !9 + %f1 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 0 + %1 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f1, ptr @.str.4, ptr @.str.1, i32 8, ptr undef) + store i32 0, ptr %1, align 4, !tbaa !9 ; CHECK-LLVM: %[[FIELD2:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 1 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD2]]{{.*}}[[STR5]] - %f2 = getelementptr inbounds %struct.bar, %struct.bar* %s1, i32 0, i32 1 - %2 = call i8* @llvm.ptr.annotation.p0i8.p0i8(i8* %f2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 9, i8* undef) - store i8 0, i8* %2, align 4, !tbaa !13 + %f2 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 1 + %2 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f2, ptr @.str.5, ptr @.str.1, i32 9, ptr undef) + store i8 0, ptr %2, align 4, !tbaa !13 ; CHECK-LLVM: %[[FIELD3:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 2 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD3]]{{.*}}[[STR6]] - %f3 = getelementptr inbounds %struct.bar, %struct.bar* %s1, i32 0, i32 2 - %3 = bitcast float* %f3 to i8* - %4 = call i8* @llvm.ptr.annotation.p0i8.p0i8(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 9, i8* undef) - %5 = bitcast i8* %4 to float* - store float 0.000000e+00, float* %5, align 4, !tbaa !14 + %f3 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 2 + %3 = bitcast ptr %f3 to ptr + %4 = call ptr @llvm.ptr.annotation.p0.p0(ptr %3, ptr @.str.6, ptr @.str.1, i32 9, ptr undef) + %5 = bitcast ptr %4 to ptr + store float 0.000000e+00,ptr %5, align 4, !tbaa !14 ; CHECK-LLVM: %[[FIELD4:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 3 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD4]]{{.*}}[[STR8]] - %f4 = getelementptr inbounds %struct.bar, %struct.bar* %s1, i32 0, i32 3 - %6 = call i8* @llvm.ptr.annotation.p0i8.p0i8(i8* %f4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 9, i8* bitcast ({ i32, i32, i32 }* @.args.1 to i8*)) - store i8 0, i8* %6, align 4, !tbaa !13 - %7 = bitcast %struct.bar* %s1 to i8* - call void @llvm.lifetime.end.p0i8(i64 12, i8* %7) #4 + %f4 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 3 + %6 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f4, ptr @.str.7, ptr @.str.1, i32 9, ptr @.args.1) + store i8 0, ptr %6, align 4, !tbaa !13 + %7 = bitcast ptr %s1 to ptr + call void @llvm.lifetime.end.p0(i64 12, ptr %7) #4 ret void } @@ -176,12 +176,12 @@ define dso_local noundef i32 @with_zeroinitializer() #0 { entry: %retval = alloca i32, align 4 %s = alloca %struct.S, align 4 - store i32 0, i32* %retval, align 4 - %a = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0 - %0 = call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %a, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* bitcast ({ i32, i32, i32 }* @.args.2 to i8*)) + store i32 0, ptr %retval, align 4 + %a = getelementptr inbounds %struct.S, ptr %s, i32 0, i32 0 + %0 = call ptr @llvm.ptr.annotation.p0.p0(ptr %a, ptr @.str.8, ptr @.str.1, i32 3, ptr @.args.2) ; CHECK-LLVM: %[[FIELD5:.*]] = getelementptr inbounds %struct.S, ptr %{{[a-z]+}}, i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0.p0{{.*}}%[[FIELD5]]{{.*}}[[STR9]] - %1 = load i32, i32* %0, align 4 + %1 = load i32, ptr %0, align 4 call void @_Z3fooi(i32 noundef %1) ret i32 0 } @@ -191,12 +191,12 @@ define dso_local noundef i32 @with_false() #0 { entry: %retval = alloca i32, align 4 %s = alloca %struct.S.1, align 4 - store i32 0, i32* %retval, align 4 - %a = getelementptr inbounds %struct.S.1, %struct.S.1* %s, i32 0, i32 0 - %0 = call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %a, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* bitcast ({ i1 }* @.args.3 to i8*)) + store i32 0, ptr %retval, align 4 + %a = getelementptr inbounds %struct.S.1, ptr %s, i32 0, i32 0 + %0 = call ptr @llvm.ptr.annotation.p0.p0(ptr %a, ptr @.str.9, ptr @.str.1, i32 3, ptr @.args.3) ; CHECK-LLVM: %[[FIELD6:.*]] = getelementptr inbounds %struct.S.1, ptr %{{[a-z]+}}, i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD6]]{{.*}}[[STR10]] - %1 = load i32, i32* %0, align 4 + %1 = load i32, ptr %0, align 4 call void @_Z3fooi(i32 noundef %1) ret i32 0 } @@ -206,35 +206,35 @@ define dso_local noundef i32 @mixed() #0 { entry: %retval = alloca i32, align 4 %s = alloca %struct.S.2, align 4 - store i32 0, i32* %retval, align 4 - %a = getelementptr inbounds %struct.S.2, %struct.S.2* %s, i32 0, i32 0 - %0 = call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %a, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* bitcast ({ i32, i32, i32 }* @.args.4 to i8*)) + store i32 0, ptr %retval, align 4 + %a = getelementptr inbounds %struct.S.2, ptr %s, i32 0, i32 0 + %0 = call ptr @llvm.ptr.annotation.p0.p0(ptr %a, ptr @.str.10, ptr @.str.1, i32 3, ptr @.args.4) ; CHECK-LLVM: %[[FIELD7:.*]] = getelementptr inbounds %struct.S.2, ptr %{{[a-z]+}}, i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD7]]{{.*}}[[STR11]] - %1 = load i32, i32* %0, align 4 + %1 = load i32, ptr %0, align 4 call void @_Z3fooi(i32 noundef %1) ret i32 0 } ; Function Attrs: mustprogress norecurse -define weak_odr dso_local spir_kernel void @_ZTSZ11TestKernelAvE4MyIP(i32 addrspace(1)* noundef align 4 %0) local_unnamed_addr #5 !kernel_arg_buffer_location !15 !sycl_kernel_omit_args !16 { +define weak_odr dso_local spir_kernel void @_ZTSZ11TestKernelAvE4MyIP(ptr addrspace(1) noundef align 4 %0) local_unnamed_addr #5 !kernel_arg_buffer_location !15 !sycl_kernel_omit_args !16 { %2 = alloca %struct.MyIP, align 8 - %3 = bitcast %struct.MyIP* %2 to i8* - call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull %3) #4 - %4 = addrspacecast i8* %3 to i8 addrspace(4)* - %5 = call i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p0i8(i8 addrspace(4)* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1.12, i64 0, i64 0), i32 13, i8* bitcast ({ i32, i32, i32 }* @.args to i8*)) + %3 = bitcast ptr %2 to ptr + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4 + %4 = addrspacecast ptr %3 to ptr addrspace(4) + %5 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p0(ptr addrspace(4) %4, ptr @.str.11, ptr @.str.1.12, i32 13, ptr @.args) ; CHECK-LLVM: %[[ALLOCA:.*]] = alloca %struct.MyIP, align 8 ; CHECK-LLVM: %[[GEP:.*]] = getelementptr inbounds %struct.MyIP, ptr %[[ALLOCA]], i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0.p0(ptr %[[GEP]], ptr [[STR12]], ptr undef, i32 undef, ptr undef) - %6 = bitcast i8 addrspace(4)* %5 to i32 addrspace(4)* addrspace(4)* - %7 = addrspacecast i32 addrspace(1)* %0 to i32 addrspace(4)* - store i32 addrspace(4)* %7, i32 addrspace(4)* addrspace(4)* %6, align 8, !tbaa !17 - %8 = bitcast i8 addrspace(4)* %5 to i32 addrspace(4)* addrspace(4)* - %9 = load i32 addrspace(4)*, i32 addrspace(4)* addrspace(4)* %8, align 8, !tbaa !17 - %10 = load i32, i32 addrspace(4)* %9, align 4, !tbaa !19 + %6 = bitcast ptr addrspace(4) %5 to ptr addrspace(4) + %7 = addrspacecast ptr addrspace(1) %0 to ptr addrspace(4) + store ptr addrspace(4) %7, ptr addrspace(4) %6, align 8, !tbaa !17 + %8 = bitcast ptr addrspace(4) %5 to ptr addrspace(4) + %9 = load ptr addrspace(4), ptr addrspace(4) %8, align 8, !tbaa !17 + %10 = load i32, ptr addrspace(4) %9, align 4, !tbaa !19 %11 = shl nsw i32 %10, 1 - store i32 %11, i32 addrspace(4)* %9, align 4, !tbaa !19 - call void @llvm.lifetime.end.p0i8(i64 8, i8* nonnull %3) #4 + store i32 %11, ptr addrspace(4) %9, align 4, !tbaa !19 + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4 ret void } @@ -243,12 +243,12 @@ define dso_local noundef i32 @with_true() #0 { entry: %retval = alloca i32, align 4 %s = alloca %struct.S.3, align 4 - store i32 0, i32* %retval, align 4 - %a = getelementptr inbounds %struct.S.3, %struct.S.3* %s, i32 0, i32 0 - %0 = call i32* @llvm.ptr.annotation.p0i32.p0i8(i32* %a, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i32 0, i32 0), i32 3, i8* bitcast ({ i1 }* @.args.5 to i8*)) + store i32 0, ptr %retval, align 4 + %a = getelementptr inbounds %struct.S.3, ptr %s, i32 0, i32 0 + %0 = call ptr @llvm.ptr.annotation.p0.p0(ptr %a, ptr @.str.12, ptr @.str.1, i32 3, ptr @.args.5) ; CHECK-LLVM: %[[FIELD8:.*]] = getelementptr inbounds %struct.S.3, ptr %{{[a-z]+}}, i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD8]]{{.*}}[[STR13]] - %1 = load i32, i32* %0, align 4 + %1 = load i32, ptr %0, align 4 call void @_Z3fooi(i32 noundef %1) ret i32 0 } @@ -256,13 +256,12 @@ entry: declare dso_local void @_Z3fooi(i32 noundef) ; Function Attrs: nounwind -declare i8* @llvm.ptr.annotation.p0i8.p0i8(i8*, i8*, i8*, i32, i8*) #4 +declare ptr @llvm.ptr.annotation.p0.p0(ptr, ptr, ptr, i32, ptr) #4 ; Function Attrs: nounwind -declare i32* @llvm.ptr.annotation.p0i32.p0i8(i32*, i8*, i8*, i32, i8*) #4 ; Function Attrs: nounwind -declare i8 addrspace(4)* @llvm.ptr.annotation.p4i8.p0i8(i8 addrspace(4)*, i8*, i8*, i32, i8*) #4 +declare ptr addrspace(4) @llvm.ptr.annotation.p4.p0(ptr addrspace(4), ptr, ptr, i32, ptr) #4 attributes #0 = { nounwind "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { argmemonly nounwind } diff --git a/test/transcoding/extract_insert_value.ll b/test/transcoding/extract_insert_value.ll index bb61babce7..f7a20a9282 100644 --- a/test/transcoding/extract_insert_value.ll +++ b/test/transcoding/extract_insert_value.ll @@ -41,15 +41,15 @@ target triple = "spir-unknown-unknown" ; CHECK-SPIRV-LABEL: 1 FunctionEnd ; Function Attrs: nounwind -define spir_func void @array_test(%struct.arr addrspace(1)* %object) #0 { +define spir_func void @array_test(ptr addrspace(1) %object) #0 { entry: - %0 = getelementptr inbounds %struct.arr, %struct.arr addrspace(1)* %object, i32 0, i32 0 - %1 = load [7 x float], [7 x float] addrspace(1)* %0, align 4 + %0 = getelementptr inbounds %struct.arr, ptr addrspace(1) %object, i32 0, i32 0 + %1 = load [7 x float], ptr addrspace(1) %0, align 4 %2 = extractvalue [7 x float] %1, 4 %3 = extractvalue [7 x float] %1, 2 %4 = fadd float %2, %3 %5 = insertvalue [7 x float] %1, float %4, 5 - store [7 x float] %5, [7 x float] addrspace(1)* %0 + store [7 x float] %5, ptr addrspace(1) %0 ret void } @@ -73,14 +73,14 @@ entry: ; CHECK-SPIRV-LABEL: 1 FunctionEnd ; Function Attrs: nounwind -define spir_func void @struct_test(%struct.st addrspace(1)* %object) #0 { +define spir_func void @struct_test(ptr addrspace(1) %object) #0 { entry: - %0 = getelementptr inbounds %struct.st, %struct.st addrspace(1)* %object, i32 0, i32 0 - %1 = load %struct.inner, %struct.inner addrspace(1)* %0, align 4 + %0 = getelementptr inbounds %struct.st, ptr addrspace(1) %object, i32 0, i32 0 + %1 = load %struct.inner, ptr addrspace(1) %0, align 4 %2 = extractvalue %struct.inner %1, 0 %3 = fadd float %2, 1.000000e+00 %4 = insertvalue %struct.inner %1, float %3, 0 - store %struct.inner %4, %struct.inner addrspace(1)* %0 + store %struct.inner %4, ptr addrspace(1) %0 ret void } diff --git a/test/transcoding/intrinsic_result_store.ll b/test/transcoding/intrinsic_result_store.ll index 86ec5c8a59..f542e3ecb5 100644 --- a/test/transcoding/intrinsic_result_store.ll +++ b/test/transcoding/intrinsic_result_store.ll @@ -12,20 +12,20 @@ target triple = "spir64-unknown-unknown" ; CHECK-LLVM: [[ZERO_INIT:@[0-9]+]] = {{.*}} addrspace(2) constant [8 x i8] zeroinitializer ; Function Attrs: convergent noinline nounwind optnone -define spir_kernel void @test_memset(i32 addrspace(1)* %data, i32 %input) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { +define spir_kernel void @test_memset(ptr addrspace(1) %data, i32 %input) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !5 !kernel_arg_type !6 !kernel_arg_base_type !6 !kernel_arg_type_qual !7 { entry: ; CHECK-LLVM: %[[BITCAST_RES:[[:alnum:].]+]] = bitcast ptr addrspace(1) %{{[[:alnum:].]+}} to ptr addrspace(1) - %ptr = bitcast i32 addrspace(1)* %data to i8 addrspace(1)* + %ptr = bitcast ptr addrspace(1) %data to ptr addrspace(1) ; CHECK-LLVM: %[[#ZERO_INIT_BITCAST:]] = bitcast ptr addrspace(2) [[ZERO_INIT]] to ptr addrspace(2) ; CHECK-LLVM: call void @llvm.memcpy.p1.p2.i64(ptr addrspace(1) align 8 %[[BITCAST_RES]], ptr addrspace(2) align 8 %[[#ZERO_INIT_BITCAST]], i64 8, i1 false) - call void @llvm.memset.p1i8.i64(i8 addrspace(1)* align 8 %ptr, i8 0, i64 8, i1 false) + call void @llvm.memset.p1.i64(ptr addrspace(1) align 8 %ptr, i8 0, i64 8, i1 false) ; CHECK-LLVM: store i8 0, ptr addrspace(1) %[[BITCAST_RES]] - store i8 0, i8 addrspace(1)* %ptr + store i8 0, ptr addrspace(1) %ptr ret void } ; Function Attrs: argmemonly nounwind willreturn writeonly -declare void @llvm.memset.p1i8.i64(i8 addrspace(1)* nocapture writeonly, i8, i64, i1 immarg) #1 +declare void @llvm.memset.p1.i64(ptr addrspace(1) nocapture writeonly, i8, i64, i1 immarg) #1 attributes #0 = { convergent noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "denorms-are-zero"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "uniform-work-group-size"="true" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { argmemonly nounwind willreturn writeonly } diff --git a/test/transcoding/memory_access.ll b/test/transcoding/memory_access.ll index 2d019c6f2a..132933f078 100644 --- a/test/transcoding/memory_access.ll +++ b/test/transcoding/memory_access.ll @@ -37,24 +37,24 @@ target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256: target triple = "spir64-unknown-unknown" ; Function Attrs: nounwind -define spir_kernel void @test_load_store(i32 addrspace(1)* %destMemory, i32 addrspace(1)* %oldValues, i32 %newValue) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { +define spir_kernel void @test_load_store(ptr addrspace(1) %destMemory, ptr addrspace(1) %oldValues, i32 %newValue) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { entry: - %ptr = alloca i32 addrspace(4)*, align 8 - %0 = addrspacecast i32 addrspace(1)* %oldValues to i32 addrspace(4)* - store volatile i32 addrspace(4)* %0, i32 addrspace(4)** %ptr, align 8 - %1 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr, align 8 - %2 = load i32, i32 addrspace(4)* %1, align 4 - %call = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)* %destMemory, i32 %2, i32 %newValue) - %3 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr, align 8 - %4 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr - %5 = load volatile i32 addrspace(4)*, i32 addrspace(4)** %ptr, align 8, !nontemporal !9 - %arrayidx = getelementptr inbounds i32, i32 addrspace(4)* %3, i64 0 - store i32 %call, i32 addrspace(4)* %arrayidx, align 4, !nontemporal !9 - store i32 addrspace(4)* %5, i32 addrspace(4)** %ptr + %ptr = alloca ptr addrspace(4), align 8 + %0 = addrspacecast ptr addrspace(1) %oldValues to ptr addrspace(4) + store volatile ptr addrspace(4) %0, ptr %ptr, align 8 + %1 = load volatile ptr addrspace(4), ptr %ptr, align 8 + %2 = load i32, ptr addrspace(4) %1, align 4 + %call = call spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(ptr addrspace(1) %destMemory, i32 %2, i32 %newValue) + %3 = load volatile ptr addrspace(4), ptr %ptr, align 8 + %4 = load volatile ptr addrspace(4), ptr %ptr + %5 = load volatile ptr addrspace(4), ptr %ptr, align 8, !nontemporal !9 + %arrayidx = getelementptr inbounds i32, ptr addrspace(4) %3, i64 0 + store i32 %call, ptr addrspace(4) %arrayidx, align 4, !nontemporal !9 + store ptr addrspace(4) %5, ptr %ptr ret void } -declare spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(i32 addrspace(1)*, i32, i32) #1 +declare spir_func i32 @_Z14atomic_cmpxchgPVU3AS1iii(ptr addrspace(1), i32, i32) #1 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } diff --git a/test/transcoding/spirv-private-array-initialization.ll b/test/transcoding/spirv-private-array-initialization.ll index a40b253393..6de1ea4f3b 100644 --- a/test/transcoding/spirv-private-array-initialization.ll +++ b/test/transcoding/spirv-private-array-initialization.ll @@ -44,9 +44,9 @@ entry: %arr = alloca [3 x i32], align 4 %arr2 = alloca [3 x i32], align 4 %0 = bitcast ptr %arr to ptr - call void @llvm.memcpy.p0.p2.i32(ptr align 4 %0, ptr addrspace(2) align 4 bitcast (ptr addrspace(2) @__const.test.arr to ptr addrspace(2)), i32 12, i1 false) + call void @llvm.memcpy.p0.p2.i32(ptr align 4 %0, ptr addrspace(2) align 4 @__const.test.arr, i32 12, i1 false) %1 = bitcast ptr %arr2 to ptr - call void @llvm.memcpy.p0.p2.i32(ptr align 4 %1, ptr addrspace(2) align 4 bitcast (ptr addrspace(2) @__const.test.arr2 to ptr addrspace(2)), i32 12, i1 false) + call void @llvm.memcpy.p0.p2.i32(ptr align 4 %1, ptr addrspace(2) align 4 @__const.test.arr2, i32 12, i1 false) ret void } From 643d3936287f274a68d48ab9047dc2be02a93cdd Mon Sep 17 00:00:00 2001 From: Sven van Haastregt Date: Fri, 15 Sep 2023 14:39:18 +0100 Subject: [PATCH 2/2] Drop unused types and unneeded bitcasts --- test/transcoding/CreatePipeFromPipeStorage.ll | 1 - .../OpPhi_ArgumentsPlaceholders.ll | 1 - test/transcoding/annotate_attribute.ll | 71 ++++++++----------- 3 files changed, 28 insertions(+), 45 deletions(-) diff --git a/test/transcoding/CreatePipeFromPipeStorage.ll b/test/transcoding/CreatePipeFromPipeStorage.ll index bfaf5b0b5b..ea780cf7d3 100644 --- a/test/transcoding/CreatePipeFromPipeStorage.ll +++ b/test/transcoding/CreatePipeFromPipeStorage.ll @@ -37,7 +37,6 @@ target triple = "spir-unknown-unknown" %spirv.ConstantPipeStorage = type { i32, i32, i32 } %"class.cl::pipe_storage" = type { ptr addrspace(1) } -%spirv.PipeStorage = type opaque %"class.cl::pipe" = type { target("spirv.Pipe", 0) } %"class.cl::pipe" = type { target("spirv.Pipe", 1) } diff --git a/test/transcoding/OpPhi_ArgumentsPlaceholders.ll b/test/transcoding/OpPhi_ArgumentsPlaceholders.ll index d60d7d4779..fba769cc25 100644 --- a/test/transcoding/OpPhi_ArgumentsPlaceholders.ll +++ b/test/transcoding/OpPhi_ArgumentsPlaceholders.ll @@ -24,7 +24,6 @@ target datalayout = "e-p:32:32-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:2 target triple = "spir" %struct.Node = type { ptr addrspace(1) } -%struct.Node.0 = type opaque ; Function Attrs: nounwind define spir_kernel void @verify_linked_lists(ptr addrspace(1) %pNodes) #0 !kernel_arg_addr_space !1 !kernel_arg_access_qual !2 !kernel_arg_type !3 !kernel_arg_base_type !4 !kernel_arg_type_qual !5 { diff --git a/test/transcoding/annotate_attribute.ll b/test/transcoding/annotate_attribute.ll index 6461fe018d..9f3d50f84b 100644 --- a/test/transcoding/annotate_attribute.ll +++ b/test/transcoding/annotate_attribute.ll @@ -78,11 +78,9 @@ target triple = "spir64-unknown-linux" define spir_kernel void @_ZTSZ4mainE15kernel_function() #0 !kernel_arg_addr_space !4 !kernel_arg_access_qual !4 !kernel_arg_type !4 !kernel_arg_base_type !4 !kernel_arg_type_qual !4 { entry: %0 = alloca %class.anon, align 1 - %1 = bitcast ptr %0 to ptr - call void @llvm.lifetime.start.p0(i64 1, ptr %1) #4 + call void @llvm.lifetime.start.p0(i64 1, ptr %0) #4 call spir_func void @"_ZZ4mainENK3$_0clEv"(ptr %0) - %2 = bitcast ptr %0 to ptr - call void @llvm.lifetime.end.p0(i64 1, ptr %2) #4 + call void @llvm.lifetime.end.p0(i64 1, ptr %0) #4 ret void } @@ -110,16 +108,12 @@ entry: %var_two = alloca i32, align 4 %var_three = alloca i8, align 1 %var_four = alloca i8, align 1 - %0 = bitcast ptr %var_one to ptr - call void @llvm.lifetime.start.p0(i64 4, ptr %0) #4 - %var_one1 = bitcast ptr %var_one to ptr + call void @llvm.lifetime.start.p0(i64 4, ptr %var_one) #4 ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR]], ptr undef, i32 undef, ptr undef) - call void @llvm.var.annotation(ptr %var_one1, ptr @.str, ptr @.str.1, i32 2, ptr undef) - %1 = bitcast ptr %var_two to ptr - call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4 - %var_two2 = bitcast ptr %var_two to ptr + call void @llvm.var.annotation(ptr %var_one, ptr @.str, ptr @.str.1, i32 2, ptr undef) + call void @llvm.lifetime.start.p0(i64 4, ptr %var_two) #4 ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR2]], ptr undef, i32 undef, ptr undef) - call void @llvm.var.annotation(ptr %var_two2, ptr @.str.2, ptr @.str.1, i32 3, ptr undef) + call void @llvm.var.annotation(ptr %var_two, ptr @.str.2, ptr @.str.1, i32 3, ptr undef) call void @llvm.lifetime.start.p0(i64 1, ptr %var_three) #4 ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR3]], ptr undef, i32 undef, ptr undef) call void @llvm.var.annotation(ptr %var_three, ptr @.str.3, ptr @.str.1, i32 4, ptr undef) @@ -128,10 +122,8 @@ entry: ; CHECK-LLVM: call void @llvm.var.annotation.p0.p0(ptr %{{.*}}, ptr [[STR7]], ptr undef, i32 undef, ptr undef) call void @llvm.var.annotation(ptr %var_four, ptr @.str.7, ptr @.str.1, i32 4, ptr @.args.0) call void @llvm.lifetime.end.p0(i64 1, ptr %var_four) #4 - %2 = bitcast ptr %var_two to ptr - call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4 - %3 = bitcast ptr %var_one to ptr - call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4 + call void @llvm.lifetime.end.p0(i64 4, ptr %var_two) #4 + call void @llvm.lifetime.end.p0(i64 4, ptr %var_one) #4 ret void } @@ -142,32 +134,28 @@ declare void @llvm.var.annotation(ptr, ptr, ptr, i32, ptr) #4 define spir_func void @_Z3bazv() #3 { entry: %s1 = alloca %struct.bar, align 4 - %0 = bitcast ptr %s1 to ptr - call void @llvm.lifetime.start.p0(i64 8, ptr %0) #4 + call void @llvm.lifetime.start.p0(i64 8, ptr %s1) #4 ; CHECK-LLVM: %[[FIELD1:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD1]]{{.*}}[[STR4]] %f1 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 0 - %1 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f1, ptr @.str.4, ptr @.str.1, i32 8, ptr undef) - store i32 0, ptr %1, align 4, !tbaa !9 + %0 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f1, ptr @.str.4, ptr @.str.1, i32 8, ptr undef) + store i32 0, ptr %0, align 4, !tbaa !9 ; CHECK-LLVM: %[[FIELD2:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 1 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD2]]{{.*}}[[STR5]] %f2 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 1 - %2 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f2, ptr @.str.5, ptr @.str.1, i32 9, ptr undef) - store i8 0, ptr %2, align 4, !tbaa !13 + %1 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f2, ptr @.str.5, ptr @.str.1, i32 9, ptr undef) + store i8 0, ptr %1, align 4, !tbaa !13 ; CHECK-LLVM: %[[FIELD3:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 2 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD3]]{{.*}}[[STR6]] %f3 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 2 - %3 = bitcast ptr %f3 to ptr - %4 = call ptr @llvm.ptr.annotation.p0.p0(ptr %3, ptr @.str.6, ptr @.str.1, i32 9, ptr undef) - %5 = bitcast ptr %4 to ptr - store float 0.000000e+00,ptr %5, align 4, !tbaa !14 + %2 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f3, ptr @.str.6, ptr @.str.1, i32 9, ptr undef) + store float 0.000000e+00,ptr %2, align 4, !tbaa !14 ; CHECK-LLVM: %[[FIELD4:.*]] = getelementptr inbounds %struct.bar, ptr %{{[a-zA-Z0-9]+}}, i32 0, i32 3 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0{{.*}}%[[FIELD4]]{{.*}}[[STR8]] %f4 = getelementptr inbounds %struct.bar, ptr %s1, i32 0, i32 3 - %6 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f4, ptr @.str.7, ptr @.str.1, i32 9, ptr @.args.1) - store i8 0, ptr %6, align 4, !tbaa !13 - %7 = bitcast ptr %s1 to ptr - call void @llvm.lifetime.end.p0(i64 12, ptr %7) #4 + %3 = call ptr @llvm.ptr.annotation.p0.p0(ptr %f4, ptr @.str.7, ptr @.str.1, i32 9, ptr @.args.1) + store i8 0, ptr %3, align 4, !tbaa !13 + call void @llvm.lifetime.end.p0(i64 12, ptr %s1) #4 ret void } @@ -219,22 +207,19 @@ entry: ; Function Attrs: mustprogress norecurse define weak_odr dso_local spir_kernel void @_ZTSZ11TestKernelAvE4MyIP(ptr addrspace(1) noundef align 4 %0) local_unnamed_addr #5 !kernel_arg_buffer_location !15 !sycl_kernel_omit_args !16 { %2 = alloca %struct.MyIP, align 8 - %3 = bitcast ptr %2 to ptr - call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4 - %4 = addrspacecast ptr %3 to ptr addrspace(4) - %5 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p0(ptr addrspace(4) %4, ptr @.str.11, ptr @.str.1.12, i32 13, ptr @.args) + call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4 + %3 = addrspacecast ptr %2 to ptr addrspace(4) + %4 = call ptr addrspace(4) @llvm.ptr.annotation.p4.p0(ptr addrspace(4) %3, ptr @.str.11, ptr @.str.1.12, i32 13, ptr @.args) ; CHECK-LLVM: %[[ALLOCA:.*]] = alloca %struct.MyIP, align 8 ; CHECK-LLVM: %[[GEP:.*]] = getelementptr inbounds %struct.MyIP, ptr %[[ALLOCA]], i32 0, i32 0 ; CHECK-LLVM: call ptr @llvm.ptr.annotation.p0.p0(ptr %[[GEP]], ptr [[STR12]], ptr undef, i32 undef, ptr undef) - %6 = bitcast ptr addrspace(4) %5 to ptr addrspace(4) - %7 = addrspacecast ptr addrspace(1) %0 to ptr addrspace(4) - store ptr addrspace(4) %7, ptr addrspace(4) %6, align 8, !tbaa !17 - %8 = bitcast ptr addrspace(4) %5 to ptr addrspace(4) - %9 = load ptr addrspace(4), ptr addrspace(4) %8, align 8, !tbaa !17 - %10 = load i32, ptr addrspace(4) %9, align 4, !tbaa !19 - %11 = shl nsw i32 %10, 1 - store i32 %11, ptr addrspace(4) %9, align 4, !tbaa !19 - call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4 + %5 = addrspacecast ptr addrspace(1) %0 to ptr addrspace(4) + store ptr addrspace(4) %5, ptr addrspace(4) %4, align 8, !tbaa !17 + %6 = load ptr addrspace(4), ptr addrspace(4) %4, align 8, !tbaa !17 + %7 = load i32, ptr addrspace(4) %6, align 4, !tbaa !19 + %8 = shl nsw i32 %7, 1 + store i32 %8, ptr addrspace(4) %6, align 4, !tbaa !19 + call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4 ret void }