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

; 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::DimsExprs" = type { i32, [8 x ptr] }

@.str = external hidden unnamed_addr constant [100 x i8], align 1
@_ZTISt9exception = external constant ptr
@__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [15 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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

24:                                               ; preds = %8
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE, i32 noundef 632, i32 noundef 0, ptr noundef @.str.10) #7
          to label %25 unwind label %26

25:                                               ; preds = %24
  unreachable

26:                                               ; preds = %61, %49, %44, %24
  %27 = landingpad { ptr, i32 }
          catch ptr @_ZTISt9exception
          catch ptr null
  %28 = extractvalue { ptr, i32 } %27, 0
  store ptr %28, ptr %18, align 8
  %29 = extractvalue { ptr, i32 } %27, 1
  store i32 %29, ptr %19, align 4
  br label %30

30:                                               ; preds = %26
  %31 = load i32, ptr %19, align 4
  %32 = call i32 @llvm.eh.typeid.for.p0(ptr @_ZTISt9exception) #8
  %33 = icmp eq i32 %31, %32
  br i1 %33, label %34, label %73

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  %35 = load ptr, ptr %18, align 8
  %36 = call ptr @__cxa_begin_catch(ptr %35) #8
  store ptr %36, ptr %20, align 8
  %37 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN8nvinfer16plugin11caughtErrorERKSt9exception(ptr noundef nonnull align 8 dereferenceable(8) %37)
          to label %38 unwind label %70

38:                                               ; preds = %34
  invoke void @__cxa_end_catch()
          to label %39 unwind label %70

39:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %40

40:                                               ; preds = %39
  store i32 1, ptr %9, align 4
  br label %68

41:                                               ; preds = %8
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = icmp eq i32 %42, 2
  br i1 %43, label %46, label %44

44:                                               ; preds = %41
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE, i32 noundef 633, i32 noundef 0, ptr noundef @.str.11) #7
          to label %45 unwind label %26

45:                                               ; preds = %44
  unreachable

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

49:                                               ; preds = %46
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE, i32 noundef 634, i32 noundef 0, ptr noundef @.str.14) #7
          to label %50 unwind label %26

50:                                               ; preds = %49
  unreachable

51:                                               ; preds = %46
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds %"class.nvinfer1::DimsExprs", ptr %52, i64 0
  %54 = getelementptr inbounds %"class.nvinfer1::DimsExprs", ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 8, !tbaa !11
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = getelementptr inbounds %"class.nvinfer1::DimsExprs", ptr %56, i64 1
  %58 = getelementptr inbounds %"class.nvinfer1::DimsExprs", ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !11
  %60 = icmp eq i32 %55, %59
  br i1 %60, label %63, label %61

61:                                               ; preds = %51
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef @.str, ptr noundef @__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE, i32 noundef 635, i32 noundef 0, ptr noundef @.str.12) #7
          to label %62 unwind label %26

62:                                               ; preds = %61
  unreachable

63:                                               ; preds = %51
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = getelementptr inbounds %"class.nvinfer1::DimsExprs", ptr %64, i64 0
  %66 = load ptr, ptr %15, align 8, !tbaa !5
  %67 = getelementptr inbounds %"class.nvinfer1::DimsExprs", ptr %66, i64 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %67, ptr align 8 %65, i64 72, i1 false), !tbaa.struct !13
  store i32 0, ptr %9, align 4
  br label %68

68:                                               ; preds = %63, %40
  %69 = load i32, ptr %9, align 4
  ret i32 %69

70:                                               ; preds = %38, %34
  %71 = landingpad { ptr, i32 }
          catch ptr null
  %72 = extractvalue { ptr, i32 } %71, 0
  call void @__clang_call_terminate(ptr %72) #9
  unreachable

73:                                               ; preds = %30
  %74 = load ptr, ptr %18, align 8
  call void @__clang_call_terminate(ptr %74) #9
  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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { noreturn }
attributes #8 = { nounwind }
attributes #9 = { 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, !10, i64 0}
!12 = !{!"_ZTSN8nvinfer19DimsExprsE", !10, i64 0, !7, i64 8}
!13 = !{i64 0, i64 4, !9, i64 8, i64 64, !14}
!14 = !{!7, !7, i64 0}


; 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 [100 x i8], align 1
@_ZTISt9exception = external constant ptr
@__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE = external hidden unnamed_addr constant [16 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [15 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 nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

15:                                               ; preds = %9
  %16 = tail call ptr @__cxa_begin_catch(ptr %11) #6
  invoke void @_ZN8nvinfer16plugin11caughtErrorERKSt9exception(ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %17 unwind label %31

17:                                               ; preds = %15
  invoke void @__cxa_end_catch()
          to label %30 unwind label %31

18:                                               ; preds = %8
  %19 = icmp eq i32 %2, 2
  br i1 %19, label %20, label %.invoke

20:                                               ; preds = %18
  %21 = icmp eq i32 %6, 1
  br i1 %21, label %22, label %.invoke

22:                                               ; preds = %20
  %23 = load i32, ptr %1, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %1, i64 72
  %25 = load i32, ptr %24, align 8, !tbaa !5
  %26 = icmp eq i32 %23, %25
  br i1 %26, label %29, label %.invoke

.invoke:                                          ; preds = %8, %22, %20, %18
  %27 = phi i32 [ 633, %18 ], [ 634, %20 ], [ 635, %22 ], [ 632, %8 ]
  %28 = phi ptr [ @.str.11, %18 ], [ @.str.14, %20 ], [ @.str.12, %22 ], [ @.str.10, %8 ]
  invoke void @_ZN8nvinfer16plugin16throwPluginErrorEPKcS2_iiS2_(ptr noundef nonnull @.str, ptr noundef nonnull @__func__._ZN8nvinfer16plugin4bert21SkipLayerNormPluginV315getOutputShapesEPKNS_9DimsExprsEiS5_iPS3_iRNS_12IExprBuilderE, i32 noundef %27, i32 noundef 0, ptr noundef nonnull %28) #7
          to label %.cont unwind label %9

.cont:                                            ; preds = %.invoke
  unreachable

29:                                               ; preds = %22
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(72) %5, ptr noundef nonnull align 8 dereferenceable(72) %1, i64 72, i1 false), !tbaa.struct !10
  br label %30

30:                                               ; preds = %17, %29
  %.0 = phi i32 [ 0, %29 ], [ 1, %17 ]
  ret i32 %.0

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

34:                                               ; preds = %9
  tail call void @__clang_call_terminate(ptr %11) #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 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #7 = { noreturn }
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, !7, i64 0}
!6 = !{!"_ZTSN8nvinfer19DimsExprsE", !7, i64 0, !8, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{i64 0, i64 4, !11, i64 8, i64 64, !12}
!11 = !{!7, !7, i64 0}
!12 = !{!8, !8, i64 0}


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