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

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

; 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: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZNK8nvinfer16plugin4bert17GeluPluginDynamic20getSerializationSizeEv(ptr noundef nonnull align 8 dereferenceable(104) %0) unnamed_addr #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %6 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %5, i32 0, i32 3
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = call noundef i32 @_ZN8nvinfer16plugin4bert14getElementSizeENS_8DataTypeE(i32 noundef %7) #3
  %9 = zext i32 %8 to i64
  store i64 %9, ptr %3, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %10 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %5, i32 0, i32 4
  %11 = load i8, ptr %10, align 4, !tbaa !23, !range !24, !noundef !25
  %12 = trunc i8 %11 to i1
  br i1 %12, label %13, label %18

13:                                               ; preds = %1
  %14 = getelementptr inbounds %"class.nvinfer1::plugin::bert::GeluPluginDynamic", ptr %5, i32 0, i32 6
  %15 = load i64, ptr %14, align 8, !tbaa !26
  %16 = load i64, ptr %3, align 8, !tbaa !22
  %17 = mul i64 %15, %16
  br label %19

18:                                               ; preds = %1
  br label %19

19:                                               ; preds = %18, %13
  %20 = phi i64 [ %17, %13 ], [ 0, %18 ]
  store i64 %20, ptr %4, align 8, !tbaa !22
  %21 = load i64, ptr %4, align 8, !tbaa !22
  %22 = add i64 13, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret i64 %22
}

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 = { 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 = { 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, !17, i64 72}
!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 = !{!16, !16, i64 0}
!23 = !{!10, !18, i64 76}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!10, !16, i64 96}


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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i64 @_ZNK8nvinfer16plugin4bert17GeluPluginDynamic20getSerializationSizeEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(104) %0) unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 72
  %3 = load i32, ptr %2, align 8, !tbaa !5
  %4 = tail call noundef i32 @_ZN8nvinfer16plugin4bert14getElementSizeENS_8DataTypeE(i32 noundef %3) #2
  %5 = getelementptr inbounds i8, ptr %0, i64 76
  %6 = load i8, ptr %5, align 4, !tbaa !21, !range !22, !noundef !23
  %7 = trunc nuw i8 %6 to i1
  %8 = zext i32 %4 to i64
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  %10 = load i64, ptr %9, align 8
  %11 = mul i64 %10, %8
  %12 = add i64 %11, 13
  %13 = select i1 %7, i64 %12, i64 13
  ret i64 %13
}

attributes #0 = { 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 #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, !16, i64 72}
!6 = !{!"_ZTSN8nvinfer16plugin4bert17GeluPluginDynamicE", !7, i64 0, !10, i64 8, !10, i64 40, !16, i64 72, !17, i64 76, !18, i64 80, !15, i64 96}
!7 = !{!"_ZTSN8nvinfer119IPluginV2DynamicExtE", !8, i64 0}
!8 = !{!"_ZTSN8nvinfer112IPluginV2ExtE", !9, i64 0}
!9 = !{!"_ZTSN8nvinfer19IPluginV2E"}
!10 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !11, i64 0, !15, i64 8, !13, i64 16}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !12, i64 0}
!12 = !{!"any pointer", !13, i64 0}
!13 = !{!"omnipotent char", !14, i64 0}
!14 = !{!"Simple C++ TBAA"}
!15 = !{!"long", !13, i64 0}
!16 = !{!"_ZTSN8nvinfer18DataTypeE", !13, i64 0}
!17 = !{!"bool", !13, i64 0}
!18 = !{!"_ZTSSt10shared_ptrIvE", !19, i64 0}
!19 = !{!"_ZTSSt12__shared_ptrIvLN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0, !20, i64 8}
!20 = !{!"_ZTSSt14__shared_countILN9__gnu_cxx12_Lock_policyE2EE", !12, i64 0}
!21 = !{!6, !17, i64 76}
!22 = !{i8 0, i8 2}
!23 = !{}


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