; LLVM IR from NVIDIA/TensorRT :: plugin/geluPlugin/geluPlugin.ll (ZNK8nvinfer16plugin4bert17GeluPluginDynamic9serializeEPv)

; 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::bert::GeluPluginDynamic" = type { %"class.nvinfer1::IPluginV2DynamicExt", %"class.std::__cxx11::basic_string", %"class.std::__cxx11::basic_string", i32, i8, %"class.std::shared_ptr", i64 }
%"class.nvinfer1::IPluginV2DynamicExt" = type { %"class.nvinfer1::IPluginV2Ext" }
%"class.nvinfer1::IPluginV2Ext" = type { %"class.nvinfer1::IPluginV2" }
%"class.nvinfer1::IPluginV2" = 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] }
%"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 }

@.str = external hidden unnamed_addr constant [82 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN8nvinfer16plugin4bert14getElementSizeENS_8DataTypeE(i32 noundef) #1

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

declare void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef, ptr noundef, i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK8nvinfer16plugin4bert17GeluPluginDynamic9serializeEPv(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  %7 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 3
  invoke void @_Z15serialize_valueIN8nvinfer18DataTypeEEvPPvRKT_(ptr noundef %4, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %8 unwind label %35

8:                                                ; preds = %2
  %9 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 6
  invoke void @_Z15serialize_valueImEvPPvRKT_(ptr noundef %4, ptr noundef nonnull align 8 dereferenceable(8) %9)
          to label %10 unwind label %35

10:                                               ; preds = %8
  %11 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 4
  invoke void @_Z15serialize_valueIbEvPPvRKT_(ptr noundef %4, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %12 unwind label %35

12:                                               ; preds = %10
  %13 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 4
  %14 = load i8, ptr %13, align 4, !tbaa !9, !range !22, !noundef !23
  %15 = trunc i8 %14 to i1
  br i1 %15, label %16, label %34

16:                                               ; preds = %12
  %17 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 6
  %18 = load i64, ptr %17, align 8, !tbaa !24
  %19 = icmp ugt i64 %18, 0
  br i1 %19, label %22, label %20

20:                                               ; preds = %16
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef @.str.4, ptr noundef @.str, i32 noundef 270)
          to label %21 unwind label %35

21:                                               ; preds = %20
  br label %22

22:                                               ; preds = %21, %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %23, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 5
  %25 = call noundef ptr @_ZNKSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %24) #6
  %26 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 6
  %27 = load i64, ptr %26, align 8, !tbaa !24
  %28 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %6, i32 0, i32 3
  %29 = load i32, ptr %28, align 8, !tbaa !25
  %30 = call noundef i32 @_ZN8nvinfer16plugin4bert14getElementSizeENS_8DataTypeE(i32 noundef %29) #6
  %31 = zext i32 %30 to i64
  %32 = mul i64 %27, %31
  invoke void @_ZN8nvinfer16plugin4bert10serFromDevIcEEvRPcPKT_m(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef %25, i64 noundef %32)
          to label %33 unwind label %35

33:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %34

34:                                               ; preds = %33, %12
  ret void

35:                                               ; preds = %22, %20, %10, %8, %2
  %36 = landingpad { ptr, i32 }
          catch ptr null
  %37 = extractvalue { ptr, i32 } %36, 0
  call void @__clang_call_terminate(ptr %37) #7
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15serialize_valueIN8nvinfer18DataTypeEEvPPvRKT_(ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15serialize_valueImEvPPvRKT_(ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15serialize_valueIbEvPPvRKT_(ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8nvinfer16plugin4bert10serFromDevIcEEvRPcPKT_m(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #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 = { 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 = { inlinehint 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 #6 = { nounwind }
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, !18, i64 76}
!10 = !{!"_ZTSN8nvinfer16plugin4bert17GeluPluginDynamicE", !11, i64 0, !14, i64 8, !14, i64 40, !17, i64 72, !18, i64 76, !19, i64 80, !16, i64 96}
!11 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !12, i64 0}
!12 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !13, i64 0}
!13 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSSt10shared_ptrIvE", !20, i64 0}
!20 = !{!"_ZTSSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !16, i64 96}
!25 = !{!10, !17, i64 72}


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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN8nvinfer16plugin4bert14getElementSizeENS_8DataTypeE(i32 noundef) local_unnamed_addr #1

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

declare void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK8nvinfer16plugin4bert17GeluPluginDynamic9serializeEPv(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  invoke void @_Z15serialize_valueIN8nvinfer18DataTypeEEvPPvRKT_(ptr noundef nonnull %3, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %6 unwind label %27

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 96
  invoke void @_Z15serialize_valueImEvPPvRKT_(ptr noundef nonnull %3, ptr noundef nonnull align 8 dereferenceable(8) %7)
          to label %8 unwind label %27

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %0, i64 76
  invoke void @_Z15serialize_valueIbEvPPvRKT_(ptr noundef nonnull %3, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %10 unwind label %27

10:                                               ; preds = %8
  %11 = load i8, ptr %9, align 4, !tbaa !9, !range !22, !noundef !23
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %13, label %26

13:                                               ; preds = %10
  %14 = load i64, ptr %7, align 8, !tbaa !24
  %.not = icmp eq i64 %14, 0
  br i1 %.not, label %15, label %16

15:                                               ; preds = %13
  invoke void @_ZN8nvinfer16plugin15reportAssertionEPKcS2_i(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str, i32 noundef 270)
          to label %16 unwind label %27

16:                                               ; preds = %15, %13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %17, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 80
  %19 = call noundef ptr @_ZNKSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16) %18) #6
  %20 = load i64, ptr %7, align 8, !tbaa !24
  %21 = load i32, ptr %5, align 8, !tbaa !25
  %22 = call noundef i32 @_ZN8nvinfer16plugin4bert14getElementSizeENS_8DataTypeE(i32 noundef %21) #6
  %23 = zext i32 %22 to i64
  %24 = mul i64 %20, %23
  invoke void @_ZN8nvinfer16plugin4bert10serFromDevIcEEvRPcPKT_m(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef %19, i64 noundef %24)
          to label %25 unwind label %27

25:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %26

26:                                               ; preds = %25, %10
  ret void

27:                                               ; preds = %16, %15, %8, %6, %2
  %28 = landingpad { ptr, i32 }
          catch ptr null
  %29 = extractvalue { ptr, i32 } %28, 0
  call void @__clang_call_terminate(ptr %29) #7
  unreachable
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15serialize_valueIN8nvinfer18DataTypeEEvPPvRKT_(ptr noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15serialize_valueImEvPPvRKT_(ptr noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z15serialize_valueIbEvPPvRKT_(ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8nvinfer16plugin4bert10serFromDevIcEEvRPcPKT_m(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE3getEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #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 = { 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 = { inlinehint 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 #6 = { nounwind }
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, !18, i64 76}
!10 = !{!"_ZTSN8nvinfer16plugin4bert17GeluPluginDynamicE", !11, i64 0, !14, i64 8, !14, i64 40, !17, i64 72, !18, i64 76, !19, i64 80, !16, i64 96}
!11 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !12, i64 0}
!12 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !13, i64 0}
!13 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!14 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !15, i64 0, !16, i64 8, !7, i64 16}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = !{!"_ZTSSt10shared_ptrIvE", !20, i64 0}
!20 = !{!"_ZTSSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0, !21, i64 8}
!21 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !6, i64 0}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!10, !16, i64 96}
!25 = !{!10, !17, i64 72}


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