; LLVM IR from NVIDIA/TensorRT :: plugin/priorBoxPlugin/priorBoxPlugin.ll (ZN8nvinfer16plugin8PriorBox7destroyEv)

; 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"

%"class.nvinfer1::plugin::PriorBox" = type { %"class.nvinfer1::IPluginV2Ext", %"struct.nvinfer1::plugin::PriorBoxParameters", i32, i32, i32, %"class.nvinfer1::Weights", %"class.nvinfer1::Weights", %"class.nvinfer1::Weights", %"class.std::vector.0", %"class.std::vector.0", %"class.std::vector.0", %"class.std::__cxx11::basic_string" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { ptr }
%"struct.nvinfer1::plugin::PriorBoxParameters" = type { ptr, ptr, ptr, i32, i32, i32, i8, i8, [4 x float], i32, i32, float, float, float }
%"class.nvinfer1::Weights" = type { i32, ptr, i64 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl" = type { %"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" }
%"struct.std::_Vector_base<float, std::allocator<float>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str = external hidden unnamed_addr constant [90 x i8], align 1
@__func__._ZN8nvinfer16plugin8PriorBox7destroyEv = external hidden unnamed_addr constant [8 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin8PriorBox7destroyEv(ptr noundef nonnull align 8 dereferenceable(280) %0) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %10 = getelementptr inbounds %"class.nvinfer1::plugin::PriorBox", ptr %9, i32 0, i32 5
  %11 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %10, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = invoke i32 @cudaFree(ptr noundef %12)
          to label %14 unwind label %73

14:                                               ; preds = %1
  store i32 %13, ptr %3, align 4, !tbaa !26
  %15 = load i32, ptr %3, align 4, !tbaa !26
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %18 = load i32, ptr %3, align 4, !tbaa !26
  %19 = invoke ptr @cudaGetErrorString(i32 noundef %18)
          to label %20 unwind label %73

20:                                               ; preds = %17
  store ptr %19, ptr %4, align 8, !tbaa !5
  %21 = load i32, ptr %3, align 4, !tbaa !26
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN8nvinfer16plugin14throwCudaErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin8PriorBox7destroyEv, i32 noundef 263, i32 noundef %21, ptr noundef %22) #6
          to label %23 unwind label %73

23:                                               ; preds = %20
  unreachable

24:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %25 = getelementptr inbounds %"class.nvinfer1::plugin::PriorBox", ptr %9, i32 0, i32 1
  %26 = getelementptr inbounds %"struct.nvinfer1::plugin::PriorBoxParameters", ptr %25, i32 0, i32 4
  %27 = load i32, ptr %26, align 4, !tbaa !28
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %29, label %45

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %30 = getelementptr inbounds %"class.nvinfer1::plugin::PriorBox", ptr %9, i32 0, i32 6
  %31 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %30, i32 0, i32 1
  %32 = load ptr, ptr %31, align 8, !tbaa !29
  %33 = invoke i32 @cudaFree(ptr noundef %32)
          to label %34 unwind label %73

34:                                               ; preds = %29
  store i32 %33, ptr %5, align 4, !tbaa !26
  %35 = load i32, ptr %5, align 4, !tbaa !26
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %38 = load i32, ptr %5, align 4, !tbaa !26
  %39 = invoke ptr @cudaGetErrorString(i32 noundef %38)
          to label %40 unwind label %73

40:                                               ; preds = %37
  store ptr %39, ptr %6, align 8, !tbaa !5
  %41 = load i32, ptr %5, align 4, !tbaa !26
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN8nvinfer16plugin14throwCudaErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin8PriorBox7destroyEv, i32 noundef 266, i32 noundef %41, ptr noundef %42) #6
          to label %43 unwind label %73

43:                                               ; preds = %40
  unreachable

44:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %45

45:                                               ; preds = %44, %24
  %46 = getelementptr inbounds %"class.nvinfer1::plugin::PriorBox", ptr %9, i32 0, i32 1
  %47 = getelementptr inbounds %"struct.nvinfer1::plugin::PriorBoxParameters", ptr %46, i32 0, i32 5
  %48 = load i32, ptr %47, align 8, !tbaa !30
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %50, label %66

50:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %51 = getelementptr inbounds %"class.nvinfer1::plugin::PriorBox", ptr %9, i32 0, i32 7
  %52 = getelementptr inbounds %"class.nvinfer1::Weights", ptr %51, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !31
  %54 = invoke i32 @cudaFree(ptr noundef %53)
          to label %55 unwind label %73

55:                                               ; preds = %50
  store i32 %54, ptr %7, align 4, !tbaa !26
  %56 = load i32, ptr %7, align 4, !tbaa !26
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %65

58:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %59 = load i32, ptr %7, align 4, !tbaa !26
  %60 = invoke ptr @cudaGetErrorString(i32 noundef %59)
          to label %61 unwind label %73

61:                                               ; preds = %58
  store ptr %60, ptr %8, align 8, !tbaa !5
  %62 = load i32, ptr %7, align 4, !tbaa !26
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  invoke void @_ZN8nvinfer16plugin14throwCudaErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin8PriorBox7destroyEv, i32 noundef 270, i32 noundef %62, ptr noundef %63) #6
          to label %64 unwind label %73

64:                                               ; preds = %61
  unreachable

65:                                               ; preds = %55
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %66

66:                                               ; preds = %65, %45
  %67 = icmp eq ptr %9, null
  br i1 %67, label %72, label %68

68:                                               ; preds = %66
  %69 = load ptr, ptr %9, align 8, !tbaa !32
  %70 = getelementptr inbounds ptr, ptr %69, i64 18
  %71 = load ptr, ptr %70, align 8
  call void %71(ptr noundef nonnull align 8 dereferenceable(280) %9) #5
  br label %72

72:                                               ; preds = %68, %66
  ret void

73:                                               ; preds = %61, %58, %50, %40, %37, %29, %20, %17, %1
  %74 = landingpad { ptr, i32 }
          catch ptr null
  %75 = extractvalue { ptr, i32 } %74, 0
  call void @__clang_call_terminate(ptr %75) #7
  unreachable
}

declare i32 @cudaFree(ptr noundef) #3

declare ptr @cudaGetErrorString(i32 noundef) #3

; Function Attrs: noreturn
declare void @_ZN8nvinfer16plugin14throwCudaErrorEPKcS2_iiS2_(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { noinline noreturn nounwind uwtable "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 = { "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 = { noreturn "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 }
attributes #6 = { noreturn }
attributes #7 = { noreturn 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, !6, i64 112}
!10 = !{!"_ZTSN8nvinfer16plugin8PriorBoxE", !11, i64 0, !13, i64 8, !14, i64 88, !14, i64 92, !14, i64 96, !17, i64 104, !17, i64 128, !17, i64 152, !20, i64 176, !20, i64 200, !20, i64 224, !24, i64 248}
!11 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !12, i64 0}
!12 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!13 = !{!"_ZTSN8nvinfer16plugin18PriorBoxParametersE", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !14, i64 28, !14, i64 32, !15, i64 36, !15, i64 37, !7, i64 40, !14, i64 56, !14, i64 60, !16, i64 64, !16, i64 68, !16, i64 72}
!14 = !{!"int", !7, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"float", !7, i64 0}
!17 = !{!"_ZTSN8nvinfer17WeightsE", !18, i64 0, !6, i64 8, !19, i64 16}
!18 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!19 = !{!"long", !7, i64 0}
!20 = !{!"_ZTSSt6vectorIfSaIfEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !25, i64 0, !19, i64 8, !7, i64 16}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!26 = !{!27, !27, i64 0}
!27 = !{!"_ZTS9cudaError", !7, i64 0}
!28 = !{!10, !14, i64 36}
!29 = !{!10, !6, i64 136}
!30 = !{!10, !14, i64 40}
!31 = !{!10, !6, i64 160}
!32 = !{!33, !33, i64 0}
!33 = !{!"vtable pointer", !8, i64 0}


; 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"

@.str = external hidden unnamed_addr constant [90 x i8], align 1
@__func__._ZN8nvinfer16plugin8PriorBox7destroyEv = external hidden unnamed_addr constant [8 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noinline noreturn nounwind uwtable
declare hidden void @__clang_call_terminate(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN8nvinfer16plugin8PriorBox7destroyEv(ptr noundef nonnull align 8 dereferenceable(280) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 112
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = invoke i32 @cudaFree(ptr noundef %3)
          to label %5 unwind label %37

5:                                                ; preds = %1
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %8, label %6

6:                                                ; preds = %5
  %7 = invoke ptr @cudaGetErrorString(i32 noundef %4)
          to label %.invoke unwind label %37

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 36
  %10 = load i32, ptr %9, align 4, !tbaa !25
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %12, label %19

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 136
  %14 = load ptr, ptr %13, align 8, !tbaa !26
  %15 = invoke i32 @cudaFree(ptr noundef %14)
          to label %16 unwind label %37

16:                                               ; preds = %12
  %.not14 = icmp eq i32 %15, 0
  br i1 %.not14, label %19, label %17

17:                                               ; preds = %16
  %18 = invoke ptr @cudaGetErrorString(i32 noundef %15)
          to label %.invoke unwind label %37

19:                                               ; preds = %16, %8
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  %21 = load i32, ptr %20, align 8, !tbaa !27
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %23, label %33

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %0, i64 160
  %25 = load ptr, ptr %24, align 8, !tbaa !28
  %26 = invoke i32 @cudaFree(ptr noundef %25)
          to label %27 unwind label %37

27:                                               ; preds = %23
  %.not15 = icmp eq i32 %26, 0
  br i1 %.not15, label %33, label %28

28:                                               ; preds = %27
  %29 = invoke ptr @cudaGetErrorString(i32 noundef %26)
          to label %.invoke unwind label %37

.invoke:                                          ; preds = %28, %17, %6
  %30 = phi i32 [ 263, %6 ], [ 266, %17 ], [ 270, %28 ]
  %31 = phi i32 [ %4, %6 ], [ %15, %17 ], [ %26, %28 ]
  %32 = phi ptr [ %7, %6 ], [ %18, %17 ], [ %29, %28 ]
  invoke void @_ZN8nvinfer16plugin14throwCudaErrorEPKcS2_iiS2_(ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN8nvinfer16plugin8PriorBox7destroyEv, i32 noundef %30, i32 noundef %31, ptr noundef %32) #4
          to label %.cont unwind label %37

.cont:                                            ; preds = %.invoke
  unreachable

33:                                               ; preds = %19, %27
  %34 = load ptr, ptr %0, align 8, !tbaa !29
  %35 = getelementptr inbounds i8, ptr %34, i64 144
  %36 = load ptr, ptr %35, align 8
  tail call void %36(ptr noundef nonnull align 8 dereferenceable(280) %0) #5
  ret void

37:                                               ; preds = %.invoke, %28, %23, %17, %12, %6, %1
  %38 = landingpad { ptr, i32 }
          catch ptr null
  %39 = extractvalue { ptr, i32 } %38, 0
  tail call void @__clang_call_terminate(ptr %39) #6
  unreachable
}

declare i32 @cudaFree(ptr noundef) local_unnamed_addr #2

declare ptr @cudaGetErrorString(i32 noundef) local_unnamed_addr #2

; Function Attrs: noreturn
declare void @_ZN8nvinfer16plugin14throwCudaErrorEPKcS2_iiS2_(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

attributes #0 = { noinline noreturn nounwind uwtable "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 #1 = { 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 #2 = { "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 = { noreturn "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 = { noreturn }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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, !10, i64 112}
!6 = !{!"_ZTSN8nvinfer16plugin8PriorBoxE", !7, i64 0, !9, i64 8, !13, i64 88, !13, i64 92, !13, i64 96, !16, i64 104, !16, i64 128, !16, i64 152, !19, i64 176, !19, i64 200, !19, i64 224, !23, i64 248}
!7 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !8, i64 0}
!8 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!9 = !{!"_ZTSN8nvinfer16plugin18PriorBoxParametersE", !10, i64 0, !10, i64 8, !10, i64 16, !13, i64 24, !13, i64 28, !13, i64 32, !14, i64 36, !14, i64 37, !11, i64 40, !13, i64 56, !13, i64 60, !15, i64 64, !15, i64 68, !15, i64 72}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"int", !11, i64 0}
!14 = !{!"bool", !11, i64 0}
!15 = !{!"float", !11, i64 0}
!16 = !{!"_ZTSN8nvinfer17WeightsE", !17, i64 0, !10, i64 8, !18, i64 16}
!17 = !{!"_ZTSN8nvinfer18DataTypeE", !11, i64 0}
!18 = !{!"long", !11, i64 0}
!19 = !{!"_ZTSSt6vectorIfSaIfEE", !20, i64 0}
!20 = !{!"_ZTSSt12_Vector_baseIfSaIfEE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE12_Vector_implE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIfSaIfEE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !24, i64 0, !18, i64 8, !11, i64 16}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !10, i64 0}
!25 = !{!6, !13, i64 36}
!26 = !{!6, !10, i64 136}
!27 = !{!6, !13, i64 40}
!28 = !{!6, !10, i64 160}
!29 = !{!30, !30, i64 0}
!30 = !{!"vtable pointer", !12, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass