; LLVM IR from NVIDIA/TensorRT :: plugin/regionPlugin/regionPlugin.ll (ZN8nvinfer16plugin6RegionC2ENS0_16RegionParametersE)

; 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.nvinfer1::plugin::RegionParameters" = type { i32, i32, i32, ptr }
%"struct.nvinfer1::plugin::(anonymous namespace)::SoftmaxTreeDeleter" = type { i8 }
%"class.nvinfer1::plugin::Region" = type { %"class.nvinfer1::IPluginV2Ext", i32, i32, i32, %"class.std::shared_ptr", i32, i32, i32, i8, %"class.std::__cxx11::basic_string" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = type { ptr }
%"class.std::shared_ptr" = type { %"class.std::__shared_ptr" }
%"class.std::__shared_ptr" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { 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] }

@_ZTVN8nvinfer16plugin6RegionE = external dso_local unnamed_addr constant { [27 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8nvinfer16plugin6RegionC2ENS0_16RegionParametersE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef byval(%"struct.nvinfer1::plugin::RegionParameters") align 8 %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca %"struct.nvinfer1::plugin::(anonymous namespace)::SoftmaxTreeDeleter", align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #2
  store ptr getelementptr inbounds inrange(-16, 200) ({ [27 x ptr] }, ptr @_ZTVN8nvinfer16plugin6RegionE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %7, i32 0, i32 1
  %9 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !11
  store i32 %10, ptr %8, align 8, !tbaa !14
  %11 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %7, i32 0, i32 2
  %12 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 1
  %13 = load i32, ptr %12, align 4, !tbaa !25
  store i32 %13, ptr %11, align 4, !tbaa !26
  %14 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %7, i32 0, i32 3
  %15 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 2
  %16 = load i32, ptr %15, align 8, !tbaa !27
  store i32 %16, ptr %14, align 8, !tbaa !28
  %17 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %7, i32 0, i32 4
  %18 = getelementptr inbounds %"struct.nvinfer1::plugin::RegionParameters", ptr %1, i32 0, i32 3
  %19 = load ptr, ptr %18, align 8, !tbaa !29
  invoke void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef %19)
          to label %20 unwind label %22

20:                                               ; preds = %2
  %21 = getelementptr inbounds %"class.nvinfer1::plugin::Region", ptr %7, i32 0, i32 9
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %21) #2
  ret void

22:                                               ; preds = %2
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %5, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %6, align 4
  call void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %7) #2
  br label %26

26:                                               ; preds = %22
  %27 = load ptr, ptr %5, align 8
  %28 = load i32, ptr %6, align 4
  %29 = insertvalue { ptr, i32 } poison, ptr %27, 0
  %30 = insertvalue { ptr, i32 } %29, i32 %28, 1
  resume { ptr, i32 } %30
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

attributes #0 = { 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 #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 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"_ZTSN8nvinfer16plugin16RegionParametersE", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 8}
!15 = !{!"_ZTSN8nvinfer16plugin6RegionE", !16, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !18, i64 24, !13, i64 40, !13, i64 44, !13, i64 48, !21, i64 52, !22, i64 56}
!16 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !17, i64 0}
!17 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!18 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !19, i64 0}
!19 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !20, i64 8}
!20 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!21 = !{!"bool", !7, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !24, i64 8, !7, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!24 = !{!"long", !7, i64 0}
!25 = !{!12, !13, i64 4}
!26 = !{!15, !13, i64 12}
!27 = !{!12, !13, i64 8}
!28 = !{!15, !13, i64 16}
!29 = !{!12, !6, i64 16}


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

%"struct.nvinfer1::plugin::RegionParameters" = type { i32, i32, i32, ptr }

@_ZTVN8nvinfer16plugin6RegionE = external dso_local unnamed_addr constant { [27 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8nvinfer16plugin6RegionC2ENS0_16RegionParametersE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr nocapture noundef readonly byval(%"struct.nvinfer1::plugin::RegionParameters") align 8 %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #2
  store ptr getelementptr inbounds inrange(-16, 200) (i8, ptr @_ZTVN8nvinfer16plugin6RegionE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load <2 x i32>, ptr %1, align 8, !tbaa !8
  store <2 x i32> %4, ptr %3, align 8, !tbaa !8
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = getelementptr inbounds i8, ptr %1, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !11
  store i32 %7, ptr %5, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load ptr, ptr %9, align 8, !tbaa !25
  invoke void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef %10)
          to label %11 unwind label %13

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 56
  tail call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #2
  ret void

13:                                               ; preds = %2
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #2
  resume { ptr, i32 } %14
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer112IPluginV2ExtC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEEC2IS2_NS1_12_GLOBAL__N_118SoftmaxTreeDeleterEvEEPT_T0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN8nvinfer19IPluginV2D2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

attributes #0 = { 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 #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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !9, i64 8}
!12 = !{!"_ZTSN8nvinfer16plugin16RegionParametersE", !9, i64 0, !9, i64 4, !9, i64 8, !13, i64 16}
!13 = !{!"any pointer", !10, i64 0}
!14 = !{!15, !9, i64 16}
!15 = !{!"_ZTSN8nvinfer16plugin6RegionE", !16, i64 0, !9, i64 8, !9, i64 12, !9, i64 16, !18, i64 24, !9, i64 40, !9, i64 44, !9, i64 48, !21, i64 52, !22, i64 56}
!16 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !17, i64 0}
!17 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!18 = !{!"_ZTSSt10shared_ptrIN8nvinfer16plugin11softmaxTreeEE", !19, i64 0}
!19 = !{!"_ZTSSt12__shared_ptrIN8nvinfer16plugin11softmaxTreeELN9__gnu_cxx12_Lock_policyE2EE", !13, i64 0, !20, i64 8}
!20 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !13, i64 0}
!21 = !{!"bool", !10, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !24, i64 8, !10, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !13, i64 0}
!24 = !{!"long", !10, i64 0}
!25 = !{!12, !13, i64 16}


; Effective O3 passes: EarlyCSEPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass