; LLVM IR from tensorflow/tensorflow :: tensorflow/c/experimental/stream_executor (stream_executor_test_util)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.SP_Platform = type { i64, ptr, ptr, ptr, i8, i8, i8 }
%struct.SP_PlatformFns = type { i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@_ZN15stream_executor9test_utilL11kDeviceNameE = external hidden constant [10 x i8], align 1
@_ZN15stream_executor9test_utilL11kDeviceTypeE = external hidden constant [4 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util14CreateTimerFnsEPK11SP_PlatformP11SP_TimerFnsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util15DestroyTimerFnsEPK11SP_PlatformP11SP_TimerFns(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util20CreateStreamExecutorEPK11SP_PlatformP29SE_CreateStreamExecutorParamsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util21DestroyStreamExecutorEPK11SP_PlatformP17SP_StreamExecutor(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util14GetDeviceCountEPK11SP_PlatformPiP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util12CreateDeviceEPK11SP_PlatformP21SE_CreateDeviceParamsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util13DestroyDeviceEPK11SP_PlatformP9SP_Device(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util15CreateDeviceFnsEPK11SP_PlatformP24SE_CreateDeviceFnsParamsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util16DestroyDeviceFnsEPK11SP_PlatformP12SP_DeviceFns(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN15stream_executor9test_util23PopulateDefaultPlatformEP11SP_PlatformP14SP_PlatformFns(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.SP_Platform, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 40, ptr %5) #5
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 40, i1 false)
  %6 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 0
  store i64 35, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 1
  %8 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 2
  %9 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 3
  %10 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 4
  %11 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 5
  %12 = getelementptr inbounds %struct.SP_Platform, ptr %5, i32 0, i32 6
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %5, i64 40, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.SP_Platform, ptr %14, i32 0, i32 2
  store ptr @_ZN15stream_executor9test_utilL11kDeviceNameE, ptr %15, align 8, !tbaa !15
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.SP_Platform, ptr %16, i32 0, i32 3
  store ptr @_ZN15stream_executor9test_utilL11kDeviceTypeE, ptr %17, align 8, !tbaa !16
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.SP_PlatformFns, ptr %18, i32 0, i32 2
  store ptr @_ZN15stream_executor9test_util14GetDeviceCountEPK11SP_PlatformPiP10TSL_Status, ptr %19, align 8, !tbaa !17
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.SP_PlatformFns, ptr %20, i32 0, i32 3
  store ptr @_ZN15stream_executor9test_util12CreateDeviceEPK11SP_PlatformP21SE_CreateDeviceParamsP10TSL_Status, ptr %21, align 8, !tbaa !19
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.SP_PlatformFns, ptr %22, i32 0, i32 4
  store ptr @_ZN15stream_executor9test_util13DestroyDeviceEPK11SP_PlatformP9SP_Device, ptr %23, align 8, !tbaa !20
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.SP_PlatformFns, ptr %24, i32 0, i32 5
  store ptr @_ZN15stream_executor9test_util15CreateDeviceFnsEPK11SP_PlatformP24SE_CreateDeviceFnsParamsP10TSL_Status, ptr %25, align 8, !tbaa !21
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.SP_PlatformFns, ptr %26, i32 0, i32 6
  store ptr @_ZN15stream_executor9test_util16DestroyDeviceFnsEPK11SP_PlatformP12SP_DeviceFns, ptr %27, align 8, !tbaa !22
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.SP_PlatformFns, ptr %28, i32 0, i32 7
  store ptr @_ZN15stream_executor9test_util20CreateStreamExecutorEPK11SP_PlatformP29SE_CreateStreamExecutorParamsP10TSL_Status, ptr %29, align 8, !tbaa !23
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.SP_PlatformFns, ptr %30, i32 0, i32 8
  store ptr @_ZN15stream_executor9test_util21DestroyStreamExecutorEPK11SP_PlatformP17SP_StreamExecutor, ptr %31, align 8, !tbaa !24
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.SP_PlatformFns, ptr %32, i32 0, i32 9
  store ptr @_ZN15stream_executor9test_util14CreateTimerFnsEPK11SP_PlatformP11SP_TimerFnsP10TSL_Status, ptr %33, align 8, !tbaa !25
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.SP_PlatformFns, ptr %34, i32 0, i32 10
  store ptr @_ZN15stream_executor9test_util15DestroyTimerFnsEPK11SP_PlatformP11SP_TimerFns, ptr %35, align 8, !tbaa !26
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTS11SP_Platform", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !7, i64 33, !7, i64 34}
!11 = !{!"long", !7, i64 0}
!12 = !{i64 0, i64 8, !13, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 8, !5, i64 32, i64 1, !14, i64 33, i64 1, !14, i64 34, i64 1, !14}
!13 = !{!11, !11, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!10, !6, i64 16}
!16 = !{!10, !6, i64 24}
!17 = !{!18, !6, i64 16}
!18 = !{!"_ZTS14SP_PlatformFns", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!19 = !{!18, !6, i64 24}
!20 = !{!18, !6, i64 32}
!21 = !{!18, !6, i64 40}
!22 = !{!18, !6, i64 48}
!23 = !{!18, !6, i64 56}
!24 = !{!18, !6, i64 64}
!25 = !{!18, !6, i64 72}
!26 = !{!18, !6, i64 80}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@_ZN15stream_executor9test_utilL11kDeviceNameE = external hidden constant [10 x i8], align 1
@_ZN15stream_executor9test_utilL11kDeviceTypeE = external hidden constant [4 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util14CreateTimerFnsEPK11SP_PlatformP11SP_TimerFnsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util15DestroyTimerFnsEPK11SP_PlatformP11SP_TimerFns(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util20CreateStreamExecutorEPK11SP_PlatformP29SE_CreateStreamExecutorParamsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util21DestroyStreamExecutorEPK11SP_PlatformP17SP_StreamExecutor(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util14GetDeviceCountEPK11SP_PlatformPiP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util12CreateDeviceEPK11SP_PlatformP21SE_CreateDeviceParamsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util13DestroyDeviceEPK11SP_PlatformP9SP_Device(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15stream_executor9test_util15CreateDeviceFnsEPK11SP_PlatformP24SE_CreateDeviceFnsParamsP10TSL_Status(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN15stream_executor9test_util16DestroyDeviceFnsEPK11SP_PlatformP12SP_DeviceFns(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @_ZN15stream_executor9test_util23PopulateDefaultPlatformEP11SP_PlatformP14SP_PlatformFns(ptr nocapture noundef writeonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #3 {
  store i64 35, ptr %0, align 8, !tbaa !5
  %.sroa.5.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %.sroa.5.0..sroa_idx, i8 0, i64 32, i1 false)
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr @_ZN15stream_executor9test_utilL11kDeviceNameE, ptr %3, align 8, !tbaa !9
  %4 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr @_ZN15stream_executor9test_utilL11kDeviceTypeE, ptr %4, align 8, !tbaa !12
  %5 = getelementptr inbounds i8, ptr %1, i64 16
  store ptr @_ZN15stream_executor9test_util14GetDeviceCountEPK11SP_PlatformPiP10TSL_Status, ptr %5, align 8, !tbaa !13
  %6 = getelementptr inbounds i8, ptr %1, i64 24
  store ptr @_ZN15stream_executor9test_util12CreateDeviceEPK11SP_PlatformP21SE_CreateDeviceParamsP10TSL_Status, ptr %6, align 8, !tbaa !15
  %7 = getelementptr inbounds i8, ptr %1, i64 32
  store ptr @_ZN15stream_executor9test_util13DestroyDeviceEPK11SP_PlatformP9SP_Device, ptr %7, align 8, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %1, i64 40
  store ptr @_ZN15stream_executor9test_util15CreateDeviceFnsEPK11SP_PlatformP24SE_CreateDeviceFnsParamsP10TSL_Status, ptr %8, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %1, i64 48
  store ptr @_ZN15stream_executor9test_util16DestroyDeviceFnsEPK11SP_PlatformP12SP_DeviceFns, ptr %9, align 8, !tbaa !18
  %10 = getelementptr inbounds i8, ptr %1, i64 56
  store ptr @_ZN15stream_executor9test_util20CreateStreamExecutorEPK11SP_PlatformP29SE_CreateStreamExecutorParamsP10TSL_Status, ptr %10, align 8, !tbaa !19
  %11 = getelementptr inbounds i8, ptr %1, i64 64
  store ptr @_ZN15stream_executor9test_util21DestroyStreamExecutorEPK11SP_PlatformP17SP_StreamExecutor, ptr %11, align 8, !tbaa !20
  %12 = getelementptr inbounds i8, ptr %1, i64 72
  store ptr @_ZN15stream_executor9test_util14CreateTimerFnsEPK11SP_PlatformP11SP_TimerFnsP10TSL_Status, ptr %12, align 8, !tbaa !21
  %13 = getelementptr inbounds i8, ptr %1, i64 80
  store ptr @_ZN15stream_executor9test_util15DestroyTimerFnsEPK11SP_PlatformP11SP_TimerFns, ptr %13, align 8, !tbaa !22
  ret void
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 16}
!10 = !{!"_ZTS11SP_Platform", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !7, i64 32, !7, i64 33, !7, i64 34}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 24}
!13 = !{!14, !11, i64 16}
!14 = !{!"_ZTS14SP_PlatformFns", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80}
!15 = !{!14, !11, i64 24}
!16 = !{!14, !11, i64 32}
!17 = !{!14, !11, i64 40}
!18 = !{!14, !11, i64 48}
!19 = !{!14, !11, i64 56}
!20 = !{!14, !11, i64 64}
!21 = !{!14, !11, i64 72}
!22 = !{!14, !11, i64 80}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass