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

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

@_ZTVN4Simd4Base27SynetConvolution16bNchwGemmE = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base27SynetConvolution16bNchwGemmC2ERKNS_9ConvParamE(ptr noundef nonnull align 8 dereferenceable(464) %0, ptr noundef nonnull align 8 dereferenceable(180) %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN4Simd19SynetConvolution16bC2ERKNS_9ConvParamE(ptr noundef nonnull align 8 dereferenceable(328) %5, ptr noundef nonnull align 8 dereferenceable(180) %6)
  store ptr getelementptr inbounds inrange(-16, 72) ({ [11 x ptr] }, ptr @_ZTVN4Simd4Base27SynetConvolution16bNchwGemmE, i32 0, i32 0, i32 2), ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.Simd::Base::SynetConvolution16bNchwGemm", ptr %5, i32 0, i32 1
  %8 = getelementptr inbounds %"class.Simd::Base::SynetConvolution16bNchwGemm", ptr %5, i32 0, i32 2
  store ptr null, ptr %8, align 8, !tbaa !11
  %9 = getelementptr inbounds %"class.Simd::Base::SynetConvolution16bNchwGemm", ptr %5, i32 0, i32 3
  %10 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  store ptr null, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds %"class.Simd::Base::SynetConvolution16bNchwGemm", ptr %5, i32 0, i32 3
  %12 = getelementptr inbounds [2 x ptr], ptr %11, i64 0, i64 1
  store ptr null, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds %"class.Simd::SynetConvolution16b", ptr %5, i32 0, i32 7
  %14 = load i8, ptr %13, align 8, !tbaa !31, !range !32, !noundef !33
  %15 = trunc i8 %14 to i1
  br i1 %15, label %16, label %23

16:                                               ; preds = %2
  %17 = getelementptr inbounds %"class.Simd::SynetConvolution16b", ptr %5, i32 0, i32 9
  %18 = load i8, ptr %17, align 2, !tbaa !34, !range !32, !noundef !33
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %22

20:                                               ; preds = %16
  %21 = getelementptr inbounds %"class.Simd::Base::SynetConvolution16bNchwGemm", ptr %5, i32 0, i32 2
  store ptr @_ZN4Simd4BaseL21Reorder16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt, ptr %21, align 8, !tbaa !11
  br label %22

22:                                               ; preds = %20, %16
  br label %30

23:                                               ; preds = %2
  %24 = getelementptr inbounds %"class.Simd::SynetConvolution16b", ptr %5, i32 0, i32 9
  %25 = load i8, ptr %24, align 2, !tbaa !34, !range !32, !noundef !33
  %26 = trunc i8 %25 to i1
  br i1 %26, label %27, label %29

27:                                               ; preds = %23
  %28 = getelementptr inbounds %"class.Simd::Base::SynetConvolution16bNchwGemm", ptr %5, i32 0, i32 2
  store ptr @_ZN4Simd4BaseL21Convert16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt, ptr %28, align 8, !tbaa !11
  br label %29

29:                                               ; preds = %27, %23
  br label %30

30:                                               ; preds = %29, %22
  ret void
}

declare void @_ZN4Simd19SynetConvolution16bC2ERKNS_9ConvParamE(ptr noundef nonnull align 8 dereferenceable(328), ptr noundef nonnull align 8 dereferenceable(180)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL21Reorder16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(180), ptr noundef nonnull align 8 dereferenceable(112), i64 noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL21Convert16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(180), ptr noundef nonnull align 8 dereferenceable(112), i64 noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #0

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" }
attributes #1 = { "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, !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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !6, i64 440}
!12 = !{!"_ZTSN4Simd4Base27SynetConvolution16bNchwGemmE", !13, i64 0, !29, i64 328, !6, i64 440, !7, i64 448}
!13 = !{!"_ZTSN4Simd19SynetConvolution16bE", !14, i64 0, !15, i64 8, !23, i64 192, !24, i64 208, !26, i64 240, !27, i64 256, !27, i64 272, !28, i64 288, !28, i64 289, !28, i64 290, !17, i64 296, !17, i64 304, !17, i64 312, !17, i64 320}
!14 = !{!"_ZTSN4Simd9DeletableE"}
!15 = !{!"_ZTSN4Simd9ConvParamE", !16, i64 0, !21, i64 160, !17, i64 168, !22, i64 176}
!16 = !{!"_ZTS25SimdConvolutionParameters", !17, i64 0, !17, i64 8, !17, i64 16, !18, i64 24, !19, i64 28, !17, i64 32, !17, i64 40, !17, i64 48, !18, i64 56, !19, i64 60, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96, !17, i64 104, !17, i64 112, !17, i64 120, !17, i64 128, !17, i64 136, !17, i64 144, !20, i64 152}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTS18SimdTensorDataType", !7, i64 0}
!19 = !{!"_ZTS20SimdTensorFormatType", !7, i64 0}
!20 = !{!"_ZTS29SimdConvolutionActivationType", !7, i64 0}
!21 = !{!"_ZTS8SimdBool", !7, i64 0}
!22 = !{!"_ZTS26SimdSynetCompatibilityType", !7, i64 0}
!23 = !{!"_ZTSN4Simd5ArrayIhEE", !6, i64 0, !17, i64 8}
!24 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !25, i64 0, !17, i64 8, !7, i64 16}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!26 = !{!"_ZTSN4Simd5ArrayItEE", !6, i64 0, !17, i64 8}
!27 = !{!"_ZTSN4Simd5ArrayIfEE", !6, i64 0, !17, i64 8}
!28 = !{!"bool", !7, i64 0}
!29 = !{!"_ZTSN4Simd4Base27SynetConvolution16bNchwGemm8AlgParamE", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24, !17, i64 32, !17, i64 40, !17, i64 48, !17, i64 56, !17, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96, !30, i64 104, !30, i64 108}
!30 = !{!"int", !7, i64 0}
!31 = !{!13, !28, i64 288}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!13, !28, i64 290}


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

@_ZTVN4Simd4Base27SynetConvolution16bNchwGemmE = external dso_local unnamed_addr constant { [11 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4Simd4Base27SynetConvolution16bNchwGemmC2ERKNS_9ConvParamE(ptr noundef nonnull align 8 dereferenceable(464) %0, ptr noundef nonnull align 8 dereferenceable(180) %1) unnamed_addr #0 align 2 {
  tail call void @_ZN4Simd19SynetConvolution16bC2ERKNS_9ConvParamE(ptr noundef nonnull align 8 dereferenceable(328) %0, ptr noundef nonnull align 8 dereferenceable(180) %1)
  store ptr getelementptr inbounds inrange(-16, 72) (i8, ptr @_ZTVN4Simd4Base27SynetConvolution16bNchwGemmE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 440
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, i8 0, i64 24, i1 false)
  %4 = getelementptr inbounds i8, ptr %0, i64 290
  %5 = load i8, ptr %4, align 2, !tbaa !8, !range !27, !noundef !28
  %6 = trunc nuw i8 %5 to i1
  br i1 %6, label %.sink.split, label %10

.sink.split:                                      ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 288
  %8 = load i8, ptr %7, align 8, !tbaa !29, !range !27, !noundef !28
  %9 = trunc nuw i8 %8 to i1
  %_ZN4Simd4BaseL21Reorder16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt._ZN4Simd4BaseL21Convert16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt = select i1 %9, ptr @_ZN4Simd4BaseL21Reorder16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt, ptr @_ZN4Simd4BaseL21Convert16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt
  store ptr %_ZN4Simd4BaseL21Reorder16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt._ZN4Simd4BaseL21Convert16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt, ptr %3, align 8, !tbaa !30
  br label %10

10:                                               ; preds = %2, %.sink.split
  ret void
}

declare void @_ZN4Simd19SynetConvolution16bC2ERKNS_9ConvParamE(ptr noundef nonnull align 8 dereferenceable(328), ptr noundef nonnull align 8 dereferenceable(180)) unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL21Reorder16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(180), ptr noundef nonnull align 8 dereferenceable(112), i64 noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare hidden void @_ZN4Simd4BaseL21Convert16bNchwGemm1x1EPKhRKNS_9ConvParamERKNS0_27SynetConvolution16bNchwGemm8AlgParamEmmmmPt(ptr noundef, ptr noundef nonnull align 8 dereferenceable(180), ptr noundef nonnull align 8 dereferenceable(112), i64 noundef, i64 noundef, i64 noundef, i64 noundef, ptr noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

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" }
attributes #1 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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, !26, i64 290}
!9 = !{!"_ZTSN4Simd19SynetConvolution16bE", !10, i64 0, !11, i64 8, !20, i64 192, !22, i64 208, !24, i64 240, !25, i64 256, !25, i64 272, !26, i64 288, !26, i64 289, !26, i64 290, !13, i64 296, !13, i64 304, !13, i64 312, !13, i64 320}
!10 = !{!"_ZTSN4Simd9DeletableE"}
!11 = !{!"_ZTSN4Simd9ConvParamE", !12, i64 0, !18, i64 160, !13, i64 168, !19, i64 176}
!12 = !{!"_ZTS25SimdConvolutionParameters", !13, i64 0, !13, i64 8, !13, i64 16, !15, i64 24, !16, i64 28, !13, i64 32, !13, i64 40, !13, i64 48, !15, i64 56, !16, i64 60, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !13, i64 104, !13, i64 112, !13, i64 120, !13, i64 128, !13, i64 136, !13, i64 144, !17, i64 152}
!13 = !{!"long", !14, i64 0}
!14 = !{!"omnipotent char", !7, i64 0}
!15 = !{!"_ZTS18SimdTensorDataType", !14, i64 0}
!16 = !{!"_ZTS20SimdTensorFormatType", !14, i64 0}
!17 = !{!"_ZTS29SimdConvolutionActivationType", !14, i64 0}
!18 = !{!"_ZTS8SimdBool", !14, i64 0}
!19 = !{!"_ZTS26SimdSynetCompatibilityType", !14, i64 0}
!20 = !{!"_ZTSN4Simd5ArrayIhEE", !21, i64 0, !13, i64 8}
!21 = !{!"any pointer", !14, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !13, i64 8, !14, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !21, i64 0}
!24 = !{!"_ZTSN4Simd5ArrayItEE", !21, i64 0, !13, i64 8}
!25 = !{!"_ZTSN4Simd5ArrayIfEE", !21, i64 0, !13, i64 8}
!26 = !{!"bool", !14, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!9, !26, i64 288}
!30 = !{!31, !21, i64 440}
!31 = !{!"_ZTSN4Simd4Base27SynetConvolution16bNchwGemmE", !9, i64 0, !32, i64 328, !21, i64 440, !14, i64 448}
!32 = !{!"_ZTSN4Simd4Base27SynetConvolution16bNchwGemm8AlgParamE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !13, i64 56, !13, i64 64, !13, i64 72, !13, i64 80, !13, i64 88, !13, i64 96, !33, i64 104, !33, i64 108}
!33 = !{!"int", !14, i64 0}


; Effective O3 passes: EarlyCSEPass,IPSCCPPass,InstCombinePass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass