; LLVM IR from NVIDIA/TensorRT :: plugin/skipLayerNormPlugin (skipLayerNormInt8InterleavedPlugin)

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

@.str = external hidden unnamed_addr constant [115 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.17 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1
@__func__._ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i = external hidden unnamed_addr constant [19 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [22 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: noreturn
declare void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #1

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

declare ptr @__cxa_begin_catch(ptr)

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

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

declare void @__cxa_end_catch()

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i(ptr noundef nonnull align 8 dereferenceable(193) %0, ptr noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  %16 = load ptr, ptr %7, align 8
  %17 = load ptr, ptr %10, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %36, label %19

19:                                               ; preds = %5
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i, i32 noundef 429, i32 noundef 0, ptr noundef @.str.28) #6
          to label %20 unwind label %21

20:                                               ; preds = %19
  unreachable

21:                                               ; preds = %49, %44, %19
  %22 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %12, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %13, align 4
  br label %25

25:                                               ; preds = %21
  %26 = load i32, ptr %13, align 4
  %27 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #7
  %28 = icmp eq i32 %26, %27
  br i1 %28, label %29, label %74

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %30 = load ptr, ptr %12, align 8
  %31 = call ptr @__cxa_begin_catch(ptr %30) #7
  store ptr %31, ptr %15, align 8
  %32 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @_ZN8nvinfer16plugin11caughtErrorERKSt9exception(ptr noundef nonnull align 8 dereferenceable(8) %32)
          to label %33 unwind label %71

33:                                               ; preds = %29
  invoke void @__cxa_end_catch()
          to label %34 unwind label %71

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

35:                                               ; preds = %34
  store i32 1, ptr %6, align 4
  br label %69

36:                                               ; preds = %5
  %37 = load i32, ptr %9, align 4, !tbaa !9
  %38 = getelementptr inbounds i8, ptr %16, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !11
  %40 = getelementptr inbounds ptr, ptr %39, i64 8
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef i32 %41(ptr noundef nonnull align 8 dereferenceable(8) %38) #7
  %43 = icmp eq i32 %37, %42
  br i1 %43, label %46, label %44

44:                                               ; preds = %36
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i, i32 noundef 430, i32 noundef 0, ptr noundef @.str.17) #6
          to label %45 unwind label %21

45:                                               ; preds = %44
  unreachable

46:                                               ; preds = %36
  %47 = load i32, ptr %11, align 4, !tbaa !9
  %48 = icmp eq i32 %47, 2
  br i1 %48, label %51, label %49

49:                                               ; preds = %46
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i, i32 noundef 431, i32 noundef 0, ptr noundef @.str.18) #6
          to label %50 unwind label %21

50:                                               ; preds = %49
  unreachable

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %52

52:                                               ; preds = %65, %51
  %53 = load i32, ptr %14, align 4, !tbaa !9
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %68

57:                                               ; preds = %52
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds i32, ptr %58, i64 0
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = load i32, ptr %14, align 4, !tbaa !9
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i32, ptr %61, i64 %63
  store i32 %60, ptr %64, align 4, !tbaa !13
  br label %65

65:                                               ; preds = %57
  %66 = load i32, ptr %14, align 4, !tbaa !9
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %14, align 4, !tbaa !9
  br label %52, !llvm.loop !15

68:                                               ; preds = %56
  store i32 0, ptr %6, align 4
  br label %69

69:                                               ; preds = %68, %35
  %70 = load i32, ptr %6, align 4
  ret i32 %70

71:                                               ; preds = %33, %29
  %72 = landingpad { ptr, i32 }
          catch ptr null
  %73 = extractvalue { ptr, i32 } %72, 0
  call void @__clang_call_terminate(ptr %73) #8
  unreachable

74:                                               ; preds = %25
  %75 = load ptr, ptr %12, align 8
  call void @__clang_call_terminate(ptr %75) #8
  unreachable
}

attributes #0 = { 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 #1 = { nounwind memory(none) }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 #6 = { noreturn }
attributes #7 = { nounwind }
attributes #8 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"vtable pointer", !8, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; 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 [115 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.17 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [14 x i8], align 1
@__func__._ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i = external hidden unnamed_addr constant [19 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [22 x i8], align 1

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: nofree nosync nounwind memory(none)
declare i32 @llvm.eh.typeid.for.p0(ptr) #1

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

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

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

declare void @__cxa_end_catch() local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i(ptr noundef nonnull align 8 dereferenceable(193) %0, ptr nocapture noundef writeonly %1, i32 noundef %2, ptr noundef readonly %3, i32 noundef %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %.invoke, label %15

6:                                                ; preds = %.invoke
  %7 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %8 = extractvalue { ptr, i32 } %7, 0
  %9 = extractvalue { ptr, i32 } %7, 1
  %10 = tail call i32 @llvm.eh.typeid.for.p0(ptr nonnull @_ZTISt9exception) #5
  %11 = icmp eq i32 %9, %10
  br i1 %11, label %12, label %34

12:                                               ; preds = %6
  %13 = tail call ptr @__cxa_begin_catch(ptr %8) #5
  invoke void @_ZN8nvinfer16plugin11caughtErrorERKSt9exception(ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %14 unwind label %31

14:                                               ; preds = %12
  invoke void @__cxa_end_catch()
          to label %.loopexit unwind label %31

15:                                               ; preds = %5
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 64
  %19 = load ptr, ptr %18, align 8
  %20 = tail call noundef i32 %19(ptr noundef nonnull align 8 dereferenceable(8) %16) #5
  %21 = icmp eq i32 %20, %2
  br i1 %21, label %22, label %.invoke

22:                                               ; preds = %15
  %23 = icmp eq i32 %4, 2
  br i1 %23, label %.preheader, label %.invoke

.preheader:                                       ; preds = %22
  %24 = icmp sgt i32 %2, 0
  br i1 %24, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.preheader
  %wide.trip.count = zext nneg i32 %2 to i64
  %.pre = load i32, ptr %3, align 4, !tbaa !8
  %min.iters.check = icmp ult i32 %2, 8
  br i1 %min.iters.check, label %.lr.ph.preheader19, label %vector.ph

.lr.ph.preheader19:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %.pre, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %25 = getelementptr inbounds i32, ptr %1, i64 %index
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x i32> %broadcast.splat, ptr %25, align 4, !tbaa !8
  store <4 x i32> %broadcast.splat, ptr %26, align 4, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.loopexit, label %.lr.ph.preheader19

.invoke:                                          ; preds = %5, %22, %15
  %28 = phi i32 [ 430, %15 ], [ 431, %22 ], [ 429, %5 ]
  %29 = phi ptr [ @.str.17, %15 ], [ @.str.18, %22 ], [ @.str.28, %5 ]
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZNK8nvinfer16plugin4bert34SkipLayerNormInterleavedPluginBase18getOutputDataTypesEPNS_8DataTypeEiPKS3_i, i32 noundef %28, i32 noundef 0, ptr noundef nonnull %29) #6
          to label %.cont unwind label %6

.cont:                                            ; preds = %.invoke
  unreachable

.lr.ph:                                           ; preds = %.lr.ph.preheader19, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader19 ]
  %30 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
  store i32 %.pre, ptr %30, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph, !llvm.loop !15

.loopexit:                                        ; preds = %.lr.ph, %middle.block, %.preheader, %14
  %.0 = phi i32 [ 1, %14 ], [ 0, %.preheader ], [ 0, %middle.block ], [ 0, %.lr.ph ]
  ret i32 %.0

31:                                               ; preds = %14, %12
  %32 = landingpad { ptr, i32 }
          catch ptr null
  %33 = extractvalue { ptr, i32 } %32, 0
  tail call void @__clang_call_terminate(ptr %33) #7
  unreachable

34:                                               ; preds = %6
  tail call void @__clang_call_terminate(ptr %8) #7
  unreachable
}

attributes #0 = { 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 #1 = { nofree nosync nounwind memory(none) }
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 = { 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 #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 }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"_ZTSN8nvinfer18DataTypeE", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12, !14, !13}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass