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

; 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::PluginTensorDesc" = type { %"class.nvinfer1::Dims64", i32, i32, float }
%"class.nvinfer1::Dims64" = type { i32, [8 x i64] }

@.str = external hidden unnamed_addr constant [121 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@__func__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii = external hidden unnamed_addr constant [26 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [41 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

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

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

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

declare ptr @__cxa_begin_catch(ptr)

; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii(ptr noundef nonnull align 8 dereferenceable(129) %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, i32 noundef %4) unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store i32 %4, ptr %11, align 4, !tbaa !9
  %16 = load ptr, ptr %7, align 8
  %17 = load ptr, ptr %9, 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__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii, i32 noundef 216, i32 noundef 0, ptr noundef @.str.14) #6
          to label %20 unwind label %21

20:                                               ; preds = %19
  unreachable

21:                                               ; preds = %59, %48, %39, %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 %82

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 %79

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

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

35:                                               ; preds = %34
  store i1 false, ptr %6, align 1
  br label %77

36:                                               ; preds = %5
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = icmp eq i32 %37, 2
  br i1 %38, label %41, label %39

39:                                               ; preds = %36
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii, i32 noundef 217, i32 noundef 0, ptr noundef @.str.11) #6
          to label %40 unwind label %21

40:                                               ; preds = %39
  unreachable

41:                                               ; preds = %36
  %42 = load i32, ptr %11, align 4, !tbaa !9
  %43 = load ptr, ptr %16, align 8, !tbaa !11
  %44 = getelementptr inbounds ptr, ptr %43, i64 3
  %45 = load ptr, ptr %44, align 8
  %46 = call noundef i32 %45(ptr noundef nonnull align 8 dereferenceable(8) %16) #7
  %47 = icmp eq i32 %42, %46
  br i1 %47, label %50, label %48

48:                                               ; preds = %41
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii, i32 noundef 218, i32 noundef 0, ptr noundef @.str.15) #6
          to label %49 unwind label %21

49:                                               ; preds = %48
  unreachable

50:                                               ; preds = %41
  %51 = load i32, ptr %8, align 4, !tbaa !9
  %52 = icmp sge i32 %51, 0
  br i1 %52, label %53, label %59

53:                                               ; preds = %50
  %54 = load i32, ptr %8, align 4, !tbaa !9
  %55 = load i32, ptr %10, align 4, !tbaa !9
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = add nsw i32 %55, %56
  %58 = icmp slt i32 %54, %57
  br i1 %58, label %61, label %59

59:                                               ; preds = %53, %50
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii, i32 noundef 219, i32 noundef 0, ptr noundef @.str.16) #6
          to label %60 unwind label %21

60:                                               ; preds = %59
  unreachable

61:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = load i32, ptr %8, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %62, i64 %64
  store ptr %65, ptr %14, align 8, !tbaa !5
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 8, !tbaa !13
  %69 = icmp eq i32 %68, 2
  br i1 %69, label %70, label %75

70:                                               ; preds = %61
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %71, i32 0, i32 2
  %73 = load i32, ptr %72, align 4, !tbaa !19
  %74 = icmp eq i32 %73, 5
  br label %75

75:                                               ; preds = %70, %61
  %76 = phi i1 [ false, %61 ], [ %74, %70 ]
  store i1 %76, ptr %6, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %77

77:                                               ; preds = %75, %35
  %78 = load i1, ptr %6, align 1
  ret i1 %78

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

82:                                               ; preds = %25
  %83 = load ptr, ptr %12, align 8
  call void @__clang_call_terminate(ptr %83) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind memory(none) }
attributes #3 = { 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 #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, !16, i64 72}
!14 = !{!"_ZTSN8nvinfer116PluginTensorDescE", !15, i64 0, !16, i64 72, !17, i64 76, !18, i64 80}
!15 = !{!"_ZTSN8nvinfer16Dims64E", !10, i64 0, !7, i64 8}
!16 = !{!"_ZTSN8nvinfer18DataTypeE", !7, i64 0}
!17 = !{!"_ZTSN8nvinfer112TensorFormatE", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!14, !17, i64 76}


; 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::PluginTensorDesc" = type { %"class.nvinfer1::Dims64", i32, i32, float }
%"class.nvinfer1::Dims64" = type { i32, [8 x i64] }

@.str = external hidden unnamed_addr constant [121 x i8], align 1
@_ZTISt9exception = external constant ptr
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@__func__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii = external hidden unnamed_addr constant [26 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [41 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 zeroext i1 @_ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii(ptr noundef nonnull align 8 dereferenceable(129) %0, i32 noundef %1, ptr noundef readonly %2, i32 noundef %3, i32 noundef %4) unnamed_addr #4 align 2 personality ptr @__gxx_personality_v0 {
  %.not = icmp eq ptr %2, 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 %43

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 %40

14:                                               ; preds = %12
  invoke void @__cxa_end_catch()
          to label %39 unwind label %40

15:                                               ; preds = %5
  %16 = icmp eq i32 %3, 2
  br i1 %16, label %17, label %.invoke

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

23:                                               ; preds = %17
  %24 = icmp sgt i32 %1, -1
  %25 = add nsw i32 %4, 2
  %26 = icmp sgt i32 %25, %1
  %or.cond = select i1 %24, i1 %26, i1 false
  br i1 %or.cond, label %29, label %.invoke

.invoke:                                          ; preds = %5, %23, %17, %15
  %27 = phi i32 [ 217, %15 ], [ 218, %17 ], [ 219, %23 ], [ 216, %5 ]
  %28 = phi ptr [ @.str.11, %15 ], [ @.str.15, %17 ], [ @.str.16, %23 ], [ @.str.14, %5 ]
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN8nvinfer16plugin4bert40SkipLayerNormInterleavedPluginBaseLegacy25supportsFormatCombinationEiPKNS_16PluginTensorDescEii, i32 noundef %27, i32 noundef 0, ptr noundef nonnull %28) #6
          to label %.cont unwind label %6

.cont:                                            ; preds = %.invoke
  unreachable

29:                                               ; preds = %23
  %30 = zext nneg i32 %1 to i64
  %31 = getelementptr inbounds %"struct.nvinfer1::PluginTensorDesc", ptr %2, i64 %30
  %32 = getelementptr inbounds i8, ptr %31, i64 72
  %33 = load i32, ptr %32, align 8, !tbaa !8
  %34 = icmp eq i32 %33, 2
  br i1 %34, label %35, label %39

35:                                               ; preds = %29
  %36 = getelementptr inbounds i8, ptr %31, i64 76
  %37 = load i32, ptr %36, align 4, !tbaa !16
  %38 = icmp eq i32 %37, 5
  br label %39

39:                                               ; preds = %29, %35, %14
  %.0 = phi i1 [ false, %14 ], [ false, %29 ], [ %38, %35 ]
  ret i1 %.0

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

43:                                               ; 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, !13, i64 72}
!9 = !{!"_ZTSN8nvinfer116PluginTensorDescE", !10, i64 0, !13, i64 72, !14, i64 76, !15, i64 80}
!10 = !{!"_ZTSN8nvinfer16Dims64E", !11, i64 0, !12, i64 8}
!11 = !{!"int", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = !{!"_ZTSN8nvinfer18DataTypeE", !12, i64 0}
!14 = !{!"_ZTSN8nvinfer112TensorFormatE", !12, i64 0}
!15 = !{!"float", !12, i64 0}
!16 = !{!9, !14, i64 76}


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