; LLVM IR from ermig1979/Simd :: src/Simd (SimdBaseSynetConvolution8i)

; 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.Simd::SynetConvolution8i" = type { %"struct.Simd::Deletable", %"struct.Simd::ConvParam", %"struct.Simd::Array", %"class.std::__cxx11::basic_string", ptr, %"struct.Simd::CvtParam", %"struct.Simd::CvtParam", %"struct.Simd::Array.1", %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.0", i8, i8, i64, i64, i64 }
%"struct.Simd::Deletable" = type { ptr }
%"struct.Simd::ConvParam" = type <{ %struct.SimdConvolutionParameters, i32, [4 x i8], i64, i32, [4 x i8] }>
%struct.SimdConvolutionParameters = type { i64, i64, i64, i32, i32, i64, i64, i64, i32, i32, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i32 }
%"struct.Simd::Array" = type { ptr, i64 }
%"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] }
%"struct.Simd::CvtParam" = type <{ %"struct.Simd::Array", %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.0", %"struct.Simd::Array.0", i8, [3 x i8], i32, i32, i32, i32, [4 x i8] }>
%"struct.Simd::Array.1" = type { ptr, i64 }
%"struct.Simd::Array.0" = type { ptr, i64 }
%"class.Simd::Base::SynetConvolution8iNhwcDepthwise" = type { %"class.Simd::SynetConvolution8i", %"struct.Simd::Base::SynetConvolution8iNhwcDepthwise::AlgParam", ptr }
%"struct.Simd::Base::SynetConvolution8iNhwcDepthwise::AlgParam" = type { i32, i32, i32 }

; 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: mustprogress uwtable
define dso_local void @_ZN4Simd4Base31SynetConvolution8iNhwcDepthwise9Forward8uEPKhPhS4_(ptr noundef nonnull align 8 dereferenceable(576) %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) unnamed_addr #1 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %17 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 7
  %18 = getelementptr inbounds %"struct.Simd::Array.1", ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %20 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 8
  %21 = getelementptr inbounds %"struct.Simd::Array.0", ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !28
  store ptr %22, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %23 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 9
  %24 = getelementptr inbounds %"struct.Simd::Array.0", ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !29
  store ptr %25, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #2
  %26 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 10
  %27 = getelementptr inbounds %"struct.Simd::Array.0", ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !30
  store ptr %28, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #2
  %29 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 6
  %30 = getelementptr inbounds %"struct.Simd::CvtParam", ptr %29, i32 0, i32 1
  %31 = getelementptr inbounds %"struct.Simd::Array.0", ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !31
  store ptr %32, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #2
  %33 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 6
  %34 = getelementptr inbounds %"struct.Simd::CvtParam", ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds %"struct.Simd::Array.0", ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !32
  store ptr %36, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #2
  store i64 0, ptr %15, align 8, !tbaa !33
  br label %37

37:                                               ; preds = %69, %4
  %38 = load i64, ptr %15, align 8, !tbaa !33
  %39 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 13
  %40 = load i64, ptr %39, align 8, !tbaa !34
  %41 = icmp ult i64 %38, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #2
  br label %72

43:                                               ; preds = %37
  %44 = getelementptr inbounds %"class.Simd::Base::SynetConvolution8iNhwcDepthwise", ptr %16, i32 0, i32 2
  %45 = load ptr, ptr %44, align 8, !tbaa !35
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 1
  %48 = getelementptr inbounds %"class.Simd::Base::SynetConvolution8iNhwcDepthwise", ptr %16, i32 0, i32 1
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = load ptr, ptr %14, align 8, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  call void %45(ptr noundef %46, ptr noundef nonnull align 8 dereferenceable(180) %47, ptr noundef nonnull align 4 dereferenceable(12) %48, ptr noundef %49, ptr noundef %50, ptr noundef %51, ptr noundef %52, ptr noundef %53, ptr noundef %54, ptr noundef %55)
  %56 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 14
  %57 = load i64, ptr %56, align 8, !tbaa !38
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds i8, ptr %58, i64 %57
  store ptr %59, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %"class.Simd::SynetConvolution8i", ptr %16, i32 0, i32 15
  %61 = load i64, ptr %60, align 8, !tbaa !39
  %62 = getelementptr inbounds %"class.Simd::Base::SynetConvolution8iNhwcDepthwise", ptr %16, i32 0, i32 1
  %63 = getelementptr inbounds %"struct.Simd::Base::SynetConvolution8iNhwcDepthwise::AlgParam", ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 4, !tbaa !40
  %65 = sext i32 %64 to i64
  %66 = mul i64 %61, %65
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 %66
  store ptr %68, ptr %8, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %43
  %70 = load i64, ptr %15, align 8, !tbaa !33
  %71 = add i64 %70, 1
  store i64 %71, ptr %15, align 8, !tbaa !33
  br label %37, !llvm.loop !41

72:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 456}
!10 = !{!"_ZTSN4Simd18SynetConvolution8iE", !11, i64 0, !12, i64 8, !20, i64 192, !21, i64 208, !6, i64 240, !23, i64 248, !23, i64 352, !27, i64 456, !24, i64 472, !24, i64 488, !24, i64 504, !25, i64 520, !25, i64 521, !14, i64 528, !14, i64 536, !14, i64 544}
!11 = !{!"_ZTSN4Simd9DeletableE"}
!12 = !{!"_ZTSN4Simd9ConvParamE", !13, i64 0, !18, i64 160, !14, i64 168, !19, i64 176}
!13 = !{!"_ZTS25SimdConvolutionParameters", !14, i64 0, !14, i64 8, !14, i64 16, !15, i64 24, !16, i64 28, !14, i64 32, !14, i64 40, !14, i64 48, !15, i64 56, !16, i64 60, !14, i64 64, !14, i64 72, !14, i64 80, !14, i64 88, !14, i64 96, !14, i64 104, !14, i64 112, !14, i64 120, !14, i64 128, !14, i64 136, !14, i64 144, !17, i64 152}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTS18SimdTensorDataType", !7, i64 0}
!16 = !{!"_ZTS20SimdTensorFormatType", !7, i64 0}
!17 = !{!"_ZTS29SimdConvolutionActivationType", !7, i64 0}
!18 = !{!"_ZTS8SimdBool", !7, i64 0}
!19 = !{!"_ZTS26SimdSynetCompatibilityType", !7, i64 0}
!20 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !14, i64 8}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !22, i64 0, !14, i64 8, !7, i64 16}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!23 = !{!"_ZTSN4Simd8CvtParamE", !20, i64 0, !24, i64 16, !24, i64 32, !24, i64 48, !24, i64 64, !25, i64 80, !26, i64 84, !26, i64 88, !26, i64 92, !26, i64 96}
!24 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !14, i64 8}
!25 = !{!"bool", !7, i64 0}
!26 = !{!"int", !7, i64 0}
!27 = !{!"_ZTSN4Simd5ArrayIaEE", !6, i64 0, !14, i64 8}
!28 = !{!10, !6, i64 472}
!29 = !{!10, !6, i64 488}
!30 = !{!10, !6, i64 504}
!31 = !{!10, !6, i64 368}
!32 = !{!10, !6, i64 384}
!33 = !{!14, !14, i64 0}
!34 = !{!10, !14, i64 528}
!35 = !{!36, !6, i64 568}
!36 = !{!"_ZTSN4Simd4Base31SynetConvolution8iNhwcDepthwiseE", !10, i64 0, !37, i64 552, !6, i64 568}
!37 = !{!"_ZTSN4Simd4Base31SynetConvolution8iNhwcDepthwise8AlgParamE", !26, i64 0, !26, i64 4, !26, i64 8}
!38 = !{!10, !14, i64 536}
!39 = !{!10, !14, i64 544}
!40 = !{!36, !26, i64 556}
!41 = distinct !{!41, !42}
!42 = !{!"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"

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base31SynetConvolution8iNhwcDepthwise9Forward8uEPKhPhS4_(ptr noundef nonnull align 8 dereferenceable(576) %0, ptr noundef %1, ptr nocapture noundef readnone %2, ptr noundef %3) unnamed_addr #0 align 2 {
  %5 = getelementptr inbounds i8, ptr %0, i64 456
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 472
  %8 = load ptr, ptr %7, align 8, !tbaa !27
  %9 = getelementptr inbounds i8, ptr %0, i64 488
  %10 = load ptr, ptr %9, align 8, !tbaa !28
  %11 = getelementptr inbounds i8, ptr %0, i64 504
  %12 = load ptr, ptr %11, align 8, !tbaa !29
  %13 = getelementptr inbounds i8, ptr %0, i64 368
  %14 = load ptr, ptr %13, align 8, !tbaa !30
  %15 = getelementptr inbounds i8, ptr %0, i64 384
  %16 = load ptr, ptr %15, align 8, !tbaa !31
  %17 = getelementptr inbounds i8, ptr %0, i64 528
  %18 = load i64, ptr %17, align 8, !tbaa !32
  %.not = icmp eq i64 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %4
  %19 = getelementptr inbounds i8, ptr %0, i64 568
  %20 = getelementptr inbounds i8, ptr %0, i64 8
  %21 = getelementptr inbounds i8, ptr %0, i64 552
  %22 = getelementptr inbounds i8, ptr %0, i64 536
  %23 = getelementptr inbounds i8, ptr %0, i64 544
  %24 = getelementptr inbounds i8, ptr %0, i64 556
  br label %25

._crit_edge:                                      ; preds = %25, %4
  ret void

25:                                               ; preds = %.lr.ph, %25
  %.016 = phi i64 [ 0, %.lr.ph ], [ %34, %25 ]
  %.01215 = phi ptr [ %1, %.lr.ph ], [ %28, %25 ]
  %.01314 = phi ptr [ %3, %.lr.ph ], [ %33, %25 ]
  %26 = load ptr, ptr %19, align 8, !tbaa !33
  tail call void %26(ptr noundef %.01215, ptr noundef nonnull align 8 dereferenceable(180) %20, ptr noundef nonnull align 4 dereferenceable(12) %21, ptr noundef %6, ptr noundef %8, ptr noundef %10, ptr noundef %12, ptr noundef %14, ptr noundef %16, ptr noundef %.01314)
  %27 = load i64, ptr %22, align 8, !tbaa !36
  %28 = getelementptr inbounds i8, ptr %.01215, i64 %27
  %29 = load i64, ptr %23, align 8, !tbaa !37
  %30 = load i32, ptr %24, align 4, !tbaa !38
  %31 = sext i32 %30 to i64
  %32 = mul i64 %29, %31
  %33 = getelementptr inbounds i8, ptr %.01314, i64 %32
  %34 = add nuw i64 %.016, 1
  %35 = load i64, ptr %17, align 8, !tbaa !32
  %36 = icmp ult i64 %34, %35
  br i1 %36, label %25, label %._crit_edge, !llvm.loop !39
}

attributes #0 = { 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" }

!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, !19, i64 456}
!6 = !{!"_ZTSN4Simd18SynetConvolution8iE", !7, i64 0, !8, i64 8, !18, i64 192, !20, i64 208, !19, i64 240, !22, i64 248, !22, i64 352, !26, i64 456, !23, i64 472, !23, i64 488, !23, i64 504, !24, i64 520, !24, i64 521, !10, i64 528, !10, i64 536, !10, i64 544}
!7 = !{!"_ZTSN4Simd9DeletableE"}
!8 = !{!"_ZTSN4Simd9ConvParamE", !9, i64 0, !16, i64 160, !10, i64 168, !17, i64 176}
!9 = !{!"_ZTS25SimdConvolutionParameters", !10, i64 0, !10, i64 8, !10, i64 16, !13, i64 24, !14, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !13, i64 56, !14, i64 60, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !15, i64 152}
!10 = !{!"long", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"_ZTS18SimdTensorDataType", !11, i64 0}
!14 = !{!"_ZTS20SimdTensorFormatType", !11, i64 0}
!15 = !{!"_ZTS29SimdConvolutionActivationType", !11, i64 0}
!16 = !{!"_ZTS8SimdBool", !11, i64 0}
!17 = !{!"_ZTS26SimdSynetCompatibilityType", !11, i64 0}
!18 = !{!"_ZTSN4Simd5ArrayIhEE", !19, i64 0, !10, i64 8}
!19 = !{!"any pointer", !11, i64 0}
!20 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !21, i64 0, !10, i64 8, !11, i64 16}
!21 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !19, i64 0}
!22 = !{!"_ZTSN4Simd8CvtParamE", !18, i64 0, !23, i64 16, !23, i64 32, !23, i64 48, !23, i64 64, !24, i64 80, !25, i64 84, !25, i64 88, !25, i64 92, !25, i64 96}
!23 = !{!"_ZTSN4Simd5ArrayIfEE", !19, i64 0, !10, i64 8}
!24 = !{!"bool", !11, i64 0}
!25 = !{!"int", !11, i64 0}
!26 = !{!"_ZTSN4Simd5ArrayIaEE", !19, i64 0, !10, i64 8}
!27 = !{!6, !19, i64 472}
!28 = !{!6, !19, i64 488}
!29 = !{!6, !19, i64 504}
!30 = !{!6, !19, i64 368}
!31 = !{!6, !19, i64 384}
!32 = !{!6, !10, i64 528}
!33 = !{!34, !19, i64 568}
!34 = !{!"_ZTSN4Simd4Base31SynetConvolution8iNhwcDepthwiseE", !6, i64 0, !35, i64 552, !19, i64 568}
!35 = !{!"_ZTSN4Simd4Base31SynetConvolution8iNhwcDepthwise8AlgParamE", !25, i64 0, !25, i64 4, !25, i64 8}
!36 = !{!6, !10, i64 536}
!37 = !{!6, !10, i64 544}
!38 = !{!34, !25, i64 556}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass